encode<V> static method

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

Implementation

static V encode<V>(
  BillingMeterEventCreateOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeString(
    'event_name',
    instance.eventName,
  );
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.identifier != null) {
    container.encodeString(
      'identifier',
      instance.identifier!,
    );
  }
  container.encodeMap(
    'payload',
    (container) => instance.payload.forEach((
      key,
      value,
    ) =>
        container.encodeString(
          key,
          value,
        )),
  );
  container.encodeDateTime(
    'timestamp',
    instance.timestamp,
  );
  return container.value;
}