summaryrefslogtreecommitdiff
path: root/docs/api-usage.rst
diff options
context:
space:
mode:
authorMax Wittig <max.wittig95@gmail.com>2020-01-26 17:28:30 +0100
committerMax Wittig <max.wittig95@gmail.com>2020-01-26 17:35:18 +0100
commit0b71ba4d2965658389b705c1bb0d83d1ff2ee8f2 (patch)
treecf0f742bca253ec1f73032e56c4df5a9016a69ab /docs/api-usage.rst
parentbded2de51951902444bc62aa016a3ad34aab799e (diff)
downloadgitlab-0b71ba4d2965658389b705c1bb0d83d1ff2ee8f2.tar.gz
feat: support keyset pagination globally
Diffstat (limited to 'docs/api-usage.rst')
-rw-r--r--docs/api-usage.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/api-usage.rst b/docs/api-usage.rst
index d211e25..5b1bd93 100644
--- a/docs/api-usage.rst
+++ b/docs/api-usage.rst
@@ -219,6 +219,18 @@ You can define the ``per_page`` value globally to avoid passing it to every
gl = gitlab.Gitlab(url, token, per_page=50)
+Gitlab allows to also use keyset pagination. You can supply it to your project listing,
+but you can also do so globally. Be aware that GitLab then also requires you to only use supported
+order options. At the time of writing, only ``order_by="id"`` works.
+
+.. code-block:: python
+
+ gl = gitlab.Gitlab(url, token, pagination="keyset", per_page=100)
+ gl.projects.list(order_by="id")
+
+Reference:
+https://docs.gitlab.com/ce/api/README.html#keyset-based-pagination
+
``list()`` methods can also return a generator object which will handle the
next calls to the API when required. This is the recommended way to iterate
through a large number of items: