Add a paging object

This commit is contained in:
Bradlee Speice 2021-07-03 22:58:38 -04:00
parent f240e0daa0
commit 2337838886
3 changed files with 22 additions and 3 deletions

View File

@ -3,6 +3,6 @@ Client-agnostic model for marshalling Spotify data types.
"""
from .album import SearchAlbum
from .pagination import Paginated
from .paging import Paging
__all__ = ["Paginated", "SearchAlbum"]
__all__ = ["Paging", "SearchAlbum"]

View File

@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
class SearchAlbum(BaseModel):
"Album as returned by the search API"
"Album as returned by the search API. Doesn't quite return a SimplifiedAlbum."
album_type: str
artists: List[Dict[str, Union[Dict[str, str], str]]]

19
spotify_model/paging.py Normal file
View File

@ -0,0 +1,19 @@
"""
Objects used for paging Spotify results
"""
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field
class Paging(BaseModel):
"https://developer.spotify.com/documentation/web-api/reference/#object-pagingobject"
href: str
items: List[Dict[str, Any]]
limit: int
next_href: Optional[str] = Field(alias="next")
offset: int
previous_href: Optional[str] = Field(alias="previous")
total: int