/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The type of identifier */ export enum IdentifierType1 { IdentifierTypeUnspecified = "IDENTIFIER_TYPE_UNSPECIFIED", OriginatingAccountId = "ORIGINATING_ACCOUNT_ID", OriginatingFdid = "ORIGINATING_FDID", OriginatingCatReporterCrd = "ORIGINATING_CAT_REPORTER_CRD", ClientAccountId = "CLIENT_ACCOUNT_ID", } /** * The type of identifier */ export type IdentifierType1Open = OpenEnum; /** * An identifier associated with an account */ export type Identifier = { /** * The type of identifier */ type?: IdentifierType1Open | undefined; /** * The value of the identifier */ value?: string | undefined; }; /** @internal */ export const IdentifierType1$inboundSchema: z.ZodType< IdentifierType1Open, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(IdentifierType1), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const IdentifierType1$outboundSchema: z.ZodType< IdentifierType1Open, z.ZodTypeDef, IdentifierType1Open > = z.union([ z.nativeEnum(IdentifierType1), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IdentifierType1$ { /** @deprecated use `IdentifierType1$inboundSchema` instead. */ export const inboundSchema = IdentifierType1$inboundSchema; /** @deprecated use `IdentifierType1$outboundSchema` instead. */ export const outboundSchema = IdentifierType1$outboundSchema; } /** @internal */ export const Identifier$inboundSchema: z.ZodType< Identifier, z.ZodTypeDef, unknown > = z.object({ type: IdentifierType1$inboundSchema.optional(), value: z.string().optional(), }); /** @internal */ export type Identifier$Outbound = { type?: string | undefined; value?: string | undefined; }; /** @internal */ export const Identifier$outboundSchema: z.ZodType< Identifier$Outbound, z.ZodTypeDef, Identifier > = z.object({ type: IdentifierType1$outboundSchema.optional(), value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Identifier$ { /** @deprecated use `Identifier$inboundSchema` instead. */ export const inboundSchema = Identifier$inboundSchema; /** @deprecated use `Identifier$outboundSchema` instead. */ export const outboundSchema = Identifier$outboundSchema; /** @deprecated use `Identifier$Outbound` instead. */ export type Outbound = Identifier$Outbound; } export function identifierToJSON(identifier: Identifier): string { return JSON.stringify(Identifier$outboundSchema.parse(identifier)); } export function identifierFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Identifier$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Identifier' from JSON`, ); }