Class: SchwarmCli::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/schwarm_cli/client.rb,
lib/schwarm_cli/client/tasks.rb,
lib/schwarm_cli/client/skills.rb,
lib/schwarm_cli/client/resource.rb,
lib/schwarm_cli/client/skill_files.rb,
lib/schwarm_cli/client/repositories.rb,
lib/schwarm_cli/client/secret_files.rb,
lib/schwarm_cli/client/shared_agents.rb,
lib/schwarm_cli/client/user_messages.rb,
lib/schwarm_cli/client/agent_sessions.rb,
lib/schwarm_cli/client/task_templates.rb,
lib/schwarm_cli/client/recurring_tasks.rb,
lib/schwarm_cli/client/repository_agents.rb,
lib/schwarm_cli/client/repository_skills.rb

Defined Under Namespace

Classes: AgentSessions, RecurringTasks, Repositories, RepositoryAgents, RepositorySkills, Resource, SecretFiles, SharedAgents, SkillFiles, Skills, TaskTemplates, Tasks, UserMessages

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url: nil, api_key: nil, config_path: Config::DEFAULT_PATH) ⇒ Client

Returns a new instance of Client.



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/schwarm_cli/client.rb', line 33

def initialize(url: nil, api_key: nil, config_path: Config::DEFAULT_PATH)
  config = Config.new(url:, api_key:, config_path:)
  unless config.valid?
    raise Error,
          "Schwarm CLI not configured. Run `schwarm configure` or set SCHWARM_URL and SCHWARM_TOKEN."
  end

  @url = config.url
  @api_key = config.api_key
  init_resources
end

Instance Attribute Details

#agentsObject (readonly)

Returns the value of attribute agents.



24
25
26
# File 'lib/schwarm_cli/client.rb', line 24

def agents
  @agents
end

#messagesObject (readonly)

Returns the value of attribute messages.



24
25
26
# File 'lib/schwarm_cli/client.rb', line 24

def messages
  @messages
end

#recurringObject (readonly)

Returns the value of attribute recurring.



24
25
26
# File 'lib/schwarm_cli/client.rb', line 24

def recurring
  @recurring
end

#repo_skillsObject (readonly)

Returns the value of attribute repo_skills.



24
25
26
# File 'lib/schwarm_cli/client.rb', line 24

def repo_skills
  @repo_skills
end

#repositoriesObject (readonly)

Returns the value of attribute repositories.



24
25
26
# File 'lib/schwarm_cli/client.rb', line 24

def repositories
  @repositories
end

#secretsObject (readonly)

Returns the value of attribute secrets.



24
25
26
# File 'lib/schwarm_cli/client.rb', line 24

def secrets
  @secrets
end

#sessionsObject (readonly)

Returns the value of attribute sessions.



24
25
26
# File 'lib/schwarm_cli/client.rb', line 24

def sessions
  @sessions
end

#skill_filesObject (readonly)

Returns the value of attribute skill_files.



24
25
26
# File 'lib/schwarm_cli/client.rb', line 24

def skill_files
  @skill_files
end

#skillsObject (readonly)

Returns the value of attribute skills.



24
25
26
# File 'lib/schwarm_cli/client.rb', line 24

def skills
  @skills
end

#subscriptionsObject (readonly)

Returns the value of attribute subscriptions.



24
25
26
# File 'lib/schwarm_cli/client.rb', line 24

def subscriptions
  @subscriptions
end

#tasksObject (readonly)

Returns the value of attribute tasks.



24
25
26
# File 'lib/schwarm_cli/client.rb', line 24

def tasks
  @tasks
end

#templatesObject (readonly)

Returns the value of attribute templates.



24
25
26
# File 'lib/schwarm_cli/client.rb', line 24

def templates
  @templates
end

Instance Method Details

#deleteObject



31
# File 'lib/schwarm_cli/client.rb', line 31

def delete(...) = conn.delete(...)

#getObject



28
# File 'lib/schwarm_cli/client.rb', line 28

def get(...) = conn.get(...)

#patchObject



30
# File 'lib/schwarm_cli/client.rb', line 30

def patch(...) = conn.patch(...)

#postObject



29
# File 'lib/schwarm_cli/client.rb', line 29

def post(...) = conn.post(...)