/* * 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 AccountingJournalEntriesUpdateGlobals = { /** * 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 AccountingJournalEntriesUpdateRequest = { /** * ID of the record you are acting upon. */ id: string; /** * 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; /** * Include raw response. Mostly used for debugging purposes */ raw?: boolean | undefined; journalEntry: components.JournalEntryInput; }; export type AccountingJournalEntriesUpdateResponse = { httpMeta: components.HTTPMetadata; /** * JournalEntries */ updateJournalEntryResponse?: | components.UpdateJournalEntryResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingJournalEntriesUpdateGlobals$inboundSchema: z.ZodType< AccountingJournalEntriesUpdateGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingJournalEntriesUpdateGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingJournalEntriesUpdateGlobals$outboundSchema: z.ZodType< AccountingJournalEntriesUpdateGlobals$Outbound, z.ZodTypeDef, AccountingJournalEntriesUpdateGlobals > = 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 AccountingJournalEntriesUpdateGlobals$ { /** @deprecated use `AccountingJournalEntriesUpdateGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingJournalEntriesUpdateGlobals$inboundSchema; /** @deprecated use `AccountingJournalEntriesUpdateGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingJournalEntriesUpdateGlobals$outboundSchema; /** @deprecated use `AccountingJournalEntriesUpdateGlobals$Outbound` instead. */ export type Outbound = AccountingJournalEntriesUpdateGlobals$Outbound; } export function accountingJournalEntriesUpdateGlobalsToJSON( accountingJournalEntriesUpdateGlobals: AccountingJournalEntriesUpdateGlobals, ): string { return JSON.stringify( AccountingJournalEntriesUpdateGlobals$outboundSchema.parse( accountingJournalEntriesUpdateGlobals, ), ); } export function accountingJournalEntriesUpdateGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingJournalEntriesUpdateGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingJournalEntriesUpdateGlobals' from JSON`, ); } /** @internal */ export const AccountingJournalEntriesUpdateRequest$inboundSchema: z.ZodType< AccountingJournalEntriesUpdateRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), JournalEntry: components.JournalEntryInput$inboundSchema, }).transform((v) => { return remap$(v, { "JournalEntry": "journalEntry", }); }); /** @internal */ export type AccountingJournalEntriesUpdateRequest$Outbound = { id: string; serviceId?: string | undefined; raw: boolean; JournalEntry: components.JournalEntryInput$Outbound; }; /** @internal */ export const AccountingJournalEntriesUpdateRequest$outboundSchema: z.ZodType< AccountingJournalEntriesUpdateRequest$Outbound, z.ZodTypeDef, AccountingJournalEntriesUpdateRequest > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), 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 AccountingJournalEntriesUpdateRequest$ { /** @deprecated use `AccountingJournalEntriesUpdateRequest$inboundSchema` instead. */ export const inboundSchema = AccountingJournalEntriesUpdateRequest$inboundSchema; /** @deprecated use `AccountingJournalEntriesUpdateRequest$outboundSchema` instead. */ export const outboundSchema = AccountingJournalEntriesUpdateRequest$outboundSchema; /** @deprecated use `AccountingJournalEntriesUpdateRequest$Outbound` instead. */ export type Outbound = AccountingJournalEntriesUpdateRequest$Outbound; } export function accountingJournalEntriesUpdateRequestToJSON( accountingJournalEntriesUpdateRequest: AccountingJournalEntriesUpdateRequest, ): string { return JSON.stringify( AccountingJournalEntriesUpdateRequest$outboundSchema.parse( accountingJournalEntriesUpdateRequest, ), ); } export function accountingJournalEntriesUpdateRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingJournalEntriesUpdateRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingJournalEntriesUpdateRequest' from JSON`, ); } /** @internal */ export const AccountingJournalEntriesUpdateResponse$inboundSchema: z.ZodType< AccountingJournalEntriesUpdateResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, UpdateJournalEntryResponse: components .UpdateJournalEntryResponse$inboundSchema.optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "UpdateJournalEntryResponse": "updateJournalEntryResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingJournalEntriesUpdateResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; UpdateJournalEntryResponse?: | components.UpdateJournalEntryResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingJournalEntriesUpdateResponse$outboundSchema: z.ZodType< AccountingJournalEntriesUpdateResponse$Outbound, z.ZodTypeDef, AccountingJournalEntriesUpdateResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, updateJournalEntryResponse: components .UpdateJournalEntryResponse$outboundSchema.optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", updateJournalEntryResponse: "UpdateJournalEntryResponse", 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 AccountingJournalEntriesUpdateResponse$ { /** @deprecated use `AccountingJournalEntriesUpdateResponse$inboundSchema` instead. */ export const inboundSchema = AccountingJournalEntriesUpdateResponse$inboundSchema; /** @deprecated use `AccountingJournalEntriesUpdateResponse$outboundSchema` instead. */ export const outboundSchema = AccountingJournalEntriesUpdateResponse$outboundSchema; /** @deprecated use `AccountingJournalEntriesUpdateResponse$Outbound` instead. */ export type Outbound = AccountingJournalEntriesUpdateResponse$Outbound; } export function accountingJournalEntriesUpdateResponseToJSON( accountingJournalEntriesUpdateResponse: AccountingJournalEntriesUpdateResponse, ): string { return JSON.stringify( AccountingJournalEntriesUpdateResponse$outboundSchema.parse( accountingJournalEntriesUpdateResponse, ), ); } export function accountingJournalEntriesUpdateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingJournalEntriesUpdateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingJournalEntriesUpdateResponse' from JSON`, ); }