{"action":"created","comment":{"url":"https://api.github.com/repos/DoSomething/dosomething/pulls/comments/28437704","id":28437704,"diff_hunk":"@@ -9,6 +9,77 @@ abstract class ReportbackTransformer {\n \n \n   /**\n+   * Get the URI for the next page in the collection of data.\n+   *\n+   * @param $data\n+   * @param $parameters\n+   * @param $endpoint","path":"lib/modules/dosomething/dosomething_reportback/dosomething_reportback.reportback_transformer.inc","position":8,"original_position":8,"commit_id":"aa7f194f6d01643965700a7e4085a552f7edeec3","original_commit_id":"aa7f194f6d01643965700a7e4085a552f7edeec3","user":{"login":"sergii-tkachenko","id":672669,"avatar_url":"https://avatars.githubusercontent.com/u/672669?v=3","gravatar_id":"","url":"https://api.github.com/users/sergii-tkachenko","html_url":"https://github.com/sergii-tkachenko","followers_url":"https://api.github.com/users/sergii-tkachenko/followers","following_url":"https://api.github.com/users/sergii-tkachenko/following{/other_user}","gists_url":"https://api.github.com/users/sergii-tkachenko/gists{/gist_id}","starred_url":"https://api.github.com/users/sergii-tkachenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergii-tkachenko/subscriptions","organizations_url":"https://api.github.com/users/sergii-tkachenko/orgs","repos_url":"https://api.github.com/users/sergii-tkachenko/repos","events_url":"https://api.github.com/users/sergii-tkachenko/events{/privacy}","received_events_url":"https://api.github.com/users/sergii-tkachenko/received_events","type":"User","site_admin":false},"body":"You missed a newline between `@param` and `@return`. Pls fix here and everywhere below.","created_at":"2015-04-15T16:40:03Z","updated_at":"2015-04-15T16:40:03Z","html_url":"https://github.com/DoSomething/dosomething/pull/4380#discussion_r28437704","pull_request_url":"https://api.github.com/repos/DoSomething/dosomething/pulls/4380","_links":{"self":{"href":"https://api.github.com/repos/DoSomething/dosomething/pulls/comments/28437704"},"html":{"href":"https://github.com/DoSomething/dosomething/pull/4380#discussion_r28437704"},"pull_request":{"href":"https://api.github.com/repos/DoSomething/dosomething/pulls/4380"}}},"pull_request":{"url":"https://api.github.com/repos/DoSomething/dosomething/pulls/4380","id":33301725,"html_url":"https://github.com/DoSomething/dosomething/pull/4380","diff_url":"https://github.com/DoSomething/dosomething/pull/4380.diff","patch_url":"https://github.com/DoSomething/dosomething/pull/4380.patch","issue_url":"https://api.github.com/repos/DoSomething/dosomething/issues/4380","number":4380,"state":"open","locked":false,"title":"Updates to add pagination to reportback-items endpoint.","user":{"login":"weerd","id":105849,"avatar_url":"https://avatars.githubusercontent.com/u/105849?v=3","gravatar_id":"","url":"https://api.github.com/users/weerd","html_url":"https://github.com/weerd","followers_url":"https://api.github.com/users/weerd/followers","following_url":"https://api.github.com/users/weerd/following{/other_user}","gists_url":"https://api.github.com/users/weerd/gists{/gist_id}","starred_url":"https://api.github.com/users/weerd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weerd/subscriptions","organizations_url":"https://api.github.com/users/weerd/orgs","repos_url":"https://api.github.com/users/weerd/repos","events_url":"https://api.github.com/users/weerd/events{/privacy}","received_events_url":"https://api.github.com/users/weerd/received_events","type":"User","site_admin":false},"body":"## Fixes #4381\r\n\r\n:sparkles: _Now with PAGINATION!_ :sparkles: \r\n\r\nRequest:\r\n```\r\nhttp://dev.dosomething.org:8888/api/v1/reportback-items.json?&campaigns=362,1321&status=promoted&count=4&page=3\r\n```\r\n\r\nResponse:\r\n```\r\n{\r\n  pagination: {\r\n    total: 20,\r\n    per_page: 4,\r\n    current_page: 3,\r\n    total_pages: 5,\r\n    prev_uri: \"http://dosomething.org/api/v1/reportback-items.json?&campaigns=362,1321&status=promoted&count=4&page=2\",\r\n    next_uri: \"http://dosomething.org/api/v1/reportback-items.json?&campaigns=362,1321&status=promoted&count=4&page=4\"\r\n  },\r\n  retrieved_count: 4,\r\n  data: [\r\n    {...},\r\n    {...},\r\n    {...},\r\n    {...}\r\n  ]\r\n}\r\n```\r\n\r\nSomething's to note... currently (I think only on staging and local, maybe production too), the value that gets calculated for the `total` is based off of what counts are in cache. These counts get updated when Reportbacks are submitted for a campaign, etc... However, I believe there's an issue with them not updating properly if reportbacks are deleted (which we've done a bit on staging). So on local testing, the `total` and `total_pages` can be a little skewed since the number reported for the calculation are off.\r\n\r\nThe code could probs also benefit from a refactor pass, but wanted to get something up. Might also make sense to rip out the pagination methods into their own class specifically for API stuff :dancer: \r\n\r\nI place all the pagination data in a `pagination` object. Hopefully that's cool :) Also we should discuss the property name differences between Northstar and this, so we can agree upon some standard naming...\r\n\r\n@uy @angaither @drewish\r\n\r\nCC: (might be of interest to) @DFurnes @barryclark @DeeZone ","created_at":"2015-04-14T21:27:12Z","updated_at":"2015-04-15T16:40:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"54621290bc4995d7077ef15a1d24d72f3d92c18d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DoSomething/dosomething/pulls/4380/commits","review_comments_url":"https://api.github.com/repos/DoSomething/dosomething/pulls/4380/comments","review_comment_url":"https://api.github.com/repos/DoSomething/dosomething/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DoSomething/dosomething/issues/4380/comments","statuses_url":"https://api.github.com/repos/DoSomething/dosomething/statuses/aa7f194f6d01643965700a7e4085a552f7edeec3","head":{"label":"weerd:reportback-endpoints-pagination","ref":"reportback-endpoints-pagination","sha":"aa7f194f6d01643965700a7e4085a552f7edeec3","user":{"login":"weerd","id":105849,"avatar_url":"https://avatars.githubusercontent.com/u/105849?v=3","gravatar_id":"","url":"https://api.github.com/users/weerd","html_url":"https://github.com/weerd","followers_url":"https://api.github.com/users/weerd/followers","following_url":"https://api.github.com/users/weerd/following{/other_user}","gists_url":"https://api.github.com/users/weerd/gists{/gist_id}","starred_url":"https://api.github.com/users/weerd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weerd/subscriptions","organizations_url":"https://api.github.com/users/weerd/orgs","repos_url":"https://api.github.com/users/weerd/repos","events_url":"https://api.github.com/users/weerd/events{/privacy}","received_events_url":"https://api.github.com/users/weerd/received_events","type":"User","site_admin":false},"repo":{"id":26650134,"name":"dosomething","full_name":"weerd/dosomething","owner":{"login":"weerd","id":105849,"avatar_url":"https://avatars.githubusercontent.com/u/105849?v=3","gravatar_id":"","url":"https://api.github.com/users/weerd","html_url":"https://github.com/weerd","followers_url":"https://api.github.com/users/weerd/followers","following_url":"https://api.github.com/users/weerd/following{/other_user}","gists_url":"https://api.github.com/users/weerd/gists{/gist_id}","starred_url":"https://api.github.com/users/weerd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weerd/subscriptions","organizations_url":"https://api.github.com/users/weerd/orgs","repos_url":"https://api.github.com/users/weerd/repos","events_url":"https://api.github.com/users/weerd/events{/privacy}","received_events_url":"https://api.github.com/users/weerd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/weerd/dosomething","description":"A Drupal 7 distribution that powers the DoSomething.org web platform.","fork":true,"url":"https://api.github.com/repos/weerd/dosomething","forks_url":"https://api.github.com/repos/weerd/dosomething/forks","keys_url":"https://api.github.com/repos/weerd/dosomething/keys{/key_id}","collaborators_url":"https://api.github.com/repos/weerd/dosomething/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/weerd/dosomething/teams","hooks_url":"https://api.github.com/repos/weerd/dosomething/hooks","issue_events_url":"https://api.github.com/repos/weerd/dosomething/issues/events{/number}","events_url":"https://api.github.com/repos/weerd/dosomething/events","assignees_url":"https://api.github.com/repos/weerd/dosomething/assignees{/user}","branches_url":"https://api.github.com/repos/weerd/dosomething/branches{/branch}","tags_url":"https://api.github.com/repos/weerd/dosomething/tags","blobs_url":"https://api.github.com/repos/weerd/dosomething/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/weerd/dosomething/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/weerd/dosomething/git/refs{/sha}","trees_url":"https://api.github.com/repos/weerd/dosomething/git/trees{/sha}","statuses_url":"https://api.github.com/repos/weerd/dosomething/statuses/{sha}","languages_url":"https://api.github.com/repos/weerd/dosomething/languages","stargazers_url":"https://api.github.com/repos/weerd/dosomething/stargazers","contributors_url":"https://api.github.com/repos/weerd/dosomething/contributors","subscribers_url":"https://api.github.com/repos/weerd/dosomething/subscribers","subscription_url":"https://api.github.com/repos/weerd/dosomething/subscription","commits_url":"https://api.github.com/repos/weerd/dosomething/commits{/sha}","git_commits_url":"https://api.github.com/repos/weerd/dosomething/git/commits{/sha}","comments_url":"https://api.github.com/repos/weerd/dosomething/comments{/number}","issue_comment_url":"https://api.github.com/repos/weerd/dosomething/issues/comments{/number}","contents_url":"https://api.github.com/repos/weerd/dosomething/contents/{+path}","compare_url":"https://api.github.com/repos/weerd/dosomething/compare/{base}...{head}","merges_url":"https://api.github.com/repos/weerd/dosomething/merges","archive_url":"https://api.github.com/repos/weerd/dosomething/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/weerd/dosomething/downloads","issues_url":"https://api.github.com/repos/weerd/dosomething/issues{/number}","pulls_url":"https://api.github.com/repos/weerd/dosomething/pulls{/number}","milestones_url":"https://api.github.com/repos/weerd/dosomething/milestones{/number}","notifications_url":"https://api.github.com/repos/weerd/dosomething/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/weerd/dosomething/labels{/name}","releases_url":"https://api.github.com/repos/weerd/dosomething/releases{/id}","created_at":"2014-11-14T17:42:44Z","updated_at":"2015-03-30T16:45:21Z","pushed_at":"2015-04-15T15:26:58Z","git_url":"git://github.com/weerd/dosomething.git","ssh_url":"git@github.com:weerd/dosomething.git","clone_url":"https://github.com/weerd/dosomething.git","svn_url":"https://github.com/weerd/dosomething","homepage":"http://www.dosomething.org/","size":13159,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev"}},"base":{"label":"DoSomething:dev","ref":"dev","sha":"324359a9570d8d71032830bb28e84852d47699f6","user":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"repo":{"id":13592927,"name":"dosomething","full_name":"DoSomething/dosomething","owner":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DoSomething/dosomething","description":"A Drupal 7 distribution that powers the DoSomething.org web platform.","fork":false,"url":"https://api.github.com/repos/DoSomething/dosomething","forks_url":"https://api.github.com/repos/DoSomething/dosomething/forks","keys_url":"https://api.github.com/repos/DoSomething/dosomething/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DoSomething/dosomething/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DoSomething/dosomething/teams","hooks_url":"https://api.github.com/repos/DoSomething/dosomething/hooks","issue_events_url":"https://api.github.com/repos/DoSomething/dosomething/issues/events{/number}","events_url":"https://api.github.com/repos/DoSomething/dosomething/events","assignees_url":"https://api.github.com/repos/DoSomething/dosomething/assignees{/user}","branches_url":"https://api.github.com/repos/DoSomething/dosomething/branches{/branch}","tags_url":"https://api.github.com/repos/DoSomething/dosomething/tags","blobs_url":"https://api.github.com/repos/DoSomething/dosomething/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DoSomething/dosomething/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DoSomething/dosomething/git/refs{/sha}","trees_url":"https://api.github.com/repos/DoSomething/dosomething/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DoSomething/dosomething/statuses/{sha}","languages_url":"https://api.github.com/repos/DoSomething/dosomething/languages","stargazers_url":"https://api.github.com/repos/DoSomething/dosomething/stargazers","contributors_url":"https://api.github.com/repos/DoSomething/dosomething/contributors","subscribers_url":"https://api.github.com/repos/DoSomething/dosomething/subscribers","subscription_url":"https://api.github.com/repos/DoSomething/dosomething/subscription","commits_url":"https://api.github.com/repos/DoSomething/dosomething/commits{/sha}","git_commits_url":"https://api.github.com/repos/DoSomething/dosomething/git/commits{/sha}","comments_url":"https://api.github.com/repos/DoSomething/dosomething/comments{/number}","issue_comment_url":"https://api.github.com/repos/DoSomething/dosomething/issues/comments{/number}","contents_url":"https://api.github.com/repos/DoSomething/dosomething/contents/{+path}","compare_url":"https://api.github.com/repos/DoSomething/dosomething/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DoSomething/dosomething/merges","archive_url":"https://api.github.com/repos/DoSomething/dosomething/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DoSomething/dosomething/downloads","issues_url":"https://api.github.com/repos/DoSomething/dosomething/issues{/number}","pulls_url":"https://api.github.com/repos/DoSomething/dosomething/pulls{/number}","milestones_url":"https://api.github.com/repos/DoSomething/dosomething/milestones{/number}","notifications_url":"https://api.github.com/repos/DoSomething/dosomething/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DoSomething/dosomething/labels{/name}","releases_url":"https://api.github.com/repos/DoSomething/dosomething/releases{/id}","created_at":"2013-10-15T14:50:48Z","updated_at":"2015-04-15T14:40:00Z","pushed_at":"2015-04-15T15:26:59Z","git_url":"git://github.com/DoSomething/dosomething.git","ssh_url":"git@github.com:DoSomething/dosomething.git","clone_url":"https://github.com/DoSomething/dosomething.git","svn_url":"https://github.com/DoSomething/dosomething","homepage":"http://www.dosomething.org/","size":27506,"stargazers_count":23,"watchers_count":23,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":187,"forks":17,"open_issues":187,"watchers":23,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/DoSomething/dosomething/pulls/4380"},"html":{"href":"https://github.com/DoSomething/dosomething/pull/4380"},"issue":{"href":"https://api.github.com/repos/DoSomething/dosomething/issues/4380"},"comments":{"href":"https://api.github.com/repos/DoSomething/dosomething/issues/4380/comments"},"review_comments":{"href":"https://api.github.com/repos/DoSomething/dosomething/pulls/4380/comments"},"review_comment":{"href":"https://api.github.com/repos/DoSomething/dosomething/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DoSomething/dosomething/pulls/4380/commits"},"statuses":{"href":"https://api.github.com/repos/DoSomething/dosomething/statuses/aa7f194f6d01643965700a7e4085a552f7edeec3"}}}}