encode<V> static method

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

Implementation

static V encode<V>(
  BillingPortalSessionCreateOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.configuration != null) {
    container.encodeString(
      'configuration',
      instance.configuration!,
    );
  }
  container.encodeString(
    'customer',
    instance.customer,
  );
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.flowData != null) {
    SessionFlowData.encode(
      instance.flowData!,
      container.nestedSingleValueContainer('flow_data').encoder,
    );
  }
  if (instance.locale != null) {
    container.encodeString(
      'locale',
      instance.locale!,
    );
  }
  if (instance.onBehalfOf != null) {
    container.encodeString(
      'on_behalf_of',
      instance.onBehalfOf!,
    );
  }
  if (instance.returnUrl != null) {
    container.encodeString(
      'return_url',
      instance.returnUrl!,
    );
  }
  return container.value;
}