/* * 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 AccountingInvoicesUpdateGlobals = { /** * 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 AccountingInvoicesUpdateRequest = { /** * 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; invoice: components.InvoiceInput; }; export type AccountingInvoicesUpdateResponse = { httpMeta: components.HTTPMetadata; /** * Invoice updated */ updateInvoiceResponse?: components.UpdateInvoiceResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingInvoicesUpdateGlobals$inboundSchema: z.ZodType< AccountingInvoicesUpdateGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingInvoicesUpdateGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingInvoicesUpdateGlobals$outboundSchema: z.ZodType< AccountingInvoicesUpdateGlobals$Outbound, z.ZodTypeDef, AccountingInvoicesUpdateGlobals > = 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 AccountingInvoicesUpdateGlobals$ { /** @deprecated use `AccountingInvoicesUpdateGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingInvoicesUpdateGlobals$inboundSchema; /** @deprecated use `AccountingInvoicesUpdateGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingInvoicesUpdateGlobals$outboundSchema; /** @deprecated use `AccountingInvoicesUpdateGlobals$Outbound` instead. */ export type Outbound = AccountingInvoicesUpdateGlobals$Outbound; } export function accountingInvoicesUpdateGlobalsToJSON( accountingInvoicesUpdateGlobals: AccountingInvoicesUpdateGlobals, ): string { return JSON.stringify( AccountingInvoicesUpdateGlobals$outboundSchema.parse( accountingInvoicesUpdateGlobals, ), ); } export function accountingInvoicesUpdateGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingInvoicesUpdateGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingInvoicesUpdateGlobals' from JSON`, ); } /** @internal */ export const AccountingInvoicesUpdateRequest$inboundSchema: z.ZodType< AccountingInvoicesUpdateRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), Invoice: components.InvoiceInput$inboundSchema, }).transform((v) => { return remap$(v, { "Invoice": "invoice", }); }); /** @internal */ export type AccountingInvoicesUpdateRequest$Outbound = { id: string; serviceId?: string | undefined; raw: boolean; Invoice: components.InvoiceInput$Outbound; }; /** @internal */ export const AccountingInvoicesUpdateRequest$outboundSchema: z.ZodType< AccountingInvoicesUpdateRequest$Outbound, z.ZodTypeDef, AccountingInvoicesUpdateRequest > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), invoice: components.InvoiceInput$outboundSchema, }).transform((v) => { return remap$(v, { invoice: "Invoice", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingInvoicesUpdateRequest$ { /** @deprecated use `AccountingInvoicesUpdateRequest$inboundSchema` instead. */ export const inboundSchema = AccountingInvoicesUpdateRequest$inboundSchema; /** @deprecated use `AccountingInvoicesUpdateRequest$outboundSchema` instead. */ export const outboundSchema = AccountingInvoicesUpdateRequest$outboundSchema; /** @deprecated use `AccountingInvoicesUpdateRequest$Outbound` instead. */ export type Outbound = AccountingInvoicesUpdateRequest$Outbound; } export function accountingInvoicesUpdateRequestToJSON( accountingInvoicesUpdateRequest: AccountingInvoicesUpdateRequest, ): string { return JSON.stringify( AccountingInvoicesUpdateRequest$outboundSchema.parse( accountingInvoicesUpdateRequest, ), ); } export function accountingInvoicesUpdateRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingInvoicesUpdateRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingInvoicesUpdateRequest' from JSON`, ); } /** @internal */ export const AccountingInvoicesUpdateResponse$inboundSchema: z.ZodType< AccountingInvoicesUpdateResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, UpdateInvoiceResponse: components.UpdateInvoiceResponse$inboundSchema .optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "UpdateInvoiceResponse": "updateInvoiceResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingInvoicesUpdateResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; UpdateInvoiceResponse?: components.UpdateInvoiceResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingInvoicesUpdateResponse$outboundSchema: z.ZodType< AccountingInvoicesUpdateResponse$Outbound, z.ZodTypeDef, AccountingInvoicesUpdateResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, updateInvoiceResponse: components.UpdateInvoiceResponse$outboundSchema .optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", updateInvoiceResponse: "UpdateInvoiceResponse", 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 AccountingInvoicesUpdateResponse$ { /** @deprecated use `AccountingInvoicesUpdateResponse$inboundSchema` instead. */ export const inboundSchema = AccountingInvoicesUpdateResponse$inboundSchema; /** @deprecated use `AccountingInvoicesUpdateResponse$outboundSchema` instead. */ export const outboundSchema = AccountingInvoicesUpdateResponse$outboundSchema; /** @deprecated use `AccountingInvoicesUpdateResponse$Outbound` instead. */ export type Outbound = AccountingInvoicesUpdateResponse$Outbound; } export function accountingInvoicesUpdateResponseToJSON( accountingInvoicesUpdateResponse: AccountingInvoicesUpdateResponse, ): string { return JSON.stringify( AccountingInvoicesUpdateResponse$outboundSchema.parse( accountingInvoicesUpdateResponse, ), ); } export function accountingInvoicesUpdateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingInvoicesUpdateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingInvoicesUpdateResponse' from JSON`, ); }