pub struct UsageReport {
pub meter_event_name: String,
pub customer_ref: String,
pub value: u64,
pub identifier: String,
pub timestamp: OffsetDateTime,
}Expand description
A metered usage amount to report to the billing provider (Stripe Billing
Meters). meter_event_name names a meter the venture configured;
customer_ref is the provider customer id the meter maps the event to;
value is the amount counted, in the meter’s own unit; identifier is the
caller-chosen exactly-once key; timestamp is when the usage happened.
Fields§
§meter_event_name: String§customer_ref: String§value: u64§identifier: String§timestamp: OffsetDateTimeImplementations§
Source§impl UsageReport
impl UsageReport
Sourcepub fn hourly(
subject: &str,
meter_event_name: &str,
customer_ref: &str,
value: u64,
at: OffsetDateTime,
) -> Self
pub fn hourly( subject: &str, meter_event_name: &str, customer_ref: &str, value: u64, at: OffsetDateTime, ) -> Self
A report for one UTC hour: timestamp is the start of the hour
containing at, and identifier is
{subject}:{meter_event_name}:{start unix seconds}. Every report for
the same subject, meter and hour therefore carries the same identifier,
so a retry, a re-delivery, or a concurrent drainer reports that window
once. The identifier is only safe when the window’s value is final
— report a window once it has closed (see docs/PAYMENTS.md); two
reports for the same open hour with different values would collide, and
the provider would count only the first. The next hour is a new window
and a new identifier.
Trait Implementations§
Source§impl Clone for UsageReport
impl Clone for UsageReport
Source§impl Debug for UsageReport
impl Debug for UsageReport
impl Eq for UsageReport
Source§impl PartialEq for UsageReport
impl PartialEq for UsageReport
impl StructuralPartialEq for UsageReport
Auto Trait Implementations§
impl Freeze for UsageReport
impl RefUnwindSafe for UsageReport
impl Send for UsageReport
impl Sync for UsageReport
impl Unpin for UsageReport
impl UnsafeUnpin for UsageReport
impl UnwindSafe for UsageReport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.