You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
decort-golang-sdk/pkg/cloudapi/account/delete.go

37 lines
644 B

package account
import (
"context"
"errors"
"net/http"
)
type DeleteRequest struct {
AccountID uint64 `url:"accountId"`
Permanently bool `url:"permanently,omitempty"`
}
func (arq DeleteRequest) Validate() error {
if arq.AccountID == 0 {
return errors.New("validation-error: field AccountID must be set")
}
return nil
}
func (a Account) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
err := req.Validate()
if err != nil {
return false, err
}
url := "/cloudapi/account/delete"
_, err = a.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
return true, nil
}