encode<V> static method

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

Implementation

static V encode<V>(
  ConfigurationSubscriptionCancel instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.cancellationReason != null) {
    ConfigurationCancellationReason.encode(
      instance.cancellationReason!,
      container.nestedSingleValueContainer('cancellation_reason').encoder,
    );
  }
  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;
}