How to use the tekore._model.paging.OffsetPaging function in tekore

To help you get started, we’ve selected a few tekore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github felix-hilden / spotipy / tekore / _model / album / __init__.py View on Github external
"""

    album_group: AlbumGroup = None
    available_markets: List[str] = None
    is_playable: True = None

    def __post_init__(self):
        super().__post_init__()
        if self.album_group is not None:
            self.album_group = AlbumGroup[self.album_group]
        if self.available_markets is not None:
            self.available_markets = ModelList(self.available_markets)


@dataclass(repr=False)
class SimpleAlbumPaging(OffsetPaging):
    """Paging containing simplified albums."""

    items: List[SimpleAlbum]

    def __post_init__(self):
        self.items = ModelList(SimpleAlbum(**a) for a in self.items)
github felix-hilden / spotipy / tekore / _model / track.py View on Github external
if self.restrictions is not None:
            self.restrictions = Restrictions(**self.restrictions)


@dataclass(repr=False)
class FullTrackPaging(OffsetPaging):
    """Paging of full tracks."""

    items: List[FullTrack]

    def __post_init__(self):
        self.items = ModelList(FullTrack(**t) for t in self.items)


@dataclass(repr=False)
class SimpleTrackPaging(OffsetPaging):
    """Paging of simplified tracks."""

    items: List[SimpleTrack]

    def __post_init__(self):
        self.items = ModelList(SimpleTrack(**t) for t in self.items)


@dataclass(repr=False)
class Tracks(Model):
    """Minimal representation of playlist tracks."""

    href: str
    total: int
github felix-hilden / spotipy / tekore / _model / show / __init__.py View on Github external
@dataclass(repr=False)
class SimpleShow(Show):
    """
    Simplified show object.

    :attr:`total_episodes` is only available in
    :meth:`Spotify.playback ` and
    :meth:`Spotify.playback_currently_playing
    `.
    """

    total_episodes: int = None


@dataclass(repr=False)
class SimpleShowPaging(OffsetPaging):
    """Paging of simplified shows."""

    items: List[SimpleShow]

    def __post_init__(self):
        self.items = ModelList(SimpleShow(**i) for i in self.items)


@dataclass(repr=False)
class SavedShow(Model):
    """Show saved in library."""

    added_at: Timestamp
    show: SimpleShow

    def __post_init__(self):
github felix-hilden / spotipy / tekore / _model / track.py View on Github external
@dataclass(repr=False)
class SavedTrack(Model):
    """Track saved to library."""

    added_at: Timestamp
    track: FullTrack

    def __post_init__(self):
        self.added_at = Timestamp.from_string(self.added_at)
        self.track = FullTrack(**self.track)


@dataclass(repr=False)
class SavedTrackPaging(OffsetPaging):
    """Paging of tracks in library."""

    items: List[SavedTrack]

    def __post_init__(self):
        self.items = ModelList(SavedTrack(**t) for t in self.items)
github felix-hilden / spotipy / tekore / _model / category.py View on Github external
@dataclass(repr=False)
class Category(Identifiable):
    """Spotify tag category."""

    href: str
    icons: List[Image]
    name: str

    def __post_init__(self):
        self.icons = ModelList(Image(**i) for i in self.icons)


@dataclass(repr=False)
class CategoryPaging(OffsetPaging):
    """Paging of categories."""

    items: List[Category]

    def __post_init__(self):
        self.items = ModelList(Category(**c) for c in self.items)
github felix-hilden / spotipy / tekore / _model / playlist.py View on Github external
@dataclass(repr=False)
class FullPlaylist(Playlist):
    """Complete playlist object."""

    followers: Followers
    tracks: PlaylistTrackPaging

    def __post_init__(self):
        super().__post_init__()
        self.followers = Followers(**self.followers)
        self.tracks = PlaylistTrackPaging(**self.tracks)


@dataclass(repr=False)
class SimplePlaylistPaging(OffsetPaging):
    """Paging of simplified playlists."""

    items: List[SimplePlaylist]

    def __post_init__(self):
        self.items = ModelList(SimplePlaylist(**p) for p in self.items)
github felix-hilden / spotipy / tekore / _model / episode.py View on Github external
@dataclass(repr=False)
class FullEpisode(Episode):
    """Complete episode object."""

    show: SimpleShow
    resume_point: ResumePoint = None

    def __post_init__(self):
        super().__post_init__()
        self.show = SimpleShow(**self.show)
        if self.resume_point is not None:
            self.resume_point = ResumePoint(**self.resume_point)


@dataclass(repr=False)
class SimpleEpisodePaging(OffsetPaging):
    """Paging of simplified episodes."""

    items = List[SimpleEpisode]

    def __post_init__(self):
        self.items = ModelList(
            SimpleEpisode(**i) if i is not None else None
            for i in self.items
        )
github felix-hilden / spotipy / tekore / _model / playlist.py View on Github external
def __post_init__(self):
        self.added_at = Timestamp.from_string(self.added_at)
        self.added_by = PublicUser(**self.added_by)

        if self.video_thumbnail is not None:
            self.video_thumbnail = Image(**self.video_thumbnail)

        if self.track is not None:
            if self.is_local:
                self.track = LocalPlaylistTrack(**self.track)
            else:
                self.track = track_type[self.track['type']](**self.track)


@dataclass(repr=False)
class PlaylistTrackPaging(OffsetPaging):
    """Paging of playlist tracks."""

    items: List[PlaylistTrack]

    def __post_init__(self):
        self.items = ModelList(PlaylistTrack(**t) for t in self.items)


@dataclass(repr=False)
class Playlist(Item):
    """Playlist base."""

    collaborative: bool
    external_urls: dict
    images: List[Image]
    name: str
github felix-hilden / spotipy / tekore / _model / show / __init__.py View on Github external
@dataclass(repr=False)
class SavedShow(Model):
    """Show saved in library."""

    added_at: Timestamp
    show: SimpleShow

    def __post_init__(self):
        self.added_at = Timestamp.from_string(self.added_at)
        self.show = SimpleShow(**self.show)


@dataclass(repr=False)
class SavedShowPaging(OffsetPaging):
    """Paging of shows in library."""

    items: List[SavedShow]

    def __post_init__(self):
        self.items = ModelList(SavedShow(**i) for i in self.items)
github felix-hilden / spotipy / tekore / _model / album / full.py View on Github external
@dataclass(repr=False)
class SavedAlbum(Model):
    """Album saved to library."""

    added_at: Timestamp
    album: FullAlbum

    def __post_init__(self):
        self.added_at = Timestamp.from_string(self.added_at)
        self.album = FullAlbum(**self.album)


@dataclass(repr=False)
class SavedAlbumPaging(OffsetPaging):
    """Paging of albums in library."""

    items: List[SavedAlbum]

    def __post_init__(self):
        self.items = ModelList(SavedAlbum(**a) for a in self.items)