| 81 | } |
| 82 | |
| 83 | func parseFSListArgs(raw json.RawMessage) (*fsListArgs, *rpcError) { |
| 84 | args := &fsListArgs{ |
| 85 | Page: 1, |
| 86 | PerPage: model.MaxInt, |
| 87 | } |
| 88 | if len(raw) == 0 || string(raw) == "null" { |
| 89 | return nil, &rpcError{Code: -32602, Message: "invalid openlist.fs.list arguments"} |
| 90 | } |
| 91 | |
| 92 | if err := json.Unmarshal(raw, args); err != nil { |
| 93 | return nil, &rpcError{Code: -32602, Message: "invalid openlist.fs.list arguments"} |
| 94 | } |
| 95 | if args.Path == "" { |
| 96 | return nil, &rpcError{Code: -32602, Message: "path is required"} |
| 97 | } |
| 98 | normalizeFSListArgs(args) |
| 99 | return args, nil |
| 100 | } |
| 101 | |
| 102 | func normalizeFSListArgs(args *fsListArgs) { |
| 103 | pageReq := model.PageReq{ |