Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): OpenAPI spec update via Stainless API #1805

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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