Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#1836)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Apr 24, 2024
1 parent 82ba8c5 commit 99c16cd
Show file tree
Hide file tree
Showing 36 changed files with 761 additions and 1,655 deletions.
49 changes: 12 additions & 37 deletions addressing/addressmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"context"
"fmt"
"net/http"
"reflect"
"time"

"github.com/cloudflare/cloudflare-go/v2/internal/apijson"
Expand All @@ -15,7 +14,6 @@ import (
"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"
)

// AddressMapService contains methods and other services that help with interacting
Expand Down Expand Up @@ -79,7 +77,7 @@ func (r *AddressMapService) ListAutoPaging(ctx context.Context, query AddressMap

// Delete a particular address map owned by the account. An Address Map must be
// disabled before it can be deleted.
func (r *AddressMapService) Delete(ctx context.Context, addressMapID string, params AddressMapDeleteParams, opts ...option.RequestOption) (res *AddressMapDeleteResponseUnion, err error) {
func (r *AddressMapService) Delete(ctx context.Context, addressMapID string, params AddressMapDeleteParams, opts ...option.RequestOption) (res *[]AddressMapDeleteResponse, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapDeleteResponseEnvelope
path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s", params.AccountID, addressMapID)
Expand Down Expand Up @@ -291,30 +289,7 @@ func (r AddressMapNewResponseMembershipsKind) IsKnown() bool {
return false
}

// Union satisfied by [addressing.AddressMapDeleteResponseUnknown],
// [addressing.AddressMapDeleteResponseArray] or [shared.UnionString].
type AddressMapDeleteResponseUnion interface {
ImplementsAddressingAddressMapDeleteResponseUnion()
}

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

type AddressMapDeleteResponseArray []interface{}

func (r AddressMapDeleteResponseArray) ImplementsAddressingAddressMapDeleteResponseUnion() {}
type AddressMapDeleteResponse = interface{}

type AddressMapGetResponse struct {
// Identifier
Expand Down Expand Up @@ -460,9 +435,9 @@ func (r AddressMapNewParams) MarshalJSON() (data []byte, err error) {
type AddressMapNewResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result AddressMapNewResponse `json:"result,required"`
// Whether the API call was successful
Success AddressMapNewResponseEnvelopeSuccess `json:"success,required"`
Result AddressMapNewResponse `json:"result"`
JSON addressMapNewResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -471,8 +446,8 @@ type AddressMapNewResponseEnvelope struct {
type addressMapNewResponseEnvelopeJSON 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 @@ -516,11 +491,11 @@ func (r AddressMapDeleteParams) MarshalJSON() (data []byte, err error) {
}

type AddressMapDeleteResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result AddressMapDeleteResponseUnion `json:"result,required,nullable"`
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
// Whether the API call was successful
Success AddressMapDeleteResponseEnvelopeSuccess `json:"success,required"`
Result []AddressMapDeleteResponse `json:"result,nullable"`
ResultInfo AddressMapDeleteResponseEnvelopeResultInfo `json:"result_info"`
JSON addressMapDeleteResponseEnvelopeJSON `json:"-"`
}
Expand All @@ -530,8 +505,8 @@ type AddressMapDeleteResponseEnvelope struct {
type addressMapDeleteResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
ResultInfo apijson.Field
raw string
ExtraFields map[string]apijson.Field
Expand Down Expand Up @@ -615,9 +590,9 @@ func (r AddressMapEditParams) MarshalJSON() (data []byte, err error) {
type AddressMapEditResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result AddressMap `json:"result,required"`
// Whether the API call was successful
Success AddressMapEditResponseEnvelopeSuccess `json:"success,required"`
Result AddressMap `json:"result"`
JSON addressMapEditResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -626,8 +601,8 @@ type AddressMapEditResponseEnvelope struct {
type addressMapEditResponseEnvelopeJSON 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 @@ -663,9 +638,9 @@ type AddressMapGetParams struct {
type AddressMapGetResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result AddressMapGetResponse `json:"result,required"`
// Whether the API call was successful
Success AddressMapGetResponseEnvelopeSuccess `json:"success,required"`
Result AddressMapGetResponse `json:"result"`
JSON addressMapGetResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -674,8 +649,8 @@ type AddressMapGetResponseEnvelope struct {
type addressMapGetResponseEnvelopeJSON 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
74 changes: 12 additions & 62 deletions addressing/addressmapaccount.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"
)

// AddressMapAccountService contains methods and other services that help with
Expand All @@ -35,7 +33,7 @@ func NewAddressMapAccountService(opts ...option.RequestOption) (r *AddressMapAcc
}

// Add an account as a member of a particular address map.
func (r *AddressMapAccountService) Update(ctx context.Context, addressMapID string, params AddressMapAccountUpdateParams, opts ...option.RequestOption) (res *AddressMapAccountUpdateResponseUnion, err error) {
func (r *AddressMapAccountService) Update(ctx context.Context, addressMapID string, params AddressMapAccountUpdateParams, opts ...option.RequestOption) (res *[]AddressMapAccountUpdateResponse, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapAccountUpdateResponseEnvelope
path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/accounts/%s", params.AccountID, addressMapID, params.AccountID)
Expand All @@ -48,7 +46,7 @@ func (r *AddressMapAccountService) Update(ctx context.Context, addressMapID stri
}

// Remove an account as a member of a particular address map.
func (r *AddressMapAccountService) Delete(ctx context.Context, addressMapID string, params AddressMapAccountDeleteParams, opts ...option.RequestOption) (res *AddressMapAccountDeleteResponseUnion, err error) {
func (r *AddressMapAccountService) Delete(ctx context.Context, addressMapID string, params AddressMapAccountDeleteParams, opts ...option.RequestOption) (res *[]AddressMapAccountDeleteResponse, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapAccountDeleteResponseEnvelope
path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/accounts/%s", params.AccountID, addressMapID, params.AccountID)
Expand All @@ -60,57 +58,9 @@ func (r *AddressMapAccountService) Delete(ctx context.Context, addressMapID stri
return
}

// Union satisfied by [addressing.AddressMapAccountUpdateResponseUnknown],
// [addressing.AddressMapAccountUpdateResponseArray] or [shared.UnionString].
type AddressMapAccountUpdateResponseUnion interface {
ImplementsAddressingAddressMapAccountUpdateResponseUnion()
}

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

type AddressMapAccountUpdateResponseArray []interface{}

func (r AddressMapAccountUpdateResponseArray) ImplementsAddressingAddressMapAccountUpdateResponseUnion() {
}

// Union satisfied by [addressing.AddressMapAccountDeleteResponseUnknown],
// [addressing.AddressMapAccountDeleteResponseArray] or [shared.UnionString].
type AddressMapAccountDeleteResponseUnion interface {
ImplementsAddressingAddressMapAccountDeleteResponseUnion()
}
type AddressMapAccountUpdateResponse = interface{}

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

type AddressMapAccountDeleteResponseArray []interface{}

func (r AddressMapAccountDeleteResponseArray) ImplementsAddressingAddressMapAccountDeleteResponseUnion() {
}
type AddressMapAccountDeleteResponse = interface{}

type AddressMapAccountUpdateParams struct {
// Identifier
Expand All @@ -123,11 +73,11 @@ func (r AddressMapAccountUpdateParams) MarshalJSON() (data []byte, err error) {
}

type AddressMapAccountUpdateResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result AddressMapAccountUpdateResponseUnion `json:"result,required,nullable"`
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
// Whether the API call was successful
Success AddressMapAccountUpdateResponseEnvelopeSuccess `json:"success,required"`
Result []AddressMapAccountUpdateResponse `json:"result,nullable"`
ResultInfo AddressMapAccountUpdateResponseEnvelopeResultInfo `json:"result_info"`
JSON addressMapAccountUpdateResponseEnvelopeJSON `json:"-"`
}
Expand All @@ -137,8 +87,8 @@ type AddressMapAccountUpdateResponseEnvelope struct {
type addressMapAccountUpdateResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
ResultInfo apijson.Field
raw string
ExtraFields map[string]apijson.Field
Expand Down Expand Up @@ -209,11 +159,11 @@ func (r AddressMapAccountDeleteParams) MarshalJSON() (data []byte, err error) {
}

type AddressMapAccountDeleteResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result AddressMapAccountDeleteResponseUnion `json:"result,required,nullable"`
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
// Whether the API call was successful
Success AddressMapAccountDeleteResponseEnvelopeSuccess `json:"success,required"`
Result []AddressMapAccountDeleteResponse `json:"result,nullable"`
ResultInfo AddressMapAccountDeleteResponseEnvelopeResultInfo `json:"result_info"`
JSON addressMapAccountDeleteResponseEnvelopeJSON `json:"-"`
}
Expand All @@ -223,8 +173,8 @@ type AddressMapAccountDeleteResponseEnvelope struct {
type addressMapAccountDeleteResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
ResultInfo apijson.Field
raw string
ExtraFields map[string]apijson.Field
Expand Down
Loading

0 comments on commit 99c16cd

Please sign in to comment.