/*
* 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 AccountingDepartmentsOneGlobals = {
/**
* 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 AccountingDepartmentsOneRequest = {
/**
* 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 AccountingDepartmentsOneResponse = {
httpMeta: components.HTTPMetadata;
/**
* Location
*/
getAccountingDepartmentResponse?:
| components.GetAccountingDepartmentResponse
| undefined;
/**
* Unexpected error
*/
unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined;
};
/** @internal */
export const AccountingDepartmentsOneGlobals$inboundSchema: z.ZodType<
AccountingDepartmentsOneGlobals,
z.ZodTypeDef,
unknown
> = z.object({
consumerId: z.string().optional(),
appId: z.string().optional(),
});
/** @internal */
export type AccountingDepartmentsOneGlobals$Outbound = {
consumerId?: string | undefined;
appId?: string | undefined;
};
/** @internal */
export const AccountingDepartmentsOneGlobals$outboundSchema: z.ZodType<
AccountingDepartmentsOneGlobals$Outbound,
z.ZodTypeDef,
AccountingDepartmentsOneGlobals
> = 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 AccountingDepartmentsOneGlobals$ {
/** @deprecated use `AccountingDepartmentsOneGlobals$inboundSchema` instead. */
export const inboundSchema = AccountingDepartmentsOneGlobals$inboundSchema;
/** @deprecated use `AccountingDepartmentsOneGlobals$outboundSchema` instead. */
export const outboundSchema = AccountingDepartmentsOneGlobals$outboundSchema;
/** @deprecated use `AccountingDepartmentsOneGlobals$Outbound` instead. */
export type Outbound = AccountingDepartmentsOneGlobals$Outbound;
}
export function accountingDepartmentsOneGlobalsToJSON(
accountingDepartmentsOneGlobals: AccountingDepartmentsOneGlobals,
): string {
return JSON.stringify(
AccountingDepartmentsOneGlobals$outboundSchema.parse(
accountingDepartmentsOneGlobals,
),
);
}
export function accountingDepartmentsOneGlobalsFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => AccountingDepartmentsOneGlobals$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AccountingDepartmentsOneGlobals' from JSON`,
);
}
/** @internal */
export const AccountingDepartmentsOneRequest$inboundSchema: z.ZodType<
AccountingDepartmentsOneRequest,
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 AccountingDepartmentsOneRequest$Outbound = {
id: string;
serviceId?: string | undefined;
raw: boolean;
fields?: string | null | undefined;
};
/** @internal */
export const AccountingDepartmentsOneRequest$outboundSchema: z.ZodType<
AccountingDepartmentsOneRequest$Outbound,
z.ZodTypeDef,
AccountingDepartmentsOneRequest
> = 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 AccountingDepartmentsOneRequest$ {
/** @deprecated use `AccountingDepartmentsOneRequest$inboundSchema` instead. */
export const inboundSchema = AccountingDepartmentsOneRequest$inboundSchema;
/** @deprecated use `AccountingDepartmentsOneRequest$outboundSchema` instead. */
export const outboundSchema = AccountingDepartmentsOneRequest$outboundSchema;
/** @deprecated use `AccountingDepartmentsOneRequest$Outbound` instead. */
export type Outbound = AccountingDepartmentsOneRequest$Outbound;
}
export function accountingDepartmentsOneRequestToJSON(
accountingDepartmentsOneRequest: AccountingDepartmentsOneRequest,
): string {
return JSON.stringify(
AccountingDepartmentsOneRequest$outboundSchema.parse(
accountingDepartmentsOneRequest,
),
);
}
export function accountingDepartmentsOneRequestFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => AccountingDepartmentsOneRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AccountingDepartmentsOneRequest' from JSON`,
);
}
/** @internal */
export const AccountingDepartmentsOneResponse$inboundSchema: z.ZodType<
AccountingDepartmentsOneResponse,
z.ZodTypeDef,
unknown
> = z.object({
HttpMeta: components.HTTPMetadata$inboundSchema,
GetAccountingDepartmentResponse: components
.GetAccountingDepartmentResponse$inboundSchema.optional(),
UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema
.optional(),
}).transform((v) => {
return remap$(v, {
"HttpMeta": "httpMeta",
"GetAccountingDepartmentResponse": "getAccountingDepartmentResponse",
"UnexpectedErrorResponse": "unexpectedErrorResponse",
});
});
/** @internal */
export type AccountingDepartmentsOneResponse$Outbound = {
HttpMeta: components.HTTPMetadata$Outbound;
GetAccountingDepartmentResponse?:
| components.GetAccountingDepartmentResponse$Outbound
| undefined;
UnexpectedErrorResponse?:
| components.UnexpectedErrorResponse$Outbound
| undefined;
};
/** @internal */
export const AccountingDepartmentsOneResponse$outboundSchema: z.ZodType<
AccountingDepartmentsOneResponse$Outbound,
z.ZodTypeDef,
AccountingDepartmentsOneResponse
> = z.object({
httpMeta: components.HTTPMetadata$outboundSchema,
getAccountingDepartmentResponse: components
.GetAccountingDepartmentResponse$outboundSchema.optional(),
unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema
.optional(),
}).transform((v) => {
return remap$(v, {
httpMeta: "HttpMeta",
getAccountingDepartmentResponse: "GetAccountingDepartmentResponse",
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 AccountingDepartmentsOneResponse$ {
/** @deprecated use `AccountingDepartmentsOneResponse$inboundSchema` instead. */
export const inboundSchema = AccountingDepartmentsOneResponse$inboundSchema;
/** @deprecated use `AccountingDepartmentsOneResponse$outboundSchema` instead. */
export const outboundSchema = AccountingDepartmentsOneResponse$outboundSchema;
/** @deprecated use `AccountingDepartmentsOneResponse$Outbound` instead. */
export type Outbound = AccountingDepartmentsOneResponse$Outbound;
}
export function accountingDepartmentsOneResponseToJSON(
accountingDepartmentsOneResponse: AccountingDepartmentsOneResponse,
): string {
return JSON.stringify(
AccountingDepartmentsOneResponse$outboundSchema.parse(
accountingDepartmentsOneResponse,
),
);
}
export function accountingDepartmentsOneResponseFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => AccountingDepartmentsOneResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AccountingDepartmentsOneResponse' from JSON`,
);
}