def post(self, episodeId): valid, req = oauth.verify_request([]) if not valid: raise AuthorizationRequired() user = req.user PlaybackProgress.set_progress(user.id, episodeId, progress_parser.parse_args()["progress"]) return {"success": True}
def delete(self, userId): if userId == "me": valid, req = oauth.verify_request([]) if not valid: raise AuthorizationRequired() unfollow = followParser.parse_args()["otherUser"].split(",") others = [User.get_by_id(u) for u in unfollow] req.user.unfollow(others) return {"success": True}
def post(self, userId): if userId == "me": valid, req = oauth.verify_request([]) follow = followParser.parse_args()["otherUser"].split(",") if not valid: raise AuthorizationRequired() user = req.user others = [User.get_by_id(f) for f in follow] user.follow(others) return {"success": True}
def post(self, userId): """Subscribe the user to a podcast""" podcasts = formPodcastParser.parse_args()["podcast"].split(",") if userId == "me": valid, req = oauth.verify_request([]) if not valid: raise AuthorizationRequired() user = req.user res = user.subscribe_multi_by_url(podcasts) logging.error("Result from user.subscribe_multi_by_url: %s" % res) return res
def get(self, episodeId): valid, req = oauth.verify_request([]) if not valid: raise AuthorizationRequired() user = req.user return { "progress": PlaybackProgress.get_progress(user_id=user.id, episode_id=episodeId) }
def delete(self, userId): """Unsubscribe the user from a podcast.""" podcast = podcastsParser.parse_args()["podcast"] if userId == "me": valid, req = oauth.verify_request([]) if not valid: raise AuthorizationRequired() user = req.user else: user = User.get_by_id(userId) return user.unsubscribe_by_url(podcast)
def get(self, userId): """Get all the user's subscriptions.""" if userId == "me": valid, req = oauth.verify_request([]) if not valid: raise AuthorizationRequired() user = req.user else: user = User.get_by_id(userId) if not user: abort(404, message="User not found.") return return user.get_subscriptions()
def get(self, userId): """Get a user.""" if userId == "me": valid, req = oauth.verify_request(["publicuserinfo/read"]) if not valid: raise AuthorizationRequired() user = req.user else: user = User.get_by_id(userId) if not user: abort(404, message="User not found: %s." % userId) return # make sure the client is authorized to get the user's email. valid, req = oauth.verify_request(["userinfo/email"]) if not (valid and (userId == "me" or userId == req.user.id)): return AttributeHider(user, ["primary_email"]) return user