/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The type of receipt being requested. */ export const Kind = { SaleCustomerV1: "sale.customer.v1", } as const; /** * The type of receipt being requested. */ export type Kind = ClosedEnum; /** * A receipt request for a specific transfer, schedule, or schedule occurrence. */ export type ReceiptRequest = { kind: Kind; /** * The email address to send the receipt to. * * @remarks * Either email or emailAccountID must be provided, but not both. */ email?: string | undefined; /** * The accountID to send the receipt to. * * @remarks * Either email or emailAccountID must be provided, but not both. */ emailAccountID?: string | undefined; /** * The ID of the transfer associated with this receipt. * * @remarks * Exactly one of forTransferID, forScheduleID, or forOccurrenceID must be provided. */ forTransferID?: string | undefined; /** * The ID of the schedule associated with this receipt. * * @remarks * Exactly one of forTransferID, forScheduleID, or forOccurrenceID must be provided. */ forScheduleID?: string | undefined; /** * The ID of the schedule occurrence associated with this receipt. * * @remarks * Exactly one of forTransferID, forScheduleID, or forOccurrenceID must be provided. */ forOccurrenceID?: string | undefined; }; /** @internal */ export const Kind$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Kind, ); /** @internal */ export const Kind$outboundSchema: z.ZodNativeEnum = Kind$inboundSchema; /** @internal */ export const ReceiptRequest$inboundSchema: z.ZodType< ReceiptRequest, z.ZodTypeDef, unknown > = z.object({ kind: Kind$inboundSchema, email: z.string().optional(), emailAccountID: z.string().optional(), forTransferID: z.string().optional(), forScheduleID: z.string().optional(), forOccurrenceID: z.string().optional(), }); /** @internal */ export type ReceiptRequest$Outbound = { kind: string; email?: string | undefined; emailAccountID?: string | undefined; forTransferID?: string | undefined; forScheduleID?: string | undefined; forOccurrenceID?: string | undefined; }; /** @internal */ export const ReceiptRequest$outboundSchema: z.ZodType< ReceiptRequest$Outbound, z.ZodTypeDef, ReceiptRequest > = z.object({ kind: Kind$outboundSchema, email: z.string().optional(), emailAccountID: z.string().optional(), forTransferID: z.string().optional(), forScheduleID: z.string().optional(), forOccurrenceID: z.string().optional(), }); export function receiptRequestToJSON(receiptRequest: ReceiptRequest): string { return JSON.stringify(ReceiptRequest$outboundSchema.parse(receiptRequest)); } export function receiptRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ReceiptRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReceiptRequest' from JSON`, ); }