# `MingaEditor.Effect.Request`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/effect/request.ex#L1)

Typed scheduler request for one domain-owned slow effect.

Requests contain data only. Executable closures and document binaries do not
enter scheduler queues; the domain module named by `handler` owns execution.

# `id`

```elixir
@type id() :: reference()
```

Scheduler-local request identity.

# `option`

```elixir
@type option() ::
  {:operation_id, MingaEditor.State.Operation.id()}
  | {:source, Minga.Extension.ContributionCleanup.contribution_source() | nil}
  | {:timeout_ms, pos_integer()}
  | {:activity, atom()}
```

Optional request metadata supplied to the scheduler.

# `resource`

```elixir
@type resource() :: term()
```

Stable identity for the mutated or calculated resource.

# `t`

```elixir
@type t() :: %MingaEditor.Effect.Request{
  activity: atom() | nil,
  effect: struct(),
  handler: module(),
  id: id(),
  operation_id: MingaEditor.State.Operation.id() | nil,
  policy: MingaEditor.Effect.Policy.t(),
  resource: resource(),
  source: Minga.Extension.ContributionCleanup.contribution_source() | nil,
  timeout_ms: pos_integer() | nil
}
```

# `coalesce`

```elixir
@spec coalesce(t(), t()) :: t()
```

Combines two queued requests through their shared domain handler.

# `new`

```elixir
@spec new(
  struct(),
  resource(),
  MingaEditor.Effect.Policy.t(),
  [option()] | MingaEditor.State.Operation.id()
) :: t()
```

Builds a scheduler request for a typed effect and optional metadata.

# `run`

```elixir
@spec run(t()) :: {:ok, term()} | {:error, term()}
```

Runs the request through its domain handler.

---

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