Skip to content

Commit

Permalink
chore(internal): codegen related update (#3033)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Sep 9, 2024
1 parent 27f3661 commit 2e4c5b8
Show file tree
Hide file tree
Showing 35 changed files with 267 additions and 1,155 deletions.
164 changes: 82 additions & 82 deletions api.md

Large diffs are not rendered by default.

54 changes: 8 additions & 46 deletions argo/smartrouting.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ import (
"errors"
"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/option"
"github.com/cloudflare/cloudflare-go/v2/shared"
"github.com/tidwall/gjson"
)

// SmartRoutingService contains methods and other services that help with
Expand All @@ -37,7 +35,7 @@ func NewSmartRoutingService(opts ...option.RequestOption) (r *SmartRoutingServic
}

// Updates enablement of Argo Smart Routing.
func (r *SmartRoutingService) Edit(ctx context.Context, params SmartRoutingEditParams, opts ...option.RequestOption) (res *SmartRoutingEditResponseUnion, err error) {
func (r *SmartRoutingService) Edit(ctx context.Context, params SmartRoutingEditParams, opts ...option.RequestOption) (res *interface{}, err error) {
var env SmartRoutingEditResponseEnvelope
opts = append(r.Options[:], opts...)
if params.ZoneID.Value == "" {
Expand All @@ -54,7 +52,7 @@ func (r *SmartRoutingService) Edit(ctx context.Context, params SmartRoutingEditP
}

// Get Argo Smart Routing setting
func (r *SmartRoutingService) Get(ctx context.Context, query SmartRoutingGetParams, opts ...option.RequestOption) (res *SmartRoutingGetResponseUnion, err error) {
func (r *SmartRoutingService) Get(ctx context.Context, query SmartRoutingGetParams, opts ...option.RequestOption) (res *interface{}, err error) {
var env SmartRoutingGetResponseEnvelope
opts = append(r.Options[:], opts...)
if query.ZoneID.Value == "" {
Expand All @@ -70,42 +68,6 @@ func (r *SmartRoutingService) Get(ctx context.Context, query SmartRoutingGetPara
return
}

// Union satisfied by
// [argo.SmartRoutingEditResponseUnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
// or [shared.UnionString].
type SmartRoutingEditResponseUnion interface {
ImplementsArgoSmartRoutingEditResponseUnion()
}

func init() {
apijson.RegisterUnion(
reflect.TypeOf((*SmartRoutingEditResponseUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.String,
Type: reflect.TypeOf(shared.UnionString("")),
},
)
}

// Union satisfied by
// [argo.SmartRoutingGetResponseUnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
// or [shared.UnionString].
type SmartRoutingGetResponseUnion interface {
ImplementsArgoSmartRoutingGetResponseUnion()
}

func init() {
apijson.RegisterUnion(
reflect.TypeOf((*SmartRoutingGetResponseUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.String,
Type: reflect.TypeOf(shared.UnionString("")),
},
)
}

type SmartRoutingEditParams struct {
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
Expand Down Expand Up @@ -134,9 +96,9 @@ func (r SmartRoutingEditParamsValue) IsKnown() bool {
}

type SmartRoutingEditResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result SmartRoutingEditResponseUnion `json:"result,required"`
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result interface{} `json:"result,required"`
// Whether the API call was successful
Success SmartRoutingEditResponseEnvelopeSuccess `json:"success,required"`
JSON smartRoutingEditResponseEnvelopeJSON `json:"-"`
Expand Down Expand Up @@ -182,9 +144,9 @@ type SmartRoutingGetParams struct {
}

type SmartRoutingGetResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result SmartRoutingGetResponseUnion `json:"result,required"`
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result interface{} `json:"result,required"`
// Whether the API call was successful
Success SmartRoutingGetResponseEnvelopeSuccess `json:"success,required"`
JSON smartRoutingGetResponseEnvelopeJSON `json:"-"`
Expand Down
29 changes: 3 additions & 26 deletions d1/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"fmt"
"net/http"
"net/url"
"reflect"
"time"

"github.com/cloudflare/cloudflare-go/v2/internal/apijson"
Expand All @@ -18,7 +17,6 @@ import (
"github.com/cloudflare/cloudflare-go/v2/internal/requestconfig"
"github.com/cloudflare/cloudflare-go/v2/option"
"github.com/cloudflare/cloudflare-go/v2/shared"
"github.com/tidwall/gjson"
)

// DatabaseService contains methods and other services that help with interacting
Expand Down Expand Up @@ -593,9 +591,9 @@ func (r databaseRawResponseMetaJSON) RawJSON() string {
}

type DatabaseRawResponseResults struct {
Columns []string `json:"columns"`
Rows [][]DatabaseRawResponseResultsRowsUnion `json:"rows"`
JSON databaseRawResponseResultsJSON `json:"-"`
Columns []string `json:"columns"`
Rows [][]interface{} `json:"rows"`
JSON databaseRawResponseResultsJSON `json:"-"`
}

// databaseRawResponseResultsJSON contains the JSON metadata for the struct
Expand All @@ -615,27 +613,6 @@ func (r databaseRawResponseResultsJSON) RawJSON() string {
return r.raw
}

// Union satisfied by [shared.UnionFloat], [shared.UnionString] or
// [d1.DatabaseRawResponseResultsRowsUnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a].
type DatabaseRawResponseResultsRowsUnion interface {
ImplementsD1DatabaseRawResponseResultsRowsUnion()
}

func init() {
apijson.RegisterUnion(
reflect.TypeOf((*DatabaseRawResponseResultsRowsUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.Number,
Type: reflect.TypeOf(shared.UnionFloat(0)),
},
apijson.UnionVariant{
TypeFilter: gjson.String,
Type: reflect.TypeOf(shared.UnionString("")),
},
)
}

type DatabaseNewParams struct {
// Account identifier tag.
AccountID param.Field[string] `path:"account_id,required"`
Expand Down
24 changes: 2 additions & 22 deletions dnssec/dnssec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ import (
"errors"
"fmt"
"net/http"
"reflect"
"time"

"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/option"
"github.com/cloudflare/cloudflare-go/v2/shared"
"github.com/tidwall/gjson"
)

// DNSSECService contains methods and other services that help with interacting
Expand All @@ -38,7 +36,7 @@ func NewDNSSECService(opts ...option.RequestOption) (r *DNSSECService) {
}

// Delete DNSSEC.
func (r *DNSSECService) Delete(ctx context.Context, body DNSSECDeleteParams, opts ...option.RequestOption) (res *DNSSECDeleteResponseUnion, err error) {
func (r *DNSSECService) Delete(ctx context.Context, body DNSSECDeleteParams, opts ...option.RequestOption) (res *interface{}, err error) {
var env DNSSECDeleteResponseEnvelope
opts = append(r.Options[:], opts...)
if body.ZoneID.Value == "" {
Expand Down Expand Up @@ -177,24 +175,6 @@ func (r DNSSECStatus) IsKnown() bool {
return false
}

// Union satisfied by
// [dnssec.DNSSECDeleteResponseUnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a] or
// [shared.UnionString].
type DNSSECDeleteResponseUnion interface {
ImplementsDNSSECDNSSECDeleteResponseUnion()
}

func init() {
apijson.RegisterUnion(
reflect.TypeOf((*DNSSECDeleteResponseUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.String,
Type: reflect.TypeOf(shared.UnionString("")),
},
)
}

type DNSSECDeleteParams struct {
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
Expand All @@ -205,7 +185,7 @@ type DNSSECDeleteResponseEnvelope struct {
Messages []shared.ResponseInfo `json:"messages,required"`
// Whether the API call was successful
Success DNSSECDeleteResponseEnvelopeSuccess `json:"success,required"`
Result DNSSECDeleteResponseUnion `json:"result"`
Result interface{} `json:"result"`
JSON dnssecDeleteResponseEnvelopeJSON `json:"-"`
}

Expand Down
6 changes: 2 additions & 4 deletions event_notifications/r2configurationqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@ func (r r2ConfigurationQueueUpdateResponseJSON) RawJSON() string {
return r.raw
}

// Union satisfied by
// [event_notifications.R2ConfigurationQueueDeleteResponseUnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a],
// [event_notifications.R2ConfigurationQueueDeleteResponseArray] or
// [shared.UnionString].
// Union satisfied by [event_notifications.R2ConfigurationQueueDeleteResponseArray]
// or [shared.UnionString].
type R2ConfigurationQueueDeleteResponseUnion interface {
ImplementsEventNotificationsR2ConfigurationQueueDeleteResponseUnion()
}
Expand Down
80 changes: 12 additions & 68 deletions firewall/accessrule.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"fmt"
"net/http"
"net/url"
"reflect"

"github.com/cloudflare/cloudflare-go/v2/internal/apijson"
"github.com/cloudflare/cloudflare-go/v2/internal/apiquery"
Expand All @@ -17,7 +16,6 @@ import (
"github.com/cloudflare/cloudflare-go/v2/internal/requestconfig"
"github.com/cloudflare/cloudflare-go/v2/option"
"github.com/cloudflare/cloudflare-go/v2/shared"
"github.com/tidwall/gjson"
)

// AccessRuleService contains methods and other services that help with interacting
Expand All @@ -44,7 +42,7 @@ func NewAccessRuleService(opts ...option.RequestOption) (r *AccessRuleService) {
//
// Note: To create an IP Access rule that applies to a single zone, refer to the
// [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints.
func (r *AccessRuleService) New(ctx context.Context, params AccessRuleNewParams, opts ...option.RequestOption) (res *AccessRuleNewResponseUnion, err error) {
func (r *AccessRuleService) New(ctx context.Context, params AccessRuleNewParams, opts ...option.RequestOption) (res *interface{}, err error) {
var env AccessRuleNewResponseEnvelope
opts = append(r.Options[:], opts...)
var accountOrZone string
Expand Down Expand Up @@ -159,7 +157,7 @@ func (r *AccessRuleService) Delete(ctx context.Context, identifier string, body
// Updates an IP Access rule defined.
//
// Note: This operation will affect all zones in the account or zone.
func (r *AccessRuleService) Edit(ctx context.Context, identifier string, params AccessRuleEditParams, opts ...option.RequestOption) (res *AccessRuleEditResponseUnion, err error) {
func (r *AccessRuleService) Edit(ctx context.Context, identifier string, params AccessRuleEditParams, opts ...option.RequestOption) (res *interface{}, err error) {
var env AccessRuleEditResponseEnvelope
opts = append(r.Options[:], opts...)
var accountOrZone string
Expand Down Expand Up @@ -194,7 +192,7 @@ func (r *AccessRuleService) Edit(ctx context.Context, identifier string, params
}

// Fetches the details of an IP Access rule defined.
func (r *AccessRuleService) Get(ctx context.Context, identifier string, query AccessRuleGetParams, opts ...option.RequestOption) (res *AccessRuleGetResponseUnion, err error) {
func (r *AccessRuleService) Get(ctx context.Context, identifier string, query AccessRuleGetParams, opts ...option.RequestOption) (res *interface{}, err error) {
var env AccessRuleGetResponseEnvelope
opts = append(r.Options[:], opts...)
var accountOrZone string
Expand Down Expand Up @@ -412,24 +410,6 @@ func (r IPV6ConfigurationTarget) IsKnown() bool {
return false
}

// Union satisfied by
// [firewall.AccessRuleNewResponseUnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
// or [shared.UnionString].
type AccessRuleNewResponseUnion interface {
ImplementsFirewallAccessRuleNewResponseUnion()
}

func init() {
apijson.RegisterUnion(
reflect.TypeOf((*AccessRuleNewResponseUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.String,
Type: reflect.TypeOf(shared.UnionString("")),
},
)
}

type AccessRuleListResponse = interface{}

type AccessRuleDeleteResponse struct {
Expand All @@ -454,42 +434,6 @@ func (r accessRuleDeleteResponseJSON) RawJSON() string {
return r.raw
}

// Union satisfied by
// [firewall.AccessRuleEditResponseUnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
// or [shared.UnionString].
type AccessRuleEditResponseUnion interface {
ImplementsFirewallAccessRuleEditResponseUnion()
}

func init() {
apijson.RegisterUnion(
reflect.TypeOf((*AccessRuleEditResponseUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.String,
Type: reflect.TypeOf(shared.UnionString("")),
},
)
}

// Union satisfied by
// [firewall.AccessRuleGetResponseUnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
// or [shared.UnionString].
type AccessRuleGetResponseUnion interface {
ImplementsFirewallAccessRuleGetResponseUnion()
}

func init() {
apijson.RegisterUnion(
reflect.TypeOf((*AccessRuleGetResponseUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.String,
Type: reflect.TypeOf(shared.UnionString("")),
},
)
}

type AccessRuleNewParams struct {
// The rule configuration.
Configuration param.Field[AccessRuleNewParamsConfigurationUnion] `json:"configuration,required"`
Expand Down Expand Up @@ -573,9 +517,9 @@ func (r AccessRuleNewParamsMode) IsKnown() bool {
}

type AccessRuleNewResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result AccessRuleNewResponseUnion `json:"result,required"`
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result interface{} `json:"result,required"`
// Whether the API call was successful
Success AccessRuleNewResponseEnvelopeSuccess `json:"success,required"`
JSON accessRuleNewResponseEnvelopeJSON `json:"-"`
Expand Down Expand Up @@ -888,9 +832,9 @@ func (r AccessRuleEditParamsMode) IsKnown() bool {
}

type AccessRuleEditResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result AccessRuleEditResponseUnion `json:"result,required"`
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result interface{} `json:"result,required"`
// Whether the API call was successful
Success AccessRuleEditResponseEnvelopeSuccess `json:"success,required"`
JSON accessRuleEditResponseEnvelopeJSON `json:"-"`
Expand Down Expand Up @@ -938,9 +882,9 @@ type AccessRuleGetParams struct {
}

type AccessRuleGetResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result AccessRuleGetResponseUnion `json:"result,required"`
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result interface{} `json:"result,required"`
// Whether the API call was successful
Success AccessRuleGetResponseEnvelopeSuccess `json:"success,required"`
JSON accessRuleGetResponseEnvelopeJSON `json:"-"`
Expand Down
Loading

0 comments on commit 2e4c5b8

Please sign in to comment.