From 0a8b85821c879f819aa703fe6e073a790dbad72f Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Tue, 16 Apr 2024 18:13:22 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API --- api.md | 4 ++-- internal/shared/union.go | 1 - logs/controlcmbconfig.go | 45 +++++++++------------------------------- 3 files changed, 12 insertions(+), 38 deletions(-) diff --git a/api.md b/api.md index 060fe8218af..d7b41e52b06 100644 --- a/api.md +++ b/api.md @@ -1992,12 +1992,12 @@ Params Types: Response Types: - logs.CmbConfig -- logs.ControlCmbConfigDeleteResponseUnion +- logs.ControlCmbConfigDeleteResponse Methods: - client.Logs.Control.Cmb.Config.New(ctx context.Context, params logs.ControlCmbConfigNewParams) (logs.CmbConfig, error) -- client.Logs.Control.Cmb.Config.Delete(ctx context.Context, params logs.ControlCmbConfigDeleteParams) (logs.ControlCmbConfigDeleteResponseUnion, error) +- client.Logs.Control.Cmb.Config.Delete(ctx context.Context, params logs.ControlCmbConfigDeleteParams) (logs.ControlCmbConfigDeleteResponse, error) - client.Logs.Control.Cmb.Config.Get(ctx context.Context, query logs.ControlCmbConfigGetParams) (logs.CmbConfig, error) ## RayID diff --git a/internal/shared/union.go b/internal/shared/union.go index da72313c790..81f6c251540 100644 --- a/internal/shared/union.go +++ b/internal/shared/union.go @@ -67,7 +67,6 @@ func (UnionString) ImplementsFirewallWAFPackageGroupEditResponseUnion() func (UnionString) ImplementsFirewallWAFPackageGroupGetResponseUnion() {} func (UnionString) ImplementsFirewallWAFPackageRuleGetResponseUnion() {} func (UnionString) ImplementsLogpushJobDeleteResponseUnion() {} -func (UnionString) ImplementsLogsControlCmbConfigDeleteResponseUnion() {} func (UnionString) ImplementsLogsRayIDGetResponseUnion() {} func (UnionString) ImplementsLogsReceivedGetResponseUnion() {} func (UnionString) ImplementsLogsReceivedGetParamsEndUnion() {} diff --git a/logs/controlcmbconfig.go b/logs/controlcmbconfig.go index b66ff77cefb..cfbda105947 100644 --- a/logs/controlcmbconfig.go +++ b/logs/controlcmbconfig.go @@ -6,14 +6,12 @@ import ( "context" "fmt" "net/http" - "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/tidwall/gjson" ) // ControlCmbConfigService contains methods and other services that help with @@ -48,7 +46,7 @@ func (r *ControlCmbConfigService) New(ctx context.Context, params ControlCmbConf } // Deletes CMB config. -func (r *ControlCmbConfigService) Delete(ctx context.Context, params ControlCmbConfigDeleteParams, opts ...option.RequestOption) (res *ControlCmbConfigDeleteResponseUnion, err error) { +func (r *ControlCmbConfigService) Delete(ctx context.Context, params ControlCmbConfigDeleteParams, opts ...option.RequestOption) (res *ControlCmbConfigDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env ControlCmbConfigDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/logs/control/cmb/config", params.AccountID) @@ -103,30 +101,7 @@ func (r CmbConfigParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Union satisfied by [logs.ControlCmbConfigDeleteResponseUnknown], -// [logs.ControlCmbConfigDeleteResponseArray] or [shared.UnionString]. -type ControlCmbConfigDeleteResponseUnion interface { - ImplementsLogsControlCmbConfigDeleteResponseUnion() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*ControlCmbConfigDeleteResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ControlCmbConfigDeleteResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type ControlCmbConfigDeleteResponseArray []interface{} - -func (r ControlCmbConfigDeleteResponseArray) ImplementsLogsControlCmbConfigDeleteResponseUnion() {} +type ControlCmbConfigDeleteResponse = interface{} type ControlCmbConfigNewParams struct { // Identifier @@ -141,9 +116,9 @@ func (r ControlCmbConfigNewParams) MarshalJSON() (data []byte, err error) { type ControlCmbConfigNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result CmbConfig `json:"result,required,nullable"` // Whether the API call was successful Success ControlCmbConfigNewResponseEnvelopeSuccess `json:"success,required"` + Result CmbConfig `json:"result,nullable"` JSON controlCmbConfigNewResponseEnvelopeJSON `json:"-"` } @@ -152,8 +127,8 @@ type ControlCmbConfigNewResponseEnvelope struct { type controlCmbConfigNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -192,11 +167,11 @@ func (r ControlCmbConfigDeleteParams) MarshalJSON() (data []byte, err error) { } type ControlCmbConfigDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result ControlCmbConfigDeleteResponseUnion `json:"result,required,nullable"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success ControlCmbConfigDeleteResponseEnvelopeSuccess `json:"success,required"` + Result ControlCmbConfigDeleteResponse `json:"result,nullable"` JSON controlCmbConfigDeleteResponseEnvelopeJSON `json:"-"` } @@ -205,8 +180,8 @@ type ControlCmbConfigDeleteResponseEnvelope struct { type controlCmbConfigDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -242,9 +217,9 @@ type ControlCmbConfigGetParams struct { type ControlCmbConfigGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result CmbConfig `json:"result,required,nullable"` // Whether the API call was successful Success ControlCmbConfigGetResponseEnvelopeSuccess `json:"success,required"` + Result CmbConfig `json:"result,nullable"` JSON controlCmbConfigGetResponseEnvelopeJSON `json:"-"` } @@ -253,8 +228,8 @@ type ControlCmbConfigGetResponseEnvelope struct { type controlCmbConfigGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field }