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.



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

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.



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

def agents
  @agents
end

#messagesObject (readonly)

Returns the value of attribute messages.



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

def messages
  @messages
end

#recurringObject (readonly)

Returns the value of attribute recurring.



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

def recurring
  @recurring
end

#repo_skillsObject (readonly)

Returns the value of attribute repo_skills.



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

def repo_skills
  @repo_skills
end

#repositoriesObject (readonly)

Returns the value of attribute repositories.



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

def repositories
  @repositories
end

#secretsObject (readonly)

Returns the value of attribute secrets.



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

def secrets
  @secrets
end

#sessionsObject (readonly)

Returns the value of attribute sessions.



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

def sessions
  @sessions
end

#shared_agentsObject (readonly)

Returns the value of attribute shared_agents.



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

def shared_agents
  @shared_agents
end

#skill_filesObject (readonly)

Returns the value of attribute skill_files.



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

def skill_files
  @skill_files
end

#skillsObject (readonly)

Returns the value of attribute skills.



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

def skills
  @skills
end

#tasksObject (readonly)

Returns the value of attribute tasks.



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

def tasks
  @tasks
end

#templatesObject (readonly)

Returns the value of attribute templates.



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

def templates
  @templates
end

Instance Method Details

#deleteObject



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

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

#getObject



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

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

#patchObject



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

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

#postObject



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

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