def get(self): args = pagination_with_current_user_parser.parse_args() current_user_id = get_current_user_id(args) top_users = get_top_users(current_user_id) users = list(map(extend_user, top_users)) return success_response(users)
def get(self, id): decoded_id = decode_with_abort(id, ns) args = pagination_with_current_user_parser.parse_args() current_user_id = get_current_user_id(args) offset = format_offset(args) limit = format_limit(args) args = { "current_user_id": current_user_id, "with_users": True, "filter_deleted": True, "limit": limit, "offset": offset, } reposts = get_repost_feed_for_user(decoded_id, args) for repost in reposts: if "playlist_id" in repost: repost["tracks"] = get_tracks_for_playlist( repost["playlist_id"], current_user_id ) activities = list(map(extend_activity, reposts)) return success_response(activities)
def get(self, id: str): args = pagination_with_current_user_parser.parse_args() decoded_id = decode_with_abort(id, full_ns) current_user_id = get_current_user_id(args) args["user_id"] = decoded_id args["current_user_id"] = current_user_id support = get_support_sent_by_user(args) support = list(map(extend_supporting, support)) return success_response(support)
def get(self, version): underground_trending_versions = trending_strategy_factory.get_versions_for_type( TrendingType.UNDERGROUND_TRACKS).keys() version_list = list( filter(lambda v: v.name == version, underground_trending_versions)) if not version_list: abort_bad_path_param("version", full_ns) args = pagination_with_current_user_parser.parse_args() strategy = trending_strategy_factory.get_strategy( TrendingType.UNDERGROUND_TRACKS, version_list[0]) trending_tracks = get_underground_trending(request, args, strategy) return success_response(trending_tracks)
def get(self, track_id): decoded_id = decode_with_abort(track_id, full_ns) request_args = pagination_with_current_user_parser.parse_args() current_user_id = get_current_user_id(request_args) args = { "with_users": True, "track_id": decoded_id, "current_user_id": current_user_id, "limit": format_limit(request_args, default_limit=10), "offset": format_offset(request_args), } tracks = get_remix_track_parents(args) tracks = list(map(extend_track, tracks)) return success_response(tracks)
def get(self, id): decoded_id = decode_with_abort(id, full_ns) args = pagination_with_current_user_parser.parse_args() limit = get_default_max(args.get("limit"), 10, 100) offset = get_default_max(args.get("offset"), 0) current_user_id = get_current_user_id(args) args = { "follower_user_id": decoded_id, "current_user_id": current_user_id, "limit": limit, "offset": offset, } users = get_followees_for_user(args) users = list(map(extend_user, users)) return success_response(users)
def get(self, id): args = pagination_with_current_user_parser.parse_args() decoded_id = decode_with_abort(id, ns) current_user_id = get_current_user_id(args) offset = format_offset(args) limit = format_limit(args) get_tracks_args = GetUserListeningHistoryArgs( user_id=decoded_id, current_user_id=current_user_id, limit=limit, offset=offset, ) track_history = get_user_listening_history(get_tracks_args) tracks = list(map(extend_activity, track_history)) return success_response(tracks)
def get(self, id): """Fetch favorited tracks for a user.""" args = pagination_with_current_user_parser.parse_args() decoded_id = decode_with_abort(id, ns) current_user_id = get_current_user_id(args) offset = format_offset(args) limit = format_limit(args) get_tracks_args = { "filter_deleted": False, "user_id": decoded_id, "current_user_id": current_user_id, "limit": limit, "offset": offset, "with_users": True, } track_saves = get_save_tracks(get_tracks_args) tracks = list(map(extend_activity, track_saves)) return success_response(tracks)