@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>
131 lines (118 loc) • 3.1 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 { safeParse } from "../lib/schemas.js";
import { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
export type UploadCertRequestBody = {
/**
* The certificate authority
*/
ca: string;
/**
* The certificate key
*/
key: string;
/**
* The certificate
*/
cert: string;
/**
* Skip validation of the certificate
*/
skipValidation?: boolean | undefined;
};
export type UploadCertRequest = {
/**
* 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?: UploadCertRequestBody | undefined;
};
export type UploadCertResponseBody = {
id: string;
createdAt: number;
expiresAt: number;
autoRenew: boolean;
cns: Array<string>;
};
/** @internal */
export type UploadCertRequestBody$Outbound = {
ca: string;
key: string;
cert: string;
skipValidation?: boolean | undefined;
};
/** @internal */
export const UploadCertRequestBody$outboundSchema: z.ZodType<
UploadCertRequestBody$Outbound,
z.ZodTypeDef,
UploadCertRequestBody
> = z.object({
ca: z.string(),
key: z.string(),
cert: z.string(),
skipValidation: z.boolean().optional(),
});
export function uploadCertRequestBodyToJSON(
uploadCertRequestBody: UploadCertRequestBody,
): string {
return JSON.stringify(
UploadCertRequestBody$outboundSchema.parse(uploadCertRequestBody),
);
}
/** @internal */
export type UploadCertRequest$Outbound = {
teamId?: string | undefined;
slug?: string | undefined;
RequestBody?: UploadCertRequestBody$Outbound | undefined;
};
/** @internal */
export const UploadCertRequest$outboundSchema: z.ZodType<
UploadCertRequest$Outbound,
z.ZodTypeDef,
UploadCertRequest
> = z.object({
teamId: z.string().optional(),
slug: z.string().optional(),
requestBody: z.lazy(() => UploadCertRequestBody$outboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function uploadCertRequestToJSON(
uploadCertRequest: UploadCertRequest,
): string {
return JSON.stringify(
UploadCertRequest$outboundSchema.parse(uploadCertRequest),
);
}
/** @internal */
export const UploadCertResponseBody$inboundSchema: z.ZodType<
UploadCertResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
id: types.string(),
createdAt: types.number(),
expiresAt: types.number(),
autoRenew: types.boolean(),
cns: z.array(types.string()),
});
export function uploadCertResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<UploadCertResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => UploadCertResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'UploadCertResponseBody' from JSON`,
);
}