{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/comments/74684417","id":74684417,"diff_hunk":"@@ -76,15 +82,18 @@ def list_users():\n \n         user_query = user_query.filter(User.supplier_id == supplier_id)\n \n-    users = user_query.paginate(\n+    paginated_users = user_query.paginate(\n         page=page,\n         per_page=current_app.config['DM_API_SERVICES_PAGE_SIZE'],\n     )\n \n     return jsonify(\n-        users=[user.serialize() for user in users.items],\n+        users=[user.serialize() for user in paginated_users.items],\n+        meta={\n+            \"total_pages\": paginated_users.pages","path":"app/main/views/users.py","position":27,"original_position":27,"commit_id":"b8bb54b044daf663a9a6401a344fc0cc6c451e8c","original_commit_id":"b518902364794f1a8699ceac460a59a9826b136a","user":{"login":"TheDoubleK","id":6525554,"avatar_url":"https://avatars.githubusercontent.com/u/6525554?v=3","gravatar_id":"","url":"https://api.github.com/users/TheDoubleK","html_url":"https://github.com/TheDoubleK","followers_url":"https://api.github.com/users/TheDoubleK/followers","following_url":"https://api.github.com/users/TheDoubleK/following{/other_user}","gists_url":"https://api.github.com/users/TheDoubleK/gists{/gist_id}","starred_url":"https://api.github.com/users/TheDoubleK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheDoubleK/subscriptions","organizations_url":"https://api.github.com/users/TheDoubleK/orgs","repos_url":"https://api.github.com/users/TheDoubleK/repos","events_url":"https://api.github.com/users/TheDoubleK/events{/privacy}","received_events_url":"https://api.github.com/users/TheDoubleK/received_events","type":"User","site_admin":false},"body":"Is `total_pages` the same as `last_page`? Elsewhere where we do pagination we have links for previous, next and last pages. I guess a count is different from a URL, but not sure it is necessary?","created_at":"2016-08-13T09:05:47Z","updated_at":"2016-08-13T09:05:47Z","html_url":"https://github.com/alphagov/digitalmarketplace-api/pull/431#discussion_r74684417","pull_request_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/431","_links":{"self":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/comments/74684417"},"html":{"href":"https://github.com/alphagov/digitalmarketplace-api/pull/431#discussion_r74684417"},"pull_request":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/431"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/431","id":80620375,"html_url":"https://github.com/alphagov/digitalmarketplace-api/pull/431","diff_url":"https://github.com/alphagov/digitalmarketplace-api/pull/431.diff","patch_url":"https://github.com/alphagov/digitalmarketplace-api/pull/431.patch","issue_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/431","number":431,"state":"open","locked":false,"title":"Adjust /briefs and /users for admin app buyer download","user":{"login":"Wynndow","id":13836290,"avatar_url":"https://avatars.githubusercontent.com/u/13836290?v=3","gravatar_id":"","url":"https://api.github.com/users/Wynndow","html_url":"https://github.com/Wynndow","followers_url":"https://api.github.com/users/Wynndow/followers","following_url":"https://api.github.com/users/Wynndow/following{/other_user}","gists_url":"https://api.github.com/users/Wynndow/gists{/gist_id}","starred_url":"https://api.github.com/users/Wynndow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wynndow/subscriptions","organizations_url":"https://api.github.com/users/Wynndow/orgs","repos_url":"https://api.github.com/users/Wynndow/repos","events_url":"https://api.github.com/users/Wynndow/events{/privacy}","received_events_url":"https://api.github.com/users/Wynndow/received_events","type":"User","site_admin":false},"body":"This PR is part of [this](https://www.pivotaltracker.com/story/show/124104161) Pivotal story. \r\n\r\nThis PR is alternative approach to the previos PR on the API for the same story, found [here](https://github.com/alphagov/digitalmarketplace-api/pull/430).\r\n\r\nThe specific endpoint set up in the previous PR was too specific and couldn't be reused for other means. This approach is hitting the api to get all briefs and all buyers and the combining them in the admin app.\r\n\r\nTo do this, the api needed to return a little more information. For briefs, it needed to return the user data along with the brief. For users, it needed a way of filtering just on buyers. This PR adds that functionality.\r\n\r\nFor both routes it also adds some metadata to the json being returned which gives the total number of paginated pages. The admin app will need to hit the api a certain number of times to make sure it's retrieved all briefs/buyers and this bit of meta allows that.","created_at":"2016-08-09T13:30:55Z","updated_at":"2016-08-13T09:05:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"65e3acff1547053ada4e8f2e30a2dac23fa9d2eb","assignee":{"login":"idavidmcdonald","id":7228605,"avatar_url":"https://avatars.githubusercontent.com/u/7228605?v=3","gravatar_id":"","url":"https://api.github.com/users/idavidmcdonald","html_url":"https://github.com/idavidmcdonald","followers_url":"https://api.github.com/users/idavidmcdonald/followers","following_url":"https://api.github.com/users/idavidmcdonald/following{/other_user}","gists_url":"https://api.github.com/users/idavidmcdonald/gists{/gist_id}","starred_url":"https://api.github.com/users/idavidmcdonald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idavidmcdonald/subscriptions","organizations_url":"https://api.github.com/users/idavidmcdonald/orgs","repos_url":"https://api.github.com/users/idavidmcdonald/repos","events_url":"https://api.github.com/users/idavidmcdonald/events{/privacy}","received_events_url":"https://api.github.com/users/idavidmcdonald/received_events","type":"User","site_admin":false},"assignees":[{"login":"idavidmcdonald","id":7228605,"avatar_url":"https://avatars.githubusercontent.com/u/7228605?v=3","gravatar_id":"","url":"https://api.github.com/users/idavidmcdonald","html_url":"https://github.com/idavidmcdonald","followers_url":"https://api.github.com/users/idavidmcdonald/followers","following_url":"https://api.github.com/users/idavidmcdonald/following{/other_user}","gists_url":"https://api.github.com/users/idavidmcdonald/gists{/gist_id}","starred_url":"https://api.github.com/users/idavidmcdonald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idavidmcdonald/subscriptions","organizations_url":"https://api.github.com/users/idavidmcdonald/orgs","repos_url":"https://api.github.com/users/idavidmcdonald/repos","events_url":"https://api.github.com/users/idavidmcdonald/events{/privacy}","received_events_url":"https://api.github.com/users/idavidmcdonald/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/431/commits","review_comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/431/comments","review_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/431/comments","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/statuses/b8bb54b044daf663a9a6401a344fc0cc6c451e8c","head":{"label":"alphagov:get_buyer_users_by_users_route","ref":"get_buyer_users_by_users_route","sha":"b8bb54b044daf663a9a6401a344fc0cc6c451e8c","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":26963583,"name":"digitalmarketplace-api","full_name":"alphagov/digitalmarketplace-api","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/digitalmarketplace-api","description":"Digital Marketplace API.","fork":false,"url":"https://api.github.com/repos/alphagov/digitalmarketplace-api","forks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/forks","keys_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/teams","hooks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/hooks","issue_events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/events","assignees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/tags","blobs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/languages","stargazers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/stargazers","contributors_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/contributors","subscribers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/subscribers","subscription_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/subscription","commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/merges","archive_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/downloads","issues_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/deployments","created_at":"2014-11-21T14:41:36Z","updated_at":"2016-03-27T08:06:55Z","pushed_at":"2016-08-12T13:03:24Z","git_url":"git://github.com/alphagov/digitalmarketplace-api.git","ssh_url":"git@github.com:alphagov/digitalmarketplace-api.git","clone_url":"https://github.com/alphagov/digitalmarketplace-api.git","svn_url":"https://github.com/alphagov/digitalmarketplace-api","homepage":null,"size":2329,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":7,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"6a6d62afd4621e435cb4758960ac3eb8f1df730a","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":26963583,"name":"digitalmarketplace-api","full_name":"alphagov/digitalmarketplace-api","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/digitalmarketplace-api","description":"Digital Marketplace API.","fork":false,"url":"https://api.github.com/repos/alphagov/digitalmarketplace-api","forks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/forks","keys_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/teams","hooks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/hooks","issue_events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/events","assignees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/tags","blobs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/languages","stargazers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/stargazers","contributors_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/contributors","subscribers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/subscribers","subscription_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/subscription","commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/merges","archive_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/downloads","issues_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/deployments","created_at":"2014-11-21T14:41:36Z","updated_at":"2016-03-27T08:06:55Z","pushed_at":"2016-08-12T13:03:24Z","git_url":"git://github.com/alphagov/digitalmarketplace-api.git","ssh_url":"git@github.com:alphagov/digitalmarketplace-api.git","clone_url":"https://github.com/alphagov/digitalmarketplace-api.git","svn_url":"https://github.com/alphagov/digitalmarketplace-api","homepage":null,"size":2329,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/431"},"html":{"href":"https://github.com/alphagov/digitalmarketplace-api/pull/431"},"issue":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/431"},"comments":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/431/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/431/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/431/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/statuses/b8bb54b044daf663a9a6401a344fc0cc6c451e8c"}}}}
{"actor":{"display_login":"TheDoubleK"}}