/* * 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 AccountingExpensesAddGlobals = { /** * 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 AccountingExpensesAddRequest = { /** * 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; expense: components.ExpenseInput; }; export type AccountingExpensesAddResponse = { httpMeta: components.HTTPMetadata; /** * Expenses */ createExpenseResponse?: components.CreateExpenseResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingExpensesAddGlobals$inboundSchema: z.ZodType< AccountingExpensesAddGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingExpensesAddGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingExpensesAddGlobals$outboundSchema: z.ZodType< AccountingExpensesAddGlobals$Outbound, z.ZodTypeDef, AccountingExpensesAddGlobals > = 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 AccountingExpensesAddGlobals$ { /** @deprecated use `AccountingExpensesAddGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingExpensesAddGlobals$inboundSchema; /** @deprecated use `AccountingExpensesAddGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingExpensesAddGlobals$outboundSchema; /** @deprecated use `AccountingExpensesAddGlobals$Outbound` instead. */ export type Outbound = AccountingExpensesAddGlobals$Outbound; } export function accountingExpensesAddGlobalsToJSON( accountingExpensesAddGlobals: AccountingExpensesAddGlobals, ): string { return JSON.stringify( AccountingExpensesAddGlobals$outboundSchema.parse( accountingExpensesAddGlobals, ), ); } export function accountingExpensesAddGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingExpensesAddGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingExpensesAddGlobals' from JSON`, ); } /** @internal */ export const AccountingExpensesAddRequest$inboundSchema: z.ZodType< AccountingExpensesAddRequest, z.ZodTypeDef, unknown > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), Expense: components.ExpenseInput$inboundSchema, }).transform((v) => { return remap$(v, { "Expense": "expense", }); }); /** @internal */ export type AccountingExpensesAddRequest$Outbound = { raw: boolean; serviceId?: string | undefined; Expense: components.ExpenseInput$Outbound; }; /** @internal */ export const AccountingExpensesAddRequest$outboundSchema: z.ZodType< AccountingExpensesAddRequest$Outbound, z.ZodTypeDef, AccountingExpensesAddRequest > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), expense: components.ExpenseInput$outboundSchema, }).transform((v) => { return remap$(v, { expense: "Expense", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingExpensesAddRequest$ { /** @deprecated use `AccountingExpensesAddRequest$inboundSchema` instead. */ export const inboundSchema = AccountingExpensesAddRequest$inboundSchema; /** @deprecated use `AccountingExpensesAddRequest$outboundSchema` instead. */ export const outboundSchema = AccountingExpensesAddRequest$outboundSchema; /** @deprecated use `AccountingExpensesAddRequest$Outbound` instead. */ export type Outbound = AccountingExpensesAddRequest$Outbound; } export function accountingExpensesAddRequestToJSON( accountingExpensesAddRequest: AccountingExpensesAddRequest, ): string { return JSON.stringify( AccountingExpensesAddRequest$outboundSchema.parse( accountingExpensesAddRequest, ), ); } export function accountingExpensesAddRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingExpensesAddRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingExpensesAddRequest' from JSON`, ); } /** @internal */ export const AccountingExpensesAddResponse$inboundSchema: z.ZodType< AccountingExpensesAddResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CreateExpenseResponse: components.CreateExpenseResponse$inboundSchema .optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CreateExpenseResponse": "createExpenseResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingExpensesAddResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; CreateExpenseResponse?: components.CreateExpenseResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingExpensesAddResponse$outboundSchema: z.ZodType< AccountingExpensesAddResponse$Outbound, z.ZodTypeDef, AccountingExpensesAddResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, createExpenseResponse: components.CreateExpenseResponse$outboundSchema .optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", createExpenseResponse: "CreateExpenseResponse", 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 AccountingExpensesAddResponse$ { /** @deprecated use `AccountingExpensesAddResponse$inboundSchema` instead. */ export const inboundSchema = AccountingExpensesAddResponse$inboundSchema; /** @deprecated use `AccountingExpensesAddResponse$outboundSchema` instead. */ export const outboundSchema = AccountingExpensesAddResponse$outboundSchema; /** @deprecated use `AccountingExpensesAddResponse$Outbound` instead. */ export type Outbound = AccountingExpensesAddResponse$Outbound; } export function accountingExpensesAddResponseToJSON( accountingExpensesAddResponse: AccountingExpensesAddResponse, ): string { return JSON.stringify( AccountingExpensesAddResponse$outboundSchema.parse( accountingExpensesAddResponse, ), ); } export function accountingExpensesAddResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingExpensesAddResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingExpensesAddResponse' from JSON`, ); }