/* * 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 AccountingLedgerAccountsAddGlobals = { /** * 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 AccountingLedgerAccountsAddRequest = { /** * 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; ledgerAccount: components.LedgerAccountInput; }; export type AccountingLedgerAccountsAddResponse = { httpMeta: components.HTTPMetadata; /** * LedgerAccount created */ createLedgerAccountResponse?: | components.CreateLedgerAccountResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingLedgerAccountsAddGlobals$inboundSchema: z.ZodType< AccountingLedgerAccountsAddGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingLedgerAccountsAddGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingLedgerAccountsAddGlobals$outboundSchema: z.ZodType< AccountingLedgerAccountsAddGlobals$Outbound, z.ZodTypeDef, AccountingLedgerAccountsAddGlobals > = 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 AccountingLedgerAccountsAddGlobals$ { /** @deprecated use `AccountingLedgerAccountsAddGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingLedgerAccountsAddGlobals$inboundSchema; /** @deprecated use `AccountingLedgerAccountsAddGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingLedgerAccountsAddGlobals$outboundSchema; /** @deprecated use `AccountingLedgerAccountsAddGlobals$Outbound` instead. */ export type Outbound = AccountingLedgerAccountsAddGlobals$Outbound; } export function accountingLedgerAccountsAddGlobalsToJSON( accountingLedgerAccountsAddGlobals: AccountingLedgerAccountsAddGlobals, ): string { return JSON.stringify( AccountingLedgerAccountsAddGlobals$outboundSchema.parse( accountingLedgerAccountsAddGlobals, ), ); } export function accountingLedgerAccountsAddGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingLedgerAccountsAddGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingLedgerAccountsAddGlobals' from JSON`, ); } /** @internal */ export const AccountingLedgerAccountsAddRequest$inboundSchema: z.ZodType< AccountingLedgerAccountsAddRequest, z.ZodTypeDef, unknown > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), LedgerAccount: components.LedgerAccountInput$inboundSchema, }).transform((v) => { return remap$(v, { "LedgerAccount": "ledgerAccount", }); }); /** @internal */ export type AccountingLedgerAccountsAddRequest$Outbound = { raw: boolean; serviceId?: string | undefined; LedgerAccount: components.LedgerAccountInput$Outbound; }; /** @internal */ export const AccountingLedgerAccountsAddRequest$outboundSchema: z.ZodType< AccountingLedgerAccountsAddRequest$Outbound, z.ZodTypeDef, AccountingLedgerAccountsAddRequest > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), ledgerAccount: components.LedgerAccountInput$outboundSchema, }).transform((v) => { return remap$(v, { ledgerAccount: "LedgerAccount", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingLedgerAccountsAddRequest$ { /** @deprecated use `AccountingLedgerAccountsAddRequest$inboundSchema` instead. */ export const inboundSchema = AccountingLedgerAccountsAddRequest$inboundSchema; /** @deprecated use `AccountingLedgerAccountsAddRequest$outboundSchema` instead. */ export const outboundSchema = AccountingLedgerAccountsAddRequest$outboundSchema; /** @deprecated use `AccountingLedgerAccountsAddRequest$Outbound` instead. */ export type Outbound = AccountingLedgerAccountsAddRequest$Outbound; } export function accountingLedgerAccountsAddRequestToJSON( accountingLedgerAccountsAddRequest: AccountingLedgerAccountsAddRequest, ): string { return JSON.stringify( AccountingLedgerAccountsAddRequest$outboundSchema.parse( accountingLedgerAccountsAddRequest, ), ); } export function accountingLedgerAccountsAddRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingLedgerAccountsAddRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingLedgerAccountsAddRequest' from JSON`, ); } /** @internal */ export const AccountingLedgerAccountsAddResponse$inboundSchema: z.ZodType< AccountingLedgerAccountsAddResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CreateLedgerAccountResponse: components .CreateLedgerAccountResponse$inboundSchema.optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CreateLedgerAccountResponse": "createLedgerAccountResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingLedgerAccountsAddResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; CreateLedgerAccountResponse?: | components.CreateLedgerAccountResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingLedgerAccountsAddResponse$outboundSchema: z.ZodType< AccountingLedgerAccountsAddResponse$Outbound, z.ZodTypeDef, AccountingLedgerAccountsAddResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, createLedgerAccountResponse: components .CreateLedgerAccountResponse$outboundSchema.optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", createLedgerAccountResponse: "CreateLedgerAccountResponse", 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 AccountingLedgerAccountsAddResponse$ { /** @deprecated use `AccountingLedgerAccountsAddResponse$inboundSchema` instead. */ export const inboundSchema = AccountingLedgerAccountsAddResponse$inboundSchema; /** @deprecated use `AccountingLedgerAccountsAddResponse$outboundSchema` instead. */ export const outboundSchema = AccountingLedgerAccountsAddResponse$outboundSchema; /** @deprecated use `AccountingLedgerAccountsAddResponse$Outbound` instead. */ export type Outbound = AccountingLedgerAccountsAddResponse$Outbound; } export function accountingLedgerAccountsAddResponseToJSON( accountingLedgerAccountsAddResponse: AccountingLedgerAccountsAddResponse, ): string { return JSON.stringify( AccountingLedgerAccountsAddResponse$outboundSchema.parse( accountingLedgerAccountsAddResponse, ), ); } export function accountingLedgerAccountsAddResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingLedgerAccountsAddResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingLedgerAccountsAddResponse' from JSON`, ); }