Source code for mattermostdriver.endpoints.teams

import warnings

from .base import Base
from .users import Users


[docs]class Teams(Base): endpoint = '/teams'
[docs] def create_team(self, options=None): return self.client.post( self.endpoint, options )
[docs] def get_teams(self, params=None): return self.client.get( self.endpoint, params=params )
[docs] def get_team(self, team_id): return self.client.get( self.endpoint + '/' + team_id, )
[docs] def update_team(self, team_id, options=None): return self.client.put( self.endpoint + '/' + team_id, options )
[docs] def delete_team(self, team_id, params=None): return self.client.delete( self.endpoint + '/' + team_id, params=params )
[docs] def patch_team(self, team_id, options=None): return self.client.put( self.endpoint + '/' + team_id + '/patch', options )
[docs] def get_team_by_name(self, name): return self.client.get( self.endpoint + '/name/' + name )
[docs] def search_teams(self, options=None): return self.client.post( self.endpoint + '/search', options )
[docs] def check_team_exists(self, name): return self.client.get( self.endpoint + '/name/' + name + '/exists' )
[docs] def get_user_teams(self, user_id): return self.client.get( Users.endpoint + '/' + user_id + '/teams' )
[docs] def get_team_members(self, team_id, params=None): return self.client.get( self.endpoint + '/' + team_id + '/members', params=params )
[docs] def add_user_to_team(self, team_id, options=None): return self.client.post( self.endpoint + '/' + team_id + '/members', options=options )
[docs] def add_user_to_team_from_invite(self, params=None): return self.client.post( self.endpoint + '/members/invite', params=params )
[docs] def add_multiple_users_to_team(self, team_id, options=None): return self.client.post( self.endpoint + '/' + team_id + '/members/batch', options=options )
[docs] def get_team_members_for_user(self, user_id): return self.client.get( Users.endpoint + '/' + user_id + '/teams/members' )
[docs] def get_team_member(self, team_id, user_id): return self.client.get( self.endpoint + '/' + team_id + '/members/' + user_id )
[docs] def remove_user_from_team(self, team_id, user_id): return self.client.delete( self.endpoint + '/' + team_id + '/members/' + user_id )
[docs] def get_team_members_by_id(self, team_id, options=None): return self.client.post( self.endpoint + '/' + team_id + '/members/ids', options )
[docs] def get_team_stats(self, team_id): return self.client.get( self.endpoint + '/' + team_id + '/stats' )
[docs] def update_team_member_roles(self, team_id, user_id, options=None): return self.client.put( self.endpoint + '/' + team_id + '/members/' + user_id + '/roles', options )
[docs] def get_team_unreads_for_user(self, user_id, params=None): return self.client.get( Users.endpoint + '/' + user_id + '/teams/unread', params=params )
[docs] def get_unreads_for_team(self, user_id, team_id): return self.client.get( Users.endpoint + '/' + user_id + '/teams/' + team_id + '/unread', )
[docs] def invite_users_to_team_by_mail(self, team_id, options=None): return self.client.post( self.endpoint + '/' + team_id + '/invite/email', options )
[docs] def import_team_from_other_app(self, team_id, data=None): return self.client.post( self.endpoint + '/' + team_id + '/import', data=data )
[docs] def get_invite_info_for_team(self, invite_id): return self.client.get( self.endpoint + '/invite/' + invite_id, )
[docs] def get_public_channels(self, team_id, params=None): warnings.warn( 'Using deprecated endpoint Teams.get_public_channels(). ' + 'Use Channels.get_public_channels() instead.', DeprecationWarning ) return self.client.get( self.endpoint + '/' + team_id + '/channels', params=params )
[docs] def get_deleted_channels(self, team_id, params=None): warnings.warn( 'Using deprecated endpoint Teams.get_deleted_channels(). ' + 'Use Channels.get_deleted_channels() instead.', DeprecationWarning ) return self.client.get( self.endpoint + '/' + team_id + '/channels/deleted', params=params )
[docs] def search_channels(self, team_id, options=None): warnings.warn( 'Using deprecated endpoint Teams.search_channels(). Use Channels.search_channels() instead.', DeprecationWarning ) return self.client.post( self.endpoint + '/' + team_id + '/channels/search', options=options )
[docs] def get_team_icon(self, team_id): return self.client.get( self.endpoint + '/' + team_id + '/image' )
[docs] def set_team_icon(self, team_id, file): return self.client.post( self.endpoint + '/' + team_id + '/image', files=file )
[docs] def update_scheme_derived_roles_of_team_member(self, team_id, user_id, options=None): return self.client.put( self.endpoint + '/' + team_id + '/members/' + user_id + '/schemeRoles', options=options )
[docs] def delete_team_icon(self, team_id): self.client.delete( self.endpoint + '/' + team_id + '/image' )
[docs] def set_team_scheme(self, team_id): return self.client.put( self.endpoint + '/' + team_id + '/scheme' )