/*
* 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 AccountingInvoiceItemsOneGlobals = {
/**
* 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 AccountingInvoiceItemsOneRequest = {
/**
* 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;
/**
* The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.
Example: `fields=name,email,addresses.city`
In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
*/
fields?: string | null | undefined;
};
export type AccountingInvoiceItemsOneResponse = {
httpMeta: components.HTTPMetadata;
/**
* InvoiceItems
*/
getInvoiceItemResponse?: components.GetInvoiceItemResponse | undefined;
/**
* Unexpected error
*/
unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined;
};
/** @internal */
export const AccountingInvoiceItemsOneGlobals$inboundSchema: z.ZodType<
AccountingInvoiceItemsOneGlobals,
z.ZodTypeDef,
unknown
> = z.object({
consumerId: z.string().optional(),
appId: z.string().optional(),
});
/** @internal */
export type AccountingInvoiceItemsOneGlobals$Outbound = {
consumerId?: string | undefined;
appId?: string | undefined;
};
/** @internal */
export const AccountingInvoiceItemsOneGlobals$outboundSchema: z.ZodType<
AccountingInvoiceItemsOneGlobals$Outbound,
z.ZodTypeDef,
AccountingInvoiceItemsOneGlobals
> = 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 AccountingInvoiceItemsOneGlobals$ {
/** @deprecated use `AccountingInvoiceItemsOneGlobals$inboundSchema` instead. */
export const inboundSchema = AccountingInvoiceItemsOneGlobals$inboundSchema;
/** @deprecated use `AccountingInvoiceItemsOneGlobals$outboundSchema` instead. */
export const outboundSchema = AccountingInvoiceItemsOneGlobals$outboundSchema;
/** @deprecated use `AccountingInvoiceItemsOneGlobals$Outbound` instead. */
export type Outbound = AccountingInvoiceItemsOneGlobals$Outbound;
}
export function accountingInvoiceItemsOneGlobalsToJSON(
accountingInvoiceItemsOneGlobals: AccountingInvoiceItemsOneGlobals,
): string {
return JSON.stringify(
AccountingInvoiceItemsOneGlobals$outboundSchema.parse(
accountingInvoiceItemsOneGlobals,
),
);
}
export function accountingInvoiceItemsOneGlobalsFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => AccountingInvoiceItemsOneGlobals$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AccountingInvoiceItemsOneGlobals' from JSON`,
);
}
/** @internal */
export const AccountingInvoiceItemsOneRequest$inboundSchema: z.ZodType<
AccountingInvoiceItemsOneRequest,
z.ZodTypeDef,
unknown
> = z.object({
id: z.string(),
serviceId: z.string().optional(),
raw: z.boolean().default(false),
fields: z.nullable(z.string()).optional(),
});
/** @internal */
export type AccountingInvoiceItemsOneRequest$Outbound = {
id: string;
serviceId?: string | undefined;
raw: boolean;
fields?: string | null | undefined;
};
/** @internal */
export const AccountingInvoiceItemsOneRequest$outboundSchema: z.ZodType<
AccountingInvoiceItemsOneRequest$Outbound,
z.ZodTypeDef,
AccountingInvoiceItemsOneRequest
> = z.object({
id: z.string(),
serviceId: z.string().optional(),
raw: z.boolean().default(false),
fields: z.nullable(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 AccountingInvoiceItemsOneRequest$ {
/** @deprecated use `AccountingInvoiceItemsOneRequest$inboundSchema` instead. */
export const inboundSchema = AccountingInvoiceItemsOneRequest$inboundSchema;
/** @deprecated use `AccountingInvoiceItemsOneRequest$outboundSchema` instead. */
export const outboundSchema = AccountingInvoiceItemsOneRequest$outboundSchema;
/** @deprecated use `AccountingInvoiceItemsOneRequest$Outbound` instead. */
export type Outbound = AccountingInvoiceItemsOneRequest$Outbound;
}
export function accountingInvoiceItemsOneRequestToJSON(
accountingInvoiceItemsOneRequest: AccountingInvoiceItemsOneRequest,
): string {
return JSON.stringify(
AccountingInvoiceItemsOneRequest$outboundSchema.parse(
accountingInvoiceItemsOneRequest,
),
);
}
export function accountingInvoiceItemsOneRequestFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => AccountingInvoiceItemsOneRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AccountingInvoiceItemsOneRequest' from JSON`,
);
}
/** @internal */
export const AccountingInvoiceItemsOneResponse$inboundSchema: z.ZodType<
AccountingInvoiceItemsOneResponse,
z.ZodTypeDef,
unknown
> = z.object({
HttpMeta: components.HTTPMetadata$inboundSchema,
GetInvoiceItemResponse: components.GetInvoiceItemResponse$inboundSchema
.optional(),
UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema
.optional(),
}).transform((v) => {
return remap$(v, {
"HttpMeta": "httpMeta",
"GetInvoiceItemResponse": "getInvoiceItemResponse",
"UnexpectedErrorResponse": "unexpectedErrorResponse",
});
});
/** @internal */
export type AccountingInvoiceItemsOneResponse$Outbound = {
HttpMeta: components.HTTPMetadata$Outbound;
GetInvoiceItemResponse?:
| components.GetInvoiceItemResponse$Outbound
| undefined;
UnexpectedErrorResponse?:
| components.UnexpectedErrorResponse$Outbound
| undefined;
};
/** @internal */
export const AccountingInvoiceItemsOneResponse$outboundSchema: z.ZodType<
AccountingInvoiceItemsOneResponse$Outbound,
z.ZodTypeDef,
AccountingInvoiceItemsOneResponse
> = z.object({
httpMeta: components.HTTPMetadata$outboundSchema,
getInvoiceItemResponse: components.GetInvoiceItemResponse$outboundSchema
.optional(),
unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema
.optional(),
}).transform((v) => {
return remap$(v, {
httpMeta: "HttpMeta",
getInvoiceItemResponse: "GetInvoiceItemResponse",
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 AccountingInvoiceItemsOneResponse$ {
/** @deprecated use `AccountingInvoiceItemsOneResponse$inboundSchema` instead. */
export const inboundSchema = AccountingInvoiceItemsOneResponse$inboundSchema;
/** @deprecated use `AccountingInvoiceItemsOneResponse$outboundSchema` instead. */
export const outboundSchema =
AccountingInvoiceItemsOneResponse$outboundSchema;
/** @deprecated use `AccountingInvoiceItemsOneResponse$Outbound` instead. */
export type Outbound = AccountingInvoiceItemsOneResponse$Outbound;
}
export function accountingInvoiceItemsOneResponseToJSON(
accountingInvoiceItemsOneResponse: AccountingInvoiceItemsOneResponse,
): string {
return JSON.stringify(
AccountingInvoiceItemsOneResponse$outboundSchema.parse(
accountingInvoiceItemsOneResponse,
),
);
}
export function accountingInvoiceItemsOneResponseFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => AccountingInvoiceItemsOneResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AccountingInvoiceItemsOneResponse' from JSON`,
);
}