@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>
99 lines (87 loc) • 2.46 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";
export const SDKKeyType = {
Server: "server",
Mobile: "mobile",
Client: "client",
} as const;
export type SDKKeyType = ClosedEnum<typeof SDKKeyType>;
export type CreateSDKKeyRequestBody = {
sdkKeyType: SDKKeyType;
environment: string;
label?: string | undefined;
};
export type CreateSDKKeyRequest = {
/**
* The project id or name
*/
projectIdOrName: string;
/**
* The Team identifier to perform the request on behalf of.
*/
teamId?: string | undefined;
/**
* The Team slug to perform the request on behalf of.
*/
slug?: string | undefined;
requestBody?: CreateSDKKeyRequestBody | undefined;
};
/** @internal */
export const SDKKeyType$outboundSchema: z.ZodNativeEnum<typeof SDKKeyType> = z
.nativeEnum(SDKKeyType);
/** @internal */
export type CreateSDKKeyRequestBody$Outbound = {
sdkKeyType: string;
environment: string;
label?: string | undefined;
};
/** @internal */
export const CreateSDKKeyRequestBody$outboundSchema: z.ZodType<
CreateSDKKeyRequestBody$Outbound,
z.ZodTypeDef,
CreateSDKKeyRequestBody
> = z.object({
sdkKeyType: SDKKeyType$outboundSchema,
environment: z.string(),
label: z.string().optional(),
});
export function createSDKKeyRequestBodyToJSON(
createSDKKeyRequestBody: CreateSDKKeyRequestBody,
): string {
return JSON.stringify(
CreateSDKKeyRequestBody$outboundSchema.parse(createSDKKeyRequestBody),
);
}
/** @internal */
export type CreateSDKKeyRequest$Outbound = {
projectIdOrName: string;
teamId?: string | undefined;
slug?: string | undefined;
RequestBody?: CreateSDKKeyRequestBody$Outbound | undefined;
};
/** @internal */
export const CreateSDKKeyRequest$outboundSchema: z.ZodType<
CreateSDKKeyRequest$Outbound,
z.ZodTypeDef,
CreateSDKKeyRequest
> = z.object({
projectIdOrName: z.string(),
teamId: z.string().optional(),
slug: z.string().optional(),
requestBody: z.lazy(() => CreateSDKKeyRequestBody$outboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function createSDKKeyRequestToJSON(
createSDKKeyRequest: CreateSDKKeyRequest,
): string {
return JSON.stringify(
CreateSDKKeyRequest$outboundSchema.parse(createSDKKeyRequest),
);
}