/* * 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 AccountingExpensesUpdateGlobals = { /** * 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 AccountingExpensesUpdateRequest = { /** * 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; expense: components.ExpenseInput; }; export type AccountingExpensesUpdateResponse = { httpMeta: components.HTTPMetadata; /** * Expenses */ updateExpenseResponse?: components.UpdateExpenseResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingExpensesUpdateGlobals$inboundSchema: z.ZodType< AccountingExpensesUpdateGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingExpensesUpdateGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingExpensesUpdateGlobals$outboundSchema: z.ZodType< AccountingExpensesUpdateGlobals$Outbound, z.ZodTypeDef, AccountingExpensesUpdateGlobals > = 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 AccountingExpensesUpdateGlobals$ { /** @deprecated use `AccountingExpensesUpdateGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingExpensesUpdateGlobals$inboundSchema; /** @deprecated use `AccountingExpensesUpdateGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingExpensesUpdateGlobals$outboundSchema; /** @deprecated use `AccountingExpensesUpdateGlobals$Outbound` instead. */ export type Outbound = AccountingExpensesUpdateGlobals$Outbound; } export function accountingExpensesUpdateGlobalsToJSON( accountingExpensesUpdateGlobals: AccountingExpensesUpdateGlobals, ): string { return JSON.stringify( AccountingExpensesUpdateGlobals$outboundSchema.parse( accountingExpensesUpdateGlobals, ), ); } export function accountingExpensesUpdateGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingExpensesUpdateGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingExpensesUpdateGlobals' from JSON`, ); } /** @internal */ export const AccountingExpensesUpdateRequest$inboundSchema: z.ZodType< AccountingExpensesUpdateRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), Expense: components.ExpenseInput$inboundSchema, }).transform((v) => { return remap$(v, { "Expense": "expense", }); }); /** @internal */ export type AccountingExpensesUpdateRequest$Outbound = { id: string; serviceId?: string | undefined; raw: boolean; Expense: components.ExpenseInput$Outbound; }; /** @internal */ export const AccountingExpensesUpdateRequest$outboundSchema: z.ZodType< AccountingExpensesUpdateRequest$Outbound, z.ZodTypeDef, AccountingExpensesUpdateRequest > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), 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 AccountingExpensesUpdateRequest$ { /** @deprecated use `AccountingExpensesUpdateRequest$inboundSchema` instead. */ export const inboundSchema = AccountingExpensesUpdateRequest$inboundSchema; /** @deprecated use `AccountingExpensesUpdateRequest$outboundSchema` instead. */ export const outboundSchema = AccountingExpensesUpdateRequest$outboundSchema; /** @deprecated use `AccountingExpensesUpdateRequest$Outbound` instead. */ export type Outbound = AccountingExpensesUpdateRequest$Outbound; } export function accountingExpensesUpdateRequestToJSON( accountingExpensesUpdateRequest: AccountingExpensesUpdateRequest, ): string { return JSON.stringify( AccountingExpensesUpdateRequest$outboundSchema.parse( accountingExpensesUpdateRequest, ), ); } export function accountingExpensesUpdateRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingExpensesUpdateRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingExpensesUpdateRequest' from JSON`, ); } /** @internal */ export const AccountingExpensesUpdateResponse$inboundSchema: z.ZodType< AccountingExpensesUpdateResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, UpdateExpenseResponse: components.UpdateExpenseResponse$inboundSchema .optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "UpdateExpenseResponse": "updateExpenseResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingExpensesUpdateResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; UpdateExpenseResponse?: components.UpdateExpenseResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingExpensesUpdateResponse$outboundSchema: z.ZodType< AccountingExpensesUpdateResponse$Outbound, z.ZodTypeDef, AccountingExpensesUpdateResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, updateExpenseResponse: components.UpdateExpenseResponse$outboundSchema .optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", updateExpenseResponse: "UpdateExpenseResponse", 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 AccountingExpensesUpdateResponse$ { /** @deprecated use `AccountingExpensesUpdateResponse$inboundSchema` instead. */ export const inboundSchema = AccountingExpensesUpdateResponse$inboundSchema; /** @deprecated use `AccountingExpensesUpdateResponse$outboundSchema` instead. */ export const outboundSchema = AccountingExpensesUpdateResponse$outboundSchema; /** @deprecated use `AccountingExpensesUpdateResponse$Outbound` instead. */ export type Outbound = AccountingExpensesUpdateResponse$Outbound; } export function accountingExpensesUpdateResponseToJSON( accountingExpensesUpdateResponse: AccountingExpensesUpdateResponse, ): string { return JSON.stringify( AccountingExpensesUpdateResponse$outboundSchema.parse( accountingExpensesUpdateResponse, ), ); } export function accountingExpensesUpdateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingExpensesUpdateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingExpensesUpdateResponse' from JSON`, ); }