/*
* 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 AccountingProfitAndLossOneGlobals = {
/**
* 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 AccountingProfitAndLossOneRequest = {
/**
* 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;
/**
* Apply filters
*/
filter?: components.ProfitAndLossFilter | undefined;
/**
* Optional unmapped key/values that will be passed through to downstream as query parameters. Ie: ?pass_through[search]=leads becomes ?search=leads
*/
passThrough?: { [k: string]: any } | 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 AccountingProfitAndLossOneResponse = {
httpMeta: components.HTTPMetadata;
/**
* Profit & Loss Report
*/
getProfitAndLossResponse?: components.GetProfitAndLossResponse | undefined;
/**
* Unexpected error
*/
unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined;
};
/** @internal */
export const AccountingProfitAndLossOneGlobals$inboundSchema: z.ZodType<
AccountingProfitAndLossOneGlobals,
z.ZodTypeDef,
unknown
> = z.object({
consumerId: z.string().optional(),
appId: z.string().optional(),
});
/** @internal */
export type AccountingProfitAndLossOneGlobals$Outbound = {
consumerId?: string | undefined;
appId?: string | undefined;
};
/** @internal */
export const AccountingProfitAndLossOneGlobals$outboundSchema: z.ZodType<
AccountingProfitAndLossOneGlobals$Outbound,
z.ZodTypeDef,
AccountingProfitAndLossOneGlobals
> = 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 AccountingProfitAndLossOneGlobals$ {
/** @deprecated use `AccountingProfitAndLossOneGlobals$inboundSchema` instead. */
export const inboundSchema = AccountingProfitAndLossOneGlobals$inboundSchema;
/** @deprecated use `AccountingProfitAndLossOneGlobals$outboundSchema` instead. */
export const outboundSchema =
AccountingProfitAndLossOneGlobals$outboundSchema;
/** @deprecated use `AccountingProfitAndLossOneGlobals$Outbound` instead. */
export type Outbound = AccountingProfitAndLossOneGlobals$Outbound;
}
export function accountingProfitAndLossOneGlobalsToJSON(
accountingProfitAndLossOneGlobals: AccountingProfitAndLossOneGlobals,
): string {
return JSON.stringify(
AccountingProfitAndLossOneGlobals$outboundSchema.parse(
accountingProfitAndLossOneGlobals,
),
);
}
export function accountingProfitAndLossOneGlobalsFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => AccountingProfitAndLossOneGlobals$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AccountingProfitAndLossOneGlobals' from JSON`,
);
}
/** @internal */
export const AccountingProfitAndLossOneRequest$inboundSchema: z.ZodType<
AccountingProfitAndLossOneRequest,
z.ZodTypeDef,
unknown
> = z.object({
raw: z.boolean().default(false),
serviceId: z.string().optional(),
filter: components.ProfitAndLossFilter$inboundSchema.optional(),
pass_through: z.record(z.any()).optional(),
fields: z.nullable(z.string()).optional(),
}).transform((v) => {
return remap$(v, {
"pass_through": "passThrough",
});
});
/** @internal */
export type AccountingProfitAndLossOneRequest$Outbound = {
raw: boolean;
serviceId?: string | undefined;
filter?: components.ProfitAndLossFilter$Outbound | undefined;
pass_through?: { [k: string]: any } | undefined;
fields?: string | null | undefined;
};
/** @internal */
export const AccountingProfitAndLossOneRequest$outboundSchema: z.ZodType<
AccountingProfitAndLossOneRequest$Outbound,
z.ZodTypeDef,
AccountingProfitAndLossOneRequest
> = z.object({
raw: z.boolean().default(false),
serviceId: z.string().optional(),
filter: components.ProfitAndLossFilter$outboundSchema.optional(),
passThrough: z.record(z.any()).optional(),
fields: z.nullable(z.string()).optional(),
}).transform((v) => {
return remap$(v, {
passThrough: "pass_through",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace AccountingProfitAndLossOneRequest$ {
/** @deprecated use `AccountingProfitAndLossOneRequest$inboundSchema` instead. */
export const inboundSchema = AccountingProfitAndLossOneRequest$inboundSchema;
/** @deprecated use `AccountingProfitAndLossOneRequest$outboundSchema` instead. */
export const outboundSchema =
AccountingProfitAndLossOneRequest$outboundSchema;
/** @deprecated use `AccountingProfitAndLossOneRequest$Outbound` instead. */
export type Outbound = AccountingProfitAndLossOneRequest$Outbound;
}
export function accountingProfitAndLossOneRequestToJSON(
accountingProfitAndLossOneRequest: AccountingProfitAndLossOneRequest,
): string {
return JSON.stringify(
AccountingProfitAndLossOneRequest$outboundSchema.parse(
accountingProfitAndLossOneRequest,
),
);
}
export function accountingProfitAndLossOneRequestFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => AccountingProfitAndLossOneRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AccountingProfitAndLossOneRequest' from JSON`,
);
}
/** @internal */
export const AccountingProfitAndLossOneResponse$inboundSchema: z.ZodType<
AccountingProfitAndLossOneResponse,
z.ZodTypeDef,
unknown
> = z.object({
HttpMeta: components.HTTPMetadata$inboundSchema,
GetProfitAndLossResponse: components.GetProfitAndLossResponse$inboundSchema
.optional(),
UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema
.optional(),
}).transform((v) => {
return remap$(v, {
"HttpMeta": "httpMeta",
"GetProfitAndLossResponse": "getProfitAndLossResponse",
"UnexpectedErrorResponse": "unexpectedErrorResponse",
});
});
/** @internal */
export type AccountingProfitAndLossOneResponse$Outbound = {
HttpMeta: components.HTTPMetadata$Outbound;
GetProfitAndLossResponse?:
| components.GetProfitAndLossResponse$Outbound
| undefined;
UnexpectedErrorResponse?:
| components.UnexpectedErrorResponse$Outbound
| undefined;
};
/** @internal */
export const AccountingProfitAndLossOneResponse$outboundSchema: z.ZodType<
AccountingProfitAndLossOneResponse$Outbound,
z.ZodTypeDef,
AccountingProfitAndLossOneResponse
> = z.object({
httpMeta: components.HTTPMetadata$outboundSchema,
getProfitAndLossResponse: components.GetProfitAndLossResponse$outboundSchema
.optional(),
unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema
.optional(),
}).transform((v) => {
return remap$(v, {
httpMeta: "HttpMeta",
getProfitAndLossResponse: "GetProfitAndLossResponse",
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 AccountingProfitAndLossOneResponse$ {
/** @deprecated use `AccountingProfitAndLossOneResponse$inboundSchema` instead. */
export const inboundSchema = AccountingProfitAndLossOneResponse$inboundSchema;
/** @deprecated use `AccountingProfitAndLossOneResponse$outboundSchema` instead. */
export const outboundSchema =
AccountingProfitAndLossOneResponse$outboundSchema;
/** @deprecated use `AccountingProfitAndLossOneResponse$Outbound` instead. */
export type Outbound = AccountingProfitAndLossOneResponse$Outbound;
}
export function accountingProfitAndLossOneResponseToJSON(
accountingProfitAndLossOneResponse: AccountingProfitAndLossOneResponse,
): string {
return JSON.stringify(
AccountingProfitAndLossOneResponse$outboundSchema.parse(
accountingProfitAndLossOneResponse,
),
);
}
export function accountingProfitAndLossOneResponseFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) =>
AccountingProfitAndLossOneResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AccountingProfitAndLossOneResponse' from JSON`,
);
}