/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type AccountingJournalEntriesAddGlobals = { /** * ID of the consumer which you want to get or push data from */ consumerId?: string | undefined; /** * The ID of your Unify application */ appId?: string | undefined; }; export type AccountingJournalEntriesAddRequest = { /** * Include raw response. Mostly used for debugging purposes */ raw?: boolean | undefined; /** * Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. */ serviceId?: string | undefined; journalEntry: components.JournalEntryInput; }; export type AccountingJournalEntriesAddResponse = { httpMeta: components.HTTPMetadata; /** * JournalEntries */ createJournalEntryResponse?: | components.CreateJournalEntryResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingJournalEntriesAddGlobals$inboundSchema: z.ZodType< AccountingJournalEntriesAddGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingJournalEntriesAddGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingJournalEntriesAddGlobals$outboundSchema: z.ZodType< AccountingJournalEntriesAddGlobals$Outbound, z.ZodTypeDef, AccountingJournalEntriesAddGlobals > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingJournalEntriesAddGlobals$ { /** @deprecated use `AccountingJournalEntriesAddGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingJournalEntriesAddGlobals$inboundSchema; /** @deprecated use `AccountingJournalEntriesAddGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingJournalEntriesAddGlobals$outboundSchema; /** @deprecated use `AccountingJournalEntriesAddGlobals$Outbound` instead. */ export type Outbound = AccountingJournalEntriesAddGlobals$Outbound; } export function accountingJournalEntriesAddGlobalsToJSON( accountingJournalEntriesAddGlobals: AccountingJournalEntriesAddGlobals, ): string { return JSON.stringify( AccountingJournalEntriesAddGlobals$outboundSchema.parse( accountingJournalEntriesAddGlobals, ), ); } export function accountingJournalEntriesAddGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingJournalEntriesAddGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingJournalEntriesAddGlobals' from JSON`, ); } /** @internal */ export const AccountingJournalEntriesAddRequest$inboundSchema: z.ZodType< AccountingJournalEntriesAddRequest, z.ZodTypeDef, unknown > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), JournalEntry: components.JournalEntryInput$inboundSchema, }).transform((v) => { return remap$(v, { "JournalEntry": "journalEntry", }); }); /** @internal */ export type AccountingJournalEntriesAddRequest$Outbound = { raw: boolean; serviceId?: string | undefined; JournalEntry: components.JournalEntryInput$Outbound; }; /** @internal */ export const AccountingJournalEntriesAddRequest$outboundSchema: z.ZodType< AccountingJournalEntriesAddRequest$Outbound, z.ZodTypeDef, AccountingJournalEntriesAddRequest > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), journalEntry: components.JournalEntryInput$outboundSchema, }).transform((v) => { return remap$(v, { journalEntry: "JournalEntry", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingJournalEntriesAddRequest$ { /** @deprecated use `AccountingJournalEntriesAddRequest$inboundSchema` instead. */ export const inboundSchema = AccountingJournalEntriesAddRequest$inboundSchema; /** @deprecated use `AccountingJournalEntriesAddRequest$outboundSchema` instead. */ export const outboundSchema = AccountingJournalEntriesAddRequest$outboundSchema; /** @deprecated use `AccountingJournalEntriesAddRequest$Outbound` instead. */ export type Outbound = AccountingJournalEntriesAddRequest$Outbound; } export function accountingJournalEntriesAddRequestToJSON( accountingJournalEntriesAddRequest: AccountingJournalEntriesAddRequest, ): string { return JSON.stringify( AccountingJournalEntriesAddRequest$outboundSchema.parse( accountingJournalEntriesAddRequest, ), ); } export function accountingJournalEntriesAddRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingJournalEntriesAddRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingJournalEntriesAddRequest' from JSON`, ); } /** @internal */ export const AccountingJournalEntriesAddResponse$inboundSchema: z.ZodType< AccountingJournalEntriesAddResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CreateJournalEntryResponse: components .CreateJournalEntryResponse$inboundSchema.optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CreateJournalEntryResponse": "createJournalEntryResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingJournalEntriesAddResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; CreateJournalEntryResponse?: | components.CreateJournalEntryResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingJournalEntriesAddResponse$outboundSchema: z.ZodType< AccountingJournalEntriesAddResponse$Outbound, z.ZodTypeDef, AccountingJournalEntriesAddResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, createJournalEntryResponse: components .CreateJournalEntryResponse$outboundSchema.optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", createJournalEntryResponse: "CreateJournalEntryResponse", unexpectedErrorResponse: "UnexpectedErrorResponse", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingJournalEntriesAddResponse$ { /** @deprecated use `AccountingJournalEntriesAddResponse$inboundSchema` instead. */ export const inboundSchema = AccountingJournalEntriesAddResponse$inboundSchema; /** @deprecated use `AccountingJournalEntriesAddResponse$outboundSchema` instead. */ export const outboundSchema = AccountingJournalEntriesAddResponse$outboundSchema; /** @deprecated use `AccountingJournalEntriesAddResponse$Outbound` instead. */ export type Outbound = AccountingJournalEntriesAddResponse$Outbound; } export function accountingJournalEntriesAddResponseToJSON( accountingJournalEntriesAddResponse: AccountingJournalEntriesAddResponse, ): string { return JSON.stringify( AccountingJournalEntriesAddResponse$outboundSchema.parse( accountingJournalEntriesAddResponse, ), ); } export function accountingJournalEntriesAddResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingJournalEntriesAddResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingJournalEntriesAddResponse' from JSON`, ); }