from aiohttp import web from server.artist.views import ( artist_videos_tiktok, artist_videos_youtube, discovery, discovery_artist_result, search_by_name, discovery_total_count, tracks_spotify, albums_spotify, tracks_soundcloud, external_links_v4, ) URL_PREFIX: str = "/api/artist" URL_PREFIX_V2: str = "/api/v2/artist" URL_PREFIX_V3: str = "/api/v3/artist" URL_PREFIX_V4: str = "/api/v4/artist" def init_routes(app: web.Application) -> None: app.add_routes( [ web.get( URL_PREFIX_V2 + r"/{id:\d+}/tracks/spotify", tracks_spotify, name="artist_tracks_spotify", allow_head=False, ), web.get( URL_PREFIX_V2 + r"/{id:\d+}/albums/spotify", albums_spotify, name="artist_albums_spotify", allow_head=False, ), web.get( URL_PREFIX_V2 + r"/{id:\d+}/videos/tiktok", artist_videos_tiktok, name="artist_videos_tiktok", allow_head=False, ), web.get( URL_PREFIX_V2 + r"/{id:\d+}/videos/youtube", artist_videos_youtube, name="artist_videos_youtube", allow_head=False, ), web.get( URL_PREFIX_V2 + r"/{id:\d+}/tracks/soundcloud", tracks_soundcloud, name="artist_tracks_soundcloud", allow_head=False, ), web.get(URL_PREFIX + r"/search_by_name", search_by_name, name="search_by_name"), web.post(URL_PREFIX + r"/discovery", discovery, name="discovery"), web.post(URL_PREFIX + r"/discovery/total_count", discovery_total_count, name="discovery_total_count"), web.get( URL_PREFIX + r"/{id:\d+}/discovery_result", discovery_artist_result, name="discovery_artist_result", allow_head=False, ), # ================================= v4 routes ================================= # v4 version web.get( URL_PREFIX_V4 + r"/{id:\d+}/external_links", external_links_v4, name="external_links_v4", allow_head=False, ), ] )