Class: OpenAI::Resources::Admin::Organization::Groups::Roles

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/resources/admin/organization/groups/roles.rb,
sig/openai/resources/admin/organization/groups/roles.rbs

Instance Method Summary collapse

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.

Parameters:



135
136
137
# File 'lib/openai/resources/admin/organization/groups/roles.rb', line 135

def initialize(client:)
  @client = client
end

Instance Method Details

#create(group_id, role_id:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Groups::RoleCreateResponse

Assigns an organization role to a group within the organization.

Parameters:

  • group_id (String)

    The ID of the group that should receive the organization role.

  • role_id (String)

    Identifier of the role to assign.

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

Returns:

See Also:



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/openai/resources/admin/organization/groups/roles.rb', line 24

def create(group_id, params)
  parsed, options = OpenAI::Admin::Organization::Groups::RoleCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["organization/groups/%1$s/roles", group_id],
    body: parsed,
    model: OpenAI::Models::Admin::Organization::Groups::RoleCreateResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#delete(role_id, group_id:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Groups::RoleDeleteResponse

Unassigns an organization role from a group within the organization.

Parameters:

  • role_id (String)

    The ID of the organization role to remove from the group.

  • group_id (String)

    The ID of the group to modify.

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

Returns:

See Also:



117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/openai/resources/admin/organization/groups/roles.rb', line 117

def delete(role_id, params)
  parsed, options = OpenAI::Admin::Organization::Groups::RoleDeleteParams.dump_request(params)
  group_id = parsed.delete(:group_id) do
    raise ArgumentError.new("missing required path argument #{_1}")
  end

  @client.request(
    method: :delete,
    path: ["organization/groups/%1$s/roles/%2$s", group_id, role_id],
    model: OpenAI::Models::Admin::Organization::Groups::RoleDeleteResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#list(group_id, after: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::NextCursorPage<OpenAI::Models::Admin::Organization::Groups::RoleListResponse>

Lists the organization roles assigned to a group within the organization.

Parameters:

  • group_id (String)

    The ID of the group whose organization role assignments you want to list.

  • after (String)

    Cursor for pagination. Provide the value from the previous response's next field to continue listing organization roles.

  • limit (Integer)

    A limit on the number of organization role assignments to return.

  • order (Symbol, OpenAI::Models::Admin::Organization::Groups::RoleListParams::Order)

    Sort order for the returned organization roles.

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

Returns:

See Also:



88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/openai/resources/admin/organization/groups/roles.rb', line 88

def list(group_id, params = {})
  parsed, options = OpenAI::Admin::Organization::Groups::RoleListParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["organization/groups/%1$s/roles", group_id],
    query: query,
    page: OpenAI::Internal::NextCursorPage,
    model: OpenAI::Models::Admin::Organization::Groups::RoleListResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#retrieve(role_id, group_id:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Groups::RoleRetrieveResponse

Retrieves an organization role assigned to a group.

Parameters:

  • role_id (String)

    The ID of the organization role to retrieve for the group.

  • group_id (String)

    The ID of the group to inspect.

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

Returns:

See Also:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/openai/resources/admin/organization/groups/roles.rb', line 51

def retrieve(role_id, params)
  parsed, options = OpenAI::Admin::Organization::Groups::RoleRetrieveParams.dump_request(params)
  group_id = parsed.delete(:group_id) do
    raise ArgumentError.new("missing required path argument #{_1}")
  end

  @client.request(
    method: :get,
    path: ["organization/groups/%1$s/roles/%2$s", group_id, role_id],
    model: OpenAI::Models::Admin::Organization::Groups::RoleRetrieveResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end