Add an initial Album model

This commit is contained in:
2021-07-03 22:35:06 -04:00
commit f240e0daa0
7 changed files with 1155 additions and 0 deletions

View 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
View 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