/*
* 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 CrmLeadsOneGlobals = {
/**
* 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 CrmLeadsOneRequest = {
/**
* 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 CrmLeadsOneResponse = {
httpMeta: components.HTTPMetadata;
/**
* Lead
*/
getLeadResponse?: components.GetLeadResponse | undefined;
/**
* Unexpected error
*/
unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined;
};
/** @internal */
export const CrmLeadsOneGlobals$inboundSchema: z.ZodType<
CrmLeadsOneGlobals,
z.ZodTypeDef,
unknown
> = z.object({
consumerId: z.string().optional(),
appId: z.string().optional(),
});
/** @internal */
export type CrmLeadsOneGlobals$Outbound = {
consumerId?: string | undefined;
appId?: string | undefined;
};
/** @internal */
export const CrmLeadsOneGlobals$outboundSchema: z.ZodType<
CrmLeadsOneGlobals$Outbound,
z.ZodTypeDef,
CrmLeadsOneGlobals
> = 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 CrmLeadsOneGlobals$ {
/** @deprecated use `CrmLeadsOneGlobals$inboundSchema` instead. */
export const inboundSchema = CrmLeadsOneGlobals$inboundSchema;
/** @deprecated use `CrmLeadsOneGlobals$outboundSchema` instead. */
export const outboundSchema = CrmLeadsOneGlobals$outboundSchema;
/** @deprecated use `CrmLeadsOneGlobals$Outbound` instead. */
export type Outbound = CrmLeadsOneGlobals$Outbound;
}
export function crmLeadsOneGlobalsToJSON(
crmLeadsOneGlobals: CrmLeadsOneGlobals,
): string {
return JSON.stringify(
CrmLeadsOneGlobals$outboundSchema.parse(crmLeadsOneGlobals),
);
}
export function crmLeadsOneGlobalsFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => CrmLeadsOneGlobals$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CrmLeadsOneGlobals' from JSON`,
);
}
/** @internal */
export const CrmLeadsOneRequest$inboundSchema: z.ZodType<
CrmLeadsOneRequest,
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 CrmLeadsOneRequest$Outbound = {
id: string;
serviceId?: string | undefined;
raw: boolean;
fields?: string | null | undefined;
};
/** @internal */
export const CrmLeadsOneRequest$outboundSchema: z.ZodType<
CrmLeadsOneRequest$Outbound,
z.ZodTypeDef,
CrmLeadsOneRequest
> = 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 CrmLeadsOneRequest$ {
/** @deprecated use `CrmLeadsOneRequest$inboundSchema` instead. */
export const inboundSchema = CrmLeadsOneRequest$inboundSchema;
/** @deprecated use `CrmLeadsOneRequest$outboundSchema` instead. */
export const outboundSchema = CrmLeadsOneRequest$outboundSchema;
/** @deprecated use `CrmLeadsOneRequest$Outbound` instead. */
export type Outbound = CrmLeadsOneRequest$Outbound;
}
export function crmLeadsOneRequestToJSON(
crmLeadsOneRequest: CrmLeadsOneRequest,
): string {
return JSON.stringify(
CrmLeadsOneRequest$outboundSchema.parse(crmLeadsOneRequest),
);
}
export function crmLeadsOneRequestFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => CrmLeadsOneRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CrmLeadsOneRequest' from JSON`,
);
}
/** @internal */
export const CrmLeadsOneResponse$inboundSchema: z.ZodType<
CrmLeadsOneResponse,
z.ZodTypeDef,
unknown
> = z.object({
HttpMeta: components.HTTPMetadata$inboundSchema,
GetLeadResponse: components.GetLeadResponse$inboundSchema.optional(),
UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema
.optional(),
}).transform((v) => {
return remap$(v, {
"HttpMeta": "httpMeta",
"GetLeadResponse": "getLeadResponse",
"UnexpectedErrorResponse": "unexpectedErrorResponse",
});
});
/** @internal */
export type CrmLeadsOneResponse$Outbound = {
HttpMeta: components.HTTPMetadata$Outbound;
GetLeadResponse?: components.GetLeadResponse$Outbound | undefined;
UnexpectedErrorResponse?:
| components.UnexpectedErrorResponse$Outbound
| undefined;
};
/** @internal */
export const CrmLeadsOneResponse$outboundSchema: z.ZodType<
CrmLeadsOneResponse$Outbound,
z.ZodTypeDef,
CrmLeadsOneResponse
> = z.object({
httpMeta: components.HTTPMetadata$outboundSchema,
getLeadResponse: components.GetLeadResponse$outboundSchema.optional(),
unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema
.optional(),
}).transform((v) => {
return remap$(v, {
httpMeta: "HttpMeta",
getLeadResponse: "GetLeadResponse",
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 CrmLeadsOneResponse$ {
/** @deprecated use `CrmLeadsOneResponse$inboundSchema` instead. */
export const inboundSchema = CrmLeadsOneResponse$inboundSchema;
/** @deprecated use `CrmLeadsOneResponse$outboundSchema` instead. */
export const outboundSchema = CrmLeadsOneResponse$outboundSchema;
/** @deprecated use `CrmLeadsOneResponse$Outbound` instead. */
export type Outbound = CrmLeadsOneResponse$Outbound;
}
export function crmLeadsOneResponseToJSON(
crmLeadsOneResponse: CrmLeadsOneResponse,
): string {
return JSON.stringify(
CrmLeadsOneResponse$outboundSchema.parse(crmLeadsOneResponse),
);
}
export function crmLeadsOneResponseFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => CrmLeadsOneResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CrmLeadsOneResponse' from JSON`,
);
}