encode<V> static method

V encode<V>(
  1. BillingMeterEvent instance,
  2. Encoder<V> encoder
)

Implementation

static V encode<V>(
  BillingMeterEvent instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeDateTime(
    'created',
    instance.created,
  );
  container.encodeString(
    'event_name',
    instance.eventName,
  );
  container.encodeString(
    'identifier',
    instance.identifier,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'billing.meter_event',
  );
  container.encodeMap(
    'payload',
    (container) => instance.payload.forEach((
      key,
      value,
    ) =>
        container.encodeString(
          key,
          value,
        )),
  );
  container.encodeDateTime(
    'timestamp',
    instance.timestamp,
  );
  return container.value;
}