feat(files): add uploadings api (#30)

* fix(uploader, files/handlers): fix incorrect unlock, catch and check after calling api

* fix(uploader): fix uploader test

* feat(files): add uploadings api

* fix(files): register uploading handlers to api

Co-authored-by: Jia He <jiah@nvidia.com>
This commit is contained in:
Hexxa 2021-01-11 22:57:02 +08:00 committed by GitHub
parent a909df384d
commit 67c07cc81f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 398 additions and 83 deletions

View file

@ -118,3 +118,24 @@ func (cl *FilesClient) List(dirPath string) (*http.Response, *fileshdr.ListResp,
}
return resp, lResp, nil
}
func (cl *FilesClient) ListUploadings() (*http.Response, *fileshdr.ListUploadingsResp, []error) {
resp, body, errs := cl.r.Get(cl.url("/v1/fs/uploadings")).
End()
if len(errs) > 0 {
return nil, nil, errs
}
lResp := &fileshdr.ListUploadingsResp{}
err := json.Unmarshal([]byte(body), lResp)
if err != nil {
return nil, nil, append(errs, err)
}
return resp, lResp, nil
}
func (cl *FilesClient) DelUploading(filepath string) (*http.Response, string, []error) {
return cl.r.Delete(cl.url("/v1/fs/uploadings")).
Param(fileshdr.FilePathQuery, filepath).
End()
}