@hongkongkiwi/clockify-master-mcp
Version:
Clockify Master MCP - The most comprehensive Model Context Protocol server for Clockify time tracking with full API integration, advanced filtering, and enterprise features
38 lines • 1.49 kB
JavaScript
export class UserService {
client;
constructor(client) {
this.client = client;
}
async getCurrentUser() {
return this.client.get('/user');
}
async getUserById(workspaceId, userId) {
return this.client.get(`/workspaces/${workspaceId}/users/${userId}`);
}
async getAllUsers(workspaceId, options) {
return this.client.get(`/workspaces/${workspaceId}/users`, options);
}
async updateUser(workspaceId, userId, data) {
return this.client.put(`/workspaces/${workspaceId}/users/${userId}`, data);
}
async findUserByEmail(workspaceId, email) {
const users = await this.getAllUsers(workspaceId, { email });
return users.length > 0 ? users[0] : null;
}
async findUserByName(workspaceId, name) {
const users = await this.getAllUsers(workspaceId);
return users.filter(user => user.name.toLowerCase().includes(name.toLowerCase()));
}
async addUserToWorkspace(workspaceId, email) {
return this.client.post(`/workspaces/${workspaceId}/users`, { email });
}
async removeUserFromWorkspace(workspaceId, userId) {
return this.client.delete(`/workspaces/${workspaceId}/users/${userId}`);
}
async setUserActiveStatus(workspaceId, userId, active) {
return this.client.put(`/workspaces/${workspaceId}/users/${userId}/status`, {
status: active ? 'ACTIVE' : 'INACTIVE',
});
}
}
//# sourceMappingURL=user.service.js.map