/* * 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"; export enum PaymentMethodReferenceTag { Id = "id", } export type PaymentMethodReference = { dotTag: PaymentMethodReferenceTag; /** * Payment ID of the saved Bolt Payment method. */ id: string; }; /** @internal */ export const PaymentMethodReferenceTag$inboundSchema: z.ZodNativeEnum< typeof PaymentMethodReferenceTag > = z.nativeEnum(PaymentMethodReferenceTag); /** @internal */ export const PaymentMethodReferenceTag$outboundSchema: z.ZodNativeEnum< typeof PaymentMethodReferenceTag > = PaymentMethodReferenceTag$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PaymentMethodReferenceTag$ { /** @deprecated use `PaymentMethodReferenceTag$inboundSchema` instead. */ export const inboundSchema = PaymentMethodReferenceTag$inboundSchema; /** @deprecated use `PaymentMethodReferenceTag$outboundSchema` instead. */ export const outboundSchema = PaymentMethodReferenceTag$outboundSchema; } /** @internal */ export const PaymentMethodReference$inboundSchema: z.ZodType< PaymentMethodReference, z.ZodTypeDef, unknown > = z.object({ ".tag": PaymentMethodReferenceTag$inboundSchema, id: z.string(), }).transform((v) => { return remap$(v, { ".tag": "dotTag", }); }); /** @internal */ export type PaymentMethodReference$Outbound = { ".tag": string; id: string; }; /** @internal */ export const PaymentMethodReference$outboundSchema: z.ZodType< PaymentMethodReference$Outbound, z.ZodTypeDef, PaymentMethodReference > = z.object({ dotTag: PaymentMethodReferenceTag$outboundSchema, id: z.string(), }).transform((v) => { return remap$(v, { dotTag: ".tag", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PaymentMethodReference$ { /** @deprecated use `PaymentMethodReference$inboundSchema` instead. */ export const inboundSchema = PaymentMethodReference$inboundSchema; /** @deprecated use `PaymentMethodReference$outboundSchema` instead. */ export const outboundSchema = PaymentMethodReference$outboundSchema; /** @deprecated use `PaymentMethodReference$Outbound` instead. */ export type Outbound = PaymentMethodReference$Outbound; } export function paymentMethodReferenceToJSON( paymentMethodReference: PaymentMethodReference, ): string { return JSON.stringify( PaymentMethodReference$outboundSchema.parse(paymentMethodReference), ); } export function paymentMethodReferenceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentMethodReference$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentMethodReference' from JSON`, ); }