{"action":"created","comment":{"url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls/comments/80735096","pull_request_review_id":1770281,"id":80735096,"diff_hunk":"@@ -0,0 +1,79 @@\n+/*\n+ * Copyright (c) 2016 Adobe Systems Incorporated. All rights reserved.\n+ *  \n+ * Permission is hereby granted, free of charge, to any person obtaining a\n+ * copy of this software and associated documentation files (the \"Software\"), \n+ * to deal in the Software without restriction, including without limitation \n+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, \n+ * and/or sell copies of the Software, and to permit persons to whom the \n+ * Software is furnished to do so, subject to the following conditions:\n+ *  \n+ * The above copyright notice and this permission notice shall be included in\n+ * all copies or substantial portions of the Software.\n+ *  \n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n+ * DEALINGS IN THE SOFTWARE.\n+ * \n+ */\n+\n+/* global _spaces */\n+\n+import Promise from \"bluebird\";\n+\n+import NotifierProxy from \"../util/notifierproxy\";\n+\n+/**\n+ * The Messages object provides helper methods for sending and receiving direct\n+ * messages from the native plugin.\n+ */\n+export class Messages extends NotifierProxy {\n+    /**\n+     * @param {object=} options\n+     * @param {Array.<string|{event: string, universal: boolean}>=} options.events\n+     */\n+    constructor (options) {\n+        super(options);\n+\n+        /**\n+         * Promisified version of sendDirectMessage\n+         *\n+         * @private\n+         * @type {function():Promise}\n+         */\n+        this._sendDirectMessageAsync = Promise.promisify(_spaces.ps.descriptor.sendDirectMessage, {\n+            context: _spaces.ps.descriptor\n+        });\n+    }\n+\n+    /**\n+     * Send a direct message to Photoshop.\n+     *\n+     * @param {string} name\n+     * @param {object} payload\n+     * @param {object=} options\n+     * @return {Promise}\n+     */\n+    sendDirectMessage (name, payload, options = {}) {\n+        return this._sendDirectMessageAsync(name, payload, options);\n+    }\n+}\n+\n+/**\n+ * Construct a Descriptor object with the given options.\n+ *\n+ * @param {object=} options\n+ * @param {?Array.<string|{event: string, universal: boolean}>=} options.events Null to allow all events.\n+ * @return {Descriptor}\n+ */\n+export function makeMessages (options = {}) {\n+    let messages = new Messages(options);\n+\n+    messages.unpause();","path":"src/ps/messages.js","position":76,"original_position":76,"commit_id":"1665d02a576e80aaafe5ca0153f69764cb5e3fd4","original_commit_id":"b4a9d58f19483069881d9855cbce31b08f0149ad","user":{"login":"iwehrman","id":1075154,"avatar_url":"https://avatars.githubusercontent.com/u/1075154?v=3","gravatar_id":"","url":"https://api.github.com/users/iwehrman","html_url":"https://github.com/iwehrman","followers_url":"https://api.github.com/users/iwehrman/followers","following_url":"https://api.github.com/users/iwehrman/following{/other_user}","gists_url":"https://api.github.com/users/iwehrman/gists{/gist_id}","starred_url":"https://api.github.com/users/iwehrman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwehrman/subscriptions","organizations_url":"https://api.github.com/users/iwehrman/orgs","repos_url":"https://api.github.com/users/iwehrman/repos","events_url":"https://api.github.com/users/iwehrman/events{/privacy}","received_events_url":"https://api.github.com/users/iwehrman/received_events","type":"User","site_admin":false},"body":"Also note that the constructor helpers do the right thing by default.","created_at":"2016-09-27T16:28:19Z","updated_at":"2016-09-27T16:28:19Z","html_url":"https://github.com/adobe-photoshop/spaces-adapter/pull/211#discussion_r80735096","pull_request_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls/211","_links":{"self":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls/comments/80735096"},"html":{"href":"https://github.com/adobe-photoshop/spaces-adapter/pull/211#discussion_r80735096"},"pull_request":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls/211"}}},"pull_request":{"url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls/211","id":86844738,"html_url":"https://github.com/adobe-photoshop/spaces-adapter/pull/211","diff_url":"https://github.com/adobe-photoshop/spaces-adapter/pull/211.diff","patch_url":"https://github.com/adobe-photoshop/spaces-adapter/pull/211.patch","issue_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/issues/211","number":211,"state":"open","locked":false,"title":"Direct message registration","user":{"login":"iwehrman","id":1075154,"avatar_url":"https://avatars.githubusercontent.com/u/1075154?v=3","gravatar_id":"","url":"https://api.github.com/users/iwehrman","html_url":"https://github.com/iwehrman","followers_url":"https://api.github.com/users/iwehrman/followers","following_url":"https://api.github.com/users/iwehrman/following{/other_user}","gists_url":"https://api.github.com/users/iwehrman/gists{/gist_id}","starred_url":"https://api.github.com/users/iwehrman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwehrman/subscriptions","organizations_url":"https://api.github.com/users/iwehrman/orgs","repos_url":"https://api.github.com/users/iwehrman/repos","events_url":"https://api.github.com/users/iwehrman/events{/privacy}","received_events_url":"https://api.github.com/users/iwehrman/received_events","type":"User","site_admin":false},"body":"This is a ~~~**REVIEW ONLY**~~~ PR that makes the following changes:\r\n\r\n1. Add a `Messages` class that emits direct message events and exposes the `sendDirectMessage` API.\r\n2. Factor out a `NotifierProxy` class that `Descriptor` and `Messages` inherit from to implement the event emitting functionality including pause/unpause.\r\n\r\n@volfied: I'd like your feedback on this. I'm testing this now in conjunction with some experimental direct-messages changes along with @dtristram, and so I'm not entirely sure that this works as billed.","created_at":"2016-09-27T00:43:48Z","updated_at":"2016-09-27T16:28:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4b97333e043c78722399d83fe8f3f7a2f948d19d","assignee":{"login":"volfied","id":386714,"avatar_url":"https://avatars.githubusercontent.com/u/386714?v=3","gravatar_id":"","url":"https://api.github.com/users/volfied","html_url":"https://github.com/volfied","followers_url":"https://api.github.com/users/volfied/followers","following_url":"https://api.github.com/users/volfied/following{/other_user}","gists_url":"https://api.github.com/users/volfied/gists{/gist_id}","starred_url":"https://api.github.com/users/volfied/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/volfied/subscriptions","organizations_url":"https://api.github.com/users/volfied/orgs","repos_url":"https://api.github.com/users/volfied/repos","events_url":"https://api.github.com/users/volfied/events{/privacy}","received_events_url":"https://api.github.com/users/volfied/received_events","type":"User","site_admin":false},"assignees":[{"login":"volfied","id":386714,"avatar_url":"https://avatars.githubusercontent.com/u/386714?v=3","gravatar_id":"","url":"https://api.github.com/users/volfied","html_url":"https://github.com/volfied","followers_url":"https://api.github.com/users/volfied/followers","following_url":"https://api.github.com/users/volfied/following{/other_user}","gists_url":"https://api.github.com/users/volfied/gists{/gist_id}","starred_url":"https://api.github.com/users/volfied/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/volfied/subscriptions","organizations_url":"https://api.github.com/users/volfied/orgs","repos_url":"https://api.github.com/users/volfied/repos","events_url":"https://api.github.com/users/volfied/events{/privacy}","received_events_url":"https://api.github.com/users/volfied/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls/211/commits","review_comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls/211/comments","review_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/issues/211/comments","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/statuses/1665d02a576e80aaafe5ca0153f69764cb5e3fd4","head":{"label":"adobe-photoshop:iwehrman/direct-messages","ref":"iwehrman/direct-messages","sha":"1665d02a576e80aaafe5ca0153f69764cb5e3fd4","user":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"repo":{"id":23519370,"name":"spaces-adapter","full_name":"adobe-photoshop/spaces-adapter","owner":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/adobe-photoshop/spaces-adapter","description":"Adobe Photoshop Spaces Plugin Adapter","fork":false,"url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter","forks_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/forks","keys_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/teams","hooks_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/hooks","issue_events_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/issues/events{/number}","events_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/events","assignees_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/assignees{/user}","branches_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/branches{/branch}","tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/tags","blobs_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/git/refs{/sha}","trees_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/statuses/{sha}","languages_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/languages","stargazers_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/stargazers","contributors_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/contributors","subscribers_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/subscribers","subscription_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/subscription","commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/commits{/sha}","git_commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/git/commits{/sha}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/comments{/number}","issue_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/issues/comments{/number}","contents_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/contents/{+path}","compare_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/merges","archive_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/downloads","issues_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/issues{/number}","pulls_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls{/number}","milestones_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/milestones{/number}","notifications_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/labels{/name}","releases_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/releases{/id}","deployments_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/deployments","created_at":"2014-08-31T17:46:47Z","updated_at":"2016-08-23T13:53:42Z","pushed_at":"2016-09-27T16:18:04Z","git_url":"git://github.com/adobe-photoshop/spaces-adapter.git","ssh_url":"git@github.com:adobe-photoshop/spaces-adapter.git","clone_url":"https://github.com/adobe-photoshop/spaces-adapter.git","svn_url":"https://github.com/adobe-photoshop/spaces-adapter","homepage":"http://adobe-photoshop.github.io/","size":1857,"stargazers_count":10,"watchers_count":10,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":10,"default_branch":"master"}},"base":{"label":"adobe-photoshop:master","ref":"master","sha":"544eb240fb2b0984e30f364540935b6cbf6ff98d","user":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"repo":{"id":23519370,"name":"spaces-adapter","full_name":"adobe-photoshop/spaces-adapter","owner":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/adobe-photoshop/spaces-adapter","description":"Adobe Photoshop Spaces Plugin Adapter","fork":false,"url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter","forks_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/forks","keys_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/teams","hooks_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/hooks","issue_events_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/issues/events{/number}","events_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/events","assignees_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/assignees{/user}","branches_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/branches{/branch}","tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/tags","blobs_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/git/refs{/sha}","trees_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/statuses/{sha}","languages_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/languages","stargazers_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/stargazers","contributors_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/contributors","subscribers_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/subscribers","subscription_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/subscription","commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/commits{/sha}","git_commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/git/commits{/sha}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/comments{/number}","issue_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/issues/comments{/number}","contents_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/contents/{+path}","compare_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/merges","archive_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/downloads","issues_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/issues{/number}","pulls_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls{/number}","milestones_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/milestones{/number}","notifications_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/labels{/name}","releases_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/releases{/id}","deployments_url":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/deployments","created_at":"2014-08-31T17:46:47Z","updated_at":"2016-08-23T13:53:42Z","pushed_at":"2016-09-27T16:18:04Z","git_url":"git://github.com/adobe-photoshop/spaces-adapter.git","ssh_url":"git@github.com:adobe-photoshop/spaces-adapter.git","clone_url":"https://github.com/adobe-photoshop/spaces-adapter.git","svn_url":"https://github.com/adobe-photoshop/spaces-adapter","homepage":"http://adobe-photoshop.github.io/","size":1857,"stargazers_count":10,"watchers_count":10,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls/211"},"html":{"href":"https://github.com/adobe-photoshop/spaces-adapter/pull/211"},"issue":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/issues/211"},"comments":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/issues/211/comments"},"review_comments":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls/211/comments"},"review_comment":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/pulls/211/commits"},"statuses":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-adapter/statuses/1665d02a576e80aaafe5ca0153f69764cb5e3fd4"}}}}
{"actor":{"display_login":"iwehrman"}}