Class: Vkit::CLI::Commands::AgentTokensListCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/vkit/cli/commands/agent_tokens_list_command.rb

Instance Method Summary collapse

Instance Method Details

#call(options) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vkit/cli/commands/agent_tokens_list_command.rb', line 10

def call(options)
  format = options[:format] || "table"

  with_auth do
    user = credential_store.user
    org  = user["organization_slug"]

    response =
      authenticated_client.get(
        "/api/v1/orgs/#{org}/agent_tokens",
        params: build_query(options)
      )

    tokens = response["tokens"] || []

    print_result(tokens, format)
  end
end