From 46ce34ba5d531a940e6aeb424137d05f97f116fe Mon Sep 17 00:00:00 2001
From: Karsten Hopp <karsten@redhat.com>
Date: Aug 20 2018 15:31:24 +0000
Subject: [PATCH 1/2] Update API documentation


Update documentation of paginated API endpoints

Signed-off-by: Karsten Hopp <karsten@redhat.com>

---

diff --git a/pagure/api/group.py b/pagure/api/group.py
index d521cee..0b41dd2 100644
--- a/pagure/api/group.py
+++ b/pagure/api/group.py
@@ -63,7 +63,7 @@ def api_groups():
           u'pagination': {
             'first': 'http://localhost/api/0/groups?per_page=20&extended=1&page=1',
             'last': 'http://localhost/api/0/groups?per_page=20&extended=1&page=1',
-            'next': None,
+            'next': null,
             'page': 1,
             'pages': 1,
             'per_page': 20,
diff --git a/pagure/api/issue.py b/pagure/api/issue.py
index 87520b7..2b0e5b9 100644
--- a/pagure/api/issue.py
+++ b/pagure/api/issue.py
@@ -439,11 +439,17 @@ def api_view_issues(repo, username=None, namespace=None):
             {
               "assignee": null,
               "blocks": ["1"],
+              "close_status": null,
+              "closed_at": null,
               "comments": [],
               "content": "asd",
+              "custom_fields": [],
               "date_created": "1427442217",
               "depends": [],
               "id": 4,
+              "last_updated": "1533815358",
+              "milestone": null,
+              "priority": null,
               "private": false,
               "status": "Fixed",
               "tags": [
@@ -456,14 +462,14 @@ def api_view_issues(repo, username=None, namespace=None):
               }
             }
           ],
-          u'pagination': {
+          'pagination': {
             'first': 'http://localhost/api/0/test/issues?per_page=20&page=1',
             'last': 'http://localhost/api/0/test/issues?per_page=20&page=1',
-            'next': None,
+            'next': null,
             'page': 1,
             'pages': 1,
             'per_page': 20,
-            'prev': None
+            'prev': null
           },
         }
 
diff --git a/pagure/api/project.py b/pagure/api/project.py
index f787d38..9470a23 100644
--- a/pagure/api/project.py
+++ b/pagure/api/project.py
@@ -406,6 +406,7 @@ def api_projects():
               "parent": null,
               "priorities": {},
               "tags": [],
+              "url_path": "test1",
               "user": {
                 "fullname": "Matt Prahl",
                 "name": "mprahl"
@@ -437,6 +438,7 @@ def api_projects():
               "parent": null,
               "priorities": {},
               "tags": [],
+              "url_path": "test2",
               "user": {
                 "fullname": "Matt Prahl",
                 "name": "mprahl"
diff --git a/pagure/api/user.py b/pagure/api/user.py
index 986a96f..589236e 100644
--- a/pagure/api/user.py
+++ b/pagure/api/user.py
@@ -101,6 +101,15 @@ def api_view_user(username):
               "name": "pagure"
             }
           ],
+          "repos_pagination": {
+            "first": "http://localhost:5000/api/0/user/ralph?per_page=1&repopage=1",
+            "last": "http://localhost:5000/api/0/user/ralph?per_page=1&repopage=123",
+            "next": "http://localhost:5000/api/0/user/ralph?per_page=1&repopage=2",
+            "pages": 123,
+            "per_page": 1,
+            "prev": null,
+            "repopage": 1
+          },
           "user": {
             "fullname": "ralph",
             "name": "ralph"
@@ -257,10 +266,13 @@ def api_view_user_issues(username):
 
         {
           "args": {
+            "assignee": true,
+            "author": true,
             "milestones": [],
             "no_stones": null,
             "order": null,
             "order_key": null,
+            "page": 1,
             "since": null,
             "status": null,
             "tags": []
@@ -321,6 +333,24 @@ def api_view_user_issues(username):
               }
             }
           ],
+          "pagination_issues_assigned": {
+            "first": "http://localhost:5000/api/0/user/anar/issues?per_page=1&page=1",
+            "last": "http://localhost:5000/api/0/user/anar/issues?per_page=1&page=0",
+            "next": null,
+            "page": 1,
+            "pages": 0,
+            "per_page": 1,
+            "prev": null
+          },
+          "pagination_issues_created": {
+            "first": "http://localhost:5000/api/0/user/anar/issues?per_page=1&page=1",
+            "last": "http://localhost:5000/api/0/user/anar/issues?per_page=1&page=200",
+            "next": "http://localhost:5000/api/0/user/anar/issues?per_page=1&page=2",
+            "page": 1,
+            "pages": 200,
+            "per_page": 1,
+            "prev": null
+          },
           "total_issues_assigned": 1,
           "total_issues_created": 1
         }
@@ -745,6 +775,15 @@ def api_view_user_requests_filed(username):
             "username": "dudemcpants",
             "page": 1,
           },
+          "pagination": {
+            "first": "http://localhost:5000/api/0/user/dudemcpants/requests/filed?per_page=1&page=1",
+            "last": "http://localhost:5000/api/0/user/dudemcpants/requests/filed?per_page=1&page=61",
+            "next": "http://localhost:5000/api/0/user/dudemcpants/requests/filed?per_page=1&page=2",
+            "page": 1,
+            "pages": 61,
+            "per_page": 1,
+            "prev": null
+          },
           "requests": [
             {
               "assignee": null,
@@ -975,6 +1014,15 @@ def api_view_user_requests_actionable(username):
             "username": "ryanlerch",
             "page": 1,
           },
+          "pagination": {
+            "first": "http://localhost:5000/api/0/user/ryanlerch/requests/actionable?per_page=1&page=1",
+            "last": "http://localhost:5000/api/0/user/ryanlerch/requests/actionable?per_page=1&page=61",
+            "next": "http://localhost:5000/api/0/user/ryanlerch/requests/actionable?per_page=1&page=2",
+            "page": 1,
+            "pages": 61,
+            "per_page": 1,
+            "prev": null
+          },
           "requests": [
             {
               "assignee": null,

From a3d7492f075cb5af8cb7844cb821834b622d6051 Mon Sep 17 00:00:00 2001
From: Pierre-Yves Chibon <pingou@pingoured.fr>
Date: Aug 20 2018 15:31:24 +0000
Subject: [PATCH 2/2] Small flake8 fixes


Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>

---

diff --git a/pagure/api/user.py b/pagure/api/user.py
index 589236e..3e9a3f2 100644
--- a/pagure/api/user.py
+++ b/pagure/api/user.py
@@ -116,7 +116,7 @@ def api_view_user(username):
           }
         }
 
-    """
+    """  # noqa
     httpcode = 200
     output = {}
 
@@ -356,7 +356,7 @@ def api_view_user_issues(username):
         }
 
 
-    """
+    """  # noqa
     milestone = flask.request.args.getlist('milestones', None)
     no_stones = flask.request.args.get('no_stones', None)
     if no_stones is not None:
@@ -910,7 +910,7 @@ def api_view_user_requests_filed(username):
           "total_requests": 1
         }
 
-    """
+    """  # noqa
     status = flask.request.args.get('status', 'open')
 
     page = get_page()
@@ -1149,7 +1149,7 @@ def api_view_user_requests_actionable(username):
           "total_requests": 1
         }
 
-    """
+    """  # noqa
     status = flask.request.args.get('status', 'open')
 
     page = get_page()

