Sprites.Sprite (Sprites v0.1.0)

View Source

Represents a sprite instance.

Summary

Functions

Returns whether control mode is enabled for this sprite's client.

Builds the WebSocket URL for the control endpoint.

Destroys this sprite.

Builds the WebSocket URL for command execution.

Creates a new sprite handle.

Returns the authorization token for this sprite's client.

Types

t()

@type t() :: %Sprites.Sprite{
  client: Sprites.Client.t(),
  config: map() | nil,
  environment: map() | nil,
  id: String.t() | nil,
  name: String.t(),
  status: String.t() | nil
}

Functions

control_mode?(sprite)

@spec control_mode?(t()) :: boolean()

Returns whether control mode is enabled for this sprite's client.

control_url(sprite)

@spec control_url(t()) :: String.t()

Builds the WebSocket URL for the control endpoint.

destroy(sprite)

@spec destroy(t()) :: :ok | {:error, term()}

Destroys this sprite.

exec_url(sprite, command, args, opts)

@spec exec_url(t(), String.t(), [String.t()], keyword()) :: String.t()

Builds the WebSocket URL for command execution.

When opts[:session_id] is set, builds an attach URL of the form /v1/sprites/:name/exec/:session_id (matching the sprites-go and sprites-py SDKs). Without :session_id, builds the spawn URL with command/args as query params.

new(client, name, attrs \\ %{})

@spec new(Sprites.Client.t(), String.t(), map()) :: t()

Creates a new sprite handle.

token(sprite)

@spec token(t()) :: String.t()

Returns the authorization token for this sprite's client.