encode<V> static method

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

Implementation

static V encode<V>(
  PriceRecurring instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.aggregateUsage != null) {
    PlanAggregateUsage.encode(
      instance.aggregateUsage!,
      container.nestedSingleValueContainer('aggregate_usage').encoder,
    );
  }
  InvoiceitemPlanInterval.encode(
    instance.interval,
    container.nestedSingleValueContainer('interval').encoder,
  );
  if (instance.intervalCount != null) {
    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!,
    );
  }
  if (instance.usageType != null) {
    InvoiceitemPlanUsageType.encode(
      instance.usageType!,
      container.nestedSingleValueContainer('usage_type').encoder,
    );
  }
  return container.value;
}