/* * 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 { JournalEntryCreateInput, JournalEntryCreateInput$Outbound, JournalEntryCreateInput$outboundSchema, } from "./journalentrycreateinput.js"; export type BatchJournalEntriesRequestItems = { /** * 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 JournalEntry for a batch create. Identical to [JournalEntry](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: JournalEntryCreateInput; }; /** * A batch of journal entries 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 BatchJournalEntriesRequest = { /** * 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 BatchJournalEntriesRequestItems$Outbound = { _ref?: string | undefined; data: JournalEntryCreateInput$Outbound; }; /** @internal */ export const BatchJournalEntriesRequestItems$outboundSchema: z.ZodType< BatchJournalEntriesRequestItems$Outbound, z.ZodTypeDef, BatchJournalEntriesRequestItems > = /* @__PURE__ */ lazySchema$(() => z.object({ ref: z.string().optional(), data: JournalEntryCreateInput$outboundSchema, }).transform((v) => { return remap$(v, { ref: "_ref", }); }) ); export function batchJournalEntriesRequestItemsToJSON( batchJournalEntriesRequestItems: BatchJournalEntriesRequestItems, ): string { return JSON.stringify( BatchJournalEntriesRequestItems$outboundSchema.parse( batchJournalEntriesRequestItems, ), ); } /** @internal */ export type BatchJournalEntriesRequest$Outbound = { items: Array; }; /** @internal */ export const BatchJournalEntriesRequest$outboundSchema: z.ZodType< BatchJournalEntriesRequest$Outbound, z.ZodTypeDef, BatchJournalEntriesRequest > = /* @__PURE__ */ lazySchema$(() => z.object({ items: z.array( z.lazy(() => BatchJournalEntriesRequestItems$outboundSchema), ), }) ); export function batchJournalEntriesRequestToJSON( batchJournalEntriesRequest: BatchJournalEntriesRequest, ): string { return JSON.stringify( BatchJournalEntriesRequest$outboundSchema.parse(batchJournalEntriesRequest), ); }