/* * 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 AccountingTaxRatesAddGlobals = { /** * 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 AccountingTaxRatesAddRequest = { /** * 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; taxRate: components.TaxRateInput; }; export type AccountingTaxRatesAddResponse = { httpMeta: components.HTTPMetadata; /** * TaxRate created */ createTaxRateResponse?: components.CreateTaxRateResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingTaxRatesAddGlobals$inboundSchema: z.ZodType< AccountingTaxRatesAddGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingTaxRatesAddGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingTaxRatesAddGlobals$outboundSchema: z.ZodType< AccountingTaxRatesAddGlobals$Outbound, z.ZodTypeDef, AccountingTaxRatesAddGlobals > = 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 AccountingTaxRatesAddGlobals$ { /** @deprecated use `AccountingTaxRatesAddGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingTaxRatesAddGlobals$inboundSchema; /** @deprecated use `AccountingTaxRatesAddGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingTaxRatesAddGlobals$outboundSchema; /** @deprecated use `AccountingTaxRatesAddGlobals$Outbound` instead. */ export type Outbound = AccountingTaxRatesAddGlobals$Outbound; } export function accountingTaxRatesAddGlobalsToJSON( accountingTaxRatesAddGlobals: AccountingTaxRatesAddGlobals, ): string { return JSON.stringify( AccountingTaxRatesAddGlobals$outboundSchema.parse( accountingTaxRatesAddGlobals, ), ); } export function accountingTaxRatesAddGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingTaxRatesAddGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingTaxRatesAddGlobals' from JSON`, ); } /** @internal */ export const AccountingTaxRatesAddRequest$inboundSchema: z.ZodType< AccountingTaxRatesAddRequest, z.ZodTypeDef, unknown > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), TaxRate: components.TaxRateInput$inboundSchema, }).transform((v) => { return remap$(v, { "TaxRate": "taxRate", }); }); /** @internal */ export type AccountingTaxRatesAddRequest$Outbound = { raw: boolean; serviceId?: string | undefined; TaxRate: components.TaxRateInput$Outbound; }; /** @internal */ export const AccountingTaxRatesAddRequest$outboundSchema: z.ZodType< AccountingTaxRatesAddRequest$Outbound, z.ZodTypeDef, AccountingTaxRatesAddRequest > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), taxRate: components.TaxRateInput$outboundSchema, }).transform((v) => { return remap$(v, { taxRate: "TaxRate", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingTaxRatesAddRequest$ { /** @deprecated use `AccountingTaxRatesAddRequest$inboundSchema` instead. */ export const inboundSchema = AccountingTaxRatesAddRequest$inboundSchema; /** @deprecated use `AccountingTaxRatesAddRequest$outboundSchema` instead. */ export const outboundSchema = AccountingTaxRatesAddRequest$outboundSchema; /** @deprecated use `AccountingTaxRatesAddRequest$Outbound` instead. */ export type Outbound = AccountingTaxRatesAddRequest$Outbound; } export function accountingTaxRatesAddRequestToJSON( accountingTaxRatesAddRequest: AccountingTaxRatesAddRequest, ): string { return JSON.stringify( AccountingTaxRatesAddRequest$outboundSchema.parse( accountingTaxRatesAddRequest, ), ); } export function accountingTaxRatesAddRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingTaxRatesAddRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingTaxRatesAddRequest' from JSON`, ); } /** @internal */ export const AccountingTaxRatesAddResponse$inboundSchema: z.ZodType< AccountingTaxRatesAddResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CreateTaxRateResponse: components.CreateTaxRateResponse$inboundSchema .optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CreateTaxRateResponse": "createTaxRateResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingTaxRatesAddResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; CreateTaxRateResponse?: components.CreateTaxRateResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingTaxRatesAddResponse$outboundSchema: z.ZodType< AccountingTaxRatesAddResponse$Outbound, z.ZodTypeDef, AccountingTaxRatesAddResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, createTaxRateResponse: components.CreateTaxRateResponse$outboundSchema .optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", createTaxRateResponse: "CreateTaxRateResponse", 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 AccountingTaxRatesAddResponse$ { /** @deprecated use `AccountingTaxRatesAddResponse$inboundSchema` instead. */ export const inboundSchema = AccountingTaxRatesAddResponse$inboundSchema; /** @deprecated use `AccountingTaxRatesAddResponse$outboundSchema` instead. */ export const outboundSchema = AccountingTaxRatesAddResponse$outboundSchema; /** @deprecated use `AccountingTaxRatesAddResponse$Outbound` instead. */ export type Outbound = AccountingTaxRatesAddResponse$Outbound; } export function accountingTaxRatesAddResponseToJSON( accountingTaxRatesAddResponse: AccountingTaxRatesAddResponse, ): string { return JSON.stringify( AccountingTaxRatesAddResponse$outboundSchema.parse( accountingTaxRatesAddResponse, ), ); } export function accountingTaxRatesAddResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingTaxRatesAddResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingTaxRatesAddResponse' from JSON`, ); }