encode<V> static method

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

Implementation

static V encode<V>(
  CustomerSession instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeString(
    'client_secret',
    instance.clientSecret,
  );
  if (instance.components != null) {
    CustomerSessionResourceComponents.encode(
      instance.components!,
      container.nestedSingleValueContainer('components').encoder,
    );
  }
  container.encodeDateTime(
    'created',
    instance.created,
  );
  CustomerOrId.encode(
    instance.customer,
    container.nestedSingleValueContainer('customer').encoder,
  );
  container.encodeDateTime(
    'expires_at',
    instance.expiresAt,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'customer_session',
  );
  return container.value;
}