diff --git a/.stats.yml b/.stats.yml index d815e5acaf..a594a05134 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1296 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-ccc4d0cef46244cffd7a8d06b4ae14a936e2c0c4ed40a5af409f183d4fd60eb9.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-ec9f8eaec2fb4d1843f2a2ffc2c6ebaf8c45275c9a18f8ece252fd7fe4a7c946.yml diff --git a/api.md b/api.md index fb86245192..144aa0f59a 100644 --- a/api.md +++ b/api.md @@ -6873,14 +6873,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) @@ -6891,13 +6891,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 @@ -6911,13 +6911,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 05902b915c..5a70f4a837 100644 --- a/cloudforce_one/request.go +++ b/cloudforce_one/request.go @@ -6,7 +6,6 @@ import ( "context" "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" ) // RequestService contains methods and other services that help with interacting @@ -95,15 +93,10 @@ 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 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 } @@ -471,30 +464,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 @@ -535,9 +544,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:"-"` } @@ -546,8 +555,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 } @@ -614,9 +623,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:"-"` } @@ -625,8 +634,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 } @@ -717,55 +726,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:"-"` } @@ -774,8 +740,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 } @@ -806,9 +772,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:"-"` } @@ -817,8 +783,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 } @@ -849,9 +815,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:"-"` } @@ -860,8 +826,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 } @@ -892,9 +858,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:"-"` } @@ -903,8 +869,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 4e93aef886..fedcf3004b 100644 --- a/cloudforce_one/requestmessage.go +++ b/cloudforce_one/requestmessage.go @@ -6,7 +6,6 @@ import ( "context" "fmt" "net/http" - "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -14,7 +13,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 @@ -65,15 +63,10 @@ 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 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 } @@ -126,30 +119,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 { @@ -164,9 +172,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:"-"` } @@ -175,8 +183,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 } @@ -243,9 +251,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:"-"` } @@ -254,8 +262,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 } @@ -283,49 +291,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"` @@ -364,9 +329,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:"-"` } @@ -375,8 +340,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 5b00484858..f6b6751bcc 100644 --- a/cloudforce_one/requestpriority.go +++ b/cloudforce_one/requestpriority.go @@ -6,7 +6,6 @@ import ( "context" "fmt" "net/http" - "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -14,7 +13,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 @@ -63,15 +61,10 @@ 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 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 } @@ -197,30 +190,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 { @@ -234,9 +242,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:"-"` } @@ -245,8 +253,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 } @@ -285,9 +293,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:"-"` } @@ -296,8 +304,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 } @@ -325,55 +333,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:"-"` } @@ -382,8 +347,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 } @@ -414,9 +379,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:"-"` } @@ -425,8 +390,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 83849a72c9..82c9c1aa90 100644 --- a/intel/whois.go +++ b/intel/whois.go @@ -259,9 +259,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:"-"` } @@ -270,8 +270,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 7daaec2f41..d00051ef1b 100644 --- a/shared/union.go +++ b/shared/union.go @@ -188,9 +188,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