Skip to content

Commit 2dafaf1

Browse files
glenscCopilotcodex
committed
Add pagination to User.get_watched_movies method
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: OpenAI Codex <codex@openai.com>
1 parent 8547707 commit 2dafaf1

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

trakt/users.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from trakt.movies import Movie
1010
from trakt.people import Person
1111
from trakt.tv import TVEpisode, TVSeason, TVShow
12-
from trakt.utils import slugify
12+
from trakt.utils import build_uri, slugify
1313

1414
__author__ = 'Jon Nappi'
1515
__all__ = ['User', 'UserList', 'PublicList', 'Request', 'follow', 'get_all_requests',
@@ -523,15 +523,21 @@ def _build_watched_movies(self, data):
523523
return watched_movies
524524

525525
@get
526-
def get_watched_movies(self):
527-
"""Watched progress for all :class:`Movie` objects for this
528-
:class:`User`.
526+
def get_watched_movies(self, page=None, limit=None):
527+
"""Watched progress for :class:`Movie` objects for this :class:`User`.
529528
530-
:return: List of :class:`Movie` instances
529+
:param page: Optional page number for pagination.
530+
:param limit: Optional number of items per page.
531+
:return: List of :class:`Movie` instances for the requested page
531532
"""
532-
data = yield 'users/{user}/watched/movies'.format(
533-
user=slugify(self.username)
533+
uri = build_uri(
534+
'users/{user}/watched/movies',
535+
user=slugify(self.username),
536+
page=page,
537+
limit=limit,
534538
)
539+
540+
data = yield uri
535541
yield self._build_watched_movies(data)
536542

537543
@property

0 commit comments

Comments
 (0)