Class: Anthropic::Resources::Organization::Users
- Inherits:
-
Object
- Object
- Anthropic::Resources::Organization::Users
- Defined in:
- lib/anthropic/resources/organization/users.rb,
sig/anthropic/resources/organization/users.rbs
Instance Method Summary collapse
-
#initialize(client:) ⇒ Users
constructor
private
A new instance of Users.
-
#list(after_id: nil, before_id: nil, email: nil, limit: nil, roles: nil, request_options: {}) ⇒ Anthropic::Internal::Page<Anthropic::Models::Organization::OrganizationUser>
List the organization's members.
-
#remove(user_id, request_options: {}) ⇒ Anthropic::Models::Organization::UserRemoveResponse
Remove a member from the organization.
-
#retrieve(user_id, request_options: {}) ⇒ Anthropic::Models::Organization::OrganizationUser
Retrieve a member of the organization by user ID.
-
#update(user_id, role:, request_options: {}) ⇒ Anthropic::Models::Organization::OrganizationUser
Update a member's organization role.
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.
130 131 132 |
# File 'lib/anthropic/resources/organization/users.rb', line 130 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::Organization::OrganizationUser>
List the organization's members.
Some parameter documentations has been truncated, see Models::Organization::UserListParams for more details.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/anthropic/resources/organization/users.rb', line 84 def list(params = {}) parsed, = Anthropic::Organization::UserListParams.dump_request(params) query = Anthropic::Internal::Util.encode_query_params(parsed) @client.request( span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_USERS_LIST, span_route: "/v1/organizations/users", span_query: %w[after_id before_id email limit roles], method: :get, path: "v1/organizations/users", query: query, page: Anthropic::Internal::Page, model: Anthropic::Organization::OrganizationUser, options: ) end |
#remove(user_id, request_options: {}) ⇒ Anthropic::Models::Organization::UserRemoveResponse
Remove a member from the organization.
115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/anthropic/resources/organization/users.rb', line 115 def remove(user_id, params = {}) @client.request( span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_USERS_REMOVE, span_attributes: {"anthropic.organization.user.id" => user_id}, span_route: "/v1/organizations/users/{user_id}", method: :delete, path: ["v1/organizations/users/%1$s", user_id], model: Anthropic::Models::Organization::UserRemoveResponse, options: params[:request_options] ) end |
#retrieve(user_id, request_options: {}) ⇒ Anthropic::Models::Organization::OrganizationUser
Retrieve a member of the organization by user ID.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/anthropic/resources/organization/users.rb', line 18 def retrieve(user_id, params = {}) @client.request( span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_USERS_RETRIEVE, span_attributes: {"anthropic.organization.user.id" => user_id}, span_route: "/v1/organizations/users/{user_id}", method: :get, path: ["v1/organizations/users/%1$s", user_id], model: Anthropic::Organization::OrganizationUser, options: params[:request_options] ) end |
#update(user_id, role:, request_options: {}) ⇒ Anthropic::Models::Organization::OrganizationUser
Update a member's organization role.
Some parameter documentations has been truncated, see Models::Organization::UserUpdateParams for more details.
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/anthropic/resources/organization/users.rb', line 48 def update(user_id, params) parsed, = Anthropic::Organization::UserUpdateParams.dump_request(params) @client.request( span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_USERS_UPDATE, span_attributes: {"anthropic.organization.user.id" => user_id}, span_route: "/v1/organizations/users/{user_id}", method: :post, path: ["v1/organizations/users/%1$s", user_id], body: parsed, model: Anthropic::Organization::OrganizationUser, options: ) end |