Ajouter API.ListBuckets()
This commit is contained in:
parent
d736d53a43
commit
9ebf27dbaf
1 changed files with 14 additions and 0 deletions
14
api/api.go
14
api/api.go
|
@ -271,3 +271,17 @@ func (a *API) CallWithData(method, route string, data []byte) (string, error) {
|
|||
//return "", errors.New(fmt.Sprintf("method must be 'POST' or 'PUT', got '%s'", method))
|
||||
return "", errors.New(fmt.Sprintf("method must be 'POST', got '%s'", method))
|
||||
}
|
||||
|
||||
func (a *API) ListBuckets() (models.V1BucketListResponse, error) {
|
||||
var response models.V1BucketListResponse
|
||||
result, err := a.Call(http.MethodGet, "/v1/bucket")
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(result, &response); err != nil {
|
||||
return response, err
|
||||
}
|
||||
|
||||
return response, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue