Exemplo n.º 1
0
 def post(self):
     parser = RequestParser()
     parser.add_argument('name', type=str, required=True)
     args = parser.parse_args()
     server = get_instance()
     args['user_auth'] = request.headers['Authorization']
     server.join_room(**args)
Exemplo n.º 2
0
 def post(self, name):
     user_auth = request.headers['Authorization']
     parser = RequestParser()
     parser.add_argument('message', type=str, required=True)
     message = parser.parse_args()['message']
     server = get_instance()
     server.handle_message(user_auth, name, message)
Exemplo n.º 3
0
 def post(self):
     parser = RequestParser()
     parser.add_argument('username', type=str, required=True)
     parser.add_argument('password', type=str, required=True)
     args = parser.parse_args()
     server = get_instance()
     user_auth = server.login(**args)
     return dict(user_auth=user_auth)
Exemplo n.º 4
0
 def post(self):
     parser = RequestParser()
     parser.add_argument('username', type=str, required=True)
     parser.add_argument('handle', type=str, required=True)
     parser.add_argument('password', type=str, required=True)
     args = parser.parse_args()
     server = get_instance()
     server.register(**args)
     return dict(result='OK')
Exemplo n.º 5
0
 def get(self, name, start, end):
     user_auth = request.headers['Authorization']
     server = get_instance()
     result = server.get_messages(user_auth, name, start, end)
     result = {k.isoformat(): v for k,v in result.iteritems()}
     return dict(result=result)
Exemplo n.º 6
0
 def get(self):
     user_auth = request.headers['Authorization']
     server = get_instance()
     return dict(result=server.get_rooms(user_auth=user_auth))
Exemplo n.º 7
0
 def delete(self, name):
     user_auth = request.headers['Authorization']
     server = get_instance()
     server.destroy_room(user_auth=user_auth, name=name)
Exemplo n.º 8
0
 def post(self, name):
     user_auth = request.headers['Authorization']
     server = get_instance()
     server.create_room(user_auth=user_auth, name=name)
Exemplo n.º 9
0
 def get(self, name):
     user_auth = request.headers['Authorization']
     server = get_instance()
     result = server.get_room_members(user_auth=user_auth, name=name)
     return dict(result=result)