Ajouter API.ListBuckets()

This commit is contained in:
Victor Lacasse-Beaudoin 2023-08-20 17:57:36 -04:00
parent d736d53a43
commit 9ebf27dbaf

View file

@ -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' or 'PUT', got '%s'", method))
return "", errors.New(fmt.Sprintf("method must be 'POST', 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
}