Module: Anthropic::Models::Organization::APIKey::Scope

Extended by:
Internal::Type::Union
Defined in:
lib/anthropic/models/organization/api_key.rb,
sig/anthropic/models/organization/api_key.rbs

Overview

Where the API key belongs: its Workspace ({"type": "workspace", "workspace_id": "wrkspc_..."}, with the Workspace's real ID even when it is the organization's default Workspace), or the organization ({"type": "organization"}) for a principal-bound API key that has no Workspace.

See Also:

  • Anthropic::Models::Organization::APIKey#scope

Defined Under Namespace

Modules: Type

Class Method Summary collapse

Methods included from Internal::Type::Union

==, ===, coerce, derefed_variants, dump, hash, inspect, to_sorbet_type

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Class Method Details

.new(type:) ⇒ Anthropic::Organization::APIKeyOrganizationScope .new(type:, workspace_id:) ⇒ Anthropic::Organization::APIKeyWorkspaceScope .new(type:, workspace_id:) ⇒ Anthropic::Models::Organization::APIKey::scope

Creates a new instance of the variant class whose type matches the given value, passing the remaining arguments to its constructor.

Some parameter documentations has been truncated, see Anthropic::Models::Organization::APIKey::Scope for more details.

Overloads:

  • .new(type:) ⇒ Anthropic::Organization::APIKeyOrganizationScope

    Parameters:

    • type: (:organization, "organization")

    Returns:

    • (Anthropic::Organization::APIKeyOrganizationScope)
  • .new(type:, workspace_id:) ⇒ Anthropic::Organization::APIKeyWorkspaceScope

    Parameters:

    • type: (:workspace, "workspace")
    • workspace_id: (String)

    Returns:

    • (Anthropic::Organization::APIKeyWorkspaceScope)
  • .new(type:, workspace_id:) ⇒ Anthropic::Models::Organization::APIKey::scope

    Parameters:

    • type: (Anthropic::Models::Organization::APIKey::Scope::type_, String)
    • workspace_id: (String)

    Returns:

    • (Anthropic::Models::Organization::APIKey::scope)

Parameters:

  • type (Symbol, Anthropic::Models::Organization::APIKey::Scope::Type, String)
  • args (Hash{Symbol=>Object}) —

    Attributes for the chosen variant.

    @option args [String] :workspace_id ID of the Workspace the API key belongs to, including when it is the organizatio

Returns:

Raises:

  • (ArgumentError)


196
197
198
199
200
201
202
203
204
205
# File 'lib/anthropic/models/organization/api_key.rb', line 196

def self.new(type:, **args)
  case type.to_sym
  when :organization
    Anthropic::Organization::APIKeyOrganizationScope.new(**args)
  when :workspace
    Anthropic::Organization::APIKeyWorkspaceScope.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/anthropic/models/organization/api_key.rb', line 175

.variants ⇒ Array(Anthropic::Models::Organization::APIKeyOrganizationScope, Anthropic::Models::Organization::APIKeyWorkspaceScope)



# File 'lib/anthropic/models/organization/api_key.rb', line 179