spotifywebapipython.models.pageobject

@export
class PageObject:

Spotify Web API PageObject object.

This allows for multiple pages of objects to be navigated.

PageObject(root: dict = None)

Initializes a new instance of the class.

Arguments:
  • root (dict): Spotify Web API JSON response in dictionary format, used to load object attributes; otherwise, None to not load attributes.
CursorAfter: object

The cursor to use as key to find the next page of items.
This value will only be populated when cursor-based paging is used, which is infrrequent. The value can be of multiple types: string, integer, etc.

Example: 3jdODvx7rIdq0UGU7BOVR3 Example: 1708495520273

CursorBefore: object

The cursor to use as key to find the previous page of items.
This value will only be populated when cursor-based paging is used, which is infrrequent. The value can be of multiple types: string, integer, etc.

Example: 3jdODvx7rIdq0UGU7BOVR3 Example: 1708495520273

Href: str

A link to the Web API endpoint returning the full result of the request.

Example: https://api.spotify.com/v1/me/shows?offset=0&limit=20

IsCursor: list[object]

True if cursors were returned at some point during the life of this paging object.

Items: list[object]

Array of objects.

This property will be overrriden by inheriting classes.

ItemsCount: int

Number of objects in the Items property array.

Limit: int

The maximum number of items in the response (as set in the query or by default).

This property can be modified in case the paging request needs to be adjusted based upon overall request limits.

Next: str

URL to the next page of items; null if none.

Example: https://api.spotify.com/v1/me/shows?offset=1&limit=1

Offset: int

The offset of the items returned (as set in the query or by default).

This property can be modified in case the paging request needs to be adjusted based upon overall request limits.

PagingInfo: str

Returns a displayable string of paging parameters.

The return value will vary, based upon if a cursor is used to navigate the results. Most methods don't use cursors, but there are a few that do (e.g. GetArtistsFollowed).

For a "(items {start} to {end} of {total} total)" message, the start value is the offset value of the last page of items retrieved.

Previous: str

URL to the previous page of items; null if none.

Example: https://api.spotify.com/v1/me/shows?offset=1&limit=1

Total: int

The total number of items available from the Spotify Web API to return.

Note that sometimes the Spotify Web API returns a larger total than the actual number of items available. Not sure why this is, but it may not match the ItemsCount value.

def ToDictionary(self) -> dict:

Returns a dictionary representation of the class.

def ToString(self, includeItems: bool = False) -> str:

Returns a displayable string representation of the class.

Arguments:
  • includeItems (bool): True to include the Items collection of objects; otherwise, False to only return base properties.