{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleChrome/confluence/pulls/comments/106294180","pull_request_review_id":27210390,"id":106294180,"diff_hunk":"@@ -0,0 +1,129 @@\n+foam.CLASS({\n+  name: 'ApiMatrix',\n+  package: 'org.chromium.apis.web',\n+  documentation: `ApiMatrix is a client side object that has methods\n+    to retrieve browserAPIs from server DAO, transform browserAPIs to\n+    CSV format string, tranform browserAPIs to object that can be\n+    displayed on HTML as a nested table.`,\n+  requires: [\n+    'foam.dao.EasyDAO',\n+    'foam.dao.ArrayDAO',\n+    'foam.mlang.ExpressionsSingleton',\n+    'org.chromium.apis.web.BrowserAPI',\n+  ],\n+  properties: [\n+    {\n+      name: 'browserAPIs',\n+      documentation: `The WebAPIs object where the browserAPIs will be\n+        be fetched from.`,\n+      typeName: 'BrowserAPI DAO',\n+      required: true,\n+      final: true,\n+    },\n+    {\n+      name: 'M',\n+      documentation: `Object contains mlang expressions, it supports\n+        logic operations such as AND and OR and math operations such\n+        as IN, EQ.`,\n+      factory: function() {\n+        return this.ExpressionsSingleton.create();\n+      },\n+    },\n+  ],\n+  methods: [\n+    {\n+      name: 'toMatrix',\n+      documentation: `An asynchronous method that takes an array of browser\n+        keys, produce a nested matrix that contains browser and interface\n+        relationship. This structure should be easy to be displayed as a\n+        nested table in client side.`,\n+      args: [\n+        {\n+          name: 'browserKeys',\n+          typeName: 'StringArray',\n+          documentation: `A string array contains valid browser keys. It will\n+            be used for filtering browserAPIs.`,\n+        },\n+      ],\n+      returns: {\n+        typeName: 'JSON',\n+        documentation: `Returns a JSON of the form:\n+            {interfaceName: {apiName: {BrowserKey: true, ...} ...} ... } ...}\n+            This structure is easy for displaying a nested table.`,\n+      },\n+      code: function(browserKeys) {\n+        return this.browserAPIs\n+          .where(this.M.IN(this.BrowserAPI.BROWSER_KEY, browserKeys))\n+          .select(this.M.GROUP_BY( this.BrowserAPI.INTERFACE_KEY,\n+            this.ArrayDAO.create()))\n+          .then((groups) => {\n+            let matrix = {};\n+            let interfaceApis = groups.groupKeys;\n+            for (let i = 0; i < interfaceApis.length; i++) {\n+              let browserAPIs = groups.groups[interfaceApis[i]].array;\n+              let interfaceName = browserAPIs[0].interfaceName;\n+              let apiName = browserAPIs[0].apiName;\n+              if (!matrix.hasOwnProperty(interfaceName)) {\n+                matrix[interfaceName] = {};\n+              }\n+              matrix[interfaceName][apiName] = {};\n+              for (let j = 0; j < browserAPIs.length; j++) {\n+                matrix[interfaceName][apiName][\n+                  browserAPIs[j].browserKey] = true;\n+              }\n+            }\n+            return matrix;\n+          });\n+      },\n+    },\n+    {\n+      name: 'toCSV',\n+      documentation: `Takes an array of browser keys, produce a string of\n+        CSV format.`,\n+      args: [\n+        {\n+          name: 'browserKeys',\n+          typeName: 'StringArray',\n+          documentation: `A string array contains valid browser keys.`,\n+        },\n+      ],\n+      returns: {\n+        typeName: 'String',\n+        documentation: `Returns a string of csv format.`,\n+      },\n+      code: function(browserKeys) {\n+        return this.toMatrix(browserKeys).then(function(result) {\n+          let table = [];\n+          // Add table header.\n+          table.push(['Interface', 'API'].concat(browserKeys));\n+          let interfaces = Object.keys(result);\n+          for (let i = 0; i < interfaces.length; i++) {\n+            let interfaceName = interfaces[i];\n+            let APIs = Object.keys(result[interfaceName]);\n+            for (let j = 0; j < APIs.length; j++) {\n+              let apiName = APIs[j];\n+              let row = [interfaceName, apiName];\n+              for (let browserKey in browserKeys) {","path":"lib/client/api_matrix.es6.js","position":null,"original_position":106,"commit_id":"335ba80998b3f7706c21ae38b6548f6be1a6ccbf","original_commit_id":"c6d72b2105f453de696f9ae3b7079e118510ff8e","user":{"login":"jingt06","id":9008746,"avatar_url":"https://avatars0.githubusercontent.com/u/9008746?v=3","gravatar_id":"","url":"https://api.github.com/users/jingt06","html_url":"https://github.com/jingt06","followers_url":"https://api.github.com/users/jingt06/followers","following_url":"https://api.github.com/users/jingt06/following{/other_user}","gists_url":"https://api.github.com/users/jingt06/gists{/gist_id}","starred_url":"https://api.github.com/users/jingt06/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jingt06/subscriptions","organizations_url":"https://api.github.com/users/jingt06/orgs","repos_url":"https://api.github.com/users/jingt06/repos","events_url":"https://api.github.com/users/jingt06/events{/privacy}","received_events_url":"https://api.github.com/users/jingt06/received_events","type":"User","site_admin":false},"body":"Changed to for(let k = 0; ...).","created_at":"2017-03-15T22:02:19Z","updated_at":"2017-03-15T22:02:19Z","html_url":"https://github.com/GoogleChrome/confluence/pull/17#discussion_r106294180","pull_request_url":"https://api.github.com/repos/GoogleChrome/confluence/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/confluence/pulls/comments/106294180"},"html":{"href":"https://github.com/GoogleChrome/confluence/pull/17#discussion_r106294180"},"pull_request":{"href":"https://api.github.com/repos/GoogleChrome/confluence/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleChrome/confluence/pulls/17","id":110489733,"html_url":"https://github.com/GoogleChrome/confluence/pull/17","diff_url":"https://github.com/GoogleChrome/confluence/pull/17.diff","patch_url":"https://github.com/GoogleChrome/confluence/pull/17.patch","issue_url":"https://api.github.com/repos/GoogleChrome/confluence/issues/17","number":17,"state":"open","locked":false,"title":"FOAM models of BrowserAPI and WebAPI using one table implementation.","user":{"login":"jingt06","id":9008746,"avatar_url":"https://avatars0.githubusercontent.com/u/9008746?v=3","gravatar_id":"","url":"https://api.github.com/users/jingt06","html_url":"https://github.com/jingt06","followers_url":"https://api.github.com/users/jingt06/followers","following_url":"https://api.github.com/users/jingt06/following{/other_user}","gists_url":"https://api.github.com/users/jingt06/gists{/gist_id}","starred_url":"https://api.github.com/users/jingt06/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jingt06/subscriptions","organizations_url":"https://api.github.com/users/jingt06/orgs","repos_url":"https://api.github.com/users/jingt06/repos","events_url":"https://api.github.com/users/jingt06/events{/privacy}","received_events_url":"https://api.github.com/users/jingt06/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-03-13T20:22:50Z","updated_at":"2017-03-15T22:02:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"345ae774ba7a1806ff590156158bd4f06de45818","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleChrome/confluence/pulls/17/commits","review_comments_url":"https://api.github.com/repos/GoogleChrome/confluence/pulls/17/comments","review_comment_url":"https://api.github.com/repos/GoogleChrome/confluence/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleChrome/confluence/issues/17/comments","statuses_url":"https://api.github.com/repos/GoogleChrome/confluence/statuses/335ba80998b3f7706c21ae38b6548f6be1a6ccbf","head":{"label":"jingt06:web-apis-one-table","ref":"web-apis-one-table","sha":"335ba80998b3f7706c21ae38b6548f6be1a6ccbf","user":{"login":"jingt06","id":9008746,"avatar_url":"https://avatars0.githubusercontent.com/u/9008746?v=3","gravatar_id":"","url":"https://api.github.com/users/jingt06","html_url":"https://github.com/jingt06","followers_url":"https://api.github.com/users/jingt06/followers","following_url":"https://api.github.com/users/jingt06/following{/other_user}","gists_url":"https://api.github.com/users/jingt06/gists{/gist_id}","starred_url":"https://api.github.com/users/jingt06/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jingt06/subscriptions","organizations_url":"https://api.github.com/users/jingt06/orgs","repos_url":"https://api.github.com/users/jingt06/repos","events_url":"https://api.github.com/users/jingt06/events{/privacy}","received_events_url":"https://api.github.com/users/jingt06/received_events","type":"User","site_admin":false},"repo":{"id":82972907,"name":"confluence","full_name":"jingt06/confluence","owner":{"login":"jingt06","id":9008746,"avatar_url":"https://avatars0.githubusercontent.com/u/9008746?v=3","gravatar_id":"","url":"https://api.github.com/users/jingt06","html_url":"https://github.com/jingt06","followers_url":"https://api.github.com/users/jingt06/followers","following_url":"https://api.github.com/users/jingt06/following{/other_user}","gists_url":"https://api.github.com/users/jingt06/gists{/gist_id}","starred_url":"https://api.github.com/users/jingt06/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jingt06/subscriptions","organizations_url":"https://api.github.com/users/jingt06/orgs","repos_url":"https://api.github.com/users/jingt06/repos","events_url":"https://api.github.com/users/jingt06/events{/privacy}","received_events_url":"https://api.github.com/users/jingt06/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jingt06/confluence","description":null,"fork":true,"url":"https://api.github.com/repos/jingt06/confluence","forks_url":"https://api.github.com/repos/jingt06/confluence/forks","keys_url":"https://api.github.com/repos/jingt06/confluence/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jingt06/confluence/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jingt06/confluence/teams","hooks_url":"https://api.github.com/repos/jingt06/confluence/hooks","issue_events_url":"https://api.github.com/repos/jingt06/confluence/issues/events{/number}","events_url":"https://api.github.com/repos/jingt06/confluence/events","assignees_url":"https://api.github.com/repos/jingt06/confluence/assignees{/user}","branches_url":"https://api.github.com/repos/jingt06/confluence/branches{/branch}","tags_url":"https://api.github.com/repos/jingt06/confluence/tags","blobs_url":"https://api.github.com/repos/jingt06/confluence/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jingt06/confluence/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jingt06/confluence/git/refs{/sha}","trees_url":"https://api.github.com/repos/jingt06/confluence/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jingt06/confluence/statuses/{sha}","languages_url":"https://api.github.com/repos/jingt06/confluence/languages","stargazers_url":"https://api.github.com/repos/jingt06/confluence/stargazers","contributors_url":"https://api.github.com/repos/jingt06/confluence/contributors","subscribers_url":"https://api.github.com/repos/jingt06/confluence/subscribers","subscription_url":"https://api.github.com/repos/jingt06/confluence/subscription","commits_url":"https://api.github.com/repos/jingt06/confluence/commits{/sha}","git_commits_url":"https://api.github.com/repos/jingt06/confluence/git/commits{/sha}","comments_url":"https://api.github.com/repos/jingt06/confluence/comments{/number}","issue_comment_url":"https://api.github.com/repos/jingt06/confluence/issues/comments{/number}","contents_url":"https://api.github.com/repos/jingt06/confluence/contents/{+path}","compare_url":"https://api.github.com/repos/jingt06/confluence/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jingt06/confluence/merges","archive_url":"https://api.github.com/repos/jingt06/confluence/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jingt06/confluence/downloads","issues_url":"https://api.github.com/repos/jingt06/confluence/issues{/number}","pulls_url":"https://api.github.com/repos/jingt06/confluence/pulls{/number}","milestones_url":"https://api.github.com/repos/jingt06/confluence/milestones{/number}","notifications_url":"https://api.github.com/repos/jingt06/confluence/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jingt06/confluence/labels{/name}","releases_url":"https://api.github.com/repos/jingt06/confluence/releases{/id}","deployments_url":"https://api.github.com/repos/jingt06/confluence/deployments","created_at":"2017-02-23T21:25:37Z","updated_at":"2017-02-23T21:25:39Z","pushed_at":"2017-03-15T21:57:39Z","git_url":"git://github.com/jingt06/confluence.git","ssh_url":"git@github.com:jingt06/confluence.git","clone_url":"https://github.com/jingt06/confluence.git","svn_url":"https://github.com/jingt06/confluence","homepage":null,"size":6644,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":false,"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":"GoogleChrome:master","ref":"master","sha":"087e88a34cdf22f237d109a78d615a4b6770b517","user":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars0.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"repo":{"id":82467989,"name":"confluence","full_name":"GoogleChrome/confluence","owner":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars0.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleChrome/confluence","description":null,"fork":false,"url":"https://api.github.com/repos/GoogleChrome/confluence","forks_url":"https://api.github.com/repos/GoogleChrome/confluence/forks","keys_url":"https://api.github.com/repos/GoogleChrome/confluence/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleChrome/confluence/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleChrome/confluence/teams","hooks_url":"https://api.github.com/repos/GoogleChrome/confluence/hooks","issue_events_url":"https://api.github.com/repos/GoogleChrome/confluence/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleChrome/confluence/events","assignees_url":"https://api.github.com/repos/GoogleChrome/confluence/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleChrome/confluence/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleChrome/confluence/tags","blobs_url":"https://api.github.com/repos/GoogleChrome/confluence/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleChrome/confluence/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleChrome/confluence/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleChrome/confluence/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleChrome/confluence/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleChrome/confluence/languages","stargazers_url":"https://api.github.com/repos/GoogleChrome/confluence/stargazers","contributors_url":"https://api.github.com/repos/GoogleChrome/confluence/contributors","subscribers_url":"https://api.github.com/repos/GoogleChrome/confluence/subscribers","subscription_url":"https://api.github.com/repos/GoogleChrome/confluence/subscription","commits_url":"https://api.github.com/repos/GoogleChrome/confluence/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleChrome/confluence/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleChrome/confluence/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleChrome/confluence/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleChrome/confluence/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleChrome/confluence/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleChrome/confluence/merges","archive_url":"https://api.github.com/repos/GoogleChrome/confluence/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleChrome/confluence/downloads","issues_url":"https://api.github.com/repos/GoogleChrome/confluence/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleChrome/confluence/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleChrome/confluence/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleChrome/confluence/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleChrome/confluence/labels{/name}","releases_url":"https://api.github.com/repos/GoogleChrome/confluence/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleChrome/confluence/deployments","created_at":"2017-02-19T15:16:33Z","updated_at":"2017-03-15T11:45:20Z","pushed_at":"2017-03-15T21:57:41Z","git_url":"git://github.com/GoogleChrome/confluence.git","ssh_url":"git@github.com:GoogleChrome/confluence.git","clone_url":"https://github.com/GoogleChrome/confluence.git","svn_url":"https://github.com/GoogleChrome/confluence","homepage":null,"size":40,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":13,"forks":2,"open_issues":13,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/confluence/pulls/17"},"html":{"href":"https://github.com/GoogleChrome/confluence/pull/17"},"issue":{"href":"https://api.github.com/repos/GoogleChrome/confluence/issues/17"},"comments":{"href":"https://api.github.com/repos/GoogleChrome/confluence/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleChrome/confluence/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleChrome/confluence/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleChrome/confluence/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleChrome/confluence/statuses/335ba80998b3f7706c21ae38b6548f6be1a6ccbf"}}}}
{"actor":{"display_login":"jingt06"}}