2023-11-20 16:14:22 -05:00
|
|
|
package apirequest
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"net/http"
|
|
|
|
|
2024-08-21 13:39:03 -04:00
|
|
|
"codeberg.org/vlbeaudoin/voki/v3"
|
2023-11-20 16:14:22 -05:00
|
|
|
"git.agecem.com/agecem/agecem-org/apiresponse"
|
|
|
|
)
|
|
|
|
|
2024-08-21 13:39:03 -04:00
|
|
|
var _ voki.Requester[apiresponse.V1BucketsGET] = V1BucketsGET{}
|
2023-11-20 16:14:22 -05:00
|
|
|
|
|
|
|
type V1BucketsGET struct{}
|
|
|
|
|
|
|
|
func NewV1BucketsGET() (request V1BucketsGET, err error) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (request V1BucketsGET) Complete() bool { return true }
|
|
|
|
|
|
|
|
func (request V1BucketsGET) Request(v *voki.Voki) (response apiresponse.V1BucketsGET, err error) {
|
|
|
|
if !request.Complete() {
|
|
|
|
err = fmt.Errorf("Incomplete V1BucketsGET request")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
return response, v.UnmarshalIfComplete(http.MethodGet, "/v1/bucket", nil, true, &response)
|
|
|
|
}
|
|
|
|
|
2024-08-21 13:39:03 -04:00
|
|
|
var _ voki.Requester[apiresponse.V1BucketGET] = V1BucketGET{}
|
2023-11-20 16:14:22 -05:00
|
|
|
|
|
|
|
type V1BucketGET struct {
|
|
|
|
Params struct {
|
|
|
|
Bucket string `json:"bucket"`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewV1BucketGET(bucket string) (request V1BucketGET, err error) {
|
|
|
|
if bucket == "" {
|
|
|
|
err = fmt.Errorf("NewV1BucketGET requires non-nil bucket name")
|
|
|
|
}
|
|
|
|
|
|
|
|
request.Params.Bucket = bucket
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (request V1BucketGET) Complete() bool { return request.Params.Bucket != "" }
|
|
|
|
|
|
|
|
func (request V1BucketGET) Request(v *voki.Voki) (response apiresponse.V1BucketGET, err error) {
|
|
|
|
if !request.Complete() {
|
|
|
|
err = fmt.Errorf("Incomplete V1BucketGET request")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
return response, v.UnmarshalIfComplete(http.MethodGet, fmt.Sprintf("/v1/bucket/%s", request.Params.Bucket), nil, true, &response)
|
|
|
|
}
|