Class: Anthropic::Resources::Organization::Workspaces::Members

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Members

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 Members.

Parameters:



189
190
191
# File 'lib/anthropic/resources/organization/workspaces/members.rb', line 189

def initialize(client:)
  @client = client
end

Instance Method Details

#add(workspace_id, user_id:, workspace_role:, request_options: {}) ⇒ Anthropic::Models::Organization::WorkspaceMember

Create Workspace Member

Parameters:

  • workspace_id (String) —

    ID of the Workspace.

  • user_id (String) —

    ID of the User.

  • workspace_role (Symbol, Anthropic::Models::Organization::NoBillingWorkspaceRole) —

    Role of the new Workspace Member. Cannot be workspace_billing.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • user_id: (String)
  • workspace_role: (Anthropic::Models::Organization::no_billing_workspace_role)
  • request_options: (Anthropic::request_opts)

Returns:

Raises:

See Also:



136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/anthropic/resources/organization/workspaces/members.rb', line 136

def add(workspace_id, params)
  parsed, options = Anthropic::Organization::Workspaces::MemberAddParams.dump_request(params)
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_MEMBERS_ADD,
    span_attributes: {"anthropic.organization.workspace.id" => workspace_id},
    span_created_id: {"anthropic.organization.workspace.member.id" => :user_id},
    span_route: "/v1/organizations/workspaces/{workspace_id}/members",
    method: :post,
    path: ["v1/organizations/workspaces/%1$s/members", workspace_id],
    body: parsed,
    model: Anthropic::Organization::WorkspaceMember,
    options: options
  )
end

#list(workspace_id, after_id: nil, before_id: nil, limit: nil, request_options: {}) ⇒ Anthropic::Internal::Page<Anthropic::Models::Organization::WorkspaceMember>

List Workspace Members

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

Parameters:

  • workspace_id (String) —

    ID of the Workspace.

  • 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

  • limit (Integer) —

    Number of items to return per page.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • after_id: (String)
  • before_id: (String)
  • limit: (Integer)
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



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

def list(workspace_id, params = {})
  parsed, options = Anthropic::Organization::Workspaces::MemberListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed)
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_MEMBERS_LIST,
    span_attributes: {"anthropic.organization.workspace.id" => workspace_id},
    span_route: "/v1/organizations/workspaces/{workspace_id}/members",
    span_query: %w[after_id before_id limit],
    method: :get,
    path: ["v1/organizations/workspaces/%1$s/members", workspace_id],
    query: query,
    page: Anthropic::Internal::Page,
    model: Anthropic::Organization::WorkspaceMember,
    options: options
  )
end

#remove(user_id, workspace_id:, request_options: {}) ⇒ Anthropic::Models::Organization::Workspaces::MemberRemoveResponse

Delete Workspace Member

Parameters:

  • user_id (String) —

    ID of the User.

  • workspace_id (String) —

    ID of the Workspace.

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

Returns:

Raises:

See Also:



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/anthropic/resources/organization/workspaces/members.rb', line 166

def remove(user_id, params)
  parsed, options = Anthropic::Organization::Workspaces::MemberRemoveParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_MEMBERS_REMOVE,
    span_attributes: {
      "anthropic.organization.workspace.id" => workspace_id,
      "anthropic.organization.workspace.member.id" => user_id
    },
    span_route: "/v1/organizations/workspaces/{workspace_id}/members/{user_id}",
    method: :delete,
    path: ["v1/organizations/workspaces/%1$s/members/%2$s", workspace_id, user_id],
    model: Anthropic::Models::Organization::Workspaces::MemberRemoveResponse,
    options: options
  )
end

#retrieve(user_id, workspace_id:, request_options: {}) ⇒ Anthropic::Models::Organization::WorkspaceMember

Get Workspace Member

Parameters:

  • user_id (String) —

    ID of the User.

  • workspace_id (String) —

    ID of the Workspace.

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

Returns:

See Also:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/anthropic/resources/organization/workspaces/members.rb', line 21

def retrieve(user_id, params)
  parsed, options = Anthropic::Organization::Workspaces::MemberRetrieveParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_MEMBERS_RETRIEVE,
    span_attributes: {
      "anthropic.organization.workspace.id" => workspace_id,
      "anthropic.organization.workspace.member.id" => user_id
    },
    span_route: "/v1/organizations/workspaces/{workspace_id}/members/{user_id}",
    method: :get,
    path: ["v1/organizations/workspaces/%1$s/members/%2$s", workspace_id, user_id],
    model: Anthropic::Organization::WorkspaceMember,
    options: options
  )
end

#update(user_id, workspace_id:, workspace_role:, request_options: {}) ⇒ Anthropic::Models::Organization::WorkspaceMember

Update Workspace Member

Parameters:

  • user_id (String) —

    Path param: ID of the User.

  • workspace_id (String) —

    Path param: ID of the Workspace.

  • workspace_role (Symbol, Anthropic::Models::Organization::WorkspaceRole) —

    Body param: New workspace role for the User.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • workspace_id: (String)
  • workspace_role: (Anthropic::Models::Organization::workspace_role)
  • request_options: (Anthropic::request_opts)

Returns:

Raises:

See Also:



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/anthropic/resources/organization/workspaces/members.rb', line 59

def update(user_id, params)
  parsed, options = Anthropic::Organization::Workspaces::MemberUpdateParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_MEMBERS_UPDATE,
    span_attributes: {
      "anthropic.organization.workspace.id" => workspace_id,
      "anthropic.organization.workspace.member.id" => user_id
    },
    span_route: "/v1/organizations/workspaces/{workspace_id}/members/{user_id}",
    method: :post,
    path: ["v1/organizations/workspaces/%1$s/members/%2$s", workspace_id, user_id],
    body: parsed,
    model: Anthropic::Organization::WorkspaceMember,
    options: options
  )
end