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)
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)
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)
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')
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)
def get(self): user_auth = request.headers['Authorization'] server = get_instance() return dict(result=server.get_rooms(user_auth=user_auth))
def delete(self, name): user_auth = request.headers['Authorization'] server = get_instance() server.destroy_room(user_auth=user_auth, name=name)
def post(self, name): user_auth = request.headers['Authorization'] server = get_instance() server.create_room(user_auth=user_auth, name=name)
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)