/* * 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"; import { CardUpdateReason, CardUpdateReason$inboundSchema, CardUpdateReason$outboundSchema, } from "./cardupdatereason.js"; /** * The results of the most recent card update request. */ export type CardAccountUpdater = { updatedOn?: Date | undefined; /** * The results of the card update request. */ updateType?: CardUpdateReason | undefined; }; /** @internal */ export const CardAccountUpdater$inboundSchema: z.ZodType< CardAccountUpdater, z.ZodTypeDef, unknown > = z.object({ updatedOn: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), updateType: CardUpdateReason$inboundSchema.optional(), }); /** @internal */ export type CardAccountUpdater$Outbound = { updatedOn?: string | undefined; updateType?: string | undefined; }; /** @internal */ export const CardAccountUpdater$outboundSchema: z.ZodType< CardAccountUpdater$Outbound, z.ZodTypeDef, CardAccountUpdater > = z.object({ updatedOn: z.date().transform(v => v.toISOString()).optional(), updateType: CardUpdateReason$outboundSchema.optional(), }); export function cardAccountUpdaterToJSON( cardAccountUpdater: CardAccountUpdater, ): string { return JSON.stringify( CardAccountUpdater$outboundSchema.parse(cardAccountUpdater), ); } export function cardAccountUpdaterFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CardAccountUpdater$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CardAccountUpdater' from JSON`, ); }