# `Celery.Canvas.Signature`
[🔗](https://github.com/hacktobeer/celery-elixir/blob/v0.1.0/lib/celery/canvas.ex#L1)

Serializable task invocation signature (`celery.canvas.Signature` / `subtask`).

Matches Python Celery's wire dictionary representation so signatures can be passed in
`callbacks`, `errbacks`, `chain`, and `chord` fields between Python and Elixir workers:
```elixir
%{
  "task" => "src.tasks.command",
  "args" => [...],
  "kwargs" => %{...},
  "options" => %{...},
  "subtask_type" => nil,
  "immutable" => false
}
```

# `t`

```elixir
@type t() :: %Celery.Canvas.Signature{
  app: Celery.t() | nil,
  args: list(),
  immutable: boolean(),
  kwargs: map(),
  options: map(),
  subtask_type: String.t() | nil,
  task: String.t()
}
```

# `apply_async`

```elixir
@spec apply_async(t(), keyword()) :: {:ok, Celery.Result.t()} | {:error, term()}
```

Dispatches a `%Celery.Canvas.Signature{}` asynchronously via `Celery.send_task/3`.

# `delay`

```elixir
@spec delay(t(), list(), map() | keyword()) ::
  {:ok, Celery.Result.t()} | {:error, term()}
```

Dispatches a `%Celery.Canvas.Signature{}` with positional/keyword arguments (`delay`).

# `freeze`

```elixir
@spec freeze(t(), keyword()) :: {t(), Celery.Result.t()}
```

Freezes a signature by assigning a `task_id` in its `options` if not already set,
returning `{updated_signature, %Celery.Result{}}`.

# `from_map`

```elixir
@spec from_map(map() | t()) :: t()
```

Reconstructs a `%Celery.Canvas.Signature{}` from a wire map.

# `new`

```elixir
@spec new(String.t(), keyword()) :: t()
```

Creates a new `%Celery.Canvas.Signature{}`.

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Serializes a `%Celery.Canvas.Signature{}` to a Python Celery wire-compatible map.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
