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