Add an initial Album model
This commit is contained in:
8
spotify_model/__init__.py
Normal file
8
spotify_model/__init__.py
Normal file
@ -0,0 +1,8 @@
|
||||
"""
|
||||
Client-agnostic model for marshalling Spotify data types.
|
||||
"""
|
||||
|
||||
from .album import SearchAlbum
|
||||
from .pagination import Paginated
|
||||
|
||||
__all__ = ["Paginated", "SearchAlbum"]
|
25
spotify_model/album.py
Normal file
25
spotify_model/album.py
Normal file
@ -0,0 +1,25 @@
|
||||
"""
|
||||
Classes designed to manage album-like objects
|
||||
"""
|
||||
|
||||
from typing import Any, Dict, List, Union
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class SearchAlbum(BaseModel):
|
||||
"Album as returned by the search API"
|
||||
|
||||
album_type: str
|
||||
artists: List[Dict[str, Union[Dict[str, str], str]]]
|
||||
available_markets: List[str]
|
||||
external_urls: Dict[str, str]
|
||||
href: str
|
||||
spotify_id: str = Field(alias="id")
|
||||
images: List[Dict[str, Any]]
|
||||
name: str
|
||||
release_date: str
|
||||
release_date_precision: str
|
||||
total_tracks: int
|
||||
type_: str = Field(alias="type")
|
||||
uri: str
|
Reference in New Issue
Block a user