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

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/beta/organization/workspaces/members.rb,
sig/anthropic/resources/beta/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:



195
196
197
# File 'lib/anthropic/resources/beta/organization/workspaces/members.rb', line 195

def initialize(client:)
  @client = client
end

Instance Method Details

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

Create Workspace Member

Parameters:

  • workspace_id (String) —

    ID of the Workspace.

  • user_id (String) —

    ID of the User.

  • workspace_role (Symbol, Anthropic::Models::Beta::Organization::BetaNoBillingWorkspaceRole) —

    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::Beta::Organization::beta_no_billing_workspace_role)
  • request_options: (Anthropic::request_opts)

Returns:

Raises:

See Also:



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/anthropic/resources/beta/organization/workspaces/members.rb', line 140

def add(workspace_id, params)
  parsed, options = Anthropic::Beta::Organization::Workspaces::MemberAddParams.dump_request(params)
  @client.request(
    qualifiers: {beta: "true"},
    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::Beta::Organization::BetaWorkspaceMember,
    options: options
  )
end

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

List Workspace Members

Some parameter documentations has been truncated, see Models::Beta::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:



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/anthropic/resources/beta/organization/workspaces/members.rb', line 104

def list(workspace_id, params = {})
  parsed, options = Anthropic::Beta::Organization::Workspaces::MemberListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed)
  @client.request(
    qualifiers: {beta: "true"},
    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::Beta::Organization::BetaWorkspaceMember,
    options: options
  )
end

#remove(user_id, workspace_id:, request_options: {}) ⇒ Anthropic::Models::Beta::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:



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/anthropic/resources/beta/organization/workspaces/members.rb', line 171

def remove(user_id, params)
  parsed, options = Anthropic::Beta::Organization::Workspaces::MemberRemoveParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    qualifiers: {beta: "true"},
    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::Beta::Organization::Workspaces::MemberRemoveResponse,
    options: options
  )
end

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

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:



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

def retrieve(user_id, params)
  parsed, options = Anthropic::Beta::Organization::Workspaces::MemberRetrieveParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    qualifiers: {beta: "true"},
    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::Beta::Organization::BetaWorkspaceMember,
    options: options
  )
end

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

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::Beta::Organization::BetaWorkspaceRole) —

    Body param: New workspace role for the User.

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

Returns:

Raises:

See Also:



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

def update(user_id, params)
  parsed, options = Anthropic::Beta::Organization::Workspaces::MemberUpdateParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    qualifiers: {beta: "true"},
    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::Beta::Organization::BetaWorkspaceMember,
    options: options
  )
end