Add the full Track object

This commit is contained in:
Bradlee Speice 2021-09-10 00:25:35 -04:00
parent f5955e9e37
commit 62550adcc1
3 changed files with 19 additions and 4 deletions

View File

@ -6,7 +6,7 @@ from .album import SearchAlbum, SimplifiedAlbum
from .extra import ReleaseDatePrecision from .extra import ReleaseDatePrecision
from .paging import Paging from .paging import Paging
from .playlist import SimplifiedPlaylist from .playlist import SimplifiedPlaylist
from .track import SimplifiedTrack from .track import SimplifiedTrack, Track
from .user import PrivateUser, PublicUser from .user import PrivateUser, PublicUser
__all__ = [ __all__ = [
@ -18,4 +18,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

@ -5,10 +5,12 @@ from typing import Dict, List, Optional, Union
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from .album import SimplifiedAlbum
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 +30,17 @@ 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: SimplifiedAlbum
external_ids: Dict[str, str]
popularity: int