This commit is contained in:
Bradlee Speice 2021-09-13 22:31:38 -04:00
commit c49f201835
3 changed files with 32 additions and 3 deletions

View File

@ -20,4 +20,5 @@ __all__ = [
"SimplifiedAlbum", "SimplifiedAlbum",
"SimplifiedPlaylist", "SimplifiedPlaylist",
"SimplifiedTrack", "SimplifiedTrack",
"Track",
] ]

View File

@ -30,7 +30,7 @@ class SearchAlbum(BaseModel):
class SimplifiedAlbum(SearchAlbum): class SimplifiedAlbum(SearchAlbum):
""" """
Album as returned by the Album API Album as returned by non-album APIs
https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedalbumobject https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedalbumobject
""" """

View File

@ -1,14 +1,18 @@
""" """
Classes designed to manage track-like objects Classes designed to manage track-like objects
""" """
from datetime import datetime
from typing import Dict, List, Optional, Union from typing import Dict, List, Optional, Union
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from .album import SearchAlbum
from .user import PublicUser
class SimplifiedTrack(BaseModel): class SimplifiedTrack(BaseModel):
""" """
Track as returned by the Tracks API Track as returned by non-track APIs
https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedtrackobject https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedtrackobject
""" """
@ -28,5 +32,29 @@ class SimplifiedTrack(BaseModel):
preview_url: Optional[str] preview_url: Optional[str]
restrictions: Optional[str] restrictions: Optional[str]
track_number: int track_number: int
type_: str = Field(alias="type") spotify_type: str = Field(alias="type")
uri: str uri: str
class Track(SimplifiedTrack):
"""
Track as returned by the Tracks APIs
https://developer.spotify.com/documentation/web-api/reference/#object-trackobject
"""
album: SearchAlbum
external_ids: Dict[str, str]
popularity: int
class PlaylistTrack(BaseModel):
"""
Track as returned from a playlist
"""
added_at: datetime
added_by: PublicUser
is_local: bool
primary_color: Optional[str]
track: Track