Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#1696)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 9, 2024
1 parent dc4636f commit e349ec2
Show file tree
Hide file tree
Showing 95 changed files with 6,875 additions and 4,537 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 1274
configured_endpoints: 1297
88 changes: 44 additions & 44 deletions accounts/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ type Member struct {
// Membership identifier tag.
ID string `json:"id,required"`
// Roles assigned to this member.
Roles []Role `json:"roles,required"`
Status interface{} `json:"status,required"`
User MemberUser `json:"user,required"`
JSON memberJSON `json:"-"`
Roles []MemberRole `json:"roles,required"`
Status interface{} `json:"status,required"`
User MemberUser `json:"user,required"`
JSON memberJSON `json:"-"`
}

// memberJSON contains the JSON metadata for the struct [Member]
Expand Down Expand Up @@ -172,11 +172,49 @@ func (r memberUserJSON) RawJSON() string {
return r.raw
}

type MemberRole 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 memberRoleJSON `json:"-"`
}

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

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

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

type MemberRoleParam struct {
// Role identifier tag.
ID param.Field[string] `json:"id,required"`
}

func (r MemberRoleParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

type MemberWithInviteCode struct {
// Membership identifier tag.
ID string `json:"id,required"`
// Roles assigned to this member.
Roles []Role `json:"roles,required"`
Roles []MemberRole `json:"roles,required"`
Status interface{} `json:"status,required"`
User MemberWithInviteCodeUser `json:"user,required"`
// The unique activation code for the account membership.
Expand Down Expand Up @@ -239,44 +277,6 @@ func (r memberWithInviteCodeUserJSON) RawJSON() string {
return r.raw
}

type Role 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 roleJSON `json:"-"`
}

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

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

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

type RoleParam struct {
// Role identifier tag.
ID param.Field[string] `json:"id,required"`
}

func (r RoleParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

type MemberListResponse struct {
// Identifier
ID string `json:"id,required"`
Expand Down Expand Up @@ -423,7 +423,7 @@ func (r MemberNewResponseEnvelopeSuccess) IsKnown() bool {
type MemberUpdateParams struct {
AccountID param.Field[interface{}] `path:"account_id,required"`
// Roles assigned to this member.
Roles param.Field[[]RoleParam] `json:"roles,required"`
Roles param.Field[[]MemberRoleParam] `json:"roles,required"`
}

func (r MemberUpdateParams) MarshalJSON() (data []byte, err error) {
Expand Down
2 changes: 1 addition & 1 deletion accounts/member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestMemberUpdate(t *testing.T) {
"4536bcfad5faccb111b47003c79917fa",
accounts.MemberUpdateParams{
AccountID: cloudflare.F[any](map[string]interface{}{}),
Roles: cloudflare.F([]accounts.RoleParam{{
Roles: cloudflare.F([]accounts.MemberRoleParam{{
ID: cloudflare.F("3536bcfad5faccb999b47003c79917fb"),
}, {
ID: cloudflare.F("3536bcfad5faccb999b47003c79917fb"),
Expand Down
9 changes: 0 additions & 9 deletions accounts/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,6 @@ func (r roleJSON) RawJSON() string {
return r.raw
}

type RoleParam struct {
// Role identifier tag.
ID param.Field[string] `json:"id,required"`
}

func (r RoleParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

type RoleListParams struct {
AccountID param.Field[interface{}] `path:"account_id,required"`
}
Expand Down
38 changes: 38 additions & 0 deletions addressing/prefixbgpbinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,44 @@ func (r ServiceBindingProvisioningState) IsKnown() bool {
return false
}

type ServiceBindingParam struct {
// IP Prefix in Classless Inter-Domain Routing format.
CIDR param.Field[string] `json:"cidr"`
// Status of a Service Binding's deployment to the Cloudflare network
Provisioning param.Field[ServiceBindingProvisioningParam] `json:"provisioning"`
// Identifier
ServiceID param.Field[string] `json:"service_id"`
// Name of a service running on the Cloudflare network
ServiceName param.Field[string] `json:"service_name"`
}

func (r ServiceBindingParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

func (r ServiceBindingParam) implementsWorkersBindingUnionParam() {}

func (r ServiceBindingParam) implementsWorkersBindingUnionParam() {}

func (r ServiceBindingParam) implementsWorkersBindingUnionParam() {}

func (r ServiceBindingParam) implementsWorkersBindingUnionParam() {}

func (r ServiceBindingParam) implementsWorkersBindingUnionParam() {}

func (r ServiceBindingParam) implementsWorkersBindingUnionParam() {}

// Status of a Service Binding's deployment to the Cloudflare network
type ServiceBindingProvisioningParam struct {
// When a binding has been deployed to a majority of Cloudflare datacenters, the
// binding will become active and can be used with its associated service.
State param.Field[ServiceBindingProvisioningState] `json:"state"`
}

func (r ServiceBindingProvisioningParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

type PrefixBGPBindingNewParams struct {
// Identifier
AccountID param.Field[string] `path:"account_id,required"`
Expand Down
Loading

0 comments on commit e349ec2

Please sign in to comment.