/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$inboundSchema, Address$Outbound, Address$outboundSchema, } from "./address.js"; export type Identity = { addresses?: Array
| undefined; /** * Prove’s tiered confidence metric, ranging from -1 to 3, that dynamically adapts to user behavior and various authentication keys. It allows for adaptive security policies, meaning you can require different levels of verification for different types of transactions. */ assuranceLevel: string; /** * The unique ID that we generate for the identity. */ clientHumanId?: string | undefined; /** * TODO: comments and validation */ dateOfBirth?: string | undefined; emails?: Array | undefined; /** * The first name of the identity. */ firstName?: string | undefined; /** * The last name of the identity. */ lastName?: string | undefined; maxAge?: number | undefined; minAge?: number | undefined; nationalId?: string | undefined; /** * Codes explaining the verification outcome */ reasons: Array; }; /** @internal */ export const Identity$inboundSchema: z.ZodType< Identity, z.ZodTypeDef, unknown > = z.object({ addresses: z.array(Address$inboundSchema).optional(), assuranceLevel: z.string(), clientHumanId: z.string().optional(), dateOfBirth: z.string().optional(), emails: z.array(z.string()).optional(), firstName: z.string().optional(), lastName: z.string().optional(), maxAge: z.number().int().optional(), minAge: z.number().int().optional(), nationalId: z.string().optional(), reasons: z.array(z.string()), }); /** @internal */ export type Identity$Outbound = { addresses?: Array | undefined; assuranceLevel: string; clientHumanId?: string | undefined; dateOfBirth?: string | undefined; emails?: Array | undefined; firstName?: string | undefined; lastName?: string | undefined; maxAge?: number | undefined; minAge?: number | undefined; nationalId?: string | undefined; reasons: Array; }; /** @internal */ export const Identity$outboundSchema: z.ZodType< Identity$Outbound, z.ZodTypeDef, Identity > = z.object({ addresses: z.array(Address$outboundSchema).optional(), assuranceLevel: z.string(), clientHumanId: z.string().optional(), dateOfBirth: z.string().optional(), emails: z.array(z.string()).optional(), firstName: z.string().optional(), lastName: z.string().optional(), maxAge: z.number().int().optional(), minAge: z.number().int().optional(), nationalId: z.string().optional(), reasons: z.array(z.string()), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Identity$ { /** @deprecated use `Identity$inboundSchema` instead. */ export const inboundSchema = Identity$inboundSchema; /** @deprecated use `Identity$outboundSchema` instead. */ export const outboundSchema = Identity$outboundSchema; /** @deprecated use `Identity$Outbound` instead. */ export type Outbound = Identity$Outbound; } export function identityToJSON(identity: Identity): string { return JSON.stringify(Identity$outboundSchema.parse(identity)); } export function identityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Identity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Identity' from JSON`, ); }