/* * 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 AccountingInvoiceItemsUpdateGlobals = { /** * 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 AccountingInvoiceItemsUpdateRequest = { /** * 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; invoiceItem: components.InvoiceItemInput; }; export type AccountingInvoiceItemsUpdateResponse = { httpMeta: components.HTTPMetadata; /** * InvoiceItems */ updateInvoiceItemsResponse?: | components.UpdateInvoiceItemsResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingInvoiceItemsUpdateGlobals$inboundSchema: z.ZodType< AccountingInvoiceItemsUpdateGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingInvoiceItemsUpdateGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingInvoiceItemsUpdateGlobals$outboundSchema: z.ZodType< AccountingInvoiceItemsUpdateGlobals$Outbound, z.ZodTypeDef, AccountingInvoiceItemsUpdateGlobals > = 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 AccountingInvoiceItemsUpdateGlobals$ { /** @deprecated use `AccountingInvoiceItemsUpdateGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingInvoiceItemsUpdateGlobals$inboundSchema; /** @deprecated use `AccountingInvoiceItemsUpdateGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingInvoiceItemsUpdateGlobals$outboundSchema; /** @deprecated use `AccountingInvoiceItemsUpdateGlobals$Outbound` instead. */ export type Outbound = AccountingInvoiceItemsUpdateGlobals$Outbound; } export function accountingInvoiceItemsUpdateGlobalsToJSON( accountingInvoiceItemsUpdateGlobals: AccountingInvoiceItemsUpdateGlobals, ): string { return JSON.stringify( AccountingInvoiceItemsUpdateGlobals$outboundSchema.parse( accountingInvoiceItemsUpdateGlobals, ), ); } export function accountingInvoiceItemsUpdateGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingInvoiceItemsUpdateGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingInvoiceItemsUpdateGlobals' from JSON`, ); } /** @internal */ export const AccountingInvoiceItemsUpdateRequest$inboundSchema: z.ZodType< AccountingInvoiceItemsUpdateRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), InvoiceItem: components.InvoiceItemInput$inboundSchema, }).transform((v) => { return remap$(v, { "InvoiceItem": "invoiceItem", }); }); /** @internal */ export type AccountingInvoiceItemsUpdateRequest$Outbound = { id: string; serviceId?: string | undefined; raw: boolean; InvoiceItem: components.InvoiceItemInput$Outbound; }; /** @internal */ export const AccountingInvoiceItemsUpdateRequest$outboundSchema: z.ZodType< AccountingInvoiceItemsUpdateRequest$Outbound, z.ZodTypeDef, AccountingInvoiceItemsUpdateRequest > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), invoiceItem: components.InvoiceItemInput$outboundSchema, }).transform((v) => { return remap$(v, { invoiceItem: "InvoiceItem", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingInvoiceItemsUpdateRequest$ { /** @deprecated use `AccountingInvoiceItemsUpdateRequest$inboundSchema` instead. */ export const inboundSchema = AccountingInvoiceItemsUpdateRequest$inboundSchema; /** @deprecated use `AccountingInvoiceItemsUpdateRequest$outboundSchema` instead. */ export const outboundSchema = AccountingInvoiceItemsUpdateRequest$outboundSchema; /** @deprecated use `AccountingInvoiceItemsUpdateRequest$Outbound` instead. */ export type Outbound = AccountingInvoiceItemsUpdateRequest$Outbound; } export function accountingInvoiceItemsUpdateRequestToJSON( accountingInvoiceItemsUpdateRequest: AccountingInvoiceItemsUpdateRequest, ): string { return JSON.stringify( AccountingInvoiceItemsUpdateRequest$outboundSchema.parse( accountingInvoiceItemsUpdateRequest, ), ); } export function accountingInvoiceItemsUpdateRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingInvoiceItemsUpdateRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingInvoiceItemsUpdateRequest' from JSON`, ); } /** @internal */ export const AccountingInvoiceItemsUpdateResponse$inboundSchema: z.ZodType< AccountingInvoiceItemsUpdateResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, UpdateInvoiceItemsResponse: components .UpdateInvoiceItemsResponse$inboundSchema.optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "UpdateInvoiceItemsResponse": "updateInvoiceItemsResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingInvoiceItemsUpdateResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; UpdateInvoiceItemsResponse?: | components.UpdateInvoiceItemsResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingInvoiceItemsUpdateResponse$outboundSchema: z.ZodType< AccountingInvoiceItemsUpdateResponse$Outbound, z.ZodTypeDef, AccountingInvoiceItemsUpdateResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, updateInvoiceItemsResponse: components .UpdateInvoiceItemsResponse$outboundSchema.optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", updateInvoiceItemsResponse: "UpdateInvoiceItemsResponse", 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 AccountingInvoiceItemsUpdateResponse$ { /** @deprecated use `AccountingInvoiceItemsUpdateResponse$inboundSchema` instead. */ export const inboundSchema = AccountingInvoiceItemsUpdateResponse$inboundSchema; /** @deprecated use `AccountingInvoiceItemsUpdateResponse$outboundSchema` instead. */ export const outboundSchema = AccountingInvoiceItemsUpdateResponse$outboundSchema; /** @deprecated use `AccountingInvoiceItemsUpdateResponse$Outbound` instead. */ export type Outbound = AccountingInvoiceItemsUpdateResponse$Outbound; } export function accountingInvoiceItemsUpdateResponseToJSON( accountingInvoiceItemsUpdateResponse: AccountingInvoiceItemsUpdateResponse, ): string { return JSON.stringify( AccountingInvoiceItemsUpdateResponse$outboundSchema.parse( accountingInvoiceItemsUpdateResponse, ), ); } export function accountingInvoiceItemsUpdateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingInvoiceItemsUpdateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingInvoiceItemsUpdateResponse' from JSON`, ); }