-
Notifications
You must be signed in to change notification settings - Fork 2
/
users.py
28 lines (22 loc) · 837 Bytes
/
users.py
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
from .base import BaseService
from .mixins import CommonMixin, NameMixin, PrintMixin
class UsersService(CommonMixin, NameMixin, PrintMixin):
def __init__(self, base: BaseService) -> None:
CommonMixin.__init__(self, base)
self.__base = base
self.endpoint = "/api/users"
def disable(self, user_id: int) -> None:
"""
disable user
"""
self.__base.post(f"/api/users/{user_id}/disable")
def add_group(self, user_id: int, group_id: int) -> None:
"""
add user to group
"""
self.__base.post(f"/api/groups/{group_id}/members", {"user_id": user_id})
def remove_group(self, user_id: int, group_id: int) -> None:
"""
remove user from group
"""
self.__base.delete(f"/api/groups/{group_id}/members/{user_id}")