{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/frontend/pulls/comments/81114640","pull_request_review_id":2117729,"id":81114640,"diff_hunk":"@@ -123,17 +123,22 @@ class ContentApiOffersController(contentApiClient: ContentApiClient, capiAgent:\n \n   private def renderNative(format: Format, isMulti: Boolean) = Action.async { implicit request =>\n \n-    retrieveContent().map(_.toList.headOption).map(\n-      {\n-        case None => Cached(componentNilMaxAge){ jsonFormat.nilResult }\n-        case Some(content) => {\n-          val capiSingle = CapiSingle.fromContent(content)\n-          Cached(60.seconds) {\n-            JsonComponent(capiSingle)\n-          }\n+    retrieveContent().map {content =>","path":"commercial/app/controllers/commercial/ContentApiOffersController.scala","position":21,"original_position":21,"commit_id":"29d9a9dcd90d723a1f6bd35fd2f7cd4272be2e66","original_commit_id":"29d9a9dcd90d723a1f6bd35fd2f7cd4272be2e66","user":{"login":"janua","id":445472,"avatar_url":"https://avatars.githubusercontent.com/u/445472?v=3","gravatar_id":"","url":"https://api.github.com/users/janua","html_url":"https://github.com/janua","followers_url":"https://api.github.com/users/janua/followers","following_url":"https://api.github.com/users/janua/following{/other_user}","gists_url":"https://api.github.com/users/janua/gists{/gist_id}","starred_url":"https://api.github.com/users/janua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janua/subscriptions","organizations_url":"https://api.github.com/users/janua/orgs","repos_url":"https://api.github.com/users/janua/repos","events_url":"https://api.github.com/users/janua/events{/privacy}","received_events_url":"https://api.github.com/users/janua/received_events","type":"User","site_admin":false},"body":"I was thinking more\r\n```scala\r\nretrieveContent().map {\r\n  case Nil                => Cached(componentNilMaxAge){ jsonFormat.nilResult }\r\n  case content if isMulti => Cached(60.seconds) {JsonComponent(CapiMultiple.fromContent(content))}\r\n  case first :: _         => Cached(60.seconds) {JsonComponent(CapiSingle.fromContent(head))}   \r\n}\r\n```\r\n\r\n`isMulti` is weird, where has it come from? You know if it is single or multi from the list...","created_at":"2016-09-29T11:20:43Z","updated_at":"2016-09-29T11:20:43Z","html_url":"https://github.com/guardian/frontend/pull/14499#discussion_r81114640","pull_request_url":"https://api.github.com/repos/guardian/frontend/pulls/14499","_links":{"self":{"href":"https://api.github.com/repos/guardian/frontend/pulls/comments/81114640"},"html":{"href":"https://github.com/guardian/frontend/pull/14499#discussion_r81114640"},"pull_request":{"href":"https://api.github.com/repos/guardian/frontend/pulls/14499"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/frontend/pulls/14499","id":87129564,"html_url":"https://github.com/guardian/frontend/pull/14499","diff_url":"https://github.com/guardian/frontend/pull/14499.diff","patch_url":"https://github.com/guardian/frontend/pull/14499.patch","issue_url":"https://api.github.com/repos/guardian/frontend/issues/14499","number":14499,"state":"open","locked":false,"title":"Native capi multiple endpoint","user":{"login":"Ap0c","id":5131341,"avatar_url":"https://avatars.githubusercontent.com/u/5131341?v=3","gravatar_id":"","url":"https://api.github.com/users/Ap0c","html_url":"https://github.com/Ap0c","followers_url":"https://api.github.com/users/Ap0c/followers","following_url":"https://api.github.com/users/Ap0c/following{/other_user}","gists_url":"https://api.github.com/users/Ap0c/gists{/gist_id}","starred_url":"https://api.github.com/users/Ap0c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ap0c/subscriptions","organizations_url":"https://api.github.com/users/Ap0c/orgs","repos_url":"https://api.github.com/users/Ap0c/repos","events_url":"https://api.github.com/users/Ap0c/events{/privacy}","received_events_url":"https://api.github.com/users/Ap0c/received_events","type":"User","site_admin":false},"body":"## What does this change?\r\n\r\n- Extends the work done in #14473.\r\n- Modifies the cAPI offers json endpoint to include the cAPI multiple data.\r\n- Adds image source data to endpoint for both cAPI single and multiple.\r\n- Adds new route for cAPI multiple endpoint.\r\n\r\n## What is the value of this and can you measure success?\r\n\r\nThis is needed for work being done on the [cAPI native templates](https://github.com/guardian/commercial-templates). It provides data for the cAPI multiple template, and image information for both the cAPI single and multiple.\r\n\r\n## Request for comment\r\n\r\n@regiskuckaertz @JonNorman, @annebyrne I'm afraid I had to modify some of your nice functional code in the controller, and replace it with some very boring imperative stuff to get access to the multiple data. `headOption` was unfortunately stripping out the additional content. If I've made a mess or if you think there's a better way of doing this please let me know! 😔","created_at":"2016-09-28T14:20:20Z","updated_at":"2016-09-29T11:20:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c1aa4c72846d88274a45353fa18c72351ac6051d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/guardian/frontend/pulls/14499/commits","review_comments_url":"https://api.github.com/repos/guardian/frontend/pulls/14499/comments","review_comment_url":"https://api.github.com/repos/guardian/frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/frontend/issues/14499/comments","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/29d9a9dcd90d723a1f6bd35fd2f7cd4272be2e66","head":{"label":"guardian:native-capi-multiple-endpoint","ref":"native-capi-multiple-endpoint","sha":"29d9a9dcd90d723a1f6bd35fd2f7cd4272be2e66","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":4370755,"name":"frontend","full_name":"guardian/frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/frontend","description":"Source for theguardian.com","fork":false,"url":"https://api.github.com/repos/guardian/frontend","forks_url":"https://api.github.com/repos/guardian/frontend/forks","keys_url":"https://api.github.com/repos/guardian/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/frontend/teams","hooks_url":"https://api.github.com/repos/guardian/frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/frontend/events","assignees_url":"https://api.github.com/repos/guardian/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/frontend/tags","blobs_url":"https://api.github.com/repos/guardian/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/frontend/subscription","commits_url":"https://api.github.com/repos/guardian/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/frontend/merges","archive_url":"https://api.github.com/repos/guardian/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/frontend/downloads","issues_url":"https://api.github.com/repos/guardian/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/frontend/deployments","created_at":"2012-05-18T15:39:15Z","updated_at":"2016-09-28T22:30:35Z","pushed_at":"2016-09-29T11:19:24Z","git_url":"git://github.com/guardian/frontend.git","ssh_url":"git@github.com:guardian/frontend.git","clone_url":"https://github.com/guardian/frontend.git","svn_url":"https://github.com/guardian/frontend","homepage":"http://www.theguardian.com","size":543158,"stargazers_count":3309,"watchers_count":3309,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":352,"mirror_url":null,"open_issues_count":50,"forks":352,"open_issues":50,"watchers":3309,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"a49d9b8a2cdcf7214b55e5eb69cd27d9d7e47438","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":4370755,"name":"frontend","full_name":"guardian/frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/frontend","description":"Source for theguardian.com","fork":false,"url":"https://api.github.com/repos/guardian/frontend","forks_url":"https://api.github.com/repos/guardian/frontend/forks","keys_url":"https://api.github.com/repos/guardian/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/frontend/teams","hooks_url":"https://api.github.com/repos/guardian/frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/frontend/events","assignees_url":"https://api.github.com/repos/guardian/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/frontend/tags","blobs_url":"https://api.github.com/repos/guardian/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/frontend/subscription","commits_url":"https://api.github.com/repos/guardian/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/frontend/merges","archive_url":"https://api.github.com/repos/guardian/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/frontend/downloads","issues_url":"https://api.github.com/repos/guardian/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/frontend/deployments","created_at":"2012-05-18T15:39:15Z","updated_at":"2016-09-28T22:30:35Z","pushed_at":"2016-09-29T11:19:24Z","git_url":"git://github.com/guardian/frontend.git","ssh_url":"git@github.com:guardian/frontend.git","clone_url":"https://github.com/guardian/frontend.git","svn_url":"https://github.com/guardian/frontend","homepage":"http://www.theguardian.com","size":543158,"stargazers_count":3309,"watchers_count":3309,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":352,"mirror_url":null,"open_issues_count":50,"forks":352,"open_issues":50,"watchers":3309,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/frontend/pulls/14499"},"html":{"href":"https://github.com/guardian/frontend/pull/14499"},"issue":{"href":"https://api.github.com/repos/guardian/frontend/issues/14499"},"comments":{"href":"https://api.github.com/repos/guardian/frontend/issues/14499/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/frontend/pulls/14499/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/frontend/pulls/14499/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/frontend/statuses/29d9a9dcd90d723a1f6bd35fd2f7cd4272be2e66"}}}}
{"actor":{"display_login":"janua"}}