encode<V> static method

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

Implementation

static V encode<V>(
  IdentityVerificationSessionCreateOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.clientReferenceId != null) {
    container.encodeString(
      'client_reference_id',
      instance.clientReferenceId!,
    );
  }
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.metadata != null) {
    container.encodeMap(
      'metadata',
      (container) => instance.metadata!.forEach((
        key,
        value,
      ) =>
          container.encodeString(
            key,
            value,
          )),
    );
  }
  if (instance.options != null) {
    VerificationSessionOptions.encode(
      instance.options!,
      container.nestedSingleValueContainer('options').encoder,
    );
  }
  if (instance.returnUrl != null) {
    container.encodeString(
      'return_url',
      instance.returnUrl!,
    );
  }
  IdentityVerificationReportType.encode(
    instance.type,
    container.nestedSingleValueContainer('type').encoder,
  );
  return container.value;
}