UNPKG

@limitly/limitly-js

Version:

Official Node.js SDK for Limitly - API Key management, plans, users and request validation

61 lines 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ApiKeysModule = void 0; /** * Module for managing API Keys */ class ApiKeysModule { constructor(client) { this.client = client; } /** * Lists all API Keys for the authenticated owner */ async list(options) { return this.client.get('/keys', options); } /** * Creates a new API Key */ async create(data, options) { return this.client.post('/keys', data, options); } /** * Gets a specific API Key by ID */ async get(keyId, options) { return this.client.get(`/keys/${keyId}`, options); } /** * Updates an existing API Key */ async update(keyId, data, options) { return this.client.put(`/keys/${keyId}`, data, options); } /** * Deletes an API Key (soft delete) */ async delete(keyId, options) { return this.client.delete(`/keys/${keyId}`, options); } /** * Regenerates an existing API Key */ async regenerate(keyId, options) { return this.client.post(`/keys/${keyId}/regenerate`, undefined, options); } /** * Gets usage statistics for an API Key */ async getUsage(keyId, options) { return this.client.get(`/keys/${keyId}/usage`, options); } /** * Gets detailed request history for an API Key */ async getRequests(keyId, options) { return this.client.get(`/keys/${keyId}/requests`, options); } } exports.ApiKeysModule = ApiKeysModule; //# sourceMappingURL=api-keys.js.map