/* * 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 AccountingInvoicesAddGlobals = { /** * 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 AccountingInvoicesAddRequest = { /** * 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; invoice: components.InvoiceInput; }; export type AccountingInvoicesAddResponse = { httpMeta: components.HTTPMetadata; /** * Invoice created */ createInvoiceResponse?: components.CreateInvoiceResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingInvoicesAddGlobals$inboundSchema: z.ZodType< AccountingInvoicesAddGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingInvoicesAddGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingInvoicesAddGlobals$outboundSchema: z.ZodType< AccountingInvoicesAddGlobals$Outbound, z.ZodTypeDef, AccountingInvoicesAddGlobals > = 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 AccountingInvoicesAddGlobals$ { /** @deprecated use `AccountingInvoicesAddGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingInvoicesAddGlobals$inboundSchema; /** @deprecated use `AccountingInvoicesAddGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingInvoicesAddGlobals$outboundSchema; /** @deprecated use `AccountingInvoicesAddGlobals$Outbound` instead. */ export type Outbound = AccountingInvoicesAddGlobals$Outbound; } export function accountingInvoicesAddGlobalsToJSON( accountingInvoicesAddGlobals: AccountingInvoicesAddGlobals, ): string { return JSON.stringify( AccountingInvoicesAddGlobals$outboundSchema.parse( accountingInvoicesAddGlobals, ), ); } export function accountingInvoicesAddGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingInvoicesAddGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingInvoicesAddGlobals' from JSON`, ); } /** @internal */ export const AccountingInvoicesAddRequest$inboundSchema: z.ZodType< AccountingInvoicesAddRequest, z.ZodTypeDef, unknown > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), Invoice: components.InvoiceInput$inboundSchema, }).transform((v) => { return remap$(v, { "Invoice": "invoice", }); }); /** @internal */ export type AccountingInvoicesAddRequest$Outbound = { raw: boolean; serviceId?: string | undefined; Invoice: components.InvoiceInput$Outbound; }; /** @internal */ export const AccountingInvoicesAddRequest$outboundSchema: z.ZodType< AccountingInvoicesAddRequest$Outbound, z.ZodTypeDef, AccountingInvoicesAddRequest > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), 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 AccountingInvoicesAddRequest$ { /** @deprecated use `AccountingInvoicesAddRequest$inboundSchema` instead. */ export const inboundSchema = AccountingInvoicesAddRequest$inboundSchema; /** @deprecated use `AccountingInvoicesAddRequest$outboundSchema` instead. */ export const outboundSchema = AccountingInvoicesAddRequest$outboundSchema; /** @deprecated use `AccountingInvoicesAddRequest$Outbound` instead. */ export type Outbound = AccountingInvoicesAddRequest$Outbound; } export function accountingInvoicesAddRequestToJSON( accountingInvoicesAddRequest: AccountingInvoicesAddRequest, ): string { return JSON.stringify( AccountingInvoicesAddRequest$outboundSchema.parse( accountingInvoicesAddRequest, ), ); } export function accountingInvoicesAddRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingInvoicesAddRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingInvoicesAddRequest' from JSON`, ); } /** @internal */ export const AccountingInvoicesAddResponse$inboundSchema: z.ZodType< AccountingInvoicesAddResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CreateInvoiceResponse: components.CreateInvoiceResponse$inboundSchema .optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CreateInvoiceResponse": "createInvoiceResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingInvoicesAddResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; CreateInvoiceResponse?: components.CreateInvoiceResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingInvoicesAddResponse$outboundSchema: z.ZodType< AccountingInvoicesAddResponse$Outbound, z.ZodTypeDef, AccountingInvoicesAddResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, createInvoiceResponse: components.CreateInvoiceResponse$outboundSchema .optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", createInvoiceResponse: "CreateInvoiceResponse", 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 AccountingInvoicesAddResponse$ { /** @deprecated use `AccountingInvoicesAddResponse$inboundSchema` instead. */ export const inboundSchema = AccountingInvoicesAddResponse$inboundSchema; /** @deprecated use `AccountingInvoicesAddResponse$outboundSchema` instead. */ export const outboundSchema = AccountingInvoicesAddResponse$outboundSchema; /** @deprecated use `AccountingInvoicesAddResponse$Outbound` instead. */ export type Outbound = AccountingInvoicesAddResponse$Outbound; } export function accountingInvoicesAddResponseToJSON( accountingInvoicesAddResponse: AccountingInvoicesAddResponse, ): string { return JSON.stringify( AccountingInvoicesAddResponse$outboundSchema.parse( accountingInvoicesAddResponse, ), ); } export function accountingInvoicesAddResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingInvoicesAddResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingInvoicesAddResponse' from JSON`, ); }