Vetspire. Subscriptions. MessagingUsage. Metering
(vetspire v3.0.0)
View Source
The billing context for a metered message. Build it with new/2, not a struct
literal: the guard rejects a typo'd feature at the first call, rather than
letting it through as an unattributable event.
The guard is the enforcement, not the @spec: dialyzer widens an atom union
above 13 members to atom(), and this enum has 15, so a typo'd feature
type-checks. Dialyzer still catches an argument of the wrong type, such as a
string feature.
The guard needs the call to run, so CI carries the unknown-messaging-feature
ast-grep rule for the call sites no test covers.
org_id is nil only for an inbound message texted to a number that matches no
location.
Summary
Types
@type t() :: %Vetspire.Subscriptions.MessagingUsage.Metering{ feature: Vetspire.Subscriptions.MessagingUsage.UsageEvent.feature(), location_id: integer() | nil, org_id: integer() | nil }
Functions
@spec new( Vetspire.Subscriptions.MessagingUsage.UsageEvent.feature(), keyword() ) :: t()