{"action":"created","comment":{"url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls/comments/76260302","id":76260302,"diff_hunk":"@@ -0,0 +1,117 @@\n+/* global fetch */\n+/**\n+ * @fileOverview Module for interacting with the statistcs.json endpoint.\n+ *\n+ */\n+const envPrefixMap = {\n+  qa: 'qa.api',\n+  staging: 'stg.api',\n+  production: 'api'\n+}\n+\n+// Default configuration\n+const API_VERSION = 5.4\n+const MAX_REQUESTED_IDS = 100;\n+\n+/**\n+ * Calls the statistics.json API with provided options. Returns a promise that\n+ * is fulfilled with an array of Results from the API or rejected with the error\n+ * message.\n+ *\n+ * Example:\n+ *\n+ * getStatistics({\n+ *  productIds: ['product1', 'product2', 'product3'],\n+ *  environment: 'qa',\n+ *  key: 'clients_api_key',\n+ *  type: 'Reviews',\n+ *  filters: {\n+ *   ContentLocale: 'en_US'\n+ *  }\n+ * }).then(results => {\n+ *   // Do something with results\n+ * }, errorMsg => {\n+ *   // Do something with error.\n+ * })\n+ *\n+ * https://developer.bazaarvoice.com/docs/read/conversations/statistics/display/5_4\n+ *\n+ * @param  {Object} options object that contains options\n+ * @param  {Array}  options.productIds - array of product IDs\n+ * @param  {Array}  options.environment - the data environment\n+ * @param  {Array}  options.key - client's api key\n+ * @param  {string}  options.type - Using \"Reviews\" returns statistics for all\n+ *         content, including syndicated content (if enabled on your API key).\n+ *         If you only want statistics for reviews you own that were written for\n+ *         the products specified, use \"NativeReviews\" instead.\n+ * @param  {Object}  [options.filters] - Filters object. Keyed by filter name.\n+ * @return {Promise} a promise that will be resolved with the raw results\n+ *                   from the statistics call.\n+ */\n+function getStatistics ({ productIds, environment, key, type, filters = {} }) {\n+  if (!productIds) {","path":"lib/api/statistics.js","position":52,"original_position":52,"commit_id":"bb2abf6e725d62b3e6770d2bbd29c323501535bf","original_commit_id":"bb2abf6e725d62b3e6770d2bbd29c323501535bf","user":{"login":"aterranova-bv","id":12698411,"avatar_url":"https://avatars.githubusercontent.com/u/12698411?v=3","gravatar_id":"","url":"https://api.github.com/users/aterranova-bv","html_url":"https://github.com/aterranova-bv","followers_url":"https://api.github.com/users/aterranova-bv/followers","following_url":"https://api.github.com/users/aterranova-bv/following{/other_user}","gists_url":"https://api.github.com/users/aterranova-bv/gists{/gist_id}","starred_url":"https://api.github.com/users/aterranova-bv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aterranova-bv/subscriptions","organizations_url":"https://api.github.com/users/aterranova-bv/orgs","repos_url":"https://api.github.com/users/aterranova-bv/repos","events_url":"https://api.github.com/users/aterranova-bv/events{/privacy}","received_events_url":"https://api.github.com/users/aterranova-bv/received_events","type":"User","site_admin":false},"body":"`!Array.isArray(productIds)` ?","created_at":"2016-08-25T15:00:50Z","updated_at":"2016-08-25T15:00:50Z","html_url":"https://github.com/bazaarvoice/bv-ui-core/pull/63#discussion_r76260302","pull_request_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls/63","_links":{"self":{"href":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls/comments/76260302"},"html":{"href":"https://github.com/bazaarvoice/bv-ui-core/pull/63#discussion_r76260302"},"pull_request":{"href":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls/63"}}},"pull_request":{"url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls/63","id":82267105,"html_url":"https://github.com/bazaarvoice/bv-ui-core/pull/63","diff_url":"https://github.com/bazaarvoice/bv-ui-core/pull/63.diff","patch_url":"https://github.com/bazaarvoice/bv-ui-core/pull/63.patch","issue_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/issues/63","number":63,"state":"open","locked":false,"title":"JST-80: Add an API module for communicating with the bazaarvoice api.","user":{"login":"sirugh","id":1278869,"avatar_url":"https://avatars.githubusercontent.com/u/1278869?v=3","gravatar_id":"","url":"https://api.github.com/users/sirugh","html_url":"https://github.com/sirugh","followers_url":"https://api.github.com/users/sirugh/followers","following_url":"https://api.github.com/users/sirugh/following{/other_user}","gists_url":"https://api.github.com/users/sirugh/gists{/gist_id}","starred_url":"https://api.github.com/users/sirugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sirugh/subscriptions","organizations_url":"https://api.github.com/users/sirugh/orgs","repos_url":"https://api.github.com/users/sirugh/repos","events_url":"https://api.github.com/users/sirugh/events{/privacy}","received_events_url":"https://api.github.com/users/sirugh/received_events","type":"User","site_admin":false},"body":"This adds a module that allows easy interaction with the bazaarvoice API.\r\n\r\nEach request type should return a promise that resolves with the response from the API.\r\n\r\nYou can interact with the api module by using the `.get` syntax or you can import the specific module type you want:\r\n\r\n```javascript\r\nimport api from 'bv-ui-core/api'\r\napi.get('statistics', options).then(...)\r\n```\r\n\r\n```javascript\r\nimport getStatistics from 'bv-ui-core/api/statistics'\r\ngetStatistics(options).then(...)\r\n```\r\n\r\nCurrently this only adds a `statistics` request type.\r\n\r\n\r\nAlso note that in the API [readme](https://github.com/bazaarvoice/bv-ui-core/pull/63/files#diff-9174f271f80a9817b3ee2debd1074a86R6) I suggested that people either require this source and then transpile or use our `dist/` folder which would contain the transpiled code. I have not added any build/deploy process to create that dist folder but I can. I just wanted to see how this felt to people.","created_at":"2016-08-22T21:31:34Z","updated_at":"2016-08-25T15:00:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fdc8b80e58f8b942d6a1b4dfa03ca9443c93088c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls/63/commits","review_comments_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls/63/comments","review_comment_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/issues/63/comments","statuses_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/statuses/bb2abf6e725d62b3e6770d2bbd29c323501535bf","head":{"label":"sirugh:JST-80","ref":"JST-80","sha":"bb2abf6e725d62b3e6770d2bbd29c323501535bf","user":{"login":"sirugh","id":1278869,"avatar_url":"https://avatars.githubusercontent.com/u/1278869?v=3","gravatar_id":"","url":"https://api.github.com/users/sirugh","html_url":"https://github.com/sirugh","followers_url":"https://api.github.com/users/sirugh/followers","following_url":"https://api.github.com/users/sirugh/following{/other_user}","gists_url":"https://api.github.com/users/sirugh/gists{/gist_id}","starred_url":"https://api.github.com/users/sirugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sirugh/subscriptions","organizations_url":"https://api.github.com/users/sirugh/orgs","repos_url":"https://api.github.com/users/sirugh/repos","events_url":"https://api.github.com/users/sirugh/events{/privacy}","received_events_url":"https://api.github.com/users/sirugh/received_events","type":"User","site_admin":false},"repo":{"id":44779043,"name":"bv-ui-core","full_name":"sirugh/bv-ui-core","owner":{"login":"sirugh","id":1278869,"avatar_url":"https://avatars.githubusercontent.com/u/1278869?v=3","gravatar_id":"","url":"https://api.github.com/users/sirugh","html_url":"https://github.com/sirugh","followers_url":"https://api.github.com/users/sirugh/followers","following_url":"https://api.github.com/users/sirugh/following{/other_user}","gists_url":"https://api.github.com/users/sirugh/gists{/gist_id}","starred_url":"https://api.github.com/users/sirugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sirugh/subscriptions","organizations_url":"https://api.github.com/users/sirugh/orgs","repos_url":"https://api.github.com/users/sirugh/repos","events_url":"https://api.github.com/users/sirugh/events{/privacy}","received_events_url":"https://api.github.com/users/sirugh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sirugh/bv-ui-core","description":"A Node module for common Bazaarvoice UI code.","fork":true,"url":"https://api.github.com/repos/sirugh/bv-ui-core","forks_url":"https://api.github.com/repos/sirugh/bv-ui-core/forks","keys_url":"https://api.github.com/repos/sirugh/bv-ui-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sirugh/bv-ui-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sirugh/bv-ui-core/teams","hooks_url":"https://api.github.com/repos/sirugh/bv-ui-core/hooks","issue_events_url":"https://api.github.com/repos/sirugh/bv-ui-core/issues/events{/number}","events_url":"https://api.github.com/repos/sirugh/bv-ui-core/events","assignees_url":"https://api.github.com/repos/sirugh/bv-ui-core/assignees{/user}","branches_url":"https://api.github.com/repos/sirugh/bv-ui-core/branches{/branch}","tags_url":"https://api.github.com/repos/sirugh/bv-ui-core/tags","blobs_url":"https://api.github.com/repos/sirugh/bv-ui-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sirugh/bv-ui-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sirugh/bv-ui-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/sirugh/bv-ui-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sirugh/bv-ui-core/statuses/{sha}","languages_url":"https://api.github.com/repos/sirugh/bv-ui-core/languages","stargazers_url":"https://api.github.com/repos/sirugh/bv-ui-core/stargazers","contributors_url":"https://api.github.com/repos/sirugh/bv-ui-core/contributors","subscribers_url":"https://api.github.com/repos/sirugh/bv-ui-core/subscribers","subscription_url":"https://api.github.com/repos/sirugh/bv-ui-core/subscription","commits_url":"https://api.github.com/repos/sirugh/bv-ui-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/sirugh/bv-ui-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/sirugh/bv-ui-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/sirugh/bv-ui-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/sirugh/bv-ui-core/contents/{+path}","compare_url":"https://api.github.com/repos/sirugh/bv-ui-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sirugh/bv-ui-core/merges","archive_url":"https://api.github.com/repos/sirugh/bv-ui-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sirugh/bv-ui-core/downloads","issues_url":"https://api.github.com/repos/sirugh/bv-ui-core/issues{/number}","pulls_url":"https://api.github.com/repos/sirugh/bv-ui-core/pulls{/number}","milestones_url":"https://api.github.com/repos/sirugh/bv-ui-core/milestones{/number}","notifications_url":"https://api.github.com/repos/sirugh/bv-ui-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sirugh/bv-ui-core/labels{/name}","releases_url":"https://api.github.com/repos/sirugh/bv-ui-core/releases{/id}","deployments_url":"https://api.github.com/repos/sirugh/bv-ui-core/deployments","created_at":"2015-10-22T23:25:04Z","updated_at":"2015-10-22T23:25:04Z","pushed_at":"2016-08-24T20:06:52Z","git_url":"git://github.com/sirugh/bv-ui-core.git","ssh_url":"git@github.com:sirugh/bv-ui-core.git","clone_url":"https://github.com/sirugh/bv-ui-core.git","svn_url":"https://github.com/sirugh/bv-ui-core","homepage":"","size":117,"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":"bazaarvoice:master","ref":"master","sha":"ebc980200e5c4ac8657cede0e05a4f93e1d62eab","user":{"login":"bazaarvoice","id":152469,"avatar_url":"https://avatars.githubusercontent.com/u/152469?v=3","gravatar_id":"","url":"https://api.github.com/users/bazaarvoice","html_url":"https://github.com/bazaarvoice","followers_url":"https://api.github.com/users/bazaarvoice/followers","following_url":"https://api.github.com/users/bazaarvoice/following{/other_user}","gists_url":"https://api.github.com/users/bazaarvoice/gists{/gist_id}","starred_url":"https://api.github.com/users/bazaarvoice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazaarvoice/subscriptions","organizations_url":"https://api.github.com/users/bazaarvoice/orgs","repos_url":"https://api.github.com/users/bazaarvoice/repos","events_url":"https://api.github.com/users/bazaarvoice/events{/privacy}","received_events_url":"https://api.github.com/users/bazaarvoice/received_events","type":"Organization","site_admin":false},"repo":{"id":39015617,"name":"bv-ui-core","full_name":"bazaarvoice/bv-ui-core","owner":{"login":"bazaarvoice","id":152469,"avatar_url":"https://avatars.githubusercontent.com/u/152469?v=3","gravatar_id":"","url":"https://api.github.com/users/bazaarvoice","html_url":"https://github.com/bazaarvoice","followers_url":"https://api.github.com/users/bazaarvoice/followers","following_url":"https://api.github.com/users/bazaarvoice/following{/other_user}","gists_url":"https://api.github.com/users/bazaarvoice/gists{/gist_id}","starred_url":"https://api.github.com/users/bazaarvoice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazaarvoice/subscriptions","organizations_url":"https://api.github.com/users/bazaarvoice/orgs","repos_url":"https://api.github.com/users/bazaarvoice/repos","events_url":"https://api.github.com/users/bazaarvoice/events{/privacy}","received_events_url":"https://api.github.com/users/bazaarvoice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bazaarvoice/bv-ui-core","description":"A Node module for common Bazaarvoice UI code.","fork":false,"url":"https://api.github.com/repos/bazaarvoice/bv-ui-core","forks_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/forks","keys_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/teams","hooks_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/hooks","issue_events_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/issues/events{/number}","events_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/events","assignees_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/assignees{/user}","branches_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/branches{/branch}","tags_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/tags","blobs_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/statuses/{sha}","languages_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/languages","stargazers_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/stargazers","contributors_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/contributors","subscribers_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/subscribers","subscription_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/subscription","commits_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/contents/{+path}","compare_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/merges","archive_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/downloads","issues_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/issues{/number}","pulls_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls{/number}","milestones_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/milestones{/number}","notifications_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/labels{/name}","releases_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/releases{/id}","deployments_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/deployments","created_at":"2015-07-13T14:03:45Z","updated_at":"2016-07-27T22:20:02Z","pushed_at":"2016-08-24T20:06:52Z","git_url":"git://github.com/bazaarvoice/bv-ui-core.git","ssh_url":"git@github.com:bazaarvoice/bv-ui-core.git","clone_url":"https://github.com/bazaarvoice/bv-ui-core.git","svn_url":"https://github.com/bazaarvoice/bv-ui-core","homepage":"","size":146,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":3,"forks":14,"open_issues":3,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls/63"},"html":{"href":"https://github.com/bazaarvoice/bv-ui-core/pull/63"},"issue":{"href":"https://api.github.com/repos/bazaarvoice/bv-ui-core/issues/63"},"comments":{"href":"https://api.github.com/repos/bazaarvoice/bv-ui-core/issues/63/comments"},"review_comments":{"href":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls/63/comments"},"review_comment":{"href":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls/63/commits"},"statuses":{"href":"https://api.github.com/repos/bazaarvoice/bv-ui-core/statuses/bb2abf6e725d62b3e6770d2bbd29c323501535bf"}}}}
{"actor":{"display_login":"aterranova-bv"}}