Compare commits

..

No commits in common. "master" and "label_playlist" have entirely different histories.

7 changed files with 18 additions and 118 deletions

View File

@ -2,12 +2,11 @@
Client-agnostic model for marshalling Spotify data types.
"""
from .album import SavedAlbum, SearchAlbum, SimplifiedAlbum
from .artist import Artist, SimplifiedArtist
from .album import SearchAlbum, SimplifiedAlbum
from .extra import ReleaseDatePrecision
from .paging import Cursor, CursorPaging, Paging
from .playlist import PlaylistTrack, SimplifiedPlaylist
from .track import SavedTrack, SimplifiedTrack, Track
from .paging import Paging
from .playlist import SimplifiedPlaylist
from .track import PlaylistTrack, SimplifiedTrack, Track
from .user import PrivateUser, PublicUser
__all__ = [
@ -17,8 +16,6 @@ __all__ = [
"PublicUser",
"ReleaseDatePrecision",
"SearchAlbum",
"SavedAlbum",
"SavedTrack",
"SimplifiedAlbum",
"SimplifiedPlaylist",
"SimplifiedTrack",

View File

@ -41,14 +41,3 @@ class SimplifiedAlbum(SearchAlbum):
label: str
popularity: int
tracks: Paging
class SavedAlbum(BaseModel):
"""
Album as returned by the Library API
https://developer.spotify.com/documentation/web-api/reference/#object-savedalbumobject
"""
added_at: str
album: SimplifiedAlbum

View File

@ -1,42 +0,0 @@
"""
Objects used for retrieving artist information from Spotify
"""
from typing import Dict, List, Optional
from pydantic import BaseModel, Field
from .extra import Image
class SimplifiedArtist(BaseModel):
"""
https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedartistobject
"""
external_urls: Dict[str, str]
href: str
spotify_id: str = Field(alias="id")
name: str
spotify_type: str = Field(alias="type")
uri: str
class Followers(BaseModel):
"""
https://developer.spotify.com/documentation/web-api/reference/#object-followersobject
"""
href: Optional[str]
total: int
class Artist(SimplifiedArtist):
"""
https://developer.spotify.com/documentation/web-api/reference/#object-artistobject
"""
followers: Followers
genres: List[str]
images: List[Image]
popularity: int

View File

@ -4,8 +4,6 @@ Extra type definitions that don't necessarily belong in other categories.
from enum import Enum
from pydantic import BaseModel
class ReleaseDatePrecision(Enum):
"Release date precision"
@ -13,13 +11,3 @@ class ReleaseDatePrecision(Enum):
YEAR = "year"
MONTH = "month"
DAY = "day"
class Image(BaseModel):
"""
https://developer.spotify.com/documentation/web-api/reference/#object-imageobject
"""
height: int
url: str
width: int

View File

@ -7,27 +7,6 @@ from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field
class Cursor(BaseModel):
"""
https://developer.spotify.com/documentation/web-api/reference/#object-cursorobject
"""
after: Optional[str]
class CursorPaging(BaseModel):
"""
https://developer.spotify.com/documentation/web-api/reference/#object-cursorpagingobject
"""
cursors: Cursor
href: str
items: List[Dict[str, Any]]
limit: int
next_href: Optional[str] = Field(alias="next")
total: int
class Paging(BaseModel):
"https://developer.spotify.com/documentation/web-api/reference/#object-pagingobject"

View File

@ -1,27 +1,13 @@
"""
Classes designed to manage playlist
"""
from typing import Any, Dict, List, Optional
from typing import Any, Dict, List
from pydantic import BaseModel, Field
from .track import SimplifiedTrack
from .user import PublicUser
class PlaylistTrack(BaseModel):
"""
Track entry as returned by the Playlist API
https://developer.spotify.com/documentation/web-api/reference/#object-playlisttrackobject
"""
added_at: str
added_by: PublicUser
is_local: bool
track: Optional[SimplifiedTrack]
class SimplifiedPlaylist(BaseModel):
"""
Playlist as returned by the Playlist API
@ -30,11 +16,11 @@ class SimplifiedPlaylist(BaseModel):
"""
collaborative: bool
description: Optional[str]
description: str
external_urls: Dict[str, str]
href: str
spotify_id: str = Field(alias="id")
images: Optional[List[Dict[str, Any]]]
images: List[Dict[str, Any]]
name: str
owner: PublicUser
snapshot_id: str

View File

@ -1,11 +1,13 @@
"""
Classes designed to manage track-like objects
"""
from datetime import datetime
from typing import Dict, List, Optional, Union
from pydantic import BaseModel, Field
from .album import SearchAlbum
from .user import PublicUser
class SimplifiedTrack(BaseModel):
@ -16,7 +18,7 @@ class SimplifiedTrack(BaseModel):
"""
artists: List[Dict[str, Union[Dict[str, str], str]]]
available_markets: Optional[List[str]]
available_markets: List[str]
disc_number: int
duration_ms: int
explicit: bool
@ -25,10 +27,10 @@ class SimplifiedTrack(BaseModel):
spotify_id: str = Field(alias="id")
is_local: bool
is_playable: Optional[bool]
linked_from: Optional[Union[str, Dict[str, Union[str, Dict[str, str]]]]]
linked_from: Optional[str]
name: str
preview_url: Optional[str]
restrictions: Optional[Union[str, Dict[str, str]]]
restrictions: Optional[str]
track_number: int
spotify_type: str = Field(alias="type")
uri: str
@ -46,12 +48,13 @@ class Track(SimplifiedTrack):
popularity: int
class SavedTrack(BaseModel):
class PlaylistTrack(BaseModel):
"""
Track as returned by the Library API
https://developer.spotify.com/documentation/web-api/reference/#object-savedtrackobject
Track as returned from a playlist
"""
added_at: str
added_at: datetime
added_by: PublicUser
is_local: bool
primary_color: Optional[str]
track: Track