/* * 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 AccountingPurchaseOrdersAddGlobals = { /** * 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 AccountingPurchaseOrdersAddRequest = { /** * 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; purchaseOrder: components.PurchaseOrderInput; }; export type AccountingPurchaseOrdersAddResponse = { httpMeta: components.HTTPMetadata; /** * PurchaseOrders */ createPurchaseOrderResponse?: | components.CreatePurchaseOrderResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingPurchaseOrdersAddGlobals$inboundSchema: z.ZodType< AccountingPurchaseOrdersAddGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingPurchaseOrdersAddGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingPurchaseOrdersAddGlobals$outboundSchema: z.ZodType< AccountingPurchaseOrdersAddGlobals$Outbound, z.ZodTypeDef, AccountingPurchaseOrdersAddGlobals > = 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 AccountingPurchaseOrdersAddGlobals$ { /** @deprecated use `AccountingPurchaseOrdersAddGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingPurchaseOrdersAddGlobals$inboundSchema; /** @deprecated use `AccountingPurchaseOrdersAddGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingPurchaseOrdersAddGlobals$outboundSchema; /** @deprecated use `AccountingPurchaseOrdersAddGlobals$Outbound` instead. */ export type Outbound = AccountingPurchaseOrdersAddGlobals$Outbound; } export function accountingPurchaseOrdersAddGlobalsToJSON( accountingPurchaseOrdersAddGlobals: AccountingPurchaseOrdersAddGlobals, ): string { return JSON.stringify( AccountingPurchaseOrdersAddGlobals$outboundSchema.parse( accountingPurchaseOrdersAddGlobals, ), ); } export function accountingPurchaseOrdersAddGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingPurchaseOrdersAddGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingPurchaseOrdersAddGlobals' from JSON`, ); } /** @internal */ export const AccountingPurchaseOrdersAddRequest$inboundSchema: z.ZodType< AccountingPurchaseOrdersAddRequest, z.ZodTypeDef, unknown > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), PurchaseOrder: components.PurchaseOrderInput$inboundSchema, }).transform((v) => { return remap$(v, { "PurchaseOrder": "purchaseOrder", }); }); /** @internal */ export type AccountingPurchaseOrdersAddRequest$Outbound = { raw: boolean; serviceId?: string | undefined; PurchaseOrder: components.PurchaseOrderInput$Outbound; }; /** @internal */ export const AccountingPurchaseOrdersAddRequest$outboundSchema: z.ZodType< AccountingPurchaseOrdersAddRequest$Outbound, z.ZodTypeDef, AccountingPurchaseOrdersAddRequest > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), purchaseOrder: components.PurchaseOrderInput$outboundSchema, }).transform((v) => { return remap$(v, { purchaseOrder: "PurchaseOrder", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingPurchaseOrdersAddRequest$ { /** @deprecated use `AccountingPurchaseOrdersAddRequest$inboundSchema` instead. */ export const inboundSchema = AccountingPurchaseOrdersAddRequest$inboundSchema; /** @deprecated use `AccountingPurchaseOrdersAddRequest$outboundSchema` instead. */ export const outboundSchema = AccountingPurchaseOrdersAddRequest$outboundSchema; /** @deprecated use `AccountingPurchaseOrdersAddRequest$Outbound` instead. */ export type Outbound = AccountingPurchaseOrdersAddRequest$Outbound; } export function accountingPurchaseOrdersAddRequestToJSON( accountingPurchaseOrdersAddRequest: AccountingPurchaseOrdersAddRequest, ): string { return JSON.stringify( AccountingPurchaseOrdersAddRequest$outboundSchema.parse( accountingPurchaseOrdersAddRequest, ), ); } export function accountingPurchaseOrdersAddRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingPurchaseOrdersAddRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingPurchaseOrdersAddRequest' from JSON`, ); } /** @internal */ export const AccountingPurchaseOrdersAddResponse$inboundSchema: z.ZodType< AccountingPurchaseOrdersAddResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CreatePurchaseOrderResponse: components .CreatePurchaseOrderResponse$inboundSchema.optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CreatePurchaseOrderResponse": "createPurchaseOrderResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingPurchaseOrdersAddResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; CreatePurchaseOrderResponse?: | components.CreatePurchaseOrderResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingPurchaseOrdersAddResponse$outboundSchema: z.ZodType< AccountingPurchaseOrdersAddResponse$Outbound, z.ZodTypeDef, AccountingPurchaseOrdersAddResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, createPurchaseOrderResponse: components .CreatePurchaseOrderResponse$outboundSchema.optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", createPurchaseOrderResponse: "CreatePurchaseOrderResponse", 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 AccountingPurchaseOrdersAddResponse$ { /** @deprecated use `AccountingPurchaseOrdersAddResponse$inboundSchema` instead. */ export const inboundSchema = AccountingPurchaseOrdersAddResponse$inboundSchema; /** @deprecated use `AccountingPurchaseOrdersAddResponse$outboundSchema` instead. */ export const outboundSchema = AccountingPurchaseOrdersAddResponse$outboundSchema; /** @deprecated use `AccountingPurchaseOrdersAddResponse$Outbound` instead. */ export type Outbound = AccountingPurchaseOrdersAddResponse$Outbound; } export function accountingPurchaseOrdersAddResponseToJSON( accountingPurchaseOrdersAddResponse: AccountingPurchaseOrdersAddResponse, ): string { return JSON.stringify( AccountingPurchaseOrdersAddResponse$outboundSchema.parse( accountingPurchaseOrdersAddResponse, ), ); } export function accountingPurchaseOrdersAddResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingPurchaseOrdersAddResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingPurchaseOrdersAddResponse' from JSON`, ); }