示例#1
0
 def get(self):
     """Search for a playlist."""
     args = search_parser.parse_args()
     query = args["query"]
     search_args = {
         "query": query,
         "kind": SearchKind.playlists.name,
         "is_auto_complete": False,
         "current_user_id": None,
         "with_users": True,
         "limit": 10,
         "offset": 0
     }
     response = search(search_args)
     playlists = list(map(extend_playlist, response["playlists"]))
     return success_response(playlists)
示例#2
0
 def get(self):
     args = search_parser.parse_args()
     query = args["query"]
     if not query:
         abort_bad_request_param("query", ns)
     search_args = {
         "query": query,
         "kind": SearchKind.users.name,
         "is_auto_complete": False,
         "current_user_id": None,
         "with_users": True,
         "limit": 10,
         "offset": 0,
     }
     response = search(search_args)
     return success_response(response)
示例#3
0
 def get(self):
     """Seach for a user."""
     args = search_parser.parse_args()
     query = args["query"]
     search_args = {
         "query": query,
         "kind": SearchKind.users.name,
         "is_auto_complete": False,
         "current_user_id": None,
         "with_users": True,
         "limit": 10,
         "offset": 0,
     }
     response = search(search_args)
     users = response["users"]
     users = list(map(extend_user, users))
     return success_response(users)
示例#4
0
 def get(self):
     """Search for a track."""
     args = search_parser.parse_args()
     query = args["query"]
     if not query:
         abort_bad_request_param('query', ns)
     search_args = {
         "query": query,
         "kind": SearchKind.tracks.name,
         "is_auto_complete": False,
         "current_user_id": None,
         "with_users": True,
         "limit": 10,
         "offset": 0
     }
     response = search(search_args)
     tracks = response["tracks"]
     tracks = list(map(extend_track, tracks))
     return success_response(tracks)