/* * 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 SentReceipt = { /** * Unique identifier for the receipt. */ receiptID: string; /** * The idempotency key used when creating the receipt. */ idempotencyKey: string; /** * When the receipt was sent. */ sentOn: Date; }; /** @internal */ export const SentReceipt$inboundSchema: z.ZodType< SentReceipt, z.ZodTypeDef, unknown > = z.object({ receiptID: z.string(), idempotencyKey: z.string(), sentOn: z.string().datetime({ offset: true }).transform(v => new Date(v)), }); /** @internal */ export type SentReceipt$Outbound = { receiptID: string; idempotencyKey: string; sentOn: string; }; /** @internal */ export const SentReceipt$outboundSchema: z.ZodType< SentReceipt$Outbound, z.ZodTypeDef, SentReceipt > = z.object({ receiptID: z.string(), idempotencyKey: z.string(), sentOn: z.date().transform(v => v.toISOString()), }); export function sentReceiptToJSON(sentReceipt: SentReceipt): string { return JSON.stringify(SentReceipt$outboundSchema.parse(sentReceipt)); } export function sentReceiptFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SentReceipt$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SentReceipt' from JSON`, ); }