github.com/anthropics/anthropic-sdk-go@v1.70.1/betaorganization.go (about) 1 // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 3 package anthropic 4 5 import ( 6 "context" 7 "net/http" 8 "slices" 9 10 "github.com/anthropics/anthropic-sdk-go/internal/apijson" 11 "github.com/anthropics/anthropic-sdk-go/internal/requestconfig" 12 "github.com/anthropics/anthropic-sdk-go/option" 13 "github.com/anthropics/anthropic-sdk-go/packages/respjson" 14 "github.com/anthropics/anthropic-sdk-go/shared/constant" 15 ) 16 17 // BetaOrganizationService contains methods and other services that help with 18 // interacting with the anthropic API. 19 // 20 // Note, unlike clients, this service does not read variables from the environment 21 // automatically. You should not instantiate this service directly, and instead use 22 // the [NewBetaOrganizationService] method instead. 23 type BetaOrganizationService struct { 24 Options []option.RequestOption 25 APIKeys BetaOrganizationAPIKeyService 26 ExternalKeys BetaOrganizationExternalKeyService 27 Federation BetaOrganizationFederationService 28 Invites BetaOrganizationInviteService 29 ServiceAccounts BetaOrganizationServiceAccountService 30 Users BetaOrganizationUserService 31 Workspaces BetaOrganizationWorkspaceService 32 RateLimits BetaOrganizationRateLimitService 33 ComplianceSettings BetaOrganizationComplianceSettingService 34 } 35 36 // NewBetaOrganizationService generates a new service that applies the given 37 // options to each request. These options are applied after the parent client's 38 // options (if there is one), and before any request-specific options. 39 func NewBetaOrganizationService(opts ...option.RequestOption) (r BetaOrganizationService) { 40 r = BetaOrganizationService{} 41 r.Options = opts 42 r.APIKeys = NewBetaOrganizationAPIKeyService(opts...) 43 r.ExternalKeys = NewBetaOrganizationExternalKeyService(opts...) 44 r.Federation = NewBetaOrganizationFederationService(opts...) 45 r.Invites = NewBetaOrganizationInviteService(opts...) 46 r.ServiceAccounts = NewBetaOrganizationServiceAccountService(opts...) 47 r.Users = NewBetaOrganizationUserService(opts...) 48 r.Workspaces = NewBetaOrganizationWorkspaceService(opts...) 49 r.RateLimits = NewBetaOrganizationRateLimitService(opts...) 50 r.ComplianceSettings = NewBetaOrganizationComplianceSettingService(opts...) 51 return 52 } 53 54 // Retrieve information about the organization associated with the authenticated 55 // API key. 56 func (r *BetaOrganizationService) Get(ctx context.Context, opts ...option.RequestOption) (res *BetaOrganization, err error) { 57 opts = slices.Concat(r.Options, opts) 58 path := "v1/organizations/me?beta=true" 59 err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) 60 return res, err 61 } 62 63 type BetaOrganization struct { 64 // ID of the Organization. 65 ID string `json:"id" api:"required" format:"uuid"` 66 // Name of the Organization. 67 Name string `json:"name" api:"required"` 68 // Object type. 69 // 70 // For Organizations, this is always `"organization"`. 71 Type constant.Organization `json:"type" default:"organization"` 72 // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. 73 JSON struct { 74 ID respjson.Field 75 Name respjson.Field 76 Type respjson.Field 77 ExtraFields map[string]respjson.Field 78 raw string 79 } `json:"-"` 80 } 81 82 // Returns the unmodified JSON received from the API 83 func (r BetaOrganization) RawJSON() string { return r.JSON.raw } 84 func (r *BetaOrganization) UnmarshalJSON(data []byte) error { 85 return apijson.UnmarshalRoot(data, r) 86 } 87 88 type BetaOrganizationRole string 89 90 const ( 91 BetaOrganizationRoleAdmin BetaOrganizationRole = "admin" 92 BetaOrganizationRoleBilling BetaOrganizationRole = "billing" 93 BetaOrganizationRoleClaudeCodeUser BetaOrganizationRole = "claude_code_user" 94 BetaOrganizationRoleDeveloper BetaOrganizationRole = "developer" 95 BetaOrganizationRoleManaged BetaOrganizationRole = "managed" 96 BetaOrganizationRoleMembershipAdmin BetaOrganizationRole = "membership_admin" 97 BetaOrganizationRoleOwner BetaOrganizationRole = "owner" 98 BetaOrganizationRolePrimaryOwner BetaOrganizationRole = "primary_owner" 99 BetaOrganizationRoleUser BetaOrganizationRole = "user" 100 )