Skip to content

Commit

Permalink
feat: OpenAPI spec update via Stainless API (#1523)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Mar 8, 2024
1 parent cdaf537 commit 9755602
Show file tree
Hide file tree
Showing 276 changed files with 15,919 additions and 94,948 deletions.
33 changes: 1 addition & 32 deletions accounts/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ type MemberListResponse struct {
// Member Name.
Name string `json:"name,required,nullable"`
// Roles assigned to this Member.
Roles []MemberListResponseRole `json:"roles,required"`
Roles []IamSchemasRole `json:"roles,required"`
// A member's status in the organization.
Status MemberListResponseStatus `json:"status,required"`
JSON memberListResponseJSON `json:"-"`
Expand All @@ -970,37 +970,6 @@ func (r memberListResponseJSON) RawJSON() string {
return r.raw
}

type MemberListResponseRole 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"`
// Access permissions for this User.
Permissions []string `json:"permissions,required"`
JSON memberListResponseRoleJSON `json:"-"`
}

// memberListResponseRoleJSON contains the JSON metadata for the struct
// [MemberListResponseRole]
type memberListResponseRoleJSON struct {
ID apijson.Field
Description apijson.Field
Name apijson.Field
Permissions apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

func (r memberListResponseRoleJSON) RawJSON() string {
return r.raw
}

// A member's status in the organization.
type MemberListResponseStatus string

Expand Down
19 changes: 9 additions & 10 deletions accounts/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewRoleService(opts ...option.RequestOption) (r *RoleService) {
}

// Get all available roles for an account.
func (r *RoleService) List(ctx context.Context, query RoleListParams, opts ...option.RequestOption) (res *[]RoleListResponse, err error) {
func (r *RoleService) List(ctx context.Context, query RoleListParams, opts ...option.RequestOption) (res *[]IamSchemasRole, err error) {
opts = append(r.Options[:], opts...)
var env RoleListResponseEnvelope
path := fmt.Sprintf("accounts/%v/roles", query.AccountID)
Expand All @@ -59,21 +59,20 @@ func (r *RoleService) Get(ctx context.Context, roleID interface{}, query RoleGet
return
}

type RoleListResponse struct {
type IamSchemasRole 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"`
// Access permissions for this User.
Permissions []string `json:"permissions,required"`
JSON roleListResponseJSON `json:"-"`
Permissions []string `json:"permissions,required"`
JSON iamSchemasRoleJSON `json:"-"`
}

// roleListResponseJSON contains the JSON metadata for the struct
// [RoleListResponse]
type roleListResponseJSON struct {
// iamSchemasRoleJSON contains the JSON metadata for the struct [IamSchemasRole]
type iamSchemasRoleJSON struct {
ID apijson.Field
Description apijson.Field
Name apijson.Field
Expand All @@ -82,11 +81,11 @@ type roleListResponseJSON struct {
ExtraFields map[string]apijson.Field
}

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

func (r roleListResponseJSON) RawJSON() string {
func (r iamSchemasRoleJSON) RawJSON() string {
return r.raw
}

Expand All @@ -113,7 +112,7 @@ type RoleListParams struct {
type RoleListResponseEnvelope struct {
Errors []RoleListResponseEnvelopeErrors `json:"errors,required"`
Messages []RoleListResponseEnvelopeMessages `json:"messages,required"`
Result []RoleListResponse `json:"result,required,nullable"`
Result []IamSchemasRole `json:"result,required,nullable"`
// Whether the API call was successful
Success RoleListResponseEnvelopeSuccess `json:"success,required"`
ResultInfo RoleListResponseEnvelopeResultInfo `json:"result_info"`
Expand Down
155 changes: 53 additions & 102 deletions addressing/addressmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,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 *[]AddressMapListResponse, err error) {
func (r *AddressMapService) List(ctx context.Context, query AddressMapListParams, opts ...option.RequestOption) (res *[]AddressingAddressMaps, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapListResponseEnvelope
path := fmt.Sprintf("accounts/%s/addressing/address_maps", query.AccountID)
Expand All @@ -81,7 +81,7 @@ func (r *AddressMapService) Delete(ctx context.Context, addressMapID string, bod
}

// 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 *AddressMapEditResponse, err error) {
func (r *AddressMapService) Edit(ctx context.Context, addressMapID string, params AddressMapEditParams, opts ...option.RequestOption) (res *AddressingAddressMaps, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapEditResponseEnvelope
path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s", params.AccountID, addressMapID)
Expand All @@ -106,6 +106,55 @@ func (r *AddressMapService) Get(ctx context.Context, addressMapID string, query
return
}

type AddressingAddressMaps struct {
// Identifier
ID string `json:"id"`
// If set to false, then the Address Map cannot be deleted via API. This is true
// for Cloudflare-managed maps.
CanDelete bool `json:"can_delete"`
// If set to false, then the IPs on the Address Map cannot be modified via the API.
// This is true for Cloudflare-managed maps.
CanModifyIPs bool `json:"can_modify_ips"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
// If you have legacy TLS clients which do not send the TLS server name indicator,
// then you can specify one default SNI on the map. If Cloudflare receives a TLS
// handshake from a client without an SNI, it will respond with the default SNI on
// those IPs. The default SNI can be any valid zone or subdomain owned by the
// account.
DefaultSni string `json:"default_sni,nullable"`
// An optional description field which may be used to describe the types of IPs or
// zones on the map.
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:"-"`
}

// addressingAddressMapsJSON contains the JSON metadata for the struct
// [AddressingAddressMaps]
type addressingAddressMapsJSON struct {
ID apijson.Field
CanDelete apijson.Field
CanModifyIPs apijson.Field
CreatedAt apijson.Field
DefaultSni apijson.Field
Description apijson.Field
Enabled apijson.Field
ModifiedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

type AddressMapNewResponse struct {
// Identifier
ID string `json:"id"`
Expand Down Expand Up @@ -224,55 +273,6 @@ const (
AddressMapNewResponseMembershipsKindAccount AddressMapNewResponseMembershipsKind = "account"
)

type AddressMapListResponse struct {
// Identifier
ID string `json:"id"`
// If set to false, then the Address Map cannot be deleted via API. This is true
// for Cloudflare-managed maps.
CanDelete bool `json:"can_delete"`
// If set to false, then the IPs on the Address Map cannot be modified via the API.
// This is true for Cloudflare-managed maps.
CanModifyIPs bool `json:"can_modify_ips"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
// If you have legacy TLS clients which do not send the TLS server name indicator,
// then you can specify one default SNI on the map. If Cloudflare receives a TLS
// handshake from a client without an SNI, it will respond with the default SNI on
// those IPs. The default SNI can be any valid zone or subdomain owned by the
// account.
DefaultSni string `json:"default_sni,nullable"`
// An optional description field which may be used to describe the types of IPs or
// zones on the map.
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 addressMapListResponseJSON `json:"-"`
}

// addressMapListResponseJSON contains the JSON metadata for the struct
// [AddressMapListResponse]
type addressMapListResponseJSON struct {
ID apijson.Field
CanDelete apijson.Field
CanModifyIPs apijson.Field
CreatedAt apijson.Field
DefaultSni apijson.Field
Description apijson.Field
Enabled apijson.Field
ModifiedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

func (r addressMapListResponseJSON) RawJSON() string {
return r.raw
}

// Union satisfied by [addressing.AddressMapDeleteResponseUnknown],
// [addressing.AddressMapDeleteResponseArray] or [shared.UnionString].
type AddressMapDeleteResponse interface {
Expand All @@ -298,55 +298,6 @@ type AddressMapDeleteResponseArray []interface{}

func (r AddressMapDeleteResponseArray) ImplementsAddressingAddressMapDeleteResponse() {}

type AddressMapEditResponse struct {
// Identifier
ID string `json:"id"`
// If set to false, then the Address Map cannot be deleted via API. This is true
// for Cloudflare-managed maps.
CanDelete bool `json:"can_delete"`
// If set to false, then the IPs on the Address Map cannot be modified via the API.
// This is true for Cloudflare-managed maps.
CanModifyIPs bool `json:"can_modify_ips"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
// If you have legacy TLS clients which do not send the TLS server name indicator,
// then you can specify one default SNI on the map. If Cloudflare receives a TLS
// handshake from a client without an SNI, it will respond with the default SNI on
// those IPs. The default SNI can be any valid zone or subdomain owned by the
// account.
DefaultSni string `json:"default_sni,nullable"`
// An optional description field which may be used to describe the types of IPs or
// zones on the map.
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 addressMapEditResponseJSON `json:"-"`
}

// addressMapEditResponseJSON contains the JSON metadata for the struct
// [AddressMapEditResponse]
type addressMapEditResponseJSON struct {
ID apijson.Field
CanDelete apijson.Field
CanModifyIPs apijson.Field
CreatedAt apijson.Field
DefaultSni apijson.Field
Description apijson.Field
Enabled apijson.Field
ModifiedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

func (r addressMapEditResponseJSON) RawJSON() string {
return r.raw
}

type AddressMapGetResponse struct {
// Identifier
ID string `json:"id"`
Expand Down Expand Up @@ -569,7 +520,7 @@ type AddressMapListParams struct {
type AddressMapListResponseEnvelope struct {
Errors []AddressMapListResponseEnvelopeErrors `json:"errors,required"`
Messages []AddressMapListResponseEnvelopeMessages `json:"messages,required"`
Result []AddressMapListResponse `json:"result,required,nullable"`
Result []AddressingAddressMaps `json:"result,required,nullable"`
// Whether the API call was successful
Success AddressMapListResponseEnvelopeSuccess `json:"success,required"`
ResultInfo AddressMapListResponseEnvelopeResultInfo `json:"result_info"`
Expand Down Expand Up @@ -823,7 +774,7 @@ func (r AddressMapEditParams) MarshalJSON() (data []byte, err error) {
type AddressMapEditResponseEnvelope struct {
Errors []AddressMapEditResponseEnvelopeErrors `json:"errors,required"`
Messages []AddressMapEditResponseEnvelopeMessages `json:"messages,required"`
Result AddressMapEditResponse `json:"result,required"`
Result AddressingAddressMaps `json:"result,required"`
// Whether the API call was successful
Success AddressMapEditResponseEnvelopeSuccess `json:"success,required"`
JSON addressMapEditResponseEnvelopeJSON `json:"-"`
Expand Down
Loading

0 comments on commit 9755602

Please sign in to comment.