/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type AmountUpdate = { /** * A 3-letter ISO 4217 currency code. */ currency?: string | undefined; /** * Quantity in the smallest unit of the specified currency. * * @remarks * * In USD this is cents, for example, $12.04 is 1204 and $0.99 is 99. */ value?: number | undefined; }; /** @internal */ export const AmountUpdate$inboundSchema: z.ZodType< AmountUpdate, z.ZodTypeDef, unknown > = z.object({ currency: z.string().optional(), value: z.number().int().optional(), }); /** @internal */ export type AmountUpdate$Outbound = { currency?: string | undefined; value?: number | undefined; }; /** @internal */ export const AmountUpdate$outboundSchema: z.ZodType< AmountUpdate$Outbound, z.ZodTypeDef, AmountUpdate > = z.object({ currency: z.string().optional(), value: z.number().int().optional(), }); export function amountUpdateToJSON(amountUpdate: AmountUpdate): string { return JSON.stringify(AmountUpdate$outboundSchema.parse(amountUpdate)); } export function amountUpdateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AmountUpdate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AmountUpdate' from JSON`, ); }