#51 Added pagination for issue listing
Opened 7 months ago by burlak. Modified 7 months ago
burlak/libpagure issues-pagination  into  master

file modified
+10
@@ -385,6 +385,8 @@ 

          no_stones=None,

          since=None,

          order=None,

+         page=None,

+         per_page=None,

      ):

          """

          List all issues of a project.
@@ -402,6 +404,10 @@ 

              Y-M-D

          :param order: Set the ordering of the issues. This can be asc or desc.

              Default: desc

+         :param page: specifies that pagination should be turned on and that

+             this specific page should be displayed

+         :param per_page: the number of issues to return per page.

+             The maximum is 20

          :return:

          """

          request_url = "{}issues".format(self.create_basic_url())
@@ -425,6 +431,10 @@ 

              payload["since"] = since

          if order is not None:

              payload["order"] = order

+         if page is not None:

+             payload["page"] = page

+         if per_page is not None:

+             payload["per_page"] = per_page

  

          return_value = self._call_api(request_url, params=payload)

  

Without pagination you can list only up to 20 issues

Hi @burlak !

I don't want to speak on behalf of the libpagure maintainers, but if you are interested in the Python API for Pagure, we (=the Packit team) have developed an alternative implementation as part of OGR library (https://github.com/packit/ogr) that provides the same Python API for multiple git forges (currently GitHub, GitLab and Pagure are supported).

Since we are heavily using it ourselves, the OGR is maintained a bit more actively than libpagure.

@lachmanfrantisek Hi František,

Thanks for the suggestion. I was using libpagure only for a one-off thing, If I knew about OGR I would used that, but for now I'm done with my project.

Anyway, once again thanks for the suggestion.

Metadata