Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#3646)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Nov 20, 2024
1 parent 419477c commit 41cb8f0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2521,11 +2521,11 @@ Methods:

Params Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#APIShieldOperationParam">APIShieldOperationParam</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#APIShieldOperationModelParam">APIShieldOperationModelParam</a>

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#APIShieldOperation">APIShieldOperation</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#APIShieldOperationModel">APIShieldOperationModel</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationNewResponse">OperationNewResponse</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationListResponse">OperationListResponse</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationDeleteResponse">OperationDeleteResponse</a>
Expand Down
52 changes: 26 additions & 26 deletions api_gateway/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -147,54 +147,54 @@ 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
raw string
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:
Expand All @@ -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)
}

Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions api_gateway/operation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions api_gateway/userschemaoperation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -145,7 +145,7 @@ func init() {
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(APIShieldOperation{}),
Type: reflect.TypeOf(APIShieldOperationModel{}),
},
)
}
Expand Down

0 comments on commit 41cb8f0

Please sign in to comment.