diff --git a/api.md b/api.md index 7c1dc91cd00..37f590aeb5f 100644 --- a/api.md +++ b/api.md @@ -2521,11 +2521,11 @@ Methods: Params Types: -- api_gateway.APIShieldOperationParam +- api_gateway.APIShieldOperationModelParam Response Types: -- api_gateway.APIShieldOperation +- api_gateway.APIShieldOperationModel - api_gateway.OperationNewResponse - api_gateway.OperationListResponse - api_gateway.OperationDeleteResponse diff --git a/api_gateway/operation.go b/api_gateway/operation.go index c22be953ed8..e04493aa38a 100644 --- a/api_gateway/operation.go +++ b/api_gateway/operation.go @@ -138,7 +138,7 @@ func (r *OperationService) Get(ctx context.Context, operationID string, params O return } -type APIShieldOperation struct { +type APIShieldOperationModel struct { // The endpoint which can contain path parameter templates in curly braces, each // will be replaced from left to right with {varN}, starting with {var1}, during // insertion. This will further be Cloudflare-normalized upon insertion. See: @@ -147,13 +147,13 @@ type APIShieldOperation struct { // RFC3986-compliant host. Host string `json:"host,required" format:"hostname"` // The HTTP method used to access the endpoint. - Method APIShieldOperationMethod `json:"method,required"` - JSON apiShieldOperationJSON `json:"-"` + Method APIShieldOperationModelMethod `json:"method,required"` + JSON apiShieldOperationModelJSON `json:"-"` } -// apiShieldOperationJSON contains the JSON metadata for the struct -// [APIShieldOperation] -type apiShieldOperationJSON struct { +// apiShieldOperationModelJSON contains the JSON metadata for the struct +// [APIShieldOperationModel] +type apiShieldOperationModelJSON struct { Endpoint apijson.Field Host apijson.Field Method apijson.Field @@ -161,40 +161,40 @@ type apiShieldOperationJSON struct { ExtraFields map[string]apijson.Field } -func (r *APIShieldOperation) UnmarshalJSON(data []byte) (err error) { +func (r *APIShieldOperationModel) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r apiShieldOperationJSON) RawJSON() string { +func (r apiShieldOperationModelJSON) RawJSON() string { return r.raw } -func (r APIShieldOperation) implementsAPIGatewayUserSchemaOperationListResponse() {} +func (r APIShieldOperationModel) implementsAPIGatewayUserSchemaOperationListResponse() {} // The HTTP method used to access the endpoint. -type APIShieldOperationMethod string +type APIShieldOperationModelMethod string const ( - APIShieldOperationMethodGet APIShieldOperationMethod = "GET" - APIShieldOperationMethodPost APIShieldOperationMethod = "POST" - APIShieldOperationMethodHead APIShieldOperationMethod = "HEAD" - APIShieldOperationMethodOptions APIShieldOperationMethod = "OPTIONS" - APIShieldOperationMethodPut APIShieldOperationMethod = "PUT" - APIShieldOperationMethodDelete APIShieldOperationMethod = "DELETE" - APIShieldOperationMethodConnect APIShieldOperationMethod = "CONNECT" - APIShieldOperationMethodPatch APIShieldOperationMethod = "PATCH" - APIShieldOperationMethodTrace APIShieldOperationMethod = "TRACE" + APIShieldOperationModelMethodGet APIShieldOperationModelMethod = "GET" + APIShieldOperationModelMethodPost APIShieldOperationModelMethod = "POST" + APIShieldOperationModelMethodHead APIShieldOperationModelMethod = "HEAD" + APIShieldOperationModelMethodOptions APIShieldOperationModelMethod = "OPTIONS" + APIShieldOperationModelMethodPut APIShieldOperationModelMethod = "PUT" + APIShieldOperationModelMethodDelete APIShieldOperationModelMethod = "DELETE" + APIShieldOperationModelMethodConnect APIShieldOperationModelMethod = "CONNECT" + APIShieldOperationModelMethodPatch APIShieldOperationModelMethod = "PATCH" + APIShieldOperationModelMethodTrace APIShieldOperationModelMethod = "TRACE" ) -func (r APIShieldOperationMethod) IsKnown() bool { +func (r APIShieldOperationModelMethod) IsKnown() bool { switch r { - case APIShieldOperationMethodGet, APIShieldOperationMethodPost, APIShieldOperationMethodHead, APIShieldOperationMethodOptions, APIShieldOperationMethodPut, APIShieldOperationMethodDelete, APIShieldOperationMethodConnect, APIShieldOperationMethodPatch, APIShieldOperationMethodTrace: + case APIShieldOperationModelMethodGet, APIShieldOperationModelMethodPost, APIShieldOperationModelMethodHead, APIShieldOperationModelMethodOptions, APIShieldOperationModelMethodPut, APIShieldOperationModelMethodDelete, APIShieldOperationModelMethodConnect, APIShieldOperationModelMethodPatch, APIShieldOperationModelMethodTrace: return true } return false } -type APIShieldOperationParam struct { +type APIShieldOperationModelParam struct { // The endpoint which can contain path parameter templates in curly braces, each // will be replaced from left to right with {varN}, starting with {var1}, during // insertion. This will further be Cloudflare-normalized upon insertion. See: @@ -203,10 +203,10 @@ type APIShieldOperationParam struct { // RFC3986-compliant host. Host param.Field[string] `json:"host,required" format:"hostname"` // The HTTP method used to access the endpoint. - Method param.Field[APIShieldOperationMethod] `json:"method,required"` + Method param.Field[APIShieldOperationModelMethod] `json:"method,required"` } -func (r APIShieldOperationParam) MarshalJSON() (data []byte, err error) { +func (r APIShieldOperationModelParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } @@ -2229,8 +2229,8 @@ func (r OperationGetResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInf type OperationNewParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body []APIShieldOperationParam `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body []APIShieldOperationModelParam `json:"body,required"` } func (r OperationNewParams) MarshalJSON() (data []byte, err error) { diff --git a/api_gateway/operation_test.go b/api_gateway/operation_test.go index bfbb7f32443..65788883165 100644 --- a/api_gateway/operation_test.go +++ b/api_gateway/operation_test.go @@ -29,10 +29,10 @@ func TestOperationNew(t *testing.T) { ) _, err := client.APIGateway.Operations.New(context.TODO(), api_gateway.OperationNewParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: []api_gateway.APIShieldOperationParam{{ + Body: []api_gateway.APIShieldOperationModelParam{{ Endpoint: cloudflare.F("/api/v1/users/{var1}"), Host: cloudflare.F("www.example.com"), - Method: cloudflare.F(api_gateway.APIShieldOperationMethodGet), + Method: cloudflare.F(api_gateway.APIShieldOperationModelMethodGet), }}, }) if err != nil { diff --git a/api_gateway/userschemaoperation.go b/api_gateway/userschemaoperation.go index 5ff07e0a249..7c2b3e01d5d 100644 --- a/api_gateway/userschemaoperation.go +++ b/api_gateway/userschemaoperation.go @@ -123,14 +123,14 @@ func (r *UserSchemaOperationListResponse) UnmarshalJSON(data []byte) (err error) // // Possible runtime types of the union are // [api_gateway.UserSchemaOperationListResponseAPIShieldOperation], -// [api_gateway.APIShieldOperation]. +// [api_gateway.APIShieldOperationModel]. func (r UserSchemaOperationListResponse) AsUnion() UserSchemaOperationListResponseUnion { return r.union } // Union satisfied by // [api_gateway.UserSchemaOperationListResponseAPIShieldOperation] or -// [api_gateway.APIShieldOperation]. +// [api_gateway.APIShieldOperationModel]. type UserSchemaOperationListResponseUnion interface { implementsAPIGatewayUserSchemaOperationListResponse() } @@ -145,7 +145,7 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(APIShieldOperation{}), + Type: reflect.TypeOf(APIShieldOperationModel{}), }, ) }