/* * 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"; import { DeviceMetadataCreate, DeviceMetadataCreate$inboundSchema, DeviceMetadataCreate$Outbound, DeviceMetadataCreate$outboundSchema, } from "./devicemetadatacreate.js"; import { IdentificationCreate, IdentificationCreate$inboundSchema, IdentificationCreate$Outbound, IdentificationCreate$outboundSchema, } from "./identificationcreate.js"; import { PhoneNumberCreate, PhoneNumberCreate$inboundSchema, PhoneNumberCreate$Outbound, PhoneNumberCreate$outboundSchema, } from "./phonenumbercreate.js"; /** * Represents an identity lookup resource */ export type IdentityLookupCreate = { /** * End-user device metadata for fraud detection and compliance All fields must represent the actual end-user's device, not any intermediate proxy or client server through which requests may be routed */ deviceMetadata: DeviceMetadataCreate; /** * Represents an identification document */ identification: IdentificationCreate; /** * An object representing a phone number, suitable as an API wire format. * * @remarks * * This representation: * * - should not be used for locale-specific formatting of a phone number, such as "+1 (650) 253-0000 ext. 123" * * - is not designed for efficient storage - may not be suitable for dialing - specialized libraries (see references) should be used to parse the number for that purpose * * To do something meaningful with this number, such as format it for various use-cases, convert it to an `i18n.phonenumbers.PhoneNumber` object first. * * For instance, in Java this would be: * * com.google.type.PhoneNumber wireProto = com.google.type.PhoneNumber.newBuilder().build(); com.google.i18n.phonenumbers.Phonenumber.PhoneNumber phoneNumber = PhoneNumberUtil.getInstance().parse(wireProto.getE164Number(), "ZZ"); if (!wireProto.getExtension().isEmpty()) { phoneNumber.setExtension(wireProto.getExtension()); } * * Reference(s): * - https://github.com/google/libphonenumber */ phoneNumber: PhoneNumberCreate; /** * Verify User has consented to an identity lookup */ userConsent: boolean; }; /** @internal */ export const IdentityLookupCreate$inboundSchema: z.ZodType< IdentityLookupCreate, z.ZodTypeDef, unknown > = z.object({ device_metadata: DeviceMetadataCreate$inboundSchema, identification: IdentificationCreate$inboundSchema, phone_number: PhoneNumberCreate$inboundSchema, user_consent: z.boolean(), }).transform((v) => { return remap$(v, { "device_metadata": "deviceMetadata", "phone_number": "phoneNumber", "user_consent": "userConsent", }); }); /** @internal */ export type IdentityLookupCreate$Outbound = { device_metadata: DeviceMetadataCreate$Outbound; identification: IdentificationCreate$Outbound; phone_number: PhoneNumberCreate$Outbound; user_consent: boolean; }; /** @internal */ export const IdentityLookupCreate$outboundSchema: z.ZodType< IdentityLookupCreate$Outbound, z.ZodTypeDef, IdentityLookupCreate > = z.object({ deviceMetadata: DeviceMetadataCreate$outboundSchema, identification: IdentificationCreate$outboundSchema, phoneNumber: PhoneNumberCreate$outboundSchema, userConsent: z.boolean(), }).transform((v) => { return remap$(v, { deviceMetadata: "device_metadata", phoneNumber: "phone_number", userConsent: "user_consent", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IdentityLookupCreate$ { /** @deprecated use `IdentityLookupCreate$inboundSchema` instead. */ export const inboundSchema = IdentityLookupCreate$inboundSchema; /** @deprecated use `IdentityLookupCreate$outboundSchema` instead. */ export const outboundSchema = IdentityLookupCreate$outboundSchema; /** @deprecated use `IdentityLookupCreate$Outbound` instead. */ export type Outbound = IdentityLookupCreate$Outbound; } export function identityLookupCreateToJSON( identityLookupCreate: IdentityLookupCreate, ): string { return JSON.stringify( IdentityLookupCreate$outboundSchema.parse(identityLookupCreate), ); } export function identityLookupCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IdentityLookupCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IdentityLookupCreate' from JSON`, ); }