{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/comments/84153094","pull_request_review_id":4948516,"id":84153094,"diff_hunk":"@@ -1,14 +1,30 @@\n import { callApi } from 'core/api';\n-import log from 'core/logger';\n \n-export function postRating({ rating, apiState, addonId, versionId }) {\n-  const postData = { rating, version: versionId };\n-  log.debug('about to post add-on rating with', postData);\n-  return callApi({\n-    endpoint: `addons/addon/${addonId}/reviews`,\n-    body: postData,\n-    method: 'post',\n-    auth: true,\n-    state: apiState,\n-  });\n+/*\n+ * POST/PATCH an add-on review using the API.\n+ */\n+export function submitReview({\n+  rating, apiState, addonSlug, versionId, body, reviewId,\n+}) {\n+  const data = { rating, version: versionId, body };\n+\n+  return new Promise(\n+    (resolve) => {\n+      if (!addonSlug) {\n+        throw new Error('addonSlug is required to build the endpoint');\n+      }\n+      let method = 'POST';\n+      let endpoint = `addons/addon/${addonSlug}/reviews`;\n+      if (reviewId) {\n+        endpoint = `${endpoint}/${reviewId}`;\n+        method = 'PATCH';\n+      }\n+      resolve(callApi({","path":"src/amo/api/index.js","position":33,"original_position":33,"commit_id":"963c0a86d6e49db842ec8f6976006eecd641fe95","original_commit_id":"963c0a86d6e49db842ec8f6976006eecd641fe95","user":{"login":"kumar303","id":55398,"avatar_url":"https://avatars.githubusercontent.com/u/55398?v=3","gravatar_id":"","url":"https://api.github.com/users/kumar303","html_url":"https://github.com/kumar303","followers_url":"https://api.github.com/users/kumar303/followers","following_url":"https://api.github.com/users/kumar303/following{/other_user}","gists_url":"https://api.github.com/users/kumar303/gists{/gist_id}","starred_url":"https://api.github.com/users/kumar303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumar303/subscriptions","organizations_url":"https://api.github.com/users/kumar303/orgs","repos_url":"https://api.github.com/users/kumar303/repos","events_url":"https://api.github.com/users/kumar303/events{/privacy}","received_events_url":"https://api.github.com/users/kumar303/received_events","type":"User","site_admin":false},"body":"nope, that's sort of why I like to avoid this pattern. It's cumbersome to refactor code like this when you move to a chaining approach.","created_at":"2016-10-19T19:53:46Z","updated_at":"2016-10-19T19:53:46Z","html_url":"https://github.com/mozilla/addons-frontend/pull/1229#discussion_r84153094","pull_request_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/1229","_links":{"self":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/comments/84153094"},"html":{"href":"https://github.com/mozilla/addons-frontend/pull/1229#discussion_r84153094"},"pull_request":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/1229"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/1229","id":89282301,"html_url":"https://github.com/mozilla/addons-frontend/pull/1229","diff_url":"https://github.com/mozilla/addons-frontend/pull/1229.diff","patch_url":"https://github.com/mozilla/addons-frontend/pull/1229.patch","issue_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/1229","number":1229,"state":"open","locked":false,"title":"Add UI to write the text of a review","user":{"login":"kumar303","id":55398,"avatar_url":"https://avatars.githubusercontent.com/u/55398?v=3","gravatar_id":"","url":"https://api.github.com/users/kumar303","html_url":"https://github.com/kumar303","followers_url":"https://api.github.com/users/kumar303/followers","following_url":"https://api.github.com/users/kumar303/following{/other_user}","gists_url":"https://api.github.com/users/kumar303/gists{/gist_id}","starred_url":"https://api.github.com/users/kumar303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumar303/subscriptions","organizations_url":"https://api.github.com/users/kumar303/orgs","repos_url":"https://api.github.com/users/kumar303/repos","events_url":"https://api.github.com/users/kumar303/events{/privacy}","received_events_url":"https://api.github.com/users/kumar303/received_events","type":"User","site_admin":false},"body":"Fixes https://github.com/mozilla/addons-frontend/issues/1020\r\n\r\nThere are some TODOs which I think we can get to later. This page is maybe / maybe not V1 but I needed to get this off my plate.","created_at":"2016-10-13T21:04:53Z","updated_at":"2016-10-19T19:53:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e5b60f09672deba7fb878d7c5b6e55ba5ce7b4d1","assignee":{"login":"mstriemer","id":211578,"avatar_url":"https://avatars.githubusercontent.com/u/211578?v=3","gravatar_id":"","url":"https://api.github.com/users/mstriemer","html_url":"https://github.com/mstriemer","followers_url":"https://api.github.com/users/mstriemer/followers","following_url":"https://api.github.com/users/mstriemer/following{/other_user}","gists_url":"https://api.github.com/users/mstriemer/gists{/gist_id}","starred_url":"https://api.github.com/users/mstriemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mstriemer/subscriptions","organizations_url":"https://api.github.com/users/mstriemer/orgs","repos_url":"https://api.github.com/users/mstriemer/repos","events_url":"https://api.github.com/users/mstriemer/events{/privacy}","received_events_url":"https://api.github.com/users/mstriemer/received_events","type":"User","site_admin":false},"assignees":[{"login":"mstriemer","id":211578,"avatar_url":"https://avatars.githubusercontent.com/u/211578?v=3","gravatar_id":"","url":"https://api.github.com/users/mstriemer","html_url":"https://github.com/mstriemer","followers_url":"https://api.github.com/users/mstriemer/followers","following_url":"https://api.github.com/users/mstriemer/following{/other_user}","gists_url":"https://api.github.com/users/mstriemer/gists{/gist_id}","starred_url":"https://api.github.com/users/mstriemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mstriemer/subscriptions","organizations_url":"https://api.github.com/users/mstriemer/orgs","repos_url":"https://api.github.com/users/mstriemer/repos","events_url":"https://api.github.com/users/mstriemer/events{/privacy}","received_events_url":"https://api.github.com/users/mstriemer/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/1229/commits","review_comments_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/1229/comments","review_comment_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/1229/comments","statuses_url":"https://api.github.com/repos/mozilla/addons-frontend/statuses/963c0a86d6e49db842ec8f6976006eecd641fe95","head":{"label":"kumar303:write-review-ui","ref":"write-review-ui","sha":"963c0a86d6e49db842ec8f6976006eecd641fe95","user":{"login":"kumar303","id":55398,"avatar_url":"https://avatars.githubusercontent.com/u/55398?v=3","gravatar_id":"","url":"https://api.github.com/users/kumar303","html_url":"https://github.com/kumar303","followers_url":"https://api.github.com/users/kumar303/followers","following_url":"https://api.github.com/users/kumar303/following{/other_user}","gists_url":"https://api.github.com/users/kumar303/gists{/gist_id}","starred_url":"https://api.github.com/users/kumar303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumar303/subscriptions","organizations_url":"https://api.github.com/users/kumar303/orgs","repos_url":"https://api.github.com/users/kumar303/repos","events_url":"https://api.github.com/users/kumar303/events{/privacy}","received_events_url":"https://api.github.com/users/kumar303/received_events","type":"User","site_admin":false},"repo":{"id":63971080,"name":"addons-frontend","full_name":"kumar303/addons-frontend","owner":{"login":"kumar303","id":55398,"avatar_url":"https://avatars.githubusercontent.com/u/55398?v=3","gravatar_id":"","url":"https://api.github.com/users/kumar303","html_url":"https://github.com/kumar303","followers_url":"https://api.github.com/users/kumar303/followers","following_url":"https://api.github.com/users/kumar303/following{/other_user}","gists_url":"https://api.github.com/users/kumar303/gists{/gist_id}","starred_url":"https://api.github.com/users/kumar303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumar303/subscriptions","organizations_url":"https://api.github.com/users/kumar303/orgs","repos_url":"https://api.github.com/users/kumar303/repos","events_url":"https://api.github.com/users/kumar303/events{/privacy}","received_events_url":"https://api.github.com/users/kumar303/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kumar303/addons-frontend","description":"Front-end infrastructure and code to complement mozilla/addons-server","fork":true,"url":"https://api.github.com/repos/kumar303/addons-frontend","forks_url":"https://api.github.com/repos/kumar303/addons-frontend/forks","keys_url":"https://api.github.com/repos/kumar303/addons-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kumar303/addons-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kumar303/addons-frontend/teams","hooks_url":"https://api.github.com/repos/kumar303/addons-frontend/hooks","issue_events_url":"https://api.github.com/repos/kumar303/addons-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/kumar303/addons-frontend/events","assignees_url":"https://api.github.com/repos/kumar303/addons-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/kumar303/addons-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/kumar303/addons-frontend/tags","blobs_url":"https://api.github.com/repos/kumar303/addons-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kumar303/addons-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kumar303/addons-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/kumar303/addons-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kumar303/addons-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/kumar303/addons-frontend/languages","stargazers_url":"https://api.github.com/repos/kumar303/addons-frontend/stargazers","contributors_url":"https://api.github.com/repos/kumar303/addons-frontend/contributors","subscribers_url":"https://api.github.com/repos/kumar303/addons-frontend/subscribers","subscription_url":"https://api.github.com/repos/kumar303/addons-frontend/subscription","commits_url":"https://api.github.com/repos/kumar303/addons-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/kumar303/addons-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/kumar303/addons-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/kumar303/addons-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/kumar303/addons-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/kumar303/addons-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kumar303/addons-frontend/merges","archive_url":"https://api.github.com/repos/kumar303/addons-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kumar303/addons-frontend/downloads","issues_url":"https://api.github.com/repos/kumar303/addons-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/kumar303/addons-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/kumar303/addons-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/kumar303/addons-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kumar303/addons-frontend/labels{/name}","releases_url":"https://api.github.com/repos/kumar303/addons-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/kumar303/addons-frontend/deployments","created_at":"2016-07-22T17:24:59Z","updated_at":"2016-07-22T17:25:02Z","pushed_at":"2016-10-18T22:02:25Z","git_url":"git://github.com/kumar303/addons-frontend.git","ssh_url":"git@github.com:kumar303/addons-frontend.git","clone_url":"https://github.com/kumar303/addons-frontend.git","svn_url":"https://github.com/kumar303/addons-frontend","homepage":null,"size":147053,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"d20afa8546a0900e1be808c61f58d12899ea5d2c","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":52104368,"name":"addons-frontend","full_name":"mozilla/addons-frontend","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/addons-frontend","description":"Front-end infrastructure and code to complement mozilla/addons-server","fork":false,"url":"https://api.github.com/repos/mozilla/addons-frontend","forks_url":"https://api.github.com/repos/mozilla/addons-frontend/forks","keys_url":"https://api.github.com/repos/mozilla/addons-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/addons-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/addons-frontend/teams","hooks_url":"https://api.github.com/repos/mozilla/addons-frontend/hooks","issue_events_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/addons-frontend/events","assignees_url":"https://api.github.com/repos/mozilla/addons-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/addons-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/addons-frontend/tags","blobs_url":"https://api.github.com/repos/mozilla/addons-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/addons-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/addons-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/addons-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/addons-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/addons-frontend/languages","stargazers_url":"https://api.github.com/repos/mozilla/addons-frontend/stargazers","contributors_url":"https://api.github.com/repos/mozilla/addons-frontend/contributors","subscribers_url":"https://api.github.com/repos/mozilla/addons-frontend/subscribers","subscription_url":"https://api.github.com/repos/mozilla/addons-frontend/subscription","commits_url":"https://api.github.com/repos/mozilla/addons-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/addons-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/addons-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/addons-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/addons-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/addons-frontend/merges","archive_url":"https://api.github.com/repos/mozilla/addons-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/addons-frontend/downloads","issues_url":"https://api.github.com/repos/mozilla/addons-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/addons-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/addons-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/addons-frontend/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/addons-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/addons-frontend/deployments","created_at":"2016-02-19T17:25:57Z","updated_at":"2016-09-09T18:05:44Z","pushed_at":"2016-10-19T19:44:35Z","git_url":"git://github.com/mozilla/addons-frontend.git","ssh_url":"git@github.com:mozilla/addons-frontend.git","clone_url":"https://github.com/mozilla/addons-frontend.git","svn_url":"https://github.com/mozilla/addons-frontend","homepage":null,"size":150026,"stargazers_count":12,"watchers_count":12,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":144,"forks":15,"open_issues":144,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/1229"},"html":{"href":"https://github.com/mozilla/addons-frontend/pull/1229"},"issue":{"href":"https://api.github.com/repos/mozilla/addons-frontend/issues/1229"},"comments":{"href":"https://api.github.com/repos/mozilla/addons-frontend/issues/1229/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/1229/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/1229/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/addons-frontend/statuses/963c0a86d6e49db842ec8f6976006eecd641fe95"}}}}
{"actor":{"display_login":"kumar303"}}