@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>
149 lines • 5.64 kB
JavaScript
/*
* 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 { safeParse } from "../lib/schemas.js";
import * as types from "../types/primitives.js";
export const Ownership = {
Owned: "owned",
Linked: "linked",
Sandbox: "sandbox",
};
export const ImportResourceStatus = {
Ready: "ready",
Pending: "pending",
Onboarding: "onboarding",
Suspended: "suspended",
Resumed: "resumed",
Uninstalled: "uninstalled",
Error: "error",
};
export const ImportResourceType = {
Prepayment: "prepayment",
Subscription: "subscription",
};
export const ImportResourceLevel = {
Info: "info",
Warn: "warn",
Error: "error",
};
/** @internal */
export const Ownership$outboundSchema = z
.nativeEnum(Ownership);
/** @internal */
export const ImportResourceStatus$outboundSchema = z.nativeEnum(ImportResourceStatus);
/** @internal */
export const ImportResourceType$outboundSchema = z.nativeEnum(ImportResourceType);
/** @internal */
export const ImportResourceDetails$outboundSchema = z.object({
label: z.string(),
value: z.string().optional(),
});
export function importResourceDetailsToJSON(importResourceDetails) {
return JSON.stringify(ImportResourceDetails$outboundSchema.parse(importResourceDetails));
}
/** @internal */
export const ImportResourceHighlightedDetails$outboundSchema = z.object({
label: z.string(),
value: z.string().optional(),
});
export function importResourceHighlightedDetailsToJSON(importResourceHighlightedDetails) {
return JSON.stringify(ImportResourceHighlightedDetails$outboundSchema.parse(importResourceHighlightedDetails));
}
/** @internal */
export const ImportResourceBillingPlan$outboundSchema = z.object({
id: z.string(),
type: ImportResourceType$outboundSchema,
name: z.string(),
description: z.string().optional(),
paymentMethodRequired: z.boolean().optional(),
cost: z.string().optional(),
details: z.array(z.lazy(() => ImportResourceDetails$outboundSchema))
.optional(),
highlightedDetails: z.array(z.lazy(() => ImportResourceHighlightedDetails$outboundSchema)).optional(),
effectiveDate: z.string().optional(),
additionalProperties: z.record(z.any()).optional(),
}).transform((v) => {
return {
...v.additionalProperties,
...remap$(v, {
additionalProperties: null,
}),
};
});
export function importResourceBillingPlanToJSON(importResourceBillingPlan) {
return JSON.stringify(ImportResourceBillingPlan$outboundSchema.parse(importResourceBillingPlan));
}
/** @internal */
export const ImportResourceLevel$outboundSchema = z.nativeEnum(ImportResourceLevel);
/** @internal */
export const ImportResourceNotification$outboundSchema = z.object({
level: ImportResourceLevel$outboundSchema,
title: z.string(),
message: z.string().optional(),
href: z.string().optional(),
});
export function importResourceNotificationToJSON(importResourceNotification) {
return JSON.stringify(ImportResourceNotification$outboundSchema.parse(importResourceNotification));
}
/** @internal */
export const EnvironmentOverrides$outboundSchema = z.object({
development: z.string().optional(),
preview: z.string().optional(),
production: z.string().optional(),
});
export function environmentOverridesToJSON(environmentOverrides) {
return JSON.stringify(EnvironmentOverrides$outboundSchema.parse(environmentOverrides));
}
/** @internal */
export const ImportResourceSecrets$outboundSchema = z.object({
name: z.string(),
value: z.string(),
prefix: z.string().optional(),
environmentOverrides: z.lazy(() => EnvironmentOverrides$outboundSchema)
.optional(),
});
export function importResourceSecretsToJSON(importResourceSecrets) {
return JSON.stringify(ImportResourceSecrets$outboundSchema.parse(importResourceSecrets));
}
/** @internal */
export const ImportResourceRequestBody$outboundSchema = z.object({
ownership: Ownership$outboundSchema.optional(),
productId: z.string(),
name: z.string(),
status: ImportResourceStatus$outboundSchema,
metadata: z.record(z.any()).optional(),
billingPlan: z.lazy(() => ImportResourceBillingPlan$outboundSchema)
.optional(),
notification: z.lazy(() => ImportResourceNotification$outboundSchema)
.optional(),
extras: z.record(z.any()).optional(),
secrets: z.array(z.lazy(() => ImportResourceSecrets$outboundSchema))
.optional(),
});
export function importResourceRequestBodyToJSON(importResourceRequestBody) {
return JSON.stringify(ImportResourceRequestBody$outboundSchema.parse(importResourceRequestBody));
}
/** @internal */
export const ImportResourceRequest$outboundSchema = z.object({
integrationConfigurationId: z.string(),
resourceId: z.string(),
requestBody: z.lazy(() => ImportResourceRequestBody$outboundSchema)
.optional(),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function importResourceRequestToJSON(importResourceRequest) {
return JSON.stringify(ImportResourceRequest$outboundSchema.parse(importResourceRequest));
}
/** @internal */
export const ImportResourceResponseBody$inboundSchema = z.object({
name: types.string(),
});
export function importResourceResponseBodyFromJSON(jsonString) {
return safeParse(jsonString, (x) => ImportResourceResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ImportResourceResponseBody' from JSON`);
}
//# sourceMappingURL=importresourceop.js.map