package trunk import ( "context" "net/http" "strconv" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) // DestroyRequest struct to destroy a trunk type DestroyRequest struct { // ID of the trunk to destroy // Required: true TrunkID uint64 `url:"id" json:"id" validate:"required"` } // Destroy destroys a trunk func (t Trunk) Destroy(ctx context.Context, req DestroyRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/trunk/destroy" res, err := t.client.DecortApiCall(ctx, http.MethodPost, url, req) if err != nil { return false, err } result, err := strconv.ParseBool(string(res)) if err != nil { return false, err } return result, nil }