encode<V> static method

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

Implementation

static V encode<V>(
  BillingMeterCreateOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.customerMapping != null) {
    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!,
    );
  }
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.valueSettings != null) {
    BillingMeterResourceBillingMeterValue.encode(
      instance.valueSettings!,
      container.nestedSingleValueContainer('value_settings').encoder,
    );
  }
  return container.value;
}