encode<V> static method

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

Implementation

static V encode<V>(
  SubscriptionScheduleAddInvoiceItem instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  SubscriptionScheduleAddInvoiceItemPriceOrId.encode(
    instance.price,
    container.nestedSingleValueContainer('price').encoder,
  );
  if (instance.quantity != null) {
    container.encodeInt(
      'quantity',
      instance.quantity!,
    );
  }
  if (instance.taxRates != null) {
    container.encodeList(
      'tax_rates',
      (container) => instance.taxRates!.forEach((el) => TaxRate.encode(
            el,
            container.nestedSingleValueContainer().encoder,
          )),
    );
  }
  return container.value;
}