def delete(self): '''Sets empty cookie (to simulate logging out)''' ret = 'Successfully logged out.' cookie_name = jwt.jwt_cookie_name return responses.success(ret, 200, {'Set-Cookie': f'{cookie_name}=\'\'' ''})
def post(self): ''' Sets a stream as finished. on_publish_done callback. Return code does not matter. ''' logger.debug('Posted stop data: %s', str(request.form.to_dict())) stream_id = request.form['name'] stream_manager.end_stream(stream_id) return responses.success('Stream ended.')
def post(self): post_data = request.get_json() stream_id = post_data.get('stream_id') name = post_data.get('name') start = float(post_data.get('start')) end = float(post_data.get('end')) ret = clip_manager.create_clip( stream_id=stream_id, name=name, start=start, end=end) return responses.success(ret, 201)
def post(self): post_data = request.get_json() email = post_data.get('email') password = post_data.get('password') user = account_manager.authenticate_user(email, password) jwt_token = jwt.encode_jwt(user.login_id) cookie_name = jwt.jwt_cookie_name ret = {'token': jwt_token} return responses.success(ret, 200, {'Set-Cookie': f'{cookie_name}={jwt_token}'})
def get(self): user = account_manager.get_user(g.user) streams = stream_manager.get_user_streams(g.user) clips = clip_manager.get_user_clips(g.user) highlights = highlight_manager.get_user_highlights(g.user) ret = { 'highlights': highlights, 'streams': streams, 'clips': clips, 'user': user } return responses.success(ret, 200)
def post(self): post_data = request.get_json() email = post_data.get('email') password = post_data.get('password') first_name = post_data.get('first_name') last_name = post_data.get('last_name') user = account_manager.create_new_user(email, password, first_name, last_name) jwt_token = jwt.encode_jwt(user.login_id) cookie_name = jwt.jwt_cookie_name ret = {'token': jwt_token} return responses.success(ret, 201, {'Set-Cookie': f'{cookie_name}={jwt_token}'})
def get(self): return responses.success({'id': g.user.id})
def post(self): '''Login''' user = self.account_manager.authenticate_user('*****@*****.**', 'test') jwt_token = jwt.encode_jwt(user.login_id) return responses.success({'token': jwt_token})
def get(self, id): highlight = highlight_manager.get_user_highlight(g.user, id) if highlight: return responses.success(highlight) return responses.client_error('Highlight can not be found.', 404)
def post(self): post_data = request.get_json() name = post_data.get('name') new_highlight = highlight_manager.create_highlight(g.user, name=name) return responses.success(new_highlight, 204)
def get(self): return responses.success(highlight_manager.get_user_highlights(g.user))
def get(self): ret = account_manager.get_user(g.user) return responses.success(ret, 200)
def get(self): '''Get list of streams''' user_streams = stream_manager.get_user_streams(g.user) return responses.success(user_streams)
def get(self, id): clip_json = clip_manager.get_user_clip(g.user, id) if clip_json: return responses.success(clip_json, 200) return responses.client_error('Clip can not be found.', 404)
def get(self): ret = clip_manager.get_user_clips(g.user) return responses.success(ret)