UNPKG

@unkey/api

Version:

Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.

97 lines 4.32 kB
"use strict"; /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Apis = void 0; const apisCreateApi_js_1 = require("../funcs/apisCreateApi.js"); const apisDeleteApi_js_1 = require("../funcs/apisDeleteApi.js"); const apisGetApi_js_1 = require("../funcs/apisGetApi.js"); const apisListKeys_js_1 = require("../funcs/apisListKeys.js"); const sdks_js_1 = require("../lib/sdks.js"); const fp_js_1 = require("../types/fp.js"); class Apis extends sdks_js_1.ClientSDK { /** * Create API namespace * * @remarks * Create an API namespace for organizing keys by environment, service, or product. * * Use this to separate production from development keys, isolate different services, or manage multiple products. Each API gets a unique identifier and dedicated infrastructure for secure key operations. * * **Important**: API names must be unique within your workspace and cannot be changed after creation. * * **Required Permissions** * * Your root key must have one of the following permissions: * - `api.*.create_api` (to create APIs in any workspace) */ async createApi(request, options) { return (0, fp_js_1.unwrapAsync)((0, apisCreateApi_js_1.apisCreateApi)(this, request, options)); } /** * Delete API namespace * * @remarks * Permanently delete an API namespace and immediately invalidate all associated keys. * * Use this for cleaning up development environments, retiring deprecated services, or removing unused resources. * All keys in the namespace are immediately marked as deleted and will fail verification with `code=NOT_FOUND`. * * **Important**: This operation is immediate and permanent. Verify you have the correct API ID before deletion. * If delete protection is enabled, disable it first through the dashboard or API configuration. * * **Required Permissions** * * Your root key must have one of the following permissions: * - `api.*.delete_api` (to delete any API) * - `api.<api_id>.delete_api` (to delete a specific API) */ async deleteApi(request, options) { return (0, fp_js_1.unwrapAsync)((0, apisDeleteApi_js_1.apisDeleteApi)(this, request, options)); } /** * Get API namespace * * @remarks * Retrieve basic information about an API namespace including its ID and name. * * Use this to verify an API exists before performing operations, get the human-readable name when you only have the API ID, or confirm access to a specific namespace. For detailed key information, use the `listKeys` endpoint instead. * * **Required Permissions** * * Your root key must have one of the following permissions: * - `api.*.read_api` (to read any API) * - `api.<api_id>.read_api` (to read a specific API) */ async getApi(request, options) { return (0, fp_js_1.unwrapAsync)((0, apisGetApi_js_1.apisGetApi)(this, request, options)); } /** * List API keys * * @remarks * Retrieve a paginated list of API keys for dashboard and administrative interfaces. * * Use this to build key management dashboards, filter keys by user with `externalId`, or retrieve key details for administrative purposes. Each key includes status, metadata, permissions, and usage limits. * * **Important**: Set `decrypt: true` only in secure contexts to retrieve plaintext key values from recoverable keys. * * **Required Permissions** * * Your root key must have one of the following permissions for basic key listing: * - `api.*.read_key` (to read keys from any API) * - `api.<api_id>.read_key` (to read keys from a specific API) * * Additionally, you need read access to the API itself: * - `api.*.read_api` or `api.<api_id>.read_api` * * Additional permission required for decrypt functionality: * - `api.*.decrypt_key` or `api.<api_id>.decrypt_key` */ async listKeys(request, options) { return (0, fp_js_1.unwrapAsync)((0, apisListKeys_js_1.apisListKeys)(this, request, options)); } } exports.Apis = Apis; //# sourceMappingURL=apis.js.map