Class: Anthropic::Resources::Beta::Organization::APIKeys

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/beta/organization/api_keys.rb,
sig/anthropic/resources/beta/organization/api_keys.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ APIKeys

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

Parameters:



94
95
96
# File 'lib/anthropic/resources/beta/organization/api_keys.rb', line 94

def initialize(client:)
  @client = client
end

Instance Method Details

#list(after_id: nil, before_id: nil, created_by_user_id: nil, limit: nil, status: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Internal::Page<Anthropic::Models::Beta::Organization::BetaAPIKey>

List API Keys

Some parameter documentations has been truncated, see Models::Beta::Organization::APIKeyListParams for more details.

Parameters:

  • after_id (String)

    ID of the object to use as a cursor for pagination. When provided, returns the p

  • before_id (String)

    ID of the object to use as a cursor for pagination. When provided, returns the p

  • created_by_user_id (String, nil)

    Filter by the ID of the User who created the object.

  • limit (Integer)

    Number of items to return per page.

  • status (Symbol, Anthropic::Models::Beta::Organization::APIKeyListParams::Status, nil)

    Filter by API key status.

  • workspace_id (String, nil)

    Filter by Workspace ID.

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

Returns:

See Also:



78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/anthropic/resources/beta/organization/api_keys.rb', line 78

def list(params = {})
  parsed, options = Anthropic::Beta::Organization::APIKeyListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v1/organizations/api_keys?beta=true",
    query: query,
    page: Anthropic::Internal::Page,
    model: Anthropic::Beta::Organization::BetaAPIKey,
    options: options
  )
end

#retrieve(api_key_id, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaAPIKey

Get API Key

Parameters:

Returns:

See Also:



19
20
21
22
23
24
25
26
# File 'lib/anthropic/resources/beta/organization/api_keys.rb', line 19

def retrieve(api_key_id, params = {})
  @client.request(
    method: :get,
    path: ["v1/organizations/api_keys/%1$s?beta=true", api_key_id],
    model: Anthropic::Beta::Organization::BetaAPIKey,
    options: params[:request_options]
  )
end

#update(api_key_id, name: nil, status: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaAPIKey

Update API Key

Parameters:

Returns:

See Also:



43
44
45
46
47
48
49
50
51
52
# File 'lib/anthropic/resources/beta/organization/api_keys.rb', line 43

def update(api_key_id, params = {})
  parsed, options = Anthropic::Beta::Organization::APIKeyUpdateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/organizations/api_keys/%1$s?beta=true", api_key_id],
    body: parsed,
    model: Anthropic::Beta::Organization::BetaAPIKey,
    options: options
  )
end