{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/comments/191723991","pull_request_review_id":124348832,"id":191723991,"diff_hunk":"@@ -0,0 +1,67 @@\n+package com.gu.zuora.reports.aqua\n+\n+import com.gu.util.zuora.RestRequestMaker.{ClientFailableOp, Requests}\n+import com.gu.util.zuora.aqua.ZuoraAquaResponse\n+import play.api.libs.json.Json\n+\n+object Querier {\n+\n+  def apply(zuoraRequester: Requests, querierRequest: QuerierRequest) /*(querierRequest: QuerierRequest)*/ : ClientFailableOp[QuerierResponse] = {\n+    val aquaRequest = AquaQueryRequest.fromQuerierRequest(querierRequest)\n+    zuoraRequester.post[AquaQueryRequest, ZuoraAquaResponse](aquaRequest, \"batch-query/\").map {\n+      aquaResponse =>\n+        val jobId = aquaResponse.id.getOrElse(\"\") // todo see how to improve error handling with zuora's inconsistent responses\n+        QuerierResponse(jobId, aquaResponse.status)\n+    }\n+  }\n+}\n+\n+case class QuerierResponse(jobId: String, status: String)\n+object QuerierResponse {\n+  implicit val writes = Json.writes[QuerierResponse]\n+}\n+\n+case class Query(name: String, query: String)\n+\n+case class AquaQuery(name: String, query: String, `type`: String = \"zoqlexport\")\n+\n+trait ZuoraAquaRequest\n+\n+case class QuerierRequest(name: String, queries: Seq[Query]) extends ZuoraAquaRequest","path":"handlers/zuora-reports/src/main/scala/com/gu/zuora/reports/Querier.scala","position":null,"original_position":30,"commit_id":"1cb6e28fa546d3d7cf3be08495eeddcb6b778999","original_commit_id":"524d33c6e92d19e61e6cd0cb6ab5fbebed9f3b14","user":{"login":"johnduffell","id":7304387,"avatar_url":"https://avatars1.githubusercontent.com/u/7304387?v=4","gravatar_id":"","url":"https://api.github.com/users/johnduffell","html_url":"https://github.com/johnduffell","followers_url":"https://api.github.com/users/johnduffell/followers","following_url":"https://api.github.com/users/johnduffell/following{/other_user}","gists_url":"https://api.github.com/users/johnduffell/gists{/gist_id}","starred_url":"https://api.github.com/users/johnduffell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnduffell/subscriptions","organizations_url":"https://api.github.com/users/johnduffell/orgs","repos_url":"https://api.github.com/users/johnduffell/repos","events_url":"https://api.github.com/users/johnduffell/events{/privacy}","received_events_url":"https://api.github.com/users/johnduffell/received_events","type":"User","site_admin":false},"body":"yes, I used the convention of \"wire\" for the ones that go over the wire to zuora, and a more normal sounding name for the ones we use internally in the code.\r\nHowever I am happy with any sensible convention and we can rename the existing ones I called \"wire\" to make them consistent.","created_at":"2018-05-30T10:57:08Z","updated_at":"2018-05-30T10:57:09Z","html_url":"https://github.com/guardian/zuora-auto-cancel/pull/99#discussion_r191723991","pull_request_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/99","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/comments/191723991"},"html":{"href":"https://github.com/guardian/zuora-auto-cancel/pull/99#discussion_r191723991"},"pull_request":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/99"}},"in_reply_to_id":191498915},"pull_request":{"url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/99","id":191174934,"html_url":"https://github.com/guardian/zuora-auto-cancel/pull/99","diff_url":"https://github.com/guardian/zuora-auto-cancel/pull/99.diff","patch_url":"https://github.com/guardian/zuora-auto-cancel/pull/99.patch","issue_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/99","number":99,"state":"open","locked":false,"title":"Zuora reports initial PR","user":{"login":"pvighi","id":15324270,"avatar_url":"https://avatars3.githubusercontent.com/u/15324270?v=4","gravatar_id":"","url":"https://api.github.com/users/pvighi","html_url":"https://github.com/pvighi","followers_url":"https://api.github.com/users/pvighi/followers","following_url":"https://api.github.com/users/pvighi/following{/other_user}","gists_url":"https://api.github.com/users/pvighi/gists{/gist_id}","starred_url":"https://api.github.com/users/pvighi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pvighi/subscriptions","organizations_url":"https://api.github.com/users/pvighi/orgs","repos_url":"https://api.github.com/users/pvighi/repos","events_url":"https://api.github.com/users/pvighi/events{/privacy}","received_events_url":"https://api.github.com/users/pvighi/received_events","type":"User","site_admin":false},"body":"This is the initial PR for a generic zuora reports project.\r\nThis will eventually contain the lambdas to run Zuora Aqua queries and store the results in S3 once they are done.\r\n\r\nthis PR only has the initial project and a fully functioning querier lambda.","created_at":"2018-05-29T14:56:18Z","updated_at":"2018-05-30T10:57:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"077ed1d492d1ced95ac42bc39afb2029b28968a4","assignee":null,"assignees":[],"requested_reviewers":[{"login":"jacobwinch","id":19384074,"avatar_url":"https://avatars3.githubusercontent.com/u/19384074?v=4","gravatar_id":"","url":"https://api.github.com/users/jacobwinch","html_url":"https://github.com/jacobwinch","followers_url":"https://api.github.com/users/jacobwinch/followers","following_url":"https://api.github.com/users/jacobwinch/following{/other_user}","gists_url":"https://api.github.com/users/jacobwinch/gists{/gist_id}","starred_url":"https://api.github.com/users/jacobwinch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacobwinch/subscriptions","organizations_url":"https://api.github.com/users/jacobwinch/orgs","repos_url":"https://api.github.com/users/jacobwinch/repos","events_url":"https://api.github.com/users/jacobwinch/events{/privacy}","received_events_url":"https://api.github.com/users/jacobwinch/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/99/commits","review_comments_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/99/comments","review_comment_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/99/comments","statuses_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/statuses/1cb6e28fa546d3d7cf3be08495eeddcb6b778999","head":{"label":"guardian:zuoraExporter","ref":"zuoraExporter","sha":"1cb6e28fa546d3d7cf3be08495eeddcb6b778999","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","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":80627505,"name":"zuora-auto-cancel","full_name":"guardian/zuora-auto-cancel","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","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/zuora-auto-cancel","description":"Lambdas covering supporter operations, mostly in life operations","fork":false,"url":"https://api.github.com/repos/guardian/zuora-auto-cancel","forks_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/forks","keys_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/teams","hooks_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/hooks","issue_events_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/events","assignees_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/tags","blobs_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/languages","stargazers_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/stargazers","contributors_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/contributors","subscribers_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/subscribers","subscription_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/subscription","commits_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/merges","archive_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/downloads","issues_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/labels{/name}","releases_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/deployments","created_at":"2017-02-01T14:25:47Z","updated_at":"2018-05-24T12:26:33Z","pushed_at":"2018-05-29T17:13:01Z","git_url":"git://github.com/guardian/zuora-auto-cancel.git","ssh_url":"git@github.com:guardian/zuora-auto-cancel.git","clone_url":"https://github.com/guardian/zuora-auto-cancel.git","svn_url":"https://github.com/guardian/zuora-auto-cancel","homepage":"","size":961,"stargazers_count":3,"watchers_count":3,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"9225466d05b787c3ab4dd22ac813742a6c80ddc5","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","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":80627505,"name":"zuora-auto-cancel","full_name":"guardian/zuora-auto-cancel","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","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/zuora-auto-cancel","description":"Lambdas covering supporter operations, mostly in life operations","fork":false,"url":"https://api.github.com/repos/guardian/zuora-auto-cancel","forks_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/forks","keys_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/teams","hooks_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/hooks","issue_events_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/events","assignees_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/tags","blobs_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/languages","stargazers_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/stargazers","contributors_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/contributors","subscribers_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/subscribers","subscription_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/subscription","commits_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/merges","archive_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/downloads","issues_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/labels{/name}","releases_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/deployments","created_at":"2017-02-01T14:25:47Z","updated_at":"2018-05-24T12:26:33Z","pushed_at":"2018-05-29T17:13:01Z","git_url":"git://github.com/guardian/zuora-auto-cancel.git","ssh_url":"git@github.com:guardian/zuora-auto-cancel.git","clone_url":"https://github.com/guardian/zuora-auto-cancel.git","svn_url":"https://github.com/guardian/zuora-auto-cancel","homepage":"","size":961,"stargazers_count":3,"watchers_count":3,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/99"},"html":{"href":"https://github.com/guardian/zuora-auto-cancel/pull/99"},"issue":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/99"},"comments":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/99/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/99/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/99/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/statuses/1cb6e28fa546d3d7cf3be08495eeddcb6b778999"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"johnduffell"}}