Class: Anthropic::Resources::UserProfiles
- Inherits:
-
Object
- Object
- Anthropic::Resources::UserProfiles
- Defined in:
- lib/anthropic/resources/user_profiles.rb,
lib/anthropic/resources/user_profiles/action_urls.rb,
sig/anthropic/resources/user_profiles.rbs,
sig/anthropic/resources/user_profiles/action_urls.rbs
Overview
Register the end customers that your platform serves, so each request can name who it's for. To get started, see the User profiles guide.
Defined Under Namespace
Classes: ActionURLs
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(access_type: nil, external_user_details: nil, metadata: nil, name: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::UserProfile
Register one of your end customers and get the ID to send on the requests you make for them.
-
#delete(user_profile_id, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::DeletedUserProfile
Delete a user profile, for example when the end customer closes their account.
-
#initialize(client:) ⇒ UserProfiles
constructor
private
A new instance of UserProfiles.
-
#list(enforcement_status: nil, limit: nil, order: nil, order_by: nil, page: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::UserProfile>
List the user profiles in your organization, newest first by default.
-
#retrieve(user_profile_id, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::UserProfile
Get a user profile by ID to check the details stored for it.
-
#update(user_profile_id, access_type: nil, external_user_details: nil, metadata: nil, name: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::UserProfile
Change the details of a user profile, leaving the fields that you don't send as they are.
Constructor Details
#initialize(client:) ⇒ UserProfiles
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 UserProfiles.
217 218 219 220 |
# File 'lib/anthropic/resources/user_profiles.rb', line 217 def initialize(client:) @client = client @action_urls = Anthropic::Resources::UserProfiles::ActionURLs.new(client: client) end |
Instance Attribute Details
#action_urls ⇒ Anthropic::Resources::UserProfiles::ActionURLs (readonly)
10 11 12 |
# File 'lib/anthropic/resources/user_profiles.rb', line 10 def action_urls @action_urls end |
Instance Method Details
#create(access_type: nil, external_user_details: nil, metadata: nil, name: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::UserProfile
Register one of your end customers and get the ID to send on the requests you make for them.
See the User profiles guide for what to send.
Some parameter documentations has been truncated, see Models::UserProfileCreateParams for more details.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/anthropic/resources/user_profiles.rb', line 39 def create(params = {}) parsed, = Anthropic::UserProfileCreateParams.dump_request(params) header_params = {workspace_id: "anthropic-workspace-id"} @client.request( span_name: Anthropic::Internal::Tracing::SpanName::USER_PROFILES_CREATE, span_created_id: "anthropic.user_profile.id", span_route: "/v1/user_profiles", method: :post, path: "v1/user_profiles", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::UserProfile, options: ) end |
#delete(user_profile_id, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::DeletedUserProfile
Delete a user profile, for example when the end customer closes their account.
Stop sending the profile's ID first. See the User profiles guide for what happens after a delete.
Some parameter documentations has been truncated, see Models::UserProfileDeleteParams for more details.
200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/anthropic/resources/user_profiles.rb', line 200 def delete(user_profile_id, params = {}) parsed, = Anthropic::UserProfileDeleteParams.dump_request(params) @client.request( span_name: Anthropic::Internal::Tracing::SpanName::USER_PROFILES_DELETE, span_attributes: {"anthropic.user_profile.id" => user_profile_id}, span_route: "/v1/user_profiles/{user_profile_id}", method: :delete, path: ["v1/user_profiles/%1$s", user_profile_id], headers: parsed.transform_keys(workspace_id: "anthropic-workspace-id"), model: Anthropic::DeletedUserProfile, options: ) end |
#list(enforcement_status: nil, limit: nil, order: nil, order_by: nil, page: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::UserProfile>
List the user profiles in your organization, newest first by default.
See the User profiles guide for how to set up and manage profiles.
Some parameter documentations has been truncated, see Models::UserProfileListParams for more details.
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/anthropic/resources/user_profiles.rb', line 162 def list(params = {}) query_params = [:enforcement_status, :limit, :order, :order_by, :page] parsed, = Anthropic::UserProfileListParams.dump_request(params) query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( span_name: Anthropic::Internal::Tracing::SpanName::USER_PROFILES_LIST, span_route: "/v1/user_profiles", span_query: %w[enforcement_status limit order order_by page], method: :get, path: "v1/user_profiles", query: query, headers: parsed.except(*query_params).transform_keys(workspace_id: "anthropic-workspace-id"), page: Anthropic::Internal::PageCursor, model: Anthropic::UserProfile, options: ) end |
#retrieve(user_profile_id, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::UserProfile
Get a user profile by ID to check the details stored for it.
See the User profiles guide for how to set up and manage profiles.
Some parameter documentations has been truncated, see Models::UserProfileRetrieveParams for more details.
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/anthropic/resources/user_profiles.rb', line 75 def retrieve(user_profile_id, params = {}) parsed, = Anthropic::UserProfileRetrieveParams.dump_request(params) @client.request( span_name: Anthropic::Internal::Tracing::SpanName::USER_PROFILES_RETRIEVE, span_attributes: {"anthropic.user_profile.id" => user_profile_id}, span_route: "/v1/user_profiles/{user_profile_id}", method: :get, path: ["v1/user_profiles/%1$s", user_profile_id], headers: parsed.transform_keys(workspace_id: "anthropic-workspace-id"), model: Anthropic::UserProfile, options: ) end |
#update(user_profile_id, access_type: nil, external_user_details: nil, metadata: nil, name: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::UserProfile
Change the details of a user profile, leaving the fields that you don't send as they are.
See the User profiles guide for how each field is updated.
Some parameter documentations has been truncated, see Models::UserProfileUpdateParams for more details.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/anthropic/resources/user_profiles.rb', line 118 def update(user_profile_id, params = {}) parsed, = Anthropic::UserProfileUpdateParams.dump_request(params) header_params = {workspace_id: "anthropic-workspace-id"} @client.request( span_name: Anthropic::Internal::Tracing::SpanName::USER_PROFILES_UPDATE, span_attributes: {"anthropic.user_profile.id" => user_profile_id}, span_route: "/v1/user_profiles/{user_profile_id}", method: :post, path: ["v1/user_profiles/%1$s", user_profile_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::UserProfile, options: ) end |