/* * 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 { CreatePaymentLinkLineItem, CreatePaymentLinkLineItem$inboundSchema, CreatePaymentLinkLineItem$Outbound, CreatePaymentLinkLineItem$outboundSchema, } from "./createpaymentlinklineitem.js"; /** * An optional collection of line items for a payment link. * * @remarks * When line items are provided, their total plus sales tax must equal the payment link amount. */ export type CreatePaymentLinkLineItems = { /** * The list of line items. */ items: Array; }; /** @internal */ export const CreatePaymentLinkLineItems$inboundSchema: z.ZodType< CreatePaymentLinkLineItems, z.ZodTypeDef, unknown > = z.object({ items: z.array(CreatePaymentLinkLineItem$inboundSchema), }); /** @internal */ export type CreatePaymentLinkLineItems$Outbound = { items: Array; }; /** @internal */ export const CreatePaymentLinkLineItems$outboundSchema: z.ZodType< CreatePaymentLinkLineItems$Outbound, z.ZodTypeDef, CreatePaymentLinkLineItems > = z.object({ items: z.array(CreatePaymentLinkLineItem$outboundSchema), }); export function createPaymentLinkLineItemsToJSON( createPaymentLinkLineItems: CreatePaymentLinkLineItems, ): string { return JSON.stringify( CreatePaymentLinkLineItems$outboundSchema.parse(createPaymentLinkLineItems), ); } export function createPaymentLinkLineItemsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreatePaymentLinkLineItems$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreatePaymentLinkLineItems' from JSON`, ); }