Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#1805)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 16, 2024
1 parent 01f9e5a commit 9d6c74e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 38 deletions.
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1992,12 +1992,12 @@ Params Types:
Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs">logs</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#CmbConfig">CmbConfig</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs">logs</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#ControlCmbConfigDeleteResponseUnion">ControlCmbConfigDeleteResponseUnion</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs">logs</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#ControlCmbConfigDeleteResponse">ControlCmbConfigDeleteResponse</a>

Methods:

- <code title="post /accounts/{account_id}/logs/control/cmb/config">client.Logs.Control.Cmb.Config.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#ControlCmbConfigService.New">New</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs">logs</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#ControlCmbConfigNewParams">ControlCmbConfigNewParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs">logs</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#CmbConfig">CmbConfig</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="delete /accounts/{account_id}/logs/control/cmb/config">client.Logs.Control.Cmb.Config.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#ControlCmbConfigService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs">logs</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#ControlCmbConfigDeleteParams">ControlCmbConfigDeleteParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs">logs</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#ControlCmbConfigDeleteResponseUnion">ControlCmbConfigDeleteResponseUnion</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="delete /accounts/{account_id}/logs/control/cmb/config">client.Logs.Control.Cmb.Config.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#ControlCmbConfigService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs">logs</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#ControlCmbConfigDeleteParams">ControlCmbConfigDeleteParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs">logs</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#ControlCmbConfigDeleteResponse">ControlCmbConfigDeleteResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_id}/logs/control/cmb/config">client.Logs.Control.Cmb.Config.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#ControlCmbConfigService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs">logs</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#ControlCmbConfigGetParams">ControlCmbConfigGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs">logs</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/logs#CmbConfig">CmbConfig</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

## RayID
Expand Down
1 change: 0 additions & 1 deletion internal/shared/union.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down
45 changes: 10 additions & 35 deletions logs/controlcmbconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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:"-"`
}

Expand All @@ -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
}
Expand Down Expand Up @@ -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:"-"`
}

Expand All @@ -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
}
Expand Down Expand Up @@ -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:"-"`
}

Expand All @@ -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
}
Expand Down

0 comments on commit 9d6c74e

Please sign in to comment.