Jidoka.Review.Response (Jidoka v0.9.0)

Copy Markdown View Source

Application response to a pending review request.

A response is intentionally small: it targets a single interrupt and either approves or denies the pending operation.

Summary

Functions

Builds an approval response for an interrupt, request, or review identifier.

Returns the supported review decisions.

Builds a denial response for an interrupt, request, or review identifier.

Normalizes an existing response, keyword list, or map.

Builds a review response from keyword or map attributes.

Builds a review response and raises if the attributes are invalid.

Returns the Zoi schema for a review response.

Types

decision()

@type decision() :: :approved | :denied

t()

@type t() :: %Jidoka.Review.Response{
  decision: :approved | :denied,
  interrupt_id: binary(),
  metadata: map(),
  reason: nil | nil | any(),
  responded_at_ms: nil | nil | integer()
}

Functions

approve(interrupt_or_id, opts \\ [])

Builds an approval response for an interrupt, request, or review identifier.

decisions()

@spec decisions() :: [decision()]

Returns the supported review decisions.

deny(interrupt_or_id, opts \\ [])

Builds a denial response for an interrupt, request, or review identifier.

from_input(response)

@spec from_input(t() | keyword() | map()) :: {:ok, t()} | {:error, term()}

Normalizes an existing response, keyword list, or map.

new(attrs)

@spec new(keyword() | map()) :: {:ok, t()} | {:error, term()}

Builds a review response from keyword or map attributes.

new!(attrs)

@spec new!(keyword() | map()) :: t()

Builds a review response and raises if the attributes are invalid.

schema()

@spec schema() :: Zoi.schema()

Returns the Zoi schema for a review response.