diff --git a/.stats.yml b/.stats.yml index 35ba8798674..2ff6fd3a13b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1321 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1f68e176f43592631364d94df7670824a599296f6734ca70ffa94454c58da466.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-0560036bc26f789658066e3350d9d3e6d0d4168f1a4f8ba0e7f55ca889e3ebfe.yml diff --git a/api.md b/api.md index 97e8bd907bf..8d9fa9e4cf6 100644 --- a/api.md +++ b/api.md @@ -7022,14 +7022,14 @@ Response Types: - cloudforce_one.Quota - cloudforce_one.RequestConstants - cloudforce_one.RequestTypes -- cloudforce_one.RequestDeleteResponseUnion +- cloudforce_one.RequestDeleteResponse Methods: - client.CloudforceOne.Requests.New(ctx context.Context, accountIdentifier string, body cloudforce_one.RequestNewParams) (cloudforce_one.Item, error) - client.CloudforceOne.Requests.Update(ctx context.Context, accountIdentifier string, requestIdentifier string, body cloudforce_one.RequestUpdateParams) (cloudforce_one.Item, error) - client.CloudforceOne.Requests.List(ctx context.Context, accountIdentifier string, body cloudforce_one.RequestListParams) (pagination.V4PagePaginationArray[cloudforce_one.ListItem], error) -- client.CloudforceOne.Requests.Delete(ctx context.Context, accountIdentifier string, requestIdentifier string) (cloudforce_one.RequestDeleteResponseUnion, error) +- client.CloudforceOne.Requests.Delete(ctx context.Context, accountIdentifier string, requestIdentifier string) (cloudforce_one.RequestDeleteResponse, error) - client.CloudforceOne.Requests.Constants(ctx context.Context, accountIdentifier string) (cloudforce_one.RequestConstants, error) - client.CloudforceOne.Requests.Get(ctx context.Context, accountIdentifier string, requestIdentifier string) (cloudforce_one.Item, error) - client.CloudforceOne.Requests.Quota(ctx context.Context, accountIdentifier string) (cloudforce_one.Quota, error) @@ -7040,13 +7040,13 @@ Methods: Response Types: - cloudforce_one.Message -- cloudforce_one.RequestMessageDeleteResponseUnion +- cloudforce_one.RequestMessageDeleteResponse Methods: - client.CloudforceOne.Requests.Message.New(ctx context.Context, accountIdentifier string, requestIdentifier string, body cloudforce_one.RequestMessageNewParams) (cloudforce_one.Message, error) - client.CloudforceOne.Requests.Message.Update(ctx context.Context, accountIdentifier string, requestIdentifier string, messageIdentifer int64, body cloudforce_one.RequestMessageUpdateParams) (cloudforce_one.Message, error) -- client.CloudforceOne.Requests.Message.Delete(ctx context.Context, accountIdentifier string, requestIdentifier string, messageIdentifer int64) (cloudforce_one.RequestMessageDeleteResponseUnion, error) +- client.CloudforceOne.Requests.Message.Delete(ctx context.Context, accountIdentifier string, requestIdentifier string, messageIdentifer int64) (cloudforce_one.RequestMessageDeleteResponse, error) - client.CloudforceOne.Requests.Message.Get(ctx context.Context, accountIdentifier string, requestIdentifier string, body cloudforce_one.RequestMessageGetParams) ([]cloudforce_one.Message, error) ### Priority @@ -7060,13 +7060,13 @@ Response Types: - cloudforce_one.Label - cloudforce_one.Priority -- cloudforce_one.RequestPriorityDeleteResponseUnion +- cloudforce_one.RequestPriorityDeleteResponse Methods: - client.CloudforceOne.Requests.Priority.New(ctx context.Context, accountIdentifier string, body cloudforce_one.RequestPriorityNewParams) (cloudforce_one.Priority, error) - client.CloudforceOne.Requests.Priority.Update(ctx context.Context, accountIdentifier string, priorityIdentifer string, body cloudforce_one.RequestPriorityUpdateParams) (cloudforce_one.Item, error) -- client.CloudforceOne.Requests.Priority.Delete(ctx context.Context, accountIdentifier string, priorityIdentifer string) (cloudforce_one.RequestPriorityDeleteResponseUnion, error) +- client.CloudforceOne.Requests.Priority.Delete(ctx context.Context, accountIdentifier string, priorityIdentifer string) (cloudforce_one.RequestPriorityDeleteResponse, error) - client.CloudforceOne.Requests.Priority.Get(ctx context.Context, accountIdentifier string, priorityIdentifer string) (cloudforce_one.Item, error) - client.CloudforceOne.Requests.Priority.Quota(ctx context.Context, accountIdentifier string) (cloudforce_one.Quota, error) diff --git a/cloudforce_one/request.go b/cloudforce_one/request.go index 24f51e78b9d..1241d196ad8 100644 --- a/cloudforce_one/request.go +++ b/cloudforce_one/request.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "net/http" - "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -16,7 +15,6 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/cloudflare/cloudflare-go/v2/shared" - "github.com/tidwall/gjson" ) // RequestService contains methods and other services that help with interacting @@ -108,9 +106,8 @@ func (r *RequestService) ListAutoPaging(ctx context.Context, accountIdentifier s } // Delete a Request -func (r *RequestService) Delete(ctx context.Context, accountIdentifier string, requestIdentifier string, opts ...option.RequestOption) (res *RequestDeleteResponseUnion, err error) { +func (r *RequestService) Delete(ctx context.Context, accountIdentifier string, requestIdentifier string, opts ...option.RequestOption) (res *RequestDeleteResponse, err error) { opts = append(r.Options[:], opts...) - var env RequestDeleteResponseEnvelope if accountIdentifier == "" { err = errors.New("missing required account_identifier parameter") return @@ -120,11 +117,7 @@ func (r *RequestService) Delete(ctx context.Context, accountIdentifier string, r return } path := fmt.Sprintf("accounts/%s/cloudforce-one/requests/%s", accountIdentifier, requestIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } @@ -512,30 +505,46 @@ func (r RequestConstantsTlp) IsKnown() bool { type RequestTypes []string -// Union satisfied by [cloudforce_one.RequestDeleteResponseUnknown], -// [cloudforce_one.RequestDeleteResponseArray] or [shared.UnionString]. -type RequestDeleteResponseUnion interface { - ImplementsCloudforceOneRequestDeleteResponseUnion() +type RequestDeleteResponse struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // Whether the API call was successful + Success RequestDeleteResponseSuccess `json:"success,required"` + JSON requestDeleteResponseJSON `json:"-"` +} + +// requestDeleteResponseJSON contains the JSON metadata for the struct +// [RequestDeleteResponse] +type requestDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RequestDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RequestDeleteResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RequestDeleteResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) +func (r requestDeleteResponseJSON) RawJSON() string { + return r.raw } -type RequestDeleteResponseArray []interface{} +// Whether the API call was successful +type RequestDeleteResponseSuccess bool -func (r RequestDeleteResponseArray) ImplementsCloudforceOneRequestDeleteResponseUnion() {} +const ( + RequestDeleteResponseSuccessTrue RequestDeleteResponseSuccess = true +) + +func (r RequestDeleteResponseSuccess) IsKnown() bool { + switch r { + case RequestDeleteResponseSuccessTrue: + return true + } + return false +} type RequestNewParams struct { // Request content @@ -576,9 +585,9 @@ func (r RequestNewParamsTlp) IsKnown() bool { type RequestNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Item `json:"result,required"` // Whether the API call was successful Success RequestNewResponseEnvelopeSuccess `json:"success,required"` + Result Item `json:"result"` JSON requestNewResponseEnvelopeJSON `json:"-"` } @@ -587,8 +596,8 @@ type RequestNewResponseEnvelope struct { type requestNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -655,9 +664,9 @@ func (r RequestUpdateParamsTlp) IsKnown() bool { type RequestUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Item `json:"result,required"` // Whether the API call was successful Success RequestUpdateResponseEnvelopeSuccess `json:"success,required"` + Result Item `json:"result"` JSON requestUpdateResponseEnvelopeJSON `json:"-"` } @@ -666,8 +675,8 @@ type RequestUpdateResponseEnvelope struct { type requestUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -758,55 +767,12 @@ func (r RequestListParamsStatus) IsKnown() bool { return false } -type RequestDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result RequestDeleteResponseUnion `json:"result,required"` - // Whether the API call was successful - Success RequestDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON requestDeleteResponseEnvelopeJSON `json:"-"` -} - -// requestDeleteResponseEnvelopeJSON contains the JSON metadata for the struct -// [RequestDeleteResponseEnvelope] -type requestDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RequestDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r requestDeleteResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -// Whether the API call was successful -type RequestDeleteResponseEnvelopeSuccess bool - -const ( - RequestDeleteResponseEnvelopeSuccessTrue RequestDeleteResponseEnvelopeSuccess = true -) - -func (r RequestDeleteResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case RequestDeleteResponseEnvelopeSuccessTrue: - return true - } - return false -} - type RequestConstantsResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result RequestConstants `json:"result,required"` // Whether the API call was successful Success RequestConstantsResponseEnvelopeSuccess `json:"success,required"` + Result RequestConstants `json:"result"` JSON requestConstantsResponseEnvelopeJSON `json:"-"` } @@ -815,8 +781,8 @@ type RequestConstantsResponseEnvelope struct { type requestConstantsResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -847,9 +813,9 @@ func (r RequestConstantsResponseEnvelopeSuccess) IsKnown() bool { type RequestGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Item `json:"result,required"` // Whether the API call was successful Success RequestGetResponseEnvelopeSuccess `json:"success,required"` + Result Item `json:"result"` JSON requestGetResponseEnvelopeJSON `json:"-"` } @@ -858,8 +824,8 @@ type RequestGetResponseEnvelope struct { type requestGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -890,9 +856,9 @@ func (r RequestGetResponseEnvelopeSuccess) IsKnown() bool { type RequestQuotaResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Quota `json:"result,required"` // Whether the API call was successful Success RequestQuotaResponseEnvelopeSuccess `json:"success,required"` + Result Quota `json:"result"` JSON requestQuotaResponseEnvelopeJSON `json:"-"` } @@ -901,8 +867,8 @@ type RequestQuotaResponseEnvelope struct { type requestQuotaResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -933,9 +899,9 @@ func (r RequestQuotaResponseEnvelopeSuccess) IsKnown() bool { type RequestTypesResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result RequestTypes `json:"result,required"` // Whether the API call was successful Success RequestTypesResponseEnvelopeSuccess `json:"success,required"` + Result RequestTypes `json:"result"` JSON requestTypesResponseEnvelopeJSON `json:"-"` } @@ -944,8 +910,8 @@ type RequestTypesResponseEnvelope struct { type requestTypesResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/cloudforce_one/requestmessage.go b/cloudforce_one/requestmessage.go index 0b155fa7a3c..1f24de63b39 100644 --- a/cloudforce_one/requestmessage.go +++ b/cloudforce_one/requestmessage.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "net/http" - "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -15,7 +14,6 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/cloudflare/cloudflare-go/v2/shared" - "github.com/tidwall/gjson" ) // RequestMessageService contains methods and other services that help with @@ -82,9 +80,8 @@ func (r *RequestMessageService) Update(ctx context.Context, accountIdentifier st } // Delete a Request Message -func (r *RequestMessageService) Delete(ctx context.Context, accountIdentifier string, requestIdentifier string, messageIdentifer int64, opts ...option.RequestOption) (res *RequestMessageDeleteResponseUnion, err error) { +func (r *RequestMessageService) Delete(ctx context.Context, accountIdentifier string, requestIdentifier string, messageIdentifer int64, opts ...option.RequestOption) (res *RequestMessageDeleteResponse, err error) { opts = append(r.Options[:], opts...) - var env RequestMessageDeleteResponseEnvelope if accountIdentifier == "" { err = errors.New("missing required account_identifier parameter") return @@ -94,11 +91,7 @@ func (r *RequestMessageService) Delete(ctx context.Context, accountIdentifier st return } path := fmt.Sprintf("accounts/%s/cloudforce-one/requests/%s/message/%v", accountIdentifier, requestIdentifier, messageIdentifer) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } @@ -159,30 +152,45 @@ func (r messageJSON) RawJSON() string { return r.raw } -// Union satisfied by [cloudforce_one.RequestMessageDeleteResponseUnknown], -// [cloudforce_one.RequestMessageDeleteResponseArray] or [shared.UnionString]. -type RequestMessageDeleteResponseUnion interface { - ImplementsCloudforceOneRequestMessageDeleteResponseUnion() +type RequestMessageDeleteResponse struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // Whether the API call was successful + Success RequestMessageDeleteResponseSuccess `json:"success,required"` + JSON requestMessageDeleteResponseJSON `json:"-"` +} + +// requestMessageDeleteResponseJSON contains the JSON metadata for the struct +// [RequestMessageDeleteResponse] +type requestMessageDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RequestMessageDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RequestMessageDeleteResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RequestMessageDeleteResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) +func (r requestMessageDeleteResponseJSON) RawJSON() string { + return r.raw } -type RequestMessageDeleteResponseArray []interface{} +// Whether the API call was successful +type RequestMessageDeleteResponseSuccess bool + +const ( + RequestMessageDeleteResponseSuccessTrue RequestMessageDeleteResponseSuccess = true +) -func (r RequestMessageDeleteResponseArray) ImplementsCloudforceOneRequestMessageDeleteResponseUnion() { +func (r RequestMessageDeleteResponseSuccess) IsKnown() bool { + switch r { + case RequestMessageDeleteResponseSuccessTrue: + return true + } + return false } type RequestMessageNewParams struct { @@ -197,9 +205,9 @@ func (r RequestMessageNewParams) MarshalJSON() (data []byte, err error) { type RequestMessageNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Message `json:"result,required"` // Whether the API call was successful Success RequestMessageNewResponseEnvelopeSuccess `json:"success,required"` + Result Message `json:"result"` JSON requestMessageNewResponseEnvelopeJSON `json:"-"` } @@ -208,8 +216,8 @@ type RequestMessageNewResponseEnvelope struct { type requestMessageNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -276,9 +284,9 @@ func (r RequestMessageUpdateParamsTlp) IsKnown() bool { type RequestMessageUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Message `json:"result,required"` // Whether the API call was successful Success RequestMessageUpdateResponseEnvelopeSuccess `json:"success,required"` + Result Message `json:"result"` JSON requestMessageUpdateResponseEnvelopeJSON `json:"-"` } @@ -287,8 +295,8 @@ type RequestMessageUpdateResponseEnvelope struct { type requestMessageUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -316,49 +324,6 @@ func (r RequestMessageUpdateResponseEnvelopeSuccess) IsKnown() bool { return false } -type RequestMessageDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result RequestMessageDeleteResponseUnion `json:"result,required"` - // Whether the API call was successful - Success RequestMessageDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON requestMessageDeleteResponseEnvelopeJSON `json:"-"` -} - -// requestMessageDeleteResponseEnvelopeJSON contains the JSON metadata for the -// struct [RequestMessageDeleteResponseEnvelope] -type requestMessageDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RequestMessageDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r requestMessageDeleteResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -// Whether the API call was successful -type RequestMessageDeleteResponseEnvelopeSuccess bool - -const ( - RequestMessageDeleteResponseEnvelopeSuccessTrue RequestMessageDeleteResponseEnvelopeSuccess = true -) - -func (r RequestMessageDeleteResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case RequestMessageDeleteResponseEnvelopeSuccessTrue: - return true - } - return false -} - type RequestMessageGetParams struct { // Page number of results Page param.Field[int64] `json:"page,required"` @@ -397,9 +362,9 @@ func (r RequestMessageGetParamsSortOrder) IsKnown() bool { type RequestMessageGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result []Message `json:"result,required"` // Whether the API call was successful Success RequestMessageGetResponseEnvelopeSuccess `json:"success,required"` + Result []Message `json:"result"` JSON requestMessageGetResponseEnvelopeJSON `json:"-"` } @@ -408,8 +373,8 @@ type RequestMessageGetResponseEnvelope struct { type requestMessageGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/cloudforce_one/requestpriority.go b/cloudforce_one/requestpriority.go index cb24f7c4b83..d3076af3f81 100644 --- a/cloudforce_one/requestpriority.go +++ b/cloudforce_one/requestpriority.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "net/http" - "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -15,7 +14,6 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/cloudflare/cloudflare-go/v2/shared" - "github.com/tidwall/gjson" ) // RequestPriorityService contains methods and other services that help with @@ -76,9 +74,8 @@ func (r *RequestPriorityService) Update(ctx context.Context, accountIdentifier s } // Delete a Priority Intelligence Report -func (r *RequestPriorityService) Delete(ctx context.Context, accountIdentifier string, priorityIdentifer string, opts ...option.RequestOption) (res *RequestPriorityDeleteResponseUnion, err error) { +func (r *RequestPriorityService) Delete(ctx context.Context, accountIdentifier string, priorityIdentifer string, opts ...option.RequestOption) (res *RequestPriorityDeleteResponse, err error) { opts = append(r.Options[:], opts...) - var env RequestPriorityDeleteResponseEnvelope if accountIdentifier == "" { err = errors.New("missing required account_identifier parameter") return @@ -88,11 +85,7 @@ func (r *RequestPriorityService) Delete(ctx context.Context, accountIdentifier s return } path := fmt.Sprintf("accounts/%s/cloudforce-one/requests/priority/%s", accountIdentifier, priorityIdentifer) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } @@ -230,30 +223,45 @@ func (r PriorityEditTlp) IsKnown() bool { return false } -// Union satisfied by [cloudforce_one.RequestPriorityDeleteResponseUnknown], -// [cloudforce_one.RequestPriorityDeleteResponseArray] or [shared.UnionString]. -type RequestPriorityDeleteResponseUnion interface { - ImplementsCloudforceOneRequestPriorityDeleteResponseUnion() +type RequestPriorityDeleteResponse struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // Whether the API call was successful + Success RequestPriorityDeleteResponseSuccess `json:"success,required"` + JSON requestPriorityDeleteResponseJSON `json:"-"` } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RequestPriorityDeleteResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RequestPriorityDeleteResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) +// requestPriorityDeleteResponseJSON contains the JSON metadata for the struct +// [RequestPriorityDeleteResponse] +type requestPriorityDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } -type RequestPriorityDeleteResponseArray []interface{} +func (r *RequestPriorityDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} -func (r RequestPriorityDeleteResponseArray) ImplementsCloudforceOneRequestPriorityDeleteResponseUnion() { +func (r requestPriorityDeleteResponseJSON) RawJSON() string { + return r.raw +} + +// Whether the API call was successful +type RequestPriorityDeleteResponseSuccess bool + +const ( + RequestPriorityDeleteResponseSuccessTrue RequestPriorityDeleteResponseSuccess = true +) + +func (r RequestPriorityDeleteResponseSuccess) IsKnown() bool { + switch r { + case RequestPriorityDeleteResponseSuccessTrue: + return true + } + return false } type RequestPriorityNewParams struct { @@ -267,9 +275,9 @@ func (r RequestPriorityNewParams) MarshalJSON() (data []byte, err error) { type RequestPriorityNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Priority `json:"result,required"` // Whether the API call was successful Success RequestPriorityNewResponseEnvelopeSuccess `json:"success,required"` + Result Priority `json:"result"` JSON requestPriorityNewResponseEnvelopeJSON `json:"-"` } @@ -278,8 +286,8 @@ type RequestPriorityNewResponseEnvelope struct { type requestPriorityNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -318,9 +326,9 @@ func (r RequestPriorityUpdateParams) MarshalJSON() (data []byte, err error) { type RequestPriorityUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Item `json:"result,required"` // Whether the API call was successful Success RequestPriorityUpdateResponseEnvelopeSuccess `json:"success,required"` + Result Item `json:"result"` JSON requestPriorityUpdateResponseEnvelopeJSON `json:"-"` } @@ -329,8 +337,8 @@ type RequestPriorityUpdateResponseEnvelope struct { type requestPriorityUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -358,55 +366,12 @@ func (r RequestPriorityUpdateResponseEnvelopeSuccess) IsKnown() bool { return false } -type RequestPriorityDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result RequestPriorityDeleteResponseUnion `json:"result,required"` - // Whether the API call was successful - Success RequestPriorityDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON requestPriorityDeleteResponseEnvelopeJSON `json:"-"` -} - -// requestPriorityDeleteResponseEnvelopeJSON contains the JSON metadata for the -// struct [RequestPriorityDeleteResponseEnvelope] -type requestPriorityDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RequestPriorityDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r requestPriorityDeleteResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -// Whether the API call was successful -type RequestPriorityDeleteResponseEnvelopeSuccess bool - -const ( - RequestPriorityDeleteResponseEnvelopeSuccessTrue RequestPriorityDeleteResponseEnvelopeSuccess = true -) - -func (r RequestPriorityDeleteResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case RequestPriorityDeleteResponseEnvelopeSuccessTrue: - return true - } - return false -} - type RequestPriorityGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Item `json:"result,required"` // Whether the API call was successful Success RequestPriorityGetResponseEnvelopeSuccess `json:"success,required"` + Result Item `json:"result"` JSON requestPriorityGetResponseEnvelopeJSON `json:"-"` } @@ -415,8 +380,8 @@ type RequestPriorityGetResponseEnvelope struct { type requestPriorityGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -447,9 +412,9 @@ func (r RequestPriorityGetResponseEnvelopeSuccess) IsKnown() bool { type RequestPriorityQuotaResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Quota `json:"result,required"` // Whether the API call was successful Success RequestPriorityQuotaResponseEnvelopeSuccess `json:"success,required"` + Result Quota `json:"result"` JSON requestPriorityQuotaResponseEnvelopeJSON `json:"-"` } @@ -458,8 +423,8 @@ type RequestPriorityQuotaResponseEnvelope struct { type requestPriorityQuotaResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/intel/whois.go b/intel/whois.go index cf321dd9d6f..65290b3410e 100644 --- a/intel/whois.go +++ b/intel/whois.go @@ -264,9 +264,9 @@ func (r WhoisGetParams) URLQuery() (v url.Values) { type WhoisGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result WhoisGetResponse `json:"result,required"` // Whether the API call was successful Success WhoisGetResponseEnvelopeSuccess `json:"success,required"` + Result WhoisGetResponse `json:"result"` JSON whoisGetResponseEnvelopeJSON `json:"-"` } @@ -275,8 +275,8 @@ type WhoisGetResponseEnvelope struct { type whoisGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/shared/union.go b/shared/union.go index 9048bf7e9f0..c6d8ab57795 100644 --- a/shared/union.go +++ b/shared/union.go @@ -179,9 +179,6 @@ func (UnionString) ImplementsOriginPostQuantumEncryptionOriginPostQuantumEncrypt } func (UnionString) ImplementsHostnamesSettingValueUnionParam() {} func (UnionString) ImplementsHostnamesSettingValueUnion() {} -func (UnionString) ImplementsCloudforceOneRequestDeleteResponseUnion() {} -func (UnionString) ImplementsCloudforceOneRequestMessageDeleteResponseUnion() {} -func (UnionString) ImplementsCloudforceOneRequestPriorityDeleteResponseUnion() {} func (UnionString) ImplementsEventNotificationsR2ConfigurationQueueDeleteResponseUnion() {} type UnionInt int64