Class: OpenAI::Resources::Admin::Organization::Projects::Groups

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

Defined Under Namespace

Classes: Roles

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Groups

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

Parameters:



105
106
107
108
# File 'lib/openai/resources/admin/organization/projects/groups.rb', line 105

def initialize(client:)
  @client = client
  @roles = OpenAI::Resources::Admin::Organization::Projects::Groups::Roles.new(client: client)
end

Instance Attribute Details

#rolesOpenAI::Resources::Admin::Organization::Projects::Groups::Roles (readonly)



10
11
12
# File 'lib/openai/resources/admin/organization/projects/groups.rb', line 10

def roles
  @roles
end

Instance Method Details

#create(project_id, group_id:, role:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Projects::ProjectGroup

Grants a group access to a project.

Parameters:

  • project_id (String)

    The ID of the project to update.

  • group_id (String)

    Identifier of the group to add to the project.

  • role (String)

    Identifier of the project role to grant to the group.

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

Returns:

See Also:



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/openai/resources/admin/organization/projects/groups.rb', line 27

def create(project_id, params)
  parsed, options = OpenAI::Admin::Organization::Projects::GroupCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["organization/projects/%1$s/groups", project_id],
    body: parsed,
    model: OpenAI::Admin::Organization::Projects::ProjectGroup,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#delete(group_id, project_id:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Projects::GroupDeleteResponse

Revokes a group’s access to a project.

Parameters:

  • group_id (String)

    The ID of the group to remove from the project.

  • project_id (String)

    The ID of the project to update.

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

Returns:

See Also:



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

def delete(group_id, params)
  parsed, options = OpenAI::Admin::Organization::Projects::GroupDeleteParams.dump_request(params)
  project_id =
    parsed.delete(:project_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["organization/projects/%1$s/groups/%2$s", project_id, group_id],
    model: OpenAI::Models::Admin::Organization::Projects::GroupDeleteResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#list(project_id, after: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::NextCursorPage<OpenAI::Models::Admin::Organization::Projects::ProjectGroup>

Some parameter documentations has been truncated, see Models::Admin::Organization::Projects::GroupListParams for more details.

Lists the groups that have access to a project.

Parameters:

Returns:

See Also:



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/openai/resources/admin/organization/projects/groups.rb', line 60

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