/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$ } from "../../lib/schemas.js"; import { PaymentCreateInput, PaymentCreateInput$Outbound, PaymentCreateInput$outboundSchema, } from "./paymentcreateinput.js"; export type BatchPaymentsRequestItems = { /** * A caller-supplied reference for this item, echoed back on the matching result so each outcome can be tied to the record it came from. Must be unique within the request. Never sent to the connector. */ ref?: string | undefined; /** * The writable shape of Payment for a batch create. Identical to [Payment](the model returned on reads) with the read-only properties removed — the same properties the single-record create endpoint rejects, so a batched record and a single-record create accept exactly the same body. */ data: PaymentCreateInput; }; /** * A batch of payments to write in a single request. Each item is processed independently: some may succeed while others fail, and the response carries one result per item in the order they were sent. */ export type BatchPaymentsRequest = { /** * The records to write. The per-connector limit is the real cap and is usually lower than the ceiling here: read `batch_support.resources[].max_items` on the Connector API for the connector you are calling, or the resource gotchas. This ceiling exists so an oversized array is rejected by request validation before any per-item work runs, rather than after it. */ items: Array; }; /** @internal */ export type BatchPaymentsRequestItems$Outbound = { _ref?: string | undefined; data: PaymentCreateInput$Outbound; }; /** @internal */ export const BatchPaymentsRequestItems$outboundSchema: z.ZodType< BatchPaymentsRequestItems$Outbound, z.ZodTypeDef, BatchPaymentsRequestItems > = /* @__PURE__ */ lazySchema$(() => z.object({ ref: z.string().optional(), data: PaymentCreateInput$outboundSchema, }).transform((v) => { return remap$(v, { ref: "_ref", }); }) ); export function batchPaymentsRequestItemsToJSON( batchPaymentsRequestItems: BatchPaymentsRequestItems, ): string { return JSON.stringify( BatchPaymentsRequestItems$outboundSchema.parse(batchPaymentsRequestItems), ); } /** @internal */ export type BatchPaymentsRequest$Outbound = { items: Array; }; /** @internal */ export const BatchPaymentsRequest$outboundSchema: z.ZodType< BatchPaymentsRequest$Outbound, z.ZodTypeDef, BatchPaymentsRequest > = /* @__PURE__ */ lazySchema$(() => z.object({ items: z.array(z.lazy(() => BatchPaymentsRequestItems$outboundSchema)), }) ); export function batchPaymentsRequestToJSON( batchPaymentsRequest: BatchPaymentsRequest, ): string { return JSON.stringify( BatchPaymentsRequest$outboundSchema.parse(batchPaymentsRequest), ); }