Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#1670)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 5, 2024
1 parent 0cfe748 commit 8b010ea
Show file tree
Hide file tree
Showing 150 changed files with 6,201 additions and 5,590 deletions.
59 changes: 30 additions & 29 deletions accounts/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewMemberService(opts ...option.RequestOption) (r *MemberService) {
}

// Add a user to the list of members for this account.
func (r *MemberService) New(ctx context.Context, params MemberNewParams, opts ...option.RequestOption) (res *MemberWithCode, err error) {
func (r *MemberService) New(ctx context.Context, params MemberNewParams, opts ...option.RequestOption) (res *MemberWithInviteCode, err error) {
opts = append(r.Options[:], opts...)
var env MemberNewResponseEnvelope
path := fmt.Sprintf("accounts/%v/members", params.AccountID)
Expand Down Expand Up @@ -201,20 +201,21 @@ func (r memberUserJSON) RawJSON() string {
return r.raw
}

type MemberWithCode struct {
type MemberWithInviteCode struct {
// Membership identifier tag.
ID string `json:"id,required"`
// Roles assigned to this member.
Roles []MemberWithCodeRole `json:"roles,required"`
Status interface{} `json:"status,required"`
User MemberWithCodeUser `json:"user,required"`
Roles []MemberWithInviteCodeRole `json:"roles,required"`
Status interface{} `json:"status,required"`
User MemberWithInviteCodeUser `json:"user,required"`
// The unique activation code for the account membership.
Code string `json:"code"`
JSON memberWithCodeJSON `json:"-"`
Code string `json:"code"`
JSON memberWithInviteCodeJSON `json:"-"`
}

// memberWithCodeJSON contains the JSON metadata for the struct [MemberWithCode]
type memberWithCodeJSON struct {
// memberWithInviteCodeJSON contains the JSON metadata for the struct
// [MemberWithInviteCode]
type memberWithInviteCodeJSON struct {
ID apijson.Field
Roles apijson.Field
Status apijson.Field
Expand All @@ -224,28 +225,28 @@ type memberWithCodeJSON struct {
ExtraFields map[string]apijson.Field
}

func (r *MemberWithCode) UnmarshalJSON(data []byte) (err error) {
func (r *MemberWithInviteCode) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r memberWithCodeJSON) RawJSON() string {
func (r memberWithInviteCodeJSON) RawJSON() string {
return r.raw
}

type MemberWithCodeRole struct {
type MemberWithInviteCodeRole struct {
// Role identifier tag.
ID string `json:"id,required"`
// Description of role's permissions.
Description string `json:"description,required"`
// Role name.
Name string `json:"name,required"`
Permissions user.Permission `json:"permissions,required"`
JSON memberWithCodeRoleJSON `json:"-"`
Name string `json:"name,required"`
Permissions user.Permission `json:"permissions,required"`
JSON memberWithInviteCodeRoleJSON `json:"-"`
}

// memberWithCodeRoleJSON contains the JSON metadata for the struct
// [MemberWithCodeRole]
type memberWithCodeRoleJSON struct {
// memberWithInviteCodeRoleJSON contains the JSON metadata for the struct
// [MemberWithInviteCodeRole]
type memberWithInviteCodeRoleJSON struct {
ID apijson.Field
Description apijson.Field
Name apijson.Field
Expand All @@ -254,15 +255,15 @@ type memberWithCodeRoleJSON struct {
ExtraFields map[string]apijson.Field
}

func (r *MemberWithCodeRole) UnmarshalJSON(data []byte) (err error) {
func (r *MemberWithInviteCodeRole) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r memberWithCodeRoleJSON) RawJSON() string {
func (r memberWithInviteCodeRoleJSON) RawJSON() string {
return r.raw
}

type MemberWithCodeUser struct {
type MemberWithInviteCodeUser struct {
// The contact email address of the user.
Email string `json:"email,required"`
// Identifier
Expand All @@ -273,13 +274,13 @@ type MemberWithCodeUser struct {
LastName string `json:"last_name,nullable"`
// Indicates whether two-factor authentication is enabled for the user account.
// Does not apply to API authentication.
TwoFactorAuthenticationEnabled bool `json:"two_factor_authentication_enabled"`
JSON memberWithCodeUserJSON `json:"-"`
TwoFactorAuthenticationEnabled bool `json:"two_factor_authentication_enabled"`
JSON memberWithInviteCodeUserJSON `json:"-"`
}

// memberWithCodeUserJSON contains the JSON metadata for the struct
// [MemberWithCodeUser]
type memberWithCodeUserJSON struct {
// memberWithInviteCodeUserJSON contains the JSON metadata for the struct
// [MemberWithInviteCodeUser]
type memberWithInviteCodeUserJSON struct {
Email apijson.Field
ID apijson.Field
FirstName apijson.Field
Expand All @@ -289,11 +290,11 @@ type memberWithCodeUserJSON struct {
ExtraFields map[string]apijson.Field
}

func (r *MemberWithCodeUser) UnmarshalJSON(data []byte) (err error) {
func (r *MemberWithInviteCodeUser) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r memberWithCodeUserJSON) RawJSON() string {
func (r memberWithInviteCodeUserJSON) RawJSON() string {
return r.raw
}

Expand Down Expand Up @@ -400,7 +401,7 @@ func (r MemberNewParamsStatus) IsKnown() bool {
type MemberNewResponseEnvelope struct {
Errors []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"errors,required"`
Messages []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"messages,required"`
Result MemberWithCode `json:"result,required"`
Result MemberWithInviteCode `json:"result,required"`
// Whether the API call was successful
Success MemberNewResponseEnvelopeSuccess `json:"success,required"`
JSON memberNewResponseEnvelopeJSON `json:"-"`
Expand Down
25 changes: 12 additions & 13 deletions addressing/addressmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (r *AddressMapService) New(ctx context.Context, params AddressMapNewParams,
}

// List all address maps owned by the account.
func (r *AddressMapService) List(ctx context.Context, query AddressMapListParams, opts ...option.RequestOption) (res *pagination.SinglePage[AddressingAddressMaps], err error) {
func (r *AddressMapService) List(ctx context.Context, query AddressMapListParams, opts ...option.RequestOption) (res *pagination.SinglePage[AddressMap], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
Expand All @@ -71,7 +71,7 @@ func (r *AddressMapService) List(ctx context.Context, query AddressMapListParams
}

// List all address maps owned by the account.
func (r *AddressMapService) ListAutoPaging(ctx context.Context, query AddressMapListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[AddressingAddressMaps] {
func (r *AddressMapService) ListAutoPaging(ctx context.Context, query AddressMapListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[AddressMap] {
return pagination.NewSinglePageAutoPager(r.List(ctx, query, opts...))
}

Expand All @@ -90,7 +90,7 @@ func (r *AddressMapService) Delete(ctx context.Context, addressMapID string, par
}

// Modify properties of an address map owned by the account.
func (r *AddressMapService) Edit(ctx context.Context, addressMapID string, params AddressMapEditParams, opts ...option.RequestOption) (res *AddressingAddressMaps, err error) {
func (r *AddressMapService) Edit(ctx context.Context, addressMapID string, params AddressMapEditParams, opts ...option.RequestOption) (res *AddressMap, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapEditResponseEnvelope
path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s", params.AccountID, addressMapID)
Expand All @@ -115,7 +115,7 @@ func (r *AddressMapService) Get(ctx context.Context, addressMapID string, query
return
}

type AddressingAddressMaps struct {
type AddressMap struct {
// Identifier
ID string `json:"id"`
// If set to false, then the Address Map cannot be deleted via API. This is true
Expand All @@ -136,14 +136,13 @@ type AddressingAddressMaps struct {
Description string `json:"description,nullable"`
// Whether the Address Map is enabled or not. Cloudflare's DNS will not respond
// with IP addresses on an Address Map until the map is enabled.
Enabled bool `json:"enabled,nullable"`
ModifiedAt time.Time `json:"modified_at" format:"date-time"`
JSON addressingAddressMapsJSON `json:"-"`
Enabled bool `json:"enabled,nullable"`
ModifiedAt time.Time `json:"modified_at" format:"date-time"`
JSON addressMapJSON `json:"-"`
}

// addressingAddressMapsJSON contains the JSON metadata for the struct
// [AddressingAddressMaps]
type addressingAddressMapsJSON struct {
// addressMapJSON contains the JSON metadata for the struct [AddressMap]
type addressMapJSON struct {
ID apijson.Field
CanDelete apijson.Field
CanModifyIPs apijson.Field
Expand All @@ -156,11 +155,11 @@ type addressingAddressMapsJSON struct {
ExtraFields map[string]apijson.Field
}

func (r *AddressingAddressMaps) UnmarshalJSON(data []byte) (err error) {
func (r *AddressMap) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r addressingAddressMapsJSON) RawJSON() string {
func (r addressMapJSON) RawJSON() string {
return r.raw
}

Expand Down Expand Up @@ -589,7 +588,7 @@ func (r AddressMapEditParams) MarshalJSON() (data []byte, err error) {
type AddressMapEditResponseEnvelope struct {
Errors []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"errors,required"`
Messages []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"messages,required"`
Result AddressingAddressMaps `json:"result,required"`
Result AddressMap `json:"result,required"`
// Whether the API call was successful
Success AddressMapEditResponseEnvelopeSuccess `json:"success,required"`
JSON addressMapEditResponseEnvelopeJSON `json:"-"`
Expand Down
31 changes: 15 additions & 16 deletions addressing/prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewPrefixService(opts ...option.RequestOption) (r *PrefixService) {
}

// Add a new prefix under the account.
func (r *PrefixService) New(ctx context.Context, params PrefixNewParams, opts ...option.RequestOption) (res *AddressingIpamPrefixes, err error) {
func (r *PrefixService) New(ctx context.Context, params PrefixNewParams, opts ...option.RequestOption) (res *Prefix, err error) {
opts = append(r.Options[:], opts...)
var env PrefixNewResponseEnvelope
path := fmt.Sprintf("accounts/%s/addressing/prefixes", params.AccountID)
Expand All @@ -51,7 +51,7 @@ func (r *PrefixService) New(ctx context.Context, params PrefixNewParams, opts ..
}

// List all prefixes owned by the account.
func (r *PrefixService) List(ctx context.Context, query PrefixListParams, opts ...option.RequestOption) (res *pagination.SinglePage[AddressingIpamPrefixes], err error) {
func (r *PrefixService) List(ctx context.Context, query PrefixListParams, opts ...option.RequestOption) (res *pagination.SinglePage[Prefix], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
Expand All @@ -69,7 +69,7 @@ func (r *PrefixService) List(ctx context.Context, query PrefixListParams, opts .
}

// List all prefixes owned by the account.
func (r *PrefixService) ListAutoPaging(ctx context.Context, query PrefixListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[AddressingIpamPrefixes] {
func (r *PrefixService) ListAutoPaging(ctx context.Context, query PrefixListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[Prefix] {
return pagination.NewSinglePageAutoPager(r.List(ctx, query, opts...))
}

Expand All @@ -87,7 +87,7 @@ func (r *PrefixService) Delete(ctx context.Context, prefixID string, params Pref
}

// Modify the description for a prefix owned by the account.
func (r *PrefixService) Edit(ctx context.Context, prefixID string, params PrefixEditParams, opts ...option.RequestOption) (res *AddressingIpamPrefixes, err error) {
func (r *PrefixService) Edit(ctx context.Context, prefixID string, params PrefixEditParams, opts ...option.RequestOption) (res *Prefix, err error) {
opts = append(r.Options[:], opts...)
var env PrefixEditResponseEnvelope
path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s", params.AccountID, prefixID)
Expand All @@ -100,7 +100,7 @@ func (r *PrefixService) Edit(ctx context.Context, prefixID string, params Prefix
}

// List a particular prefix owned by the account.
func (r *PrefixService) Get(ctx context.Context, prefixID string, query PrefixGetParams, opts ...option.RequestOption) (res *AddressingIpamPrefixes, err error) {
func (r *PrefixService) Get(ctx context.Context, prefixID string, query PrefixGetParams, opts ...option.RequestOption) (res *Prefix, err error) {
opts = append(r.Options[:], opts...)
var env PrefixGetResponseEnvelope
path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s", query.AccountID, prefixID)
Expand All @@ -112,7 +112,7 @@ func (r *PrefixService) Get(ctx context.Context, prefixID string, query PrefixGe
return
}

type AddressingIpamPrefixes struct {
type Prefix struct {
// Identifier
ID string `json:"id"`
// Identifier
Expand Down Expand Up @@ -140,13 +140,12 @@ type AddressingIpamPrefixes struct {
OnDemandEnabled bool `json:"on_demand_enabled"`
// Whether advertisement status of the prefix is locked, meaning it cannot be
// changed.
OnDemandLocked bool `json:"on_demand_locked"`
JSON addressingIpamPrefixesJSON `json:"-"`
OnDemandLocked bool `json:"on_demand_locked"`
JSON prefixJSON `json:"-"`
}

// addressingIpamPrefixesJSON contains the JSON metadata for the struct
// [AddressingIpamPrefixes]
type addressingIpamPrefixesJSON struct {
// prefixJSON contains the JSON metadata for the struct [Prefix]
type prefixJSON struct {
ID apijson.Field
AccountID apijson.Field
Advertised apijson.Field
Expand All @@ -164,11 +163,11 @@ type addressingIpamPrefixesJSON struct {
ExtraFields map[string]apijson.Field
}

func (r *AddressingIpamPrefixes) UnmarshalJSON(data []byte) (err error) {
func (r *Prefix) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r addressingIpamPrefixesJSON) RawJSON() string {
func (r prefixJSON) RawJSON() string {
return r.raw
}

Expand All @@ -190,7 +189,7 @@ func (r PrefixNewParams) MarshalJSON() (data []byte, err error) {
type PrefixNewResponseEnvelope struct {
Errors []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"errors,required"`
Messages []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"messages,required"`
Result AddressingIpamPrefixes `json:"result,required"`
Result Prefix `json:"result,required"`
// Whether the API call was successful
Success PrefixNewResponseEnvelopeSuccess `json:"success,required"`
JSON prefixNewResponseEnvelopeJSON `json:"-"`
Expand Down Expand Up @@ -335,7 +334,7 @@ func (r PrefixEditParams) MarshalJSON() (data []byte, err error) {
type PrefixEditResponseEnvelope struct {
Errors []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"errors,required"`
Messages []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"messages,required"`
Result AddressingIpamPrefixes `json:"result,required"`
Result Prefix `json:"result,required"`
// Whether the API call was successful
Success PrefixEditResponseEnvelopeSuccess `json:"success,required"`
JSON prefixEditResponseEnvelopeJSON `json:"-"`
Expand Down Expand Up @@ -383,7 +382,7 @@ type PrefixGetParams struct {
type PrefixGetResponseEnvelope struct {
Errors []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"errors,required"`
Messages []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"messages,required"`
Result AddressingIpamPrefixes `json:"result,required"`
Result Prefix `json:"result,required"`
// Whether the API call was successful
Success PrefixGetResponseEnvelopeSuccess `json:"success,required"`
JSON prefixGetResponseEnvelopeJSON `json:"-"`
Expand Down
Loading

0 comments on commit 8b010ea

Please sign in to comment.