encode<V> static method

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

Implementation

static V encode<V>(
  ForwardingRequest instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeString(
    'config',
    instance.config,
  );
  container.encodeDateTime(
    'created',
    instance.created,
  );
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'forwarding.request',
  );
  container.encodeString(
    'payment_method',
    instance.paymentMethod,
  );
  container.encodeList(
    'replacements',
    (container) =>
        instance.replacements.forEach((el) => container.encodeString(el)),
  );
  if (instance.requestContext != null) {
    ForwardedRequestContext.encode(
      instance.requestContext!,
      container.nestedSingleValueContainer('request_context').encoder,
    );
  }
  if (instance.requestDetails != null) {
    ForwardedRequestDetails.encode(
      instance.requestDetails!,
      container.nestedSingleValueContainer('request_details').encoder,
    );
  }
  if (instance.responseDetails != null) {
    ForwardedResponseDetails.encode(
      instance.responseDetails!,
      container.nestedSingleValueContainer('response_details').encoder,
    );
  }
  if (instance.url != null) {
    container.encodeString(
      'url',
      instance.url!,
    );
  }
  return container.value;
}