(ctx context.Context, path string, options *api.ResourceInfoRequestOptions)
| 215 | } |
| 216 | |
| 217 | func (f *Fs) readMetaDataForPath(ctx context.Context, path string, options *api.ResourceInfoRequestOptions) (*api.ResourceInfoResponse, error) { |
| 218 | opts := rest.Opts{ |
| 219 | Method: "GET", |
| 220 | Path: "/resources", |
| 221 | Parameters: url.Values{}, |
| 222 | } |
| 223 | |
| 224 | opts.Parameters.Set("path", f.opt.Enc.FromStandardPath(path)) |
| 225 | |
| 226 | if options.SortMode != nil { |
| 227 | opts.Parameters.Set("sort", options.SortMode.String()) |
| 228 | } |
| 229 | if options.Limit != 0 { |
| 230 | opts.Parameters.Set("limit", strconv.FormatUint(options.Limit, 10)) |
| 231 | } |
| 232 | if options.Offset != 0 { |
| 233 | opts.Parameters.Set("offset", strconv.FormatUint(options.Offset, 10)) |
| 234 | } |
| 235 | if options.Fields != nil { |
| 236 | opts.Parameters.Set("fields", strings.Join(options.Fields, ",")) |
| 237 | } |
| 238 | |
| 239 | var err error |
| 240 | var info api.ResourceInfoResponse |
| 241 | var resp *http.Response |
| 242 | err = f.pacer.Call(func() (bool, error) { |
| 243 | resp, err = f.srv.CallJSON(ctx, &opts, nil, &info) |
| 244 | return shouldRetry(ctx, resp, err) |
| 245 | }) |
| 246 | |
| 247 | if err != nil { |
| 248 | return nil, err |
| 249 | } |
| 250 | |
| 251 | info.Name = f.opt.Enc.ToStandardName(info.Name) |
| 252 | return &info, nil |
| 253 | } |
| 254 | |
| 255 | // NewFs constructs an Fs from the path, container:path |
| 256 | func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error) { |
no test coverage detected