encode<V> static method

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

Implementation

static V encode<V>(
  ForwardingRequestCreateOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeString(
    'config',
    instance.config,
  );
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  container.encodeString(
    'payment_method',
    instance.paymentMethod,
  );
  container.encodeList(
    'replacements',
    (container) => instance.replacements
        .forEach((el) => ForwardingRequestReplacementsItem.encode(
              el,
              container.nestedSingleValueContainer().encoder,
            )),
  );
  if (instance.request != null) {
    Request.encode(
      instance.request!,
      container.nestedSingleValueContainer('request').encoder,
    );
  }
  container.encodeString(
    'url',
    instance.url,
  );
  return container.value;
}