/* * 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 IdentifierCreateType { 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 IdentifierCreateTypeOpen = OpenEnum; /** * An identifier associated with an account */ export type IdentifierCreate = { /** * The type of identifier */ type: IdentifierCreateTypeOpen; /** * The value of the identifier */ value: string; }; /** @internal */ export const IdentifierCreateType$inboundSchema: z.ZodType< IdentifierCreateTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(IdentifierCreateType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const IdentifierCreateType$outboundSchema: z.ZodType< IdentifierCreateTypeOpen, z.ZodTypeDef, IdentifierCreateTypeOpen > = z.union([ z.nativeEnum(IdentifierCreateType), 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 IdentifierCreateType$ { /** @deprecated use `IdentifierCreateType$inboundSchema` instead. */ export const inboundSchema = IdentifierCreateType$inboundSchema; /** @deprecated use `IdentifierCreateType$outboundSchema` instead. */ export const outboundSchema = IdentifierCreateType$outboundSchema; } /** @internal */ export const IdentifierCreate$inboundSchema: z.ZodType< IdentifierCreate, z.ZodTypeDef, unknown > = z.object({ type: IdentifierCreateType$inboundSchema, value: z.string(), }); /** @internal */ export type IdentifierCreate$Outbound = { type: string; value: string; }; /** @internal */ export const IdentifierCreate$outboundSchema: z.ZodType< IdentifierCreate$Outbound, z.ZodTypeDef, IdentifierCreate > = z.object({ type: IdentifierCreateType$outboundSchema, value: 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 IdentifierCreate$ { /** @deprecated use `IdentifierCreate$inboundSchema` instead. */ export const inboundSchema = IdentifierCreate$inboundSchema; /** @deprecated use `IdentifierCreate$outboundSchema` instead. */ export const outboundSchema = IdentifierCreate$outboundSchema; /** @deprecated use `IdentifierCreate$Outbound` instead. */ export type Outbound = IdentifierCreate$Outbound; } export function identifierCreateToJSON( identifierCreate: IdentifierCreate, ): string { return JSON.stringify( IdentifierCreate$outboundSchema.parse(identifierCreate), ); } export function identifierCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IdentifierCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IdentifierCreate' from JSON`, ); }