Class: Anthropic::Resources::Beta::Organization::Users

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Users

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

Parameters:



113
114
115
# File 'lib/anthropic/resources/beta/organization/users.rb', line 113

def initialize(client:)
  @client = client
end

Instance Method Details

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

List the organization's members.

Some parameter documentations has been truncated, see Models::Beta::Organization::UserListParams 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 user email.

  • 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

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

Returns:

See Also:



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/anthropic/resources/beta/organization/users.rb', line 77

def list(params = {})
  parsed, options = Anthropic::Beta::Organization::UserListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v1/organizations/users?beta=true",
    query: query,
    page: Anthropic::Internal::Page,
    model: Anthropic::Beta::Organization::BetaOrganizationUser,
    options: options
  )
end

#remove(user_id, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::UserRemoveResponse

Remove a member from the organization.

Parameters:

Returns:

See Also:



101
102
103
104
105
106
107
108
# File 'lib/anthropic/resources/beta/organization/users.rb', line 101

def remove(user_id, params = {})
  @client.request(
    method: :delete,
    path: ["v1/organizations/users/%1$s?beta=true", user_id],
    model: Anthropic::Models::Beta::Organization::UserRemoveResponse,
    options: params[:request_options]
  )
end

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

Retrieve a member of the organization by user ID.

Parameters:

Returns:

See Also:



19
20
21
22
23
24
25
26
# File 'lib/anthropic/resources/beta/organization/users.rb', line 19

def retrieve(user_id, params = {})
  @client.request(
    method: :get,
    path: ["v1/organizations/users/%1$s?beta=true", user_id],
    model: Anthropic::Beta::Organization::BetaOrganizationUser,
    options: params[:request_options]
  )
end

#update(user_id, role:, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaOrganizationUser

Update a member's organization role.

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

Parameters:

Returns:

See Also:



44
45
46
47
48
49
50
51
52
53
# File 'lib/anthropic/resources/beta/organization/users.rb', line 44

def update(user_id, params)
  parsed, options = Anthropic::Beta::Organization::UserUpdateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/organizations/users/%1$s?beta=true", user_id],
    body: parsed,
    model: Anthropic::Beta::Organization::BetaOrganizationUser,
    options: options
  )
end