/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * A summary of the results from a identity verification check */ export type IdentityVerificationResult = { /** * The time the identity verification result was created */ createTime?: Date | null | undefined; /** * The resource identifier for the CIP service The format is "customerIdentificationResults/{customer_identification_id}" */ customerIdentificationId?: string | undefined; /** * If identity verification result is verified by a document(s) upload, this is the document id(s) relating to that */ documentIds?: Array | undefined; /** * The external vendor name that verified the identity verification result */ externalVendor?: string | undefined; /** * Whether the overall identity verification check has passed or not */ identityVerificationPassed?: boolean | undefined; /** * Describes the type of Identity Verification that was performed */ identityVerificationTypes?: Array | undefined; /** * Who provided the identity verification result */ providedBy?: string | undefined; }; /** @internal */ export const IdentityVerificationResult$inboundSchema: z.ZodType< IdentityVerificationResult, z.ZodTypeDef, unknown > = z.object({ create_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), customer_identification_id: z.string().optional(), document_ids: z.array(z.string()).optional(), external_vendor: z.string().optional(), identity_verification_passed: z.boolean().optional(), identity_verification_types: z.array(z.string()).optional(), provided_by: z.string().optional(), }).transform((v) => { return remap$(v, { "create_time": "createTime", "customer_identification_id": "customerIdentificationId", "document_ids": "documentIds", "external_vendor": "externalVendor", "identity_verification_passed": "identityVerificationPassed", "identity_verification_types": "identityVerificationTypes", "provided_by": "providedBy", }); }); /** @internal */ export type IdentityVerificationResult$Outbound = { create_time?: string | null | undefined; customer_identification_id?: string | undefined; document_ids?: Array | undefined; external_vendor?: string | undefined; identity_verification_passed?: boolean | undefined; identity_verification_types?: Array | undefined; provided_by?: string | undefined; }; /** @internal */ export const IdentityVerificationResult$outboundSchema: z.ZodType< IdentityVerificationResult$Outbound, z.ZodTypeDef, IdentityVerificationResult > = z.object({ createTime: z.nullable(z.date().transform(v => v.toISOString())).optional(), customerIdentificationId: z.string().optional(), documentIds: z.array(z.string()).optional(), externalVendor: z.string().optional(), identityVerificationPassed: z.boolean().optional(), identityVerificationTypes: z.array(z.string()).optional(), providedBy: z.string().optional(), }).transform((v) => { return remap$(v, { createTime: "create_time", customerIdentificationId: "customer_identification_id", documentIds: "document_ids", externalVendor: "external_vendor", identityVerificationPassed: "identity_verification_passed", identityVerificationTypes: "identity_verification_types", providedBy: "provided_by", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IdentityVerificationResult$ { /** @deprecated use `IdentityVerificationResult$inboundSchema` instead. */ export const inboundSchema = IdentityVerificationResult$inboundSchema; /** @deprecated use `IdentityVerificationResult$outboundSchema` instead. */ export const outboundSchema = IdentityVerificationResult$outboundSchema; /** @deprecated use `IdentityVerificationResult$Outbound` instead. */ export type Outbound = IdentityVerificationResult$Outbound; } export function identityVerificationResultToJSON( identityVerificationResult: IdentityVerificationResult, ): string { return JSON.stringify( IdentityVerificationResult$outboundSchema.parse(identityVerificationResult), ); } export function identityVerificationResultFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IdentityVerificationResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IdentityVerificationResult' from JSON`, ); }