encode<V> static method

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

Implementation

static V encode<V>(
  IdentityVerificationReport instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.clientReferenceId != null) {
    container.encodeString(
      'client_reference_id',
      instance.clientReferenceId!,
    );
  }
  container.encodeDateTime(
    'created',
    instance.created,
  );
  if (instance.document != null) {
    GelatoDocumentReport.encode(
      instance.document!,
      container.nestedSingleValueContainer('document').encoder,
    );
  }
  container.encodeString(
    'id',
    instance.id,
  );
  if (instance.idNumber != null) {
    GelatoIdNumberReport.encode(
      instance.idNumber!,
      container.nestedSingleValueContainer('id_number').encoder,
    );
  }
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'identity.verification_report',
  );
  if (instance.options != null) {
    GelatoVerificationReportOptions.encode(
      instance.options!,
      container.nestedSingleValueContainer('options').encoder,
    );
  }
  if (instance.selfie != null) {
    GelatoSelfieReport.encode(
      instance.selfie!,
      container.nestedSingleValueContainer('selfie').encoder,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  if (instance.verificationSession != null) {
    container.encodeString(
      'verification_session',
      instance.verificationSession!,
    );
  }
  return container.value;
}