encode<V> static method

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

Implementation

static V encode<V>(
  BillingPortalSession instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  BillingPortalConfigurationOrId.encode(
    instance.configuration,
    container.nestedSingleValueContainer('configuration').encoder,
  );
  container.encodeDateTime(
    'created',
    instance.created,
  );
  container.encodeString(
    'customer',
    instance.customer,
  );
  if (instance.flow != null) {
    BillingPortalSessionFlow.encode(
      instance.flow!,
      container.nestedSingleValueContainer('flow').encoder,
    );
  }
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  if (instance.locale != null) {
    container.encodeString(
      'locale',
      instance.locale!,
    );
  }
  container.encodeString(
    'object',
    'billing_portal.session',
  );
  if (instance.onBehalfOf != null) {
    container.encodeString(
      'on_behalf_of',
      instance.onBehalfOf!,
    );
  }
  if (instance.returnUrl != null) {
    container.encodeString(
      'return_url',
      instance.returnUrl!,
    );
  }
  container.encodeString(
    'url',
    instance.url,
  );
  return container.value;
}