@limitly/limitly-js
Version:
Official Node.js SDK for Limitly - API Key management, plans, users and request validation
61 lines • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlansModule = void 0;
/**
* Module for managing Plans
*/
class PlansModule {
constructor(client) {
this.client = client;
}
/**
* Lists all plans for the client
*/
async list(options) {
return this.client.get('/plans', options);
}
/**
* Creates a new plan
*/
async create(data, options) {
return this.client.post('/plans', data, options);
}
/**
* Gets a specific plan by ID
*/
async get(planId, options) {
return this.client.get(`/plans/${planId}`, options);
}
/**
* Updates an existing plan
*/
async update(planId, data, options) {
return this.client.put(`/plans/${planId}`, data, options);
}
/**
* Deletes a plan
*/
async delete(planId, options) {
return this.client.delete(`/plans/${planId}`, options);
}
/**
* Gets usage statistics for a plan
*/
async getUsage(planId, options) {
return this.client.get(`/plans/${planId}/usage`, options);
}
/**
* Gets all users assigned to a plan
*/
async getUsers(planId, options) {
return this.client.get(`/plans/${planId}/users`, options);
}
/**
* Gets all API Keys directly assigned to a plan
*/
async getKeys(planId, options) {
return this.client.get(`/plans/${planId}/keys`, options);
}
}
exports.PlansModule = PlansModule;
//# sourceMappingURL=plans.js.map