recordUsage method

Future<void> recordUsage({
  1. required Object customer,
  2. required DVUsageMeter meter,
  3. required int quantity,
  4. required String idempotencyKey,
  5. DateTime? at,
})

Records quantity against meter for customer.

idempotencyKey is required, and the reason is worth repeating here because this is where application code calls it from: usage is reported from jobs, jobs are redelivered, and a provider counts one record per identifier. A key derived from the work -- the job id, the request id, the row being charged for -- is the same on the retry. A fresh one every call bills twice.

Implementation

Future<void> recordUsage({
  required Object customer,
  required DVUsageMeter meter,
  required int quantity,
  required String idempotencyKey,
  DateTime? at,
}) {
  return _configuredProvider.recordUsage(
    customer: customer,
    meter: meter,
    quantity: quantity,
    idempotencyKey: idempotencyKey,
    at: at,
  );
}