bandcamp-search/bandcamp_search/models.py

61 lines
1.1 KiB
Python
Raw Normal View History

2024-10-15 16:07:27 +00:00
from enum import StrEnum
2024-10-15 16:15:35 +00:00
from typing import Any, TypedDict
2024-10-15 16:07:27 +00:00
class SearchType(StrEnum):
ALL = ""
ALBUMS = "a"
ARTISTS_AND_LABELS = "b"
TRACKS = "t"
class SearchResult(TypedDict):
type: SearchType
id: int
art_id: int
img_id: int
name: str
class ArtistLabelSearchResult(SearchResult):
item_url_root: str
location: str
is_label: bool
img: str
tag_names: list[str]
genre_name: str
stat_params: str
class TrackSearchResult(SearchResult):
album_name: str
album_id: int
band_id: int
band_name: str
item_url_root: str
item_url_path: str
img: str
stat_params: str
class AlbumSearchResult(SearchResult):
band_id: int
band_name: str
item_url_root: str
item_url_path: str
img: str
tag_names: list[str]
stat_params: str
class AutoCompleteResult(TypedDict):
2024-10-15 16:15:35 +00:00
results: list[AlbumSearchResult | ArtistLabelSearchResult | TrackSearchResult]
2024-10-15 16:07:27 +00:00
stat_params_for_tag: str
time_ms: int
class BandcampResponse(TypedDict):
auto: AutoCompleteResult
tag: dict[str, Any]
genre: dict[str, Any]