/* * 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 AccountingDepartmentsAddGlobals = { /** * 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 AccountingDepartmentsAddRequest = { /** * 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; accountingDepartment: components.AccountingDepartmentInput; }; export type AccountingDepartmentsAddResponse = { httpMeta: components.HTTPMetadata; /** * Department */ createAccountingDepartmentResponse?: | components.CreateAccountingDepartmentResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingDepartmentsAddGlobals$inboundSchema: z.ZodType< AccountingDepartmentsAddGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingDepartmentsAddGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingDepartmentsAddGlobals$outboundSchema: z.ZodType< AccountingDepartmentsAddGlobals$Outbound, z.ZodTypeDef, AccountingDepartmentsAddGlobals > = 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 AccountingDepartmentsAddGlobals$ { /** @deprecated use `AccountingDepartmentsAddGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingDepartmentsAddGlobals$inboundSchema; /** @deprecated use `AccountingDepartmentsAddGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingDepartmentsAddGlobals$outboundSchema; /** @deprecated use `AccountingDepartmentsAddGlobals$Outbound` instead. */ export type Outbound = AccountingDepartmentsAddGlobals$Outbound; } export function accountingDepartmentsAddGlobalsToJSON( accountingDepartmentsAddGlobals: AccountingDepartmentsAddGlobals, ): string { return JSON.stringify( AccountingDepartmentsAddGlobals$outboundSchema.parse( accountingDepartmentsAddGlobals, ), ); } export function accountingDepartmentsAddGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingDepartmentsAddGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingDepartmentsAddGlobals' from JSON`, ); } /** @internal */ export const AccountingDepartmentsAddRequest$inboundSchema: z.ZodType< AccountingDepartmentsAddRequest, z.ZodTypeDef, unknown > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), AccountingDepartment: components.AccountingDepartmentInput$inboundSchema, }).transform((v) => { return remap$(v, { "AccountingDepartment": "accountingDepartment", }); }); /** @internal */ export type AccountingDepartmentsAddRequest$Outbound = { raw: boolean; serviceId?: string | undefined; AccountingDepartment: components.AccountingDepartmentInput$Outbound; }; /** @internal */ export const AccountingDepartmentsAddRequest$outboundSchema: z.ZodType< AccountingDepartmentsAddRequest$Outbound, z.ZodTypeDef, AccountingDepartmentsAddRequest > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), accountingDepartment: components.AccountingDepartmentInput$outboundSchema, }).transform((v) => { return remap$(v, { accountingDepartment: "AccountingDepartment", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingDepartmentsAddRequest$ { /** @deprecated use `AccountingDepartmentsAddRequest$inboundSchema` instead. */ export const inboundSchema = AccountingDepartmentsAddRequest$inboundSchema; /** @deprecated use `AccountingDepartmentsAddRequest$outboundSchema` instead. */ export const outboundSchema = AccountingDepartmentsAddRequest$outboundSchema; /** @deprecated use `AccountingDepartmentsAddRequest$Outbound` instead. */ export type Outbound = AccountingDepartmentsAddRequest$Outbound; } export function accountingDepartmentsAddRequestToJSON( accountingDepartmentsAddRequest: AccountingDepartmentsAddRequest, ): string { return JSON.stringify( AccountingDepartmentsAddRequest$outboundSchema.parse( accountingDepartmentsAddRequest, ), ); } export function accountingDepartmentsAddRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingDepartmentsAddRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingDepartmentsAddRequest' from JSON`, ); } /** @internal */ export const AccountingDepartmentsAddResponse$inboundSchema: z.ZodType< AccountingDepartmentsAddResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CreateAccountingDepartmentResponse: components .CreateAccountingDepartmentResponse$inboundSchema.optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CreateAccountingDepartmentResponse": "createAccountingDepartmentResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingDepartmentsAddResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; CreateAccountingDepartmentResponse?: | components.CreateAccountingDepartmentResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingDepartmentsAddResponse$outboundSchema: z.ZodType< AccountingDepartmentsAddResponse$Outbound, z.ZodTypeDef, AccountingDepartmentsAddResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, createAccountingDepartmentResponse: components .CreateAccountingDepartmentResponse$outboundSchema.optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", createAccountingDepartmentResponse: "CreateAccountingDepartmentResponse", 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 AccountingDepartmentsAddResponse$ { /** @deprecated use `AccountingDepartmentsAddResponse$inboundSchema` instead. */ export const inboundSchema = AccountingDepartmentsAddResponse$inboundSchema; /** @deprecated use `AccountingDepartmentsAddResponse$outboundSchema` instead. */ export const outboundSchema = AccountingDepartmentsAddResponse$outboundSchema; /** @deprecated use `AccountingDepartmentsAddResponse$Outbound` instead. */ export type Outbound = AccountingDepartmentsAddResponse$Outbound; } export function accountingDepartmentsAddResponseToJSON( accountingDepartmentsAddResponse: AccountingDepartmentsAddResponse, ): string { return JSON.stringify( AccountingDepartmentsAddResponse$outboundSchema.parse( accountingDepartmentsAddResponse, ), ); } export function accountingDepartmentsAddResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingDepartmentsAddResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingDepartmentsAddResponse' from JSON`, ); }