-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.api.ts
More file actions
37 lines (36 loc) · 1.25 KB
/
user.api.ts
File metadata and controls
37 lines (36 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { AdminApi } from './admin.api';
export class UserApi extends AdminApi {
me(): Promise<any> {
return this.get('/_info/me').then((resp) => resp.data);
}
updateMe(data: Record<string, any>): Promise<any> {
return this.patch('/_info/me', data);
}
status(): Promise<any> {
return this.get('/_info/ping');
}
deleteUser(userId: string): Promise<any> {
return this.delete(`/user/${userId}`);
}
deleteUserAccessKey(userId: string, accessKeyId: string): Promise<any> {
return this.delete(`/user/${userId}/access-keys/${accessKeyId}`);
}
upsertUser(data: Record<string, any>): Promise<any> {
return this.post('/api/user', data);
}
updateUser(userId: string, data: Record<string, any>): Promise<any> {
return this.post(`/api/user/${userId}`, data);
}
upsertRole(data: Record<string, any>): Promise<any> {
return this.post('/api/acl-role', data);
}
updateRole(roleId: string, data: Record<string, any>): Promise<any> {
return this.post(`/api/acl-role/${roleId}`, data);
}
deleteUserRole(userId: string, roleId: string): Promise<any> {
return this.delete(`/api/user/${userId}/acl-roles/${roleId}`);
}
deleteRole(roleId: string): Promise<any> {
return this.delete(`/api/acl-role/${roleId}`);
}
}