Add more models to get some of the playlists I wanted to create going
This commit is contained in:
parent
ea03da8575
commit
1dd79fa4f8
@ -155,7 +155,8 @@ disable=print-statement,
|
|||||||
comprehension-escape,
|
comprehension-escape,
|
||||||
# Manually added
|
# Manually added
|
||||||
import-error,
|
import-error,
|
||||||
too-few-public-methods
|
too-few-public-methods,
|
||||||
|
duplicate-code
|
||||||
|
|
||||||
# Enable the message, report, category or checker with the given id(s). You can
|
# Enable the message, report, category or checker with the given id(s). You can
|
||||||
# either give multiple identifier separated by comma (,) or put this option
|
# either give multiple identifier separated by comma (,) or put this option
|
||||||
|
@ -5,12 +5,17 @@ Client-agnostic model for marshalling Spotify data types.
|
|||||||
from .album import SearchAlbum, SimplifiedAlbum
|
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 .track import SimplifiedTrack
|
from .track import SimplifiedTrack
|
||||||
|
from .user import PrivateUser, PublicUser
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Paging",
|
"Paging",
|
||||||
|
"PrivateUser",
|
||||||
|
"PublicUser",
|
||||||
"ReleaseDatePrecision",
|
"ReleaseDatePrecision",
|
||||||
"SearchAlbum",
|
"SearchAlbum",
|
||||||
"SimplifiedAlbum",
|
"SimplifiedAlbum",
|
||||||
|
"SimplifiedPlaylist",
|
||||||
"SimplifiedTrack",
|
"SimplifiedTrack",
|
||||||
]
|
]
|
||||||
|
@ -24,7 +24,7 @@ class SearchAlbum(BaseModel):
|
|||||||
release_date: str
|
release_date: str
|
||||||
release_date_precision: ReleaseDatePrecision
|
release_date_precision: ReleaseDatePrecision
|
||||||
total_tracks: int
|
total_tracks: int
|
||||||
type_: str = Field(alias="type")
|
spotify_type: str = Field(alias="type")
|
||||||
uri: str
|
uri: str
|
||||||
|
|
||||||
|
|
||||||
|
29
spotify_model/playlist.py
Normal file
29
spotify_model/playlist.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
"""
|
||||||
|
Classes designed to manage playlist
|
||||||
|
"""
|
||||||
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
from .user import PublicUser
|
||||||
|
|
||||||
|
|
||||||
|
class SimplifiedPlaylist(BaseModel):
|
||||||
|
"""
|
||||||
|
Playlist as returned by the Playlist API
|
||||||
|
|
||||||
|
https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedplaylistobject
|
||||||
|
"""
|
||||||
|
|
||||||
|
collaborative: bool
|
||||||
|
description: str
|
||||||
|
external_urls: Dict[str, str]
|
||||||
|
href: str
|
||||||
|
spotify_id: str = Field(alias="id")
|
||||||
|
images: List[Dict[str, Any]]
|
||||||
|
name: str
|
||||||
|
owner: PublicUser
|
||||||
|
snapshot_id: str
|
||||||
|
tracks: Dict[str, Any]
|
||||||
|
spotify_type: str = Field(alias="type")
|
||||||
|
uri: str
|
32
spotify_model/user.py
Normal file
32
spotify_model/user.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
"""
|
||||||
|
Classes for managing users
|
||||||
|
"""
|
||||||
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
|
class PublicUser(BaseModel):
|
||||||
|
"""
|
||||||
|
Public information associated with a user
|
||||||
|
|
||||||
|
https://developer.spotify.com/documentation/web-api/reference/#object-publicuserobject
|
||||||
|
"""
|
||||||
|
|
||||||
|
display_name: str
|
||||||
|
external_urls: Dict[str, str]
|
||||||
|
href: str
|
||||||
|
spotify_id: str = Field(alias="id")
|
||||||
|
spotify_type: str = Field(alias="type")
|
||||||
|
uri: str
|
||||||
|
|
||||||
|
|
||||||
|
class PrivateUser(PublicUser):
|
||||||
|
"""
|
||||||
|
Private information associated with a user
|
||||||
|
|
||||||
|
https://developer.spotify.com/documentation/web-api/reference/#object-privateuserobject
|
||||||
|
"""
|
||||||
|
|
||||||
|
followers: Dict[str, Any]
|
||||||
|
images: List[Dict[str, str]]
|
Loading…
Reference in New Issue
Block a user