Class: Anthropic::Resources::Organization::Invites

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/organization/invites.rb,
sig/anthropic/resources/organization/invites.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Invites

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Invites.

Parameters:



144
145
146
# File 'lib/anthropic/resources/organization/invites.rb', line 144

def initialize(client:)
  @client = client
end

Instance Method Details

#create(email:, role:, rbac_group_ids: nil, request_options: {}) ⇒ Anthropic::Models::Organization::OrganizationInvite

Invite a user to join the organization by email.

On plans that draw members from a finite pool of purchased seats, the invite automatically consumes a seat from the lowest tier with availability; there is no seat-tier parameter. When no seat is free the request fails with a 400 error rather than purchasing a seat.

Some parameter documentations has been truncated, see Models::Organization::InviteCreateParams for more details.

Parameters:

  • email (String) —

    Email of the User.

  • role (Symbol, Anthropic::Models::Organization::InviteCreateParams::Role) —

    Role for the invited User.

  • rbac_group_ids (Array<String>) —

    RBAC group IDs to assign to the User when the Invite is accepted. A non-empty ar

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • email: (String)
  • role: (Anthropic::Models::Organization::InviteCreateParams::role)
  • rbac_group_ids: (::Array[String])
  • request_options: (Anthropic::request_opts)

Returns:

Raises:

See Also:



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/anthropic/resources/organization/invites.rb', line 39

def create(params)
  parsed, options = Anthropic::Organization::InviteCreateParams.dump_request(params)
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_INVITES_CREATE,
    span_created_id: "anthropic.organization.invite.id",
    span_route: "/v1/organizations/invites",
    method: :post,
    path: "v1/organizations/invites",
    body: parsed,
    model: Anthropic::Organization::OrganizationInvite,
    options: options
  )
end

#delete(invite_id, request_options: {}) ⇒ Anthropic::Models::Organization::InviteDeleteResponse

Delete a pending invite.

Parameters:

  • invite_id (String) —

    ID of the Invite.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • request_options: (Anthropic::request_opts)

Returns:

Raises:

See Also:



129
130
131
132
133
134
135
136
137
138
139
# File 'lib/anthropic/resources/organization/invites.rb', line 129

def delete(invite_id, params = {})
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_INVITES_DELETE,
    span_attributes: {"anthropic.organization.invite.id" => invite_id},
    span_route: "/v1/organizations/invites/{invite_id}",
    method: :delete,
    path: ["v1/organizations/invites/%1$s", invite_id],
    model: Anthropic::Models::Organization::InviteDeleteResponse,
    options: params[:request_options]
  )
end

#list(after_id: nil, before_id: nil, email: nil, limit: nil, roles: nil, statuses: nil, request_options: {}) ⇒ Anthropic::Internal::Page<Anthropic::Models::Organization::OrganizationInvite>

List the organization's invites.

Some parameter documentations has been truncated, see Models::Organization::InviteListParams for more details.

Parameters:

  • after_id (String) —

    ID of the object to use as a cursor for pagination. When provided, returns the p

  • before_id (String) —

    ID of the object to use as a cursor for pagination. When provided, returns the p

  • email (String) —

    Filter by the email address the Invite was sent to. Matches the same way as the

  • limit (Integer) —

    Number of items to return per page.

  • roles (Array<String>) —

    Filter to items whose role equals one of the supplied values. Repeatable; valu

  • statuses (Array<Symbol, Anthropic::Models::Organization::InviteListParams::Status>) —

    Filter by Invite status. Repeatable; values are OR'ed together. Omit to return

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • after_id: (String)
  • before_id: (String)
  • email: (String)
  • limit: (Integer)
  • roles: (::Array[String])
  • statuses: (::Array[Anthropic::Models::Organization::InviteListParams::status])
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/anthropic/resources/organization/invites.rb', line 100

def list(params = {})
  parsed, options = Anthropic::Organization::InviteListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed)
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_INVITES_LIST,
    span_route: "/v1/organizations/invites",
    span_query: %w[after_id before_id email limit roles statuses],
    method: :get,
    path: "v1/organizations/invites",
    query: query,
    page: Anthropic::Internal::Page,
    model: Anthropic::Organization::OrganizationInvite,
    options: options
  )
end

#retrieve(invite_id, request_options: {}) ⇒ Anthropic::Models::Organization::OrganizationInvite

Retrieve an invite by ID.

Parameters:

  • invite_id (String) —

    ID of the Invite.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/anthropic/resources/organization/invites.rb', line 64

def retrieve(invite_id, params = {})
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_INVITES_RETRIEVE,
    span_attributes: {"anthropic.organization.invite.id" => invite_id},
    span_route: "/v1/organizations/invites/{invite_id}",
    method: :get,
    path: ["v1/organizations/invites/%1$s", invite_id],
    model: Anthropic::Organization::OrganizationInvite,
    options: params[:request_options]
  )
end