Class: OpenAI::Resources::Admin::Organization::Users::Roles
- Inherits:
-
Object
- Object
- OpenAI::Resources::Admin::Organization::Users::Roles
- Defined in:
- lib/openai/resources/admin/organization/users/roles.rb,
sig/openai/resources/admin/organization/users/roles.rbs
Instance Method Summary collapse
-
#create(user_id, role_id:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Users::RoleCreateResponse
Assigns an organization role to a user within the organization.
-
#delete(role_id, user_id:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Users::RoleDeleteResponse
Unassigns an organization role from a user within the organization.
-
#initialize(client:) ⇒ Roles
constructor
private
A new instance of Roles.
-
#list(user_id, after: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::NextCursorPage<OpenAI::Models::Admin::Organization::Users::RoleListResponse>
Lists the organization roles assigned to a user within the organization.
-
#retrieve(role_id, user_id:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Users::RoleRetrieveResponse
Retrieves an organization role assigned to a user.
Constructor Details
#initialize(client:) ⇒ Roles
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 Roles.
135 136 137 |
# File 'lib/openai/resources/admin/organization/users/roles.rb', line 135 def initialize(client:) @client = client end |
Instance Method Details
#create(user_id, role_id:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Users::RoleCreateResponse
Assigns an organization role to a user within the organization.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/openai/resources/admin/organization/users/roles.rb', line 24 def create(user_id, params) parsed, = OpenAI::Admin::Organization::Users::RoleCreateParams.dump_request(params) @client.request( method: :post, path: ["organization/users/%1$s/roles", user_id], body: parsed, model: OpenAI::Models::Admin::Organization::Users::RoleCreateResponse, security: {admin_api_key_auth: true}, options: ) end |
#delete(role_id, user_id:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Users::RoleDeleteResponse
Unassigns an organization role from a user within the organization.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/openai/resources/admin/organization/users/roles.rb', line 117 def delete(role_id, params) parsed, = OpenAI::Admin::Organization::Users::RoleDeleteParams.dump_request(params) user_id = parsed.delete(:user_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["organization/users/%1$s/roles/%2$s", user_id, role_id], model: OpenAI::Models::Admin::Organization::Users::RoleDeleteResponse, security: {admin_api_key_auth: true}, options: ) end |
#list(user_id, after: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::NextCursorPage<OpenAI::Models::Admin::Organization::Users::RoleListResponse>
Lists the organization roles assigned to a user within the organization.
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/openai/resources/admin/organization/users/roles.rb', line 88 def list(user_id, params = {}) parsed, = OpenAI::Admin::Organization::Users::RoleListParams.dump_request(params) query = OpenAI::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["organization/users/%1$s/roles", user_id], query: query, page: OpenAI::Internal::NextCursorPage, model: OpenAI::Models::Admin::Organization::Users::RoleListResponse, security: {admin_api_key_auth: true}, options: ) end |
#retrieve(role_id, user_id:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Users::RoleRetrieveResponse
Retrieves an organization role assigned to a user.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/openai/resources/admin/organization/users/roles.rb', line 51 def retrieve(role_id, params) parsed, = OpenAI::Admin::Organization::Users::RoleRetrieveParams.dump_request(params) user_id = parsed.delete(:user_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["organization/users/%1$s/roles/%2$s", user_id, role_id], model: OpenAI::Models::Admin::Organization::Users::RoleRetrieveResponse, security: {admin_api_key_auth: true}, options: ) end |