LemonCore.Events.ApprovalResolved (lemon_core v0.1.0)

View Source

A pending approval was decided, denied or timed out. Published on exec_approvals.

Summary

Functions

The accepted decisions.

The LemonCore.Event type atom this payload is published under.

Payload version. Bumped only for a breaking field change (see the semver table in docs/platform/bus-events.md §4.3).

The struct's field names, in declaration order.

Build from a legacy map, coercing the nested pending record when present.

Build the payload, raising on unknown or missing keys.

Types

decision()

@type decision() ::
  :approve_once
  | :approve_session
  | :approve_agent
  | :approve_global
  | :deny
  | :timeout

t()

@type t() :: %LemonCore.Events.ApprovalResolved{
  approval_id: String.t(),
  decision: decision(),
  pending: LemonCore.Events.ApprovalPending.t() | nil
}

Functions

decisions()

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

The accepted decisions.

event_type()

@spec event_type() :: atom()

The LemonCore.Event type atom this payload is published under.

event_version()

@spec event_version() :: pos_integer()

Payload version. Bumped only for a breaking field change (see the semver table in docs/platform/bus-events.md §4.3).

fields()

@spec fields() :: [atom()]

The struct's field names, in declaration order.

from_map(payload)

@spec from_map(map() | struct() | keyword()) :: struct()
@spec from_map(map() | struct() | keyword()) :: t()

Build from a legacy map, coercing the nested pending record when present.

new(payload)

@spec new(map() | keyword()) :: struct()

Build the payload, raising on unknown or missing keys.

This is the publisher-side constructor: a typo should fail at the point of publish, not silently produce a payload with a nil field that a consumer reads as absent.