@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>
213 lines • 8.27 kB
TypeScript
import * as z from "zod/v3";
import { ClosedEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { APIKey } from "./apikey.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
import { VercelError } from "./vercelerror.js";
/**
* How often the quota refreshes.
*/
export declare const CreateApiKeysRefreshPeriod: {
readonly Daily: "daily";
readonly Weekly: "weekly";
readonly Monthly: "monthly";
readonly None: "none";
};
/**
* How often the quota refreshes.
*/
export type CreateApiKeysRefreshPeriod = ClosedEnum<typeof CreateApiKeysRefreshPeriod>;
/**
* Optional AI Gateway quota configuration for the API key.
*/
export type AiGatewayQuota = {
/**
* The quota limit amount.
*/
limitAmount: number;
/**
* Whether to include BYOK (Bring Your Own Key) usage in the quota.
*/
includeByokInQuota?: boolean | undefined;
/**
* How often the quota refreshes.
*/
refreshPeriod?: CreateApiKeysRefreshPeriod | undefined;
/**
* Spend percentages (a subset of [50, 75, 100]) at which to send a spend alert.
*/
alertThresholds?: Array<number> | undefined;
};
export type CreateApiKeysRequestBody = {
/**
* The API key's purpose, which restricts how it can be used.
*/
purpose: string;
/**
* An optional project to restrict the API key to.
*/
projectId?: string | undefined;
/**
* An optional name for the API key.
*/
name?: string | undefined;
/**
* The API key's expiration, expressed as a UNIX timestamp in milliseconds.
*/
expiresAt?: number | undefined;
/**
* Optional AI Gateway quota configuration for the API key.
*/
aiGatewayQuota?: AiGatewayQuota | undefined;
/**
* Optional generic metadata for the API key. The accepted shape depends on the key's `purpose` and is validated on creation; for `ai-gateway` keys this accepts `environment`.
*/
metadata?: {
[k: string]: any;
} | undefined;
};
export type CreateApiKeysResponse500Error = {
code: string;
message: string;
};
export type CreateApiKeysResponse500ResponseBodyData = {
error: CreateApiKeysResponse500Error;
};
export declare class CreateApiKeysResponse500ResponseBody extends VercelError {
error: CreateApiKeysResponse500Error;
/** The original data that was passed to this error instance. */
data$: CreateApiKeysResponse500ResponseBodyData;
constructor(err: CreateApiKeysResponse500ResponseBodyData, httpMeta: {
response: Response;
request: Request;
body: string;
});
}
export type CreateApiKeysResponse429Error = {
code: string;
name: string;
message: string;
limit: number;
};
export type CreateApiKeysResponse429ResponseBodyData = {
error: CreateApiKeysResponse429Error;
};
export declare class CreateApiKeysResponse429ResponseBody extends VercelError {
error: CreateApiKeysResponse429Error;
/** The original data that was passed to this error instance. */
data$: CreateApiKeysResponse429ResponseBodyData;
constructor(err: CreateApiKeysResponse429ResponseBodyData, httpMeta: {
response: Response;
request: Request;
body: string;
});
}
export type CreateApiKeysResponseError = {
code: string;
message: string;
};
/**
* You do not have permission to access this resource.
*/
export type CreateApiKeysResponse403ResponseBodyData = {
error: CreateApiKeysResponseError;
};
/**
* You do not have permission to access this resource.
*/
export declare class CreateApiKeysResponse403ResponseBody extends VercelError {
error: CreateApiKeysResponseError;
/** The original data that was passed to this error instance. */
data$: CreateApiKeysResponse403ResponseBodyData;
constructor(err: CreateApiKeysResponse403ResponseBodyData, httpMeta: {
response: Response;
request: Request;
body: string;
});
}
export type CreateApiKeysError = {
code: string;
message: string;
};
/**
* The request is not authorized.
*/
export type CreateApiKeysResponseResponseBodyData = {
error: CreateApiKeysError;
};
/**
* The request is not authorized.
*/
export declare class CreateApiKeysResponseResponseBody extends VercelError {
error: CreateApiKeysError;
/** The original data that was passed to this error instance. */
data$: CreateApiKeysResponseResponseBodyData;
constructor(err: CreateApiKeysResponseResponseBodyData, httpMeta: {
response: Response;
request: Request;
body: string;
});
}
/**
* Successfully created an API key.
*/
export type CreateApiKeysResponseBody = {
/**
* The API key's actual value. This value is only provided in this response, and can never be retrieved again in the future. Be sure to save it somewhere safe!
*/
apiKeyString: string;
/**
* Information about the newly created API key.
*/
apiKey: APIKey;
};
/** @internal */
export declare const CreateApiKeysRefreshPeriod$outboundSchema: z.ZodNativeEnum<typeof CreateApiKeysRefreshPeriod>;
/** @internal */
export type AiGatewayQuota$Outbound = {
limitAmount: number;
includeByokInQuota: boolean;
refreshPeriod: string;
alertThresholds?: Array<number> | undefined;
};
/** @internal */
export declare const AiGatewayQuota$outboundSchema: z.ZodType<AiGatewayQuota$Outbound, z.ZodTypeDef, AiGatewayQuota>;
export declare function aiGatewayQuotaToJSON(aiGatewayQuota: AiGatewayQuota): string;
/** @internal */
export type CreateApiKeysRequestBody$Outbound = {
purpose: string;
projectId?: string | undefined;
name?: string | undefined;
expiresAt?: number | undefined;
aiGatewayQuota?: AiGatewayQuota$Outbound | undefined;
metadata?: {
[k: string]: any;
} | undefined;
};
/** @internal */
export declare const CreateApiKeysRequestBody$outboundSchema: z.ZodType<CreateApiKeysRequestBody$Outbound, z.ZodTypeDef, CreateApiKeysRequestBody>;
export declare function createApiKeysRequestBodyToJSON(createApiKeysRequestBody: CreateApiKeysRequestBody): string;
/** @internal */
export declare const CreateApiKeysResponse500Error$inboundSchema: z.ZodType<CreateApiKeysResponse500Error, z.ZodTypeDef, unknown>;
export declare function createApiKeysResponse500ErrorFromJSON(jsonString: string): SafeParseResult<CreateApiKeysResponse500Error, SDKValidationError>;
/** @internal */
export declare const CreateApiKeysResponse500ResponseBody$inboundSchema: z.ZodType<CreateApiKeysResponse500ResponseBody, z.ZodTypeDef, unknown>;
/** @internal */
export declare const CreateApiKeysResponse429Error$inboundSchema: z.ZodType<CreateApiKeysResponse429Error, z.ZodTypeDef, unknown>;
export declare function createApiKeysResponse429ErrorFromJSON(jsonString: string): SafeParseResult<CreateApiKeysResponse429Error, SDKValidationError>;
/** @internal */
export declare const CreateApiKeysResponse429ResponseBody$inboundSchema: z.ZodType<CreateApiKeysResponse429ResponseBody, z.ZodTypeDef, unknown>;
/** @internal */
export declare const CreateApiKeysResponseError$inboundSchema: z.ZodType<CreateApiKeysResponseError, z.ZodTypeDef, unknown>;
export declare function createApiKeysResponseErrorFromJSON(jsonString: string): SafeParseResult<CreateApiKeysResponseError, SDKValidationError>;
/** @internal */
export declare const CreateApiKeysResponse403ResponseBody$inboundSchema: z.ZodType<CreateApiKeysResponse403ResponseBody, z.ZodTypeDef, unknown>;
/** @internal */
export declare const CreateApiKeysError$inboundSchema: z.ZodType<CreateApiKeysError, z.ZodTypeDef, unknown>;
export declare function createApiKeysErrorFromJSON(jsonString: string): SafeParseResult<CreateApiKeysError, SDKValidationError>;
/** @internal */
export declare const CreateApiKeysResponseResponseBody$inboundSchema: z.ZodType<CreateApiKeysResponseResponseBody, z.ZodTypeDef, unknown>;
/** @internal */
export declare const CreateApiKeysResponseBody$inboundSchema: z.ZodType<CreateApiKeysResponseBody, z.ZodTypeDef, unknown>;
export declare function createApiKeysResponseBodyFromJSON(jsonString: string): SafeParseResult<CreateApiKeysResponseBody, SDKValidationError>;
//# sourceMappingURL=createapikeysop.d.ts.map