encode<V> static method

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

Implementation

static V encode<V>(
  BillingPortalConfigurationUpdateOptionsFeaturesSubscriptionCancel instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.cancellationReason != null) {
    BillingPortalConfigurationUpdateOptionsFeaturesSubscriptionCancelCancellationReason
        .encode(
      instance.cancellationReason!,
      container.nestedSingleValueContainer('cancellation_reason').encoder,
    );
  }
  if (instance.enabled != null) {
    container.encodeBool(
      'enabled',
      instance.enabled!,
    );
  }
  if (instance.mode != null) {
    PortalSubscriptionCancelMode.encode(
      instance.mode!,
      container.nestedSingleValueContainer('mode').encoder,
    );
  }
  if (instance.prorationBehavior != null) {
    PortalSubscriptionCancelProrationBehavior.encode(
      instance.prorationBehavior!,
      container.nestedSingleValueContainer('proration_behavior').encoder,
    );
  }
  return container.value;
}