encode<V> static method

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

Implementation

static V encode<V>(
  Recurring instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.aggregateUsage != null) {
    InvoiceitemPlanAggregateUsage.encode(
      instance.aggregateUsage!,
      container.nestedSingleValueContainer('aggregate_usage').encoder,
    );
  }
  InvoiceitemPlanInterval.encode(
    instance.interval,
    container.nestedSingleValueContainer('interval').encoder,
  );
  container.encodeInt(
    'interval_count',
    instance.intervalCount,
  );
  if (instance.meter != null) {
    container.encodeString(
      'meter',
      instance.meter!,
    );
  }
  if (instance.trialPeriodDays != null) {
    container.encodeInt(
      'trial_period_days',
      instance.trialPeriodDays!,
    );
  }
  InvoiceitemPlanUsageType.encode(
    instance.usageType,
    container.nestedSingleValueContainer('usage_type').encoder,
  );
  return container.value;
}