def update_me(self, **kwargs): data = { 'name': kwargs.get('name'), 'email': kwargs.get('email'), 'password': kwargs.get('password'), 'status': kwargs.get('status'), 'attributes': kwargs.get('attributes', None) or dict(), 'text': kwargs.get('text') } r = self.http.put('/user/me', data) return User.parse(r['user'])
def create_user(self, name, email, password, status, roles=None, attributes=None, text='', email_verified=False): data = { 'name': name, 'email': email, 'password': password, 'status': status, 'roles': roles or list(), 'attributes': attributes or dict(), 'text': text, 'email_verified': email_verified } r = self.http.post('/user', data) return User.parse(r['user'])
def update_user(self, id, **kwargs): data = { 'name': kwargs.get('name'), 'email': kwargs.get('email'), 'password': kwargs.get('password'), 'status': kwargs.get('status'), 'roles': kwargs.get('roles', None) or list(), 'attributes': kwargs.get('attributes', None) or dict(), 'text': kwargs.get('text'), 'email_verified': kwargs.get('email_verified') } r = self.http.put('/user/{}'.format(id), data) return User.parse(r['user'])
def get_users(self, query=None): r = self.http.get('/users', query) return [User.parse(u) for u in r['users']]
def get_group_users(self, id): r = self.http.get('/group/{}/users'.format(id)) return [User.parse(u) for u in r['users']]
def get_me(self): return User.parse(self.http.get('/user/me')['user'])
def get_user(self): return User.parse(self.http.get('/user/%s' % id)['user'])
def get_group_users(self, id): r = self.http.get(f'/group/{id}/users') return [User.parse(u) for u in r['users']]