class Pytty::Client::Api::Spawn

Public Class Methods

run(id:, tty:, interactive:) click to toggle source
# File lib/pytty/client/api/spawn.rb, line 5
def self.run(id:, tty:, interactive:)
  internet = Async::HTTP::Internet.new
  headers = [['accept', 'application/json']]
  body = {
    tty: tty,
    interactive: interactive
  }.to_json

  response = internet.post("#{Pytty::Client.host_url}/v1/spawn/#{id}", headers, [body])
  [response, JSON.parse(response.read)]
ensure
  internet.close
end