summaryrefslogtreecommitdiff
path: root/gitlab/base.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2017-11-01 17:07:30 +0100
committerGauvain Pocentek <gauvain@pocentek.net>2017-11-01 17:07:30 +0100
commit38d446737f45ea54136d1f03f75fbddf46c45e00 (patch)
treec4ccbe765f075313d1f7dc1ef476f4f09f172ab1 /gitlab/base.py
parentfba7730161c15be222a22b4618d79bb92a87ef1f (diff)
downloadgitlab-38d446737f45ea54136d1f03f75fbddf46c45e00.tar.gz
Pagination generators: expose more information
Expose the X-* pagination attributes returned by the Gitlab server when requesting lists. Closes #304
Diffstat (limited to 'gitlab/base.py')
-rw-r--r--gitlab/base.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/gitlab/base.py b/gitlab/base.py
index 795d7fa..4213d2f 100644
--- a/gitlab/base.py
+++ b/gitlab/base.py
@@ -670,6 +670,42 @@ class RESTObjectList(object):
data = self._list.next()
return self._obj_cls(self.manager, data)
+ @property
+ def current_page(self):
+ """The current page number."""
+ return self._list.current_page
+
+ @property
+ def prev_page(self):
+ """The next page number.
+
+ If None, the current page is the last.
+ """
+ return self._list.prev_page
+
+ @property
+ def next_page(self):
+ """The next page number.
+
+ If None, the current page is the last.
+ """
+ return self._list.next_page
+
+ @property
+ def per_page(self):
+ """The number of items per page."""
+ return self._list.per_page
+
+ @property
+ def total_pages(self):
+ """The total number of pages."""
+ return self._list.total_pages
+
+ @property
+ def total(self):
+ """The total number of items."""
+ return self._list.total
+
class RESTManager(object):
"""Base class for CRUD operations on objects.