Add followed artist support
This commit is contained in:
parent
f5955e9e37
commit
b6109fa17c
@ -3,14 +3,16 @@ Client-agnostic model for marshalling Spotify data types.
|
||||
"""
|
||||
|
||||
from .album import SearchAlbum, SimplifiedAlbum
|
||||
from .artist import Artist, SimplifiedArtist
|
||||
from .extra import ReleaseDatePrecision
|
||||
from .paging import Paging
|
||||
from .playlist import SimplifiedPlaylist
|
||||
from .paging import Cursor, CursorPaging, Paging
|
||||
from .playlist import PlaylistTrack, SimplifiedPlaylist
|
||||
from .track import SimplifiedTrack
|
||||
from .user import PrivateUser, PublicUser
|
||||
|
||||
__all__ = [
|
||||
"Paging",
|
||||
"PlaylistTrack",
|
||||
"PrivateUser",
|
||||
"PublicUser",
|
||||
"ReleaseDatePrecision",
|
||||
|
42
spotify_model/artist.py
Normal file
42
spotify_model/artist.py
Normal file
@ -0,0 +1,42 @@
|
||||
"""
|
||||
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
|
@ -4,6 +4,8 @@ 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"
|
||||
@ -11,3 +13,13 @@ 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
|
||||
|
@ -7,6 +7,27 @@ 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"
|
||||
|
||||
|
@ -5,9 +5,23 @@ 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: SimplifiedTrack
|
||||
|
||||
|
||||
class SimplifiedPlaylist(BaseModel):
|
||||
"""
|
||||
Playlist as returned by the Playlist API
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""
|
||||
Classes for managing users
|
||||
"""
|
||||
from typing import Any, Dict, List
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
@ -13,7 +13,7 @@ class PublicUser(BaseModel):
|
||||
https://developer.spotify.com/documentation/web-api/reference/#object-publicuserobject
|
||||
"""
|
||||
|
||||
display_name: str
|
||||
display_name: Optional[str]
|
||||
external_urls: Dict[str, str]
|
||||
href: str
|
||||
spotify_id: str = Field(alias="id")
|
||||
|
Loading…
Reference in New Issue
Block a user