encode<V> static method

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

Implementation

static V encode<V>(
  BillingMeter instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeDateTime(
    'created',
    instance.created,
  );
  BillingMeterResourceCustomerMappingSettings.encode(
    instance.customerMapping,
    container.nestedSingleValueContainer('customer_mapping').encoder,
  );
  BillingMeterResourceAggregationSettings.encode(
    instance.defaultAggregation,
    container.nestedSingleValueContainer('default_aggregation').encoder,
  );
  container.encodeString(
    'display_name',
    instance.displayName,
  );
  container.encodeString(
    'event_name',
    instance.eventName,
  );
  if (instance.eventTimeWindow != null) {
    container.encodeString(
      'event_time_window',
      instance.eventTimeWindow!,
    );
  }
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'billing.meter',
  );
  container.encodeString(
    'status',
    instance.status,
  );
  BillingMeterResourceBillingMeterStatusTransitions.encode(
    instance.statusTransitions,
    container.nestedSingleValueContainer('status_transitions').encoder,
  );
  container.encodeDateTime(
    'updated',
    instance.updated,
  );
  BillingMeterResourceBillingMeterValue.encode(
    instance.valueSettings,
    container.nestedSingleValueContainer('value_settings').encoder,
  );
  return container.value;
}