/* * 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 AccountingBillsAddGlobals = { /** * 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 AccountingBillsAddRequest = { /** * 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; bill: components.BillInput; }; export type AccountingBillsAddResponse = { httpMeta: components.HTTPMetadata; /** * Bill created */ createBillResponse?: components.CreateBillResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingBillsAddGlobals$inboundSchema: z.ZodType< AccountingBillsAddGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingBillsAddGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingBillsAddGlobals$outboundSchema: z.ZodType< AccountingBillsAddGlobals$Outbound, z.ZodTypeDef, AccountingBillsAddGlobals > = 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 AccountingBillsAddGlobals$ { /** @deprecated use `AccountingBillsAddGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingBillsAddGlobals$inboundSchema; /** @deprecated use `AccountingBillsAddGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingBillsAddGlobals$outboundSchema; /** @deprecated use `AccountingBillsAddGlobals$Outbound` instead. */ export type Outbound = AccountingBillsAddGlobals$Outbound; } export function accountingBillsAddGlobalsToJSON( accountingBillsAddGlobals: AccountingBillsAddGlobals, ): string { return JSON.stringify( AccountingBillsAddGlobals$outboundSchema.parse(accountingBillsAddGlobals), ); } export function accountingBillsAddGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingBillsAddGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingBillsAddGlobals' from JSON`, ); } /** @internal */ export const AccountingBillsAddRequest$inboundSchema: z.ZodType< AccountingBillsAddRequest, z.ZodTypeDef, unknown > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), Bill: components.BillInput$inboundSchema, }).transform((v) => { return remap$(v, { "Bill": "bill", }); }); /** @internal */ export type AccountingBillsAddRequest$Outbound = { raw: boolean; serviceId?: string | undefined; Bill: components.BillInput$Outbound; }; /** @internal */ export const AccountingBillsAddRequest$outboundSchema: z.ZodType< AccountingBillsAddRequest$Outbound, z.ZodTypeDef, AccountingBillsAddRequest > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), bill: components.BillInput$outboundSchema, }).transform((v) => { return remap$(v, { bill: "Bill", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingBillsAddRequest$ { /** @deprecated use `AccountingBillsAddRequest$inboundSchema` instead. */ export const inboundSchema = AccountingBillsAddRequest$inboundSchema; /** @deprecated use `AccountingBillsAddRequest$outboundSchema` instead. */ export const outboundSchema = AccountingBillsAddRequest$outboundSchema; /** @deprecated use `AccountingBillsAddRequest$Outbound` instead. */ export type Outbound = AccountingBillsAddRequest$Outbound; } export function accountingBillsAddRequestToJSON( accountingBillsAddRequest: AccountingBillsAddRequest, ): string { return JSON.stringify( AccountingBillsAddRequest$outboundSchema.parse(accountingBillsAddRequest), ); } export function accountingBillsAddRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingBillsAddRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingBillsAddRequest' from JSON`, ); } /** @internal */ export const AccountingBillsAddResponse$inboundSchema: z.ZodType< AccountingBillsAddResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CreateBillResponse: components.CreateBillResponse$inboundSchema.optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CreateBillResponse": "createBillResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingBillsAddResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; CreateBillResponse?: components.CreateBillResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingBillsAddResponse$outboundSchema: z.ZodType< AccountingBillsAddResponse$Outbound, z.ZodTypeDef, AccountingBillsAddResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, createBillResponse: components.CreateBillResponse$outboundSchema.optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", createBillResponse: "CreateBillResponse", 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 AccountingBillsAddResponse$ { /** @deprecated use `AccountingBillsAddResponse$inboundSchema` instead. */ export const inboundSchema = AccountingBillsAddResponse$inboundSchema; /** @deprecated use `AccountingBillsAddResponse$outboundSchema` instead. */ export const outboundSchema = AccountingBillsAddResponse$outboundSchema; /** @deprecated use `AccountingBillsAddResponse$Outbound` instead. */ export type Outbound = AccountingBillsAddResponse$Outbound; } export function accountingBillsAddResponseToJSON( accountingBillsAddResponse: AccountingBillsAddResponse, ): string { return JSON.stringify( AccountingBillsAddResponse$outboundSchema.parse(accountingBillsAddResponse), ); } export function accountingBillsAddResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingBillsAddResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingBillsAddResponse' from JSON`, ); }