/* * 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 AccountingPurchaseOrdersUpdateGlobals = { /** * 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 AccountingPurchaseOrdersUpdateRequest = { /** * 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; purchaseOrder: components.PurchaseOrderInput; }; export type AccountingPurchaseOrdersUpdateResponse = { httpMeta: components.HTTPMetadata; /** * PurchaseOrders */ updatePurchaseOrderResponse?: | components.UpdatePurchaseOrderResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingPurchaseOrdersUpdateGlobals$inboundSchema: z.ZodType< AccountingPurchaseOrdersUpdateGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingPurchaseOrdersUpdateGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingPurchaseOrdersUpdateGlobals$outboundSchema: z.ZodType< AccountingPurchaseOrdersUpdateGlobals$Outbound, z.ZodTypeDef, AccountingPurchaseOrdersUpdateGlobals > = 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 AccountingPurchaseOrdersUpdateGlobals$ { /** @deprecated use `AccountingPurchaseOrdersUpdateGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingPurchaseOrdersUpdateGlobals$inboundSchema; /** @deprecated use `AccountingPurchaseOrdersUpdateGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingPurchaseOrdersUpdateGlobals$outboundSchema; /** @deprecated use `AccountingPurchaseOrdersUpdateGlobals$Outbound` instead. */ export type Outbound = AccountingPurchaseOrdersUpdateGlobals$Outbound; } export function accountingPurchaseOrdersUpdateGlobalsToJSON( accountingPurchaseOrdersUpdateGlobals: AccountingPurchaseOrdersUpdateGlobals, ): string { return JSON.stringify( AccountingPurchaseOrdersUpdateGlobals$outboundSchema.parse( accountingPurchaseOrdersUpdateGlobals, ), ); } export function accountingPurchaseOrdersUpdateGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingPurchaseOrdersUpdateGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingPurchaseOrdersUpdateGlobals' from JSON`, ); } /** @internal */ export const AccountingPurchaseOrdersUpdateRequest$inboundSchema: z.ZodType< AccountingPurchaseOrdersUpdateRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), PurchaseOrder: components.PurchaseOrderInput$inboundSchema, }).transform((v) => { return remap$(v, { "PurchaseOrder": "purchaseOrder", }); }); /** @internal */ export type AccountingPurchaseOrdersUpdateRequest$Outbound = { id: string; serviceId?: string | undefined; raw: boolean; PurchaseOrder: components.PurchaseOrderInput$Outbound; }; /** @internal */ export const AccountingPurchaseOrdersUpdateRequest$outboundSchema: z.ZodType< AccountingPurchaseOrdersUpdateRequest$Outbound, z.ZodTypeDef, AccountingPurchaseOrdersUpdateRequest > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), 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 AccountingPurchaseOrdersUpdateRequest$ { /** @deprecated use `AccountingPurchaseOrdersUpdateRequest$inboundSchema` instead. */ export const inboundSchema = AccountingPurchaseOrdersUpdateRequest$inboundSchema; /** @deprecated use `AccountingPurchaseOrdersUpdateRequest$outboundSchema` instead. */ export const outboundSchema = AccountingPurchaseOrdersUpdateRequest$outboundSchema; /** @deprecated use `AccountingPurchaseOrdersUpdateRequest$Outbound` instead. */ export type Outbound = AccountingPurchaseOrdersUpdateRequest$Outbound; } export function accountingPurchaseOrdersUpdateRequestToJSON( accountingPurchaseOrdersUpdateRequest: AccountingPurchaseOrdersUpdateRequest, ): string { return JSON.stringify( AccountingPurchaseOrdersUpdateRequest$outboundSchema.parse( accountingPurchaseOrdersUpdateRequest, ), ); } export function accountingPurchaseOrdersUpdateRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingPurchaseOrdersUpdateRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingPurchaseOrdersUpdateRequest' from JSON`, ); } /** @internal */ export const AccountingPurchaseOrdersUpdateResponse$inboundSchema: z.ZodType< AccountingPurchaseOrdersUpdateResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, UpdatePurchaseOrderResponse: components .UpdatePurchaseOrderResponse$inboundSchema.optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "UpdatePurchaseOrderResponse": "updatePurchaseOrderResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingPurchaseOrdersUpdateResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; UpdatePurchaseOrderResponse?: | components.UpdatePurchaseOrderResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingPurchaseOrdersUpdateResponse$outboundSchema: z.ZodType< AccountingPurchaseOrdersUpdateResponse$Outbound, z.ZodTypeDef, AccountingPurchaseOrdersUpdateResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, updatePurchaseOrderResponse: components .UpdatePurchaseOrderResponse$outboundSchema.optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", updatePurchaseOrderResponse: "UpdatePurchaseOrderResponse", 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 AccountingPurchaseOrdersUpdateResponse$ { /** @deprecated use `AccountingPurchaseOrdersUpdateResponse$inboundSchema` instead. */ export const inboundSchema = AccountingPurchaseOrdersUpdateResponse$inboundSchema; /** @deprecated use `AccountingPurchaseOrdersUpdateResponse$outboundSchema` instead. */ export const outboundSchema = AccountingPurchaseOrdersUpdateResponse$outboundSchema; /** @deprecated use `AccountingPurchaseOrdersUpdateResponse$Outbound` instead. */ export type Outbound = AccountingPurchaseOrdersUpdateResponse$Outbound; } export function accountingPurchaseOrdersUpdateResponseToJSON( accountingPurchaseOrdersUpdateResponse: AccountingPurchaseOrdersUpdateResponse, ): string { return JSON.stringify( AccountingPurchaseOrdersUpdateResponse$outboundSchema.parse( accountingPurchaseOrdersUpdateResponse, ), ); } export function accountingPurchaseOrdersUpdateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingPurchaseOrdersUpdateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingPurchaseOrdersUpdateResponse' from JSON`, ); }