UNPKG

@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>

198 lines 7.18 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../lib/schemas.js"; import * as types from "../types/primitives.js"; import { APIKey$inboundSchema } from "./apikey.js"; import { VercelError } from "./vercelerror.js"; /** * How often the quota refreshes. */ export const CreateApiKeysRefreshPeriod = { Daily: "daily", Weekly: "weekly", Monthly: "monthly", None: "none", }; export class CreateApiKeysResponse500ResponseBody extends VercelError { error; /** The original data that was passed to this error instance. */ data$; constructor(err, httpMeta) { const message = err.error?.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; this.error = err.error; this.name = "CreateApiKeysResponse500ResponseBody"; } } export class CreateApiKeysResponse429ResponseBody extends VercelError { error; /** The original data that was passed to this error instance. */ data$; constructor(err, httpMeta) { const message = err.error?.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; this.error = err.error; this.name = "CreateApiKeysResponse429ResponseBody"; } } /** * You do not have permission to access this resource. */ export class CreateApiKeysResponse403ResponseBody extends VercelError { error; /** The original data that was passed to this error instance. */ data$; constructor(err, httpMeta) { const message = err.error?.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; this.error = err.error; this.name = "CreateApiKeysResponse403ResponseBody"; } } /** * The request is not authorized. */ export class CreateApiKeysResponseResponseBody extends VercelError { error; /** The original data that was passed to this error instance. */ data$; constructor(err, httpMeta) { const message = err.error?.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; this.error = err.error; this.name = "CreateApiKeysResponseResponseBody"; } } /** @internal */ export const CreateApiKeysRefreshPeriod$outboundSchema = z.nativeEnum(CreateApiKeysRefreshPeriod); /** @internal */ export const AiGatewayQuota$outboundSchema = z.object({ limitAmount: z.number(), includeByokInQuota: z.boolean().default(false), refreshPeriod: CreateApiKeysRefreshPeriod$outboundSchema.default("none"), alertThresholds: z.array(z.number()).optional(), }); export function aiGatewayQuotaToJSON(aiGatewayQuota) { return JSON.stringify(AiGatewayQuota$outboundSchema.parse(aiGatewayQuota)); } /** @internal */ export const CreateApiKeysRequestBody$outboundSchema = z.object({ purpose: z.string(), projectId: z.string().optional(), name: z.string().optional(), expiresAt: z.number().optional(), aiGatewayQuota: z.lazy(() => AiGatewayQuota$outboundSchema).optional(), metadata: z.record(z.any()).optional(), }); export function createApiKeysRequestBodyToJSON(createApiKeysRequestBody) { return JSON.stringify(CreateApiKeysRequestBody$outboundSchema.parse(createApiKeysRequestBody)); } /** @internal */ export const CreateApiKeysResponse500Error$inboundSchema = z.object({ code: types.string(), message: types.string(), }); export function createApiKeysResponse500ErrorFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateApiKeysResponse500Error$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateApiKeysResponse500Error' from JSON`); } /** @internal */ export const CreateApiKeysResponse500ResponseBody$inboundSchema = z.object({ error: z.lazy(() => CreateApiKeysResponse500Error$inboundSchema), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new CreateApiKeysResponse500ResponseBody(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export const CreateApiKeysResponse429Error$inboundSchema = z.object({ code: types.string(), name: types.string(), message: types.string(), limit: types.number(), }); export function createApiKeysResponse429ErrorFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateApiKeysResponse429Error$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateApiKeysResponse429Error' from JSON`); } /** @internal */ export const CreateApiKeysResponse429ResponseBody$inboundSchema = z.object({ error: z.lazy(() => CreateApiKeysResponse429Error$inboundSchema), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new CreateApiKeysResponse429ResponseBody(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export const CreateApiKeysResponseError$inboundSchema = z.object({ code: types.string(), message: types.string(), }); export function createApiKeysResponseErrorFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateApiKeysResponseError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateApiKeysResponseError' from JSON`); } /** @internal */ export const CreateApiKeysResponse403ResponseBody$inboundSchema = z.object({ error: z.lazy(() => CreateApiKeysResponseError$inboundSchema), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new CreateApiKeysResponse403ResponseBody(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export const CreateApiKeysError$inboundSchema = z.object({ code: types.string(), message: types.string(), }); export function createApiKeysErrorFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateApiKeysError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateApiKeysError' from JSON`); } /** @internal */ export const CreateApiKeysResponseResponseBody$inboundSchema = z.object({ error: z.lazy(() => CreateApiKeysError$inboundSchema), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new CreateApiKeysResponseResponseBody(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export const CreateApiKeysResponseBody$inboundSchema = z.object({ apiKeyString: types.string(), apiKey: APIKey$inboundSchema, }); export function createApiKeysResponseBodyFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateApiKeysResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateApiKeysResponseBody' from JSON`); } //# sourceMappingURL=createapikeysop.js.map