/* * 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 AccountingCustomersAddGlobals = { /** * 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 AccountingCustomersAddRequest = { /** * 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; customer: components.CustomerInput; }; export type AccountingCustomersAddResponse = { httpMeta: components.HTTPMetadata; /** * Customers */ createCustomerResponse?: components.CreateCustomerResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingCustomersAddGlobals$inboundSchema: z.ZodType< AccountingCustomersAddGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingCustomersAddGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingCustomersAddGlobals$outboundSchema: z.ZodType< AccountingCustomersAddGlobals$Outbound, z.ZodTypeDef, AccountingCustomersAddGlobals > = 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 AccountingCustomersAddGlobals$ { /** @deprecated use `AccountingCustomersAddGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingCustomersAddGlobals$inboundSchema; /** @deprecated use `AccountingCustomersAddGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingCustomersAddGlobals$outboundSchema; /** @deprecated use `AccountingCustomersAddGlobals$Outbound` instead. */ export type Outbound = AccountingCustomersAddGlobals$Outbound; } export function accountingCustomersAddGlobalsToJSON( accountingCustomersAddGlobals: AccountingCustomersAddGlobals, ): string { return JSON.stringify( AccountingCustomersAddGlobals$outboundSchema.parse( accountingCustomersAddGlobals, ), ); } export function accountingCustomersAddGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingCustomersAddGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingCustomersAddGlobals' from JSON`, ); } /** @internal */ export const AccountingCustomersAddRequest$inboundSchema: z.ZodType< AccountingCustomersAddRequest, z.ZodTypeDef, unknown > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), Customer: components.CustomerInput$inboundSchema, }).transform((v) => { return remap$(v, { "Customer": "customer", }); }); /** @internal */ export type AccountingCustomersAddRequest$Outbound = { raw: boolean; serviceId?: string | undefined; Customer: components.CustomerInput$Outbound; }; /** @internal */ export const AccountingCustomersAddRequest$outboundSchema: z.ZodType< AccountingCustomersAddRequest$Outbound, z.ZodTypeDef, AccountingCustomersAddRequest > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), customer: components.CustomerInput$outboundSchema, }).transform((v) => { return remap$(v, { customer: "Customer", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingCustomersAddRequest$ { /** @deprecated use `AccountingCustomersAddRequest$inboundSchema` instead. */ export const inboundSchema = AccountingCustomersAddRequest$inboundSchema; /** @deprecated use `AccountingCustomersAddRequest$outboundSchema` instead. */ export const outboundSchema = AccountingCustomersAddRequest$outboundSchema; /** @deprecated use `AccountingCustomersAddRequest$Outbound` instead. */ export type Outbound = AccountingCustomersAddRequest$Outbound; } export function accountingCustomersAddRequestToJSON( accountingCustomersAddRequest: AccountingCustomersAddRequest, ): string { return JSON.stringify( AccountingCustomersAddRequest$outboundSchema.parse( accountingCustomersAddRequest, ), ); } export function accountingCustomersAddRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingCustomersAddRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingCustomersAddRequest' from JSON`, ); } /** @internal */ export const AccountingCustomersAddResponse$inboundSchema: z.ZodType< AccountingCustomersAddResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CreateCustomerResponse: components.CreateCustomerResponse$inboundSchema .optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CreateCustomerResponse": "createCustomerResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingCustomersAddResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; CreateCustomerResponse?: | components.CreateCustomerResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingCustomersAddResponse$outboundSchema: z.ZodType< AccountingCustomersAddResponse$Outbound, z.ZodTypeDef, AccountingCustomersAddResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, createCustomerResponse: components.CreateCustomerResponse$outboundSchema .optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", createCustomerResponse: "CreateCustomerResponse", 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 AccountingCustomersAddResponse$ { /** @deprecated use `AccountingCustomersAddResponse$inboundSchema` instead. */ export const inboundSchema = AccountingCustomersAddResponse$inboundSchema; /** @deprecated use `AccountingCustomersAddResponse$outboundSchema` instead. */ export const outboundSchema = AccountingCustomersAddResponse$outboundSchema; /** @deprecated use `AccountingCustomersAddResponse$Outbound` instead. */ export type Outbound = AccountingCustomersAddResponse$Outbound; } export function accountingCustomersAddResponseToJSON( accountingCustomersAddResponse: AccountingCustomersAddResponse, ): string { return JSON.stringify( AccountingCustomersAddResponse$outboundSchema.parse( accountingCustomersAddResponse, ), ); } export function accountingCustomersAddResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingCustomersAddResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingCustomersAddResponse' from JSON`, ); }