ExShopifyApp.AppEvents.Event (ex_shopify_app v1.2.0)
A usage event to report through ExShopifyApp.AppEvents.report/2.
:event_handle- must match a usage meter handle from the pricing config.:value- the usage amount (must be> 0to be billed).:idempotency_key- stable key deduping the event. Billing events are permanently deduped, so the key must be stable per billing period; the caller owns this.:timestamp- the eventDateTime.new/2stamps it withDateTime.utc_now/0when not given; on a struct built as a literal without one,ExShopifyApp.AppEvents.report/2stamps it at send time instead.
Summary
Functions
Builds an event from a map of the required fields.
Maps the event to the App Events API request body for the shop identified by
shop_gid (e.g. "gid://shopify/Shop/123"), stamping DateTime.utc_now/0 when
the event carries no timestamp.
Types
@type t() :: %ExShopifyApp.AppEvents.Event{ event_handle: String.t(), idempotency_key: String.t(), timestamp: DateTime.t() | nil, value: number() }
Functions
@spec new( %{event_handle: String.t(), value: number(), idempotency_key: String.t()}, keyword() ) :: t()
Builds an event from a map of the required fields.
Options
:timestamp- the eventDateTime; defaults toDateTime.utc_now/0, so the event carries the time it was built rather than the time it is sent.
Maps the event to the App Events API request body for the shop identified by
shop_gid (e.g. "gid://shopify/Shop/123"), stamping DateTime.utc_now/0 when
the event carries no timestamp.