@vercel/sdk
Version:
<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>
295 lines (259 loc) • 7.97 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { remap as remap$ } from "../lib/primitives.js";
import { ClosedEnum } from "../types/enums.js";
import { smartUnion } from "../types/smartUnion.js";
export const UpdateInstallationStatus = {
Ready: "ready",
Pending: "pending",
Onboarding: "onboarding",
Suspended: "suspended",
Resumed: "resumed",
Uninstalled: "uninstalled",
Error: "error",
} as const;
export type UpdateInstallationStatus = ClosedEnum<
typeof UpdateInstallationStatus
>;
export const UpdateInstallationType = {
Prepayment: "prepayment",
Subscription: "subscription",
} as const;
export type UpdateInstallationType = ClosedEnum<typeof UpdateInstallationType>;
export type Details = {
label: string;
value?: string | undefined;
};
export type HighlightedDetails = {
label: string;
value?: string | undefined;
};
export type UpdateInstallationBillingPlan = {
id: string;
type: UpdateInstallationType;
name: string;
description?: string | undefined;
paymentMethodRequired?: boolean | undefined;
cost?: string | undefined;
details?: Array<Details> | undefined;
highlightedDetails?: Array<HighlightedDetails> | undefined;
effectiveDate?: string | undefined;
additionalProperties?: { [k: string]: any } | undefined;
};
export const Level = {
Info: "info",
Warn: "warn",
Error: "error",
} as const;
export type Level = ClosedEnum<typeof Level>;
export type Notification1 = {
level: Level;
title: string;
message?: string | undefined;
href?: string | undefined;
};
/**
* A notification to display to your customer. Send `null` to clear the current notification.
*/
export type Notification = Notification1 | string;
export type UpdateInstallationRequestBody = {
status?: UpdateInstallationStatus | undefined;
externalId?: string | undefined;
billingPlan?: UpdateInstallationBillingPlan | undefined;
/**
* A notification to display to your customer. Send `null` to clear the current notification.
*/
notification?: Notification1 | string | undefined;
};
export type UpdateInstallationRequest = {
integrationConfigurationId: string;
requestBody?: UpdateInstallationRequestBody | undefined;
};
/** @internal */
export const UpdateInstallationStatus$outboundSchema: z.ZodNativeEnum<
typeof UpdateInstallationStatus
> = z.nativeEnum(UpdateInstallationStatus);
/** @internal */
export const UpdateInstallationType$outboundSchema: z.ZodNativeEnum<
typeof UpdateInstallationType
> = z.nativeEnum(UpdateInstallationType);
/** @internal */
export type Details$Outbound = {
label: string;
value?: string | undefined;
};
/** @internal */
export const Details$outboundSchema: z.ZodType<
Details$Outbound,
z.ZodTypeDef,
Details
> = z.object({
label: z.string(),
value: z.string().optional(),
});
export function detailsToJSON(details: Details): string {
return JSON.stringify(Details$outboundSchema.parse(details));
}
/** @internal */
export type HighlightedDetails$Outbound = {
label: string;
value?: string | undefined;
};
/** @internal */
export const HighlightedDetails$outboundSchema: z.ZodType<
HighlightedDetails$Outbound,
z.ZodTypeDef,
HighlightedDetails
> = z.object({
label: z.string(),
value: z.string().optional(),
});
export function highlightedDetailsToJSON(
highlightedDetails: HighlightedDetails,
): string {
return JSON.stringify(
HighlightedDetails$outboundSchema.parse(highlightedDetails),
);
}
/** @internal */
export type UpdateInstallationBillingPlan$Outbound = {
id: string;
type: string;
name: string;
description?: string | undefined;
paymentMethodRequired?: boolean | undefined;
cost?: string | undefined;
details?: Array<Details$Outbound> | undefined;
highlightedDetails?: Array<HighlightedDetails$Outbound> | undefined;
effectiveDate?: string | undefined;
[additionalProperties: string]: unknown;
};
/** @internal */
export const UpdateInstallationBillingPlan$outboundSchema: z.ZodType<
UpdateInstallationBillingPlan$Outbound,
z.ZodTypeDef,
UpdateInstallationBillingPlan
> = z.object({
id: z.string(),
type: UpdateInstallationType$outboundSchema,
name: z.string(),
description: z.string().optional(),
paymentMethodRequired: z.boolean().optional(),
cost: z.string().optional(),
details: z.array(z.lazy(() => Details$outboundSchema)).optional(),
highlightedDetails: z.array(z.lazy(() => HighlightedDetails$outboundSchema))
.optional(),
effectiveDate: z.string().optional(),
additionalProperties: z.record(z.any()).optional(),
}).transform((v) => {
return {
...v.additionalProperties,
...remap$(v, {
additionalProperties: null,
}),
};
});
export function updateInstallationBillingPlanToJSON(
updateInstallationBillingPlan: UpdateInstallationBillingPlan,
): string {
return JSON.stringify(
UpdateInstallationBillingPlan$outboundSchema.parse(
updateInstallationBillingPlan,
),
);
}
/** @internal */
export const Level$outboundSchema: z.ZodNativeEnum<typeof Level> = z.nativeEnum(
Level,
);
/** @internal */
export type Notification1$Outbound = {
level: string;
title: string;
message?: string | undefined;
href?: string | undefined;
};
/** @internal */
export const Notification1$outboundSchema: z.ZodType<
Notification1$Outbound,
z.ZodTypeDef,
Notification1
> = z.object({
level: Level$outboundSchema,
title: z.string(),
message: z.string().optional(),
href: z.string().optional(),
});
export function notification1ToJSON(notification1: Notification1): string {
return JSON.stringify(Notification1$outboundSchema.parse(notification1));
}
/** @internal */
export type Notification$Outbound = Notification1$Outbound | string;
/** @internal */
export const Notification$outboundSchema: z.ZodType<
Notification$Outbound,
z.ZodTypeDef,
Notification
> = smartUnion([z.lazy(() => Notification1$outboundSchema), z.string()]);
export function notificationToJSON(notification: Notification): string {
return JSON.stringify(Notification$outboundSchema.parse(notification));
}
/** @internal */
export type UpdateInstallationRequestBody$Outbound = {
status?: string | undefined;
externalId?: string | undefined;
billingPlan?: UpdateInstallationBillingPlan$Outbound | undefined;
notification?: Notification1$Outbound | string | undefined;
};
/** @internal */
export const UpdateInstallationRequestBody$outboundSchema: z.ZodType<
UpdateInstallationRequestBody$Outbound,
z.ZodTypeDef,
UpdateInstallationRequestBody
> = z.object({
status: UpdateInstallationStatus$outboundSchema.optional(),
externalId: z.string().optional(),
billingPlan: z.lazy(() => UpdateInstallationBillingPlan$outboundSchema)
.optional(),
notification: smartUnion([
z.lazy(() => Notification1$outboundSchema),
z.string(),
]).optional(),
});
export function updateInstallationRequestBodyToJSON(
updateInstallationRequestBody: UpdateInstallationRequestBody,
): string {
return JSON.stringify(
UpdateInstallationRequestBody$outboundSchema.parse(
updateInstallationRequestBody,
),
);
}
/** @internal */
export type UpdateInstallationRequest$Outbound = {
integrationConfigurationId: string;
RequestBody?: UpdateInstallationRequestBody$Outbound | undefined;
};
/** @internal */
export const UpdateInstallationRequest$outboundSchema: z.ZodType<
UpdateInstallationRequest$Outbound,
z.ZodTypeDef,
UpdateInstallationRequest
> = z.object({
integrationConfigurationId: z.string(),
requestBody: z.lazy(() => UpdateInstallationRequestBody$outboundSchema)
.optional(),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function updateInstallationRequestToJSON(
updateInstallationRequest: UpdateInstallationRequest,
): string {
return JSON.stringify(
UpdateInstallationRequest$outboundSchema.parse(updateInstallationRequest),
);
}