Add SimplifiedAlbum and SimplifiedTrack
This commit is contained in:
parent
ad39ddf83f
commit
ea03da8575
@ -2,8 +2,15 @@
|
||||
Client-agnostic model for marshalling Spotify data types.
|
||||
"""
|
||||
|
||||
from .album import SearchAlbum
|
||||
from .album import SearchAlbum, SimplifiedAlbum
|
||||
from .extra import ReleaseDatePrecision
|
||||
from .paging import Paging
|
||||
from .track import SimplifiedTrack
|
||||
|
||||
__all__ = ["Paging", "ReleaseDatePrecision", "SearchAlbum"]
|
||||
__all__ = [
|
||||
"Paging",
|
||||
"ReleaseDatePrecision",
|
||||
"SearchAlbum",
|
||||
"SimplifiedAlbum",
|
||||
"SimplifiedTrack",
|
||||
]
|
||||
|
@ -7,6 +7,7 @@ from typing import Any, Dict, List, Union
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from .extra import ReleaseDatePrecision
|
||||
from .paging import Paging
|
||||
|
||||
|
||||
class SearchAlbum(BaseModel):
|
||||
@ -25,3 +26,18 @@ class SearchAlbum(BaseModel):
|
||||
total_tracks: int
|
||||
type_: str = Field(alias="type")
|
||||
uri: str
|
||||
|
||||
|
||||
class SimplifiedAlbum(SearchAlbum):
|
||||
"""
|
||||
Album as returned by the Album API
|
||||
|
||||
https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedalbumobject
|
||||
"""
|
||||
|
||||
copyrights: List[Dict[str, str]]
|
||||
external_ids: Dict[str, str]
|
||||
genres: List[str]
|
||||
label: str
|
||||
popularity: int
|
||||
tracks: Paging
|
||||
|
32
spotify_model/track.py
Normal file
32
spotify_model/track.py
Normal file
@ -0,0 +1,32 @@
|
||||
"""
|
||||
Classes designed to manage track-like objects
|
||||
"""
|
||||
from typing import Dict, List, Optional, Union
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class SimplifiedTrack(BaseModel):
|
||||
"""
|
||||
Track as returned by the Tracks API
|
||||
|
||||
https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedtrackobject
|
||||
"""
|
||||
|
||||
artists: List[Dict[str, Union[Dict[str, str], str]]]
|
||||
available_markets: List[str]
|
||||
disc_number: int
|
||||
duration_ms: int
|
||||
explicit: bool
|
||||
external_urls: Dict[str, str]
|
||||
href: str
|
||||
spotify_id: str = Field(alias="id")
|
||||
is_local: bool
|
||||
is_playable: Optional[bool]
|
||||
linked_from: Optional[str]
|
||||
name: str
|
||||
preview_url: str
|
||||
restrictions: Optional[str]
|
||||
track_number: int
|
||||
type_: str = Field(alias="type")
|
||||
uri: str
|
Loading…
Reference in New Issue
Block a user