Wardrik.Spend (wardrik_protocol v0.1.0-rc.1)

Copy Markdown

What an org's agents have spent against one ceiling in its current period. See Wardrik.Ceiling.

  • :ceiling - the ceiling's name.
  • :limit - its limit, as a Wardrik.Amount.
  • :spent - what the agents have spent.
  • :granted - what approvals added.
  • :per - the period: :day, :week, :month or :total.
  • :on_exhausted - what the next call does once it's spent: :ask, :deny or :continue.
  • :starts_over - the day the period resets. nil for :total.

Summary

Functions

Builds one from the protocol's JSON.

Returns it as the protocol's JSON, without fields that are nil.

Types

t()

@type t() :: %Wardrik.Spend{
  ceiling: term(),
  granted: term(),
  limit: term(),
  on_exhausted: term(),
  per: term(),
  spent: term(),
  starts_over: term()
}

Functions

from_json(json)

@spec from_json(map()) :: t()

Builds one from the protocol's JSON.

to_json(value)

@spec to_json(t()) :: map()

Returns it as the protocol's JSON, without fields that are nil.