{"action":"created","comment":{"url":"https://api.github.com/repos/mediamonks/kiai/pulls/comments/229868057","pull_request_review_id":170287190,"id":229868057,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyOTg2ODA1Nw==","diff_hunk":"@@ -0,0 +1,75 @@\n+import { TFlow, TFlows, TIntentHandler, TMapping } from './Types';\n+import Kiai from '../../Kiai';\n+\n+export default abstract class Platform {\n+  abstract readonly IDENTIFIER: string;\n+\n+  abstract readonly INTENT_DELIMITER: string;\n+\n+  abstract readonly requestHandler: () => any;\n+\n+  private readonly app: Kiai;\n+\n+  protected constructor({ app }: { app: Kiai }) {\n+    this.app = app;\n+  }\n+\n+  private get localeMapping(): TMapping {\n+    return this.app.localeMapping;\n+  }\n+\n+  protected abstract registerIntent(key: string, handler: TIntentHandler): void;\n+\n+  protected registerIntents(flowName: string, intents: TFlow) {\n+    Object.keys(intents).forEach(intentKey => {\n+      const intentHandler = intents[intentKey];\n+\n+      if (typeof intentHandler === 'object') {\n+        return this.registerIntents(flowName, intentHandler);\n+      }\n+\n+      if (typeof intentHandler === 'function') {\n+        this.registerIntent(`${flowName}${this.INTENT_DELIMITER}${intentKey}`, intentHandler);\n+      }\n+    });\n+  }\n+\n+  protected registerConfirmationIntents(...options: string[]): void {\n+    options.forEach(option => {\n+      this.registerIntent(`confirmation_${option}`, conversation => {\n+        conversation.handleConfirmation(option);\n+      });\n+    });\n+  }\n+\n+  protected registerPermissionIntents(): void {\n+    this.registerIntent('permission_confirmation', conversation => {\n+      conversation.handlePermission(!!conversation.input[0]);\n+    });\n+  }\n+\n+  /* Unfinished feature\n+  protected registerLoginIntent(): void {\n+    this.registerIntent('login', conversation => {\n+      conversation.handleLogin(conversation.input.status === 'OK');\n+    });\n+  }\n+*/\n+\n+  protected registerFlows(flows: TFlows): void {\n+    Object.keys(flows).forEach(flowName => {\n+      const intents = flows[flowName];\n+      this.registerIntents(flowName, intents);\n+    });\n+  }\n+\n+  protected mapLocale(locale: string): string {\n+    Object.keys(this.localeMapping).find(key => {\n+      const match = new RegExp(key).test(locale);","path":"src/lib/common/Platform.ts","position":68,"original_position":68,"commit_id":"9c156634ab78be66f77119308d5bbc870058d4b7","original_commit_id":"9c156634ab78be66f77119308d5bbc870058d4b7","user":{"login":"ThaNarie","id":1449580,"node_id":"MDQ6VXNlcjE0NDk1ODA=","avatar_url":"https://avatars0.githubusercontent.com/u/1449580?v=4","gravatar_id":"","url":"https://api.github.com/users/ThaNarie","html_url":"https://github.com/ThaNarie","followers_url":"https://api.github.com/users/ThaNarie/followers","following_url":"https://api.github.com/users/ThaNarie/following{/other_user}","gists_url":"https://api.github.com/users/ThaNarie/gists{/gist_id}","starred_url":"https://api.github.com/users/ThaNarie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThaNarie/subscriptions","organizations_url":"https://api.github.com/users/ThaNarie/orgs","repos_url":"https://api.github.com/users/ThaNarie/repos","events_url":"https://api.github.com/users/ThaNarie/events{/privacy}","received_events_url":"https://api.github.com/users/ThaNarie/received_events","type":"User","site_admin":false},"body":"Would `locale.includes(key)` be a nicer way of doing this?","created_at":"2018-10-31T21:06:22Z","updated_at":"2018-10-31T21:33:31Z","html_url":"https://github.com/mediamonks/kiai/pull/1#discussion_r229868057","pull_request_url":"https://api.github.com/repos/mediamonks/kiai/pulls/1","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mediamonks/kiai/pulls/comments/229868057"},"html":{"href":"https://github.com/mediamonks/kiai/pull/1#discussion_r229868057"},"pull_request":{"href":"https://api.github.com/repos/mediamonks/kiai/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/mediamonks/kiai/pulls/1","id":227307861,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3MzA3ODYx","html_url":"https://github.com/mediamonks/kiai/pull/1","diff_url":"https://github.com/mediamonks/kiai/pull/1.diff","patch_url":"https://github.com/mediamonks/kiai/pull/1.patch","issue_url":"https://api.github.com/repos/mediamonks/kiai/issues/1","number":1,"state":"open","locked":false,"title":"0.1.1","user":{"login":"n0cha","id":6113324,"node_id":"MDQ6VXNlcjYxMTMzMjQ=","avatar_url":"https://avatars0.githubusercontent.com/u/6113324?v=4","gravatar_id":"","url":"https://api.github.com/users/n0cha","html_url":"https://github.com/n0cha","followers_url":"https://api.github.com/users/n0cha/followers","following_url":"https://api.github.com/users/n0cha/following{/other_user}","gists_url":"https://api.github.com/users/n0cha/gists{/gist_id}","starred_url":"https://api.github.com/users/n0cha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n0cha/subscriptions","organizations_url":"https://api.github.com/users/n0cha/orgs","repos_url":"https://api.github.com/users/n0cha/repos","events_url":"https://api.github.com/users/n0cha/events{/privacy}","received_events_url":"https://api.github.com/users/n0cha/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-31T14:29:21Z","updated_at":"2018-10-31T21:33:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5c3c9df0241e498c380eb049198f266abbe2a9bf","assignee":null,"assignees":[],"requested_reviewers":[{"login":"AndreMediaMonks","id":6205378,"node_id":"MDQ6VXNlcjYyMDUzNzg=","avatar_url":"https://avatars1.githubusercontent.com/u/6205378?v=4","gravatar_id":"","url":"https://api.github.com/users/AndreMediaMonks","html_url":"https://github.com/AndreMediaMonks","followers_url":"https://api.github.com/users/AndreMediaMonks/followers","following_url":"https://api.github.com/users/AndreMediaMonks/following{/other_user}","gists_url":"https://api.github.com/users/AndreMediaMonks/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreMediaMonks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreMediaMonks/subscriptions","organizations_url":"https://api.github.com/users/AndreMediaMonks/orgs","repos_url":"https://api.github.com/users/AndreMediaMonks/repos","events_url":"https://api.github.com/users/AndreMediaMonks/events{/privacy}","received_events_url":"https://api.github.com/users/AndreMediaMonks/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mediamonks/kiai/pulls/1/commits","review_comments_url":"https://api.github.com/repos/mediamonks/kiai/pulls/1/comments","review_comment_url":"https://api.github.com/repos/mediamonks/kiai/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mediamonks/kiai/issues/1/comments","statuses_url":"https://api.github.com/repos/mediamonks/kiai/statuses/9c156634ab78be66f77119308d5bbc870058d4b7","head":{"label":"mediamonks:dev","ref":"dev","sha":"9c156634ab78be66f77119308d5bbc870058d4b7","user":{"login":"mediamonks","id":11174980,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMTc0OTgw","avatar_url":"https://avatars0.githubusercontent.com/u/11174980?v=4","gravatar_id":"","url":"https://api.github.com/users/mediamonks","html_url":"https://github.com/mediamonks","followers_url":"https://api.github.com/users/mediamonks/followers","following_url":"https://api.github.com/users/mediamonks/following{/other_user}","gists_url":"https://api.github.com/users/mediamonks/gists{/gist_id}","starred_url":"https://api.github.com/users/mediamonks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mediamonks/subscriptions","organizations_url":"https://api.github.com/users/mediamonks/orgs","repos_url":"https://api.github.com/users/mediamonks/repos","events_url":"https://api.github.com/users/mediamonks/events{/privacy}","received_events_url":"https://api.github.com/users/mediamonks/received_events","type":"Organization","site_admin":false},"repo":{"id":155569063,"node_id":"MDEwOlJlcG9zaXRvcnkxNTU1NjkwNjM=","name":"kiai","full_name":"mediamonks/kiai","private":false,"owner":{"login":"mediamonks","id":11174980,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMTc0OTgw","avatar_url":"https://avatars0.githubusercontent.com/u/11174980?v=4","gravatar_id":"","url":"https://api.github.com/users/mediamonks","html_url":"https://github.com/mediamonks","followers_url":"https://api.github.com/users/mediamonks/followers","following_url":"https://api.github.com/users/mediamonks/following{/other_user}","gists_url":"https://api.github.com/users/mediamonks/gists{/gist_id}","starred_url":"https://api.github.com/users/mediamonks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mediamonks/subscriptions","organizations_url":"https://api.github.com/users/mediamonks/orgs","repos_url":"https://api.github.com/users/mediamonks/repos","events_url":"https://api.github.com/users/mediamonks/events{/privacy}","received_events_url":"https://api.github.com/users/mediamonks/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mediamonks/kiai","description":"Kiai VoiceAction Framework","fork":false,"url":"https://api.github.com/repos/mediamonks/kiai","forks_url":"https://api.github.com/repos/mediamonks/kiai/forks","keys_url":"https://api.github.com/repos/mediamonks/kiai/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mediamonks/kiai/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mediamonks/kiai/teams","hooks_url":"https://api.github.com/repos/mediamonks/kiai/hooks","issue_events_url":"https://api.github.com/repos/mediamonks/kiai/issues/events{/number}","events_url":"https://api.github.com/repos/mediamonks/kiai/events","assignees_url":"https://api.github.com/repos/mediamonks/kiai/assignees{/user}","branches_url":"https://api.github.com/repos/mediamonks/kiai/branches{/branch}","tags_url":"https://api.github.com/repos/mediamonks/kiai/tags","blobs_url":"https://api.github.com/repos/mediamonks/kiai/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mediamonks/kiai/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mediamonks/kiai/git/refs{/sha}","trees_url":"https://api.github.com/repos/mediamonks/kiai/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mediamonks/kiai/statuses/{sha}","languages_url":"https://api.github.com/repos/mediamonks/kiai/languages","stargazers_url":"https://api.github.com/repos/mediamonks/kiai/stargazers","contributors_url":"https://api.github.com/repos/mediamonks/kiai/contributors","subscribers_url":"https://api.github.com/repos/mediamonks/kiai/subscribers","subscription_url":"https://api.github.com/repos/mediamonks/kiai/subscription","commits_url":"https://api.github.com/repos/mediamonks/kiai/commits{/sha}","git_commits_url":"https://api.github.com/repos/mediamonks/kiai/git/commits{/sha}","comments_url":"https://api.github.com/repos/mediamonks/kiai/comments{/number}","issue_comment_url":"https://api.github.com/repos/mediamonks/kiai/issues/comments{/number}","contents_url":"https://api.github.com/repos/mediamonks/kiai/contents/{+path}","compare_url":"https://api.github.com/repos/mediamonks/kiai/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mediamonks/kiai/merges","archive_url":"https://api.github.com/repos/mediamonks/kiai/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mediamonks/kiai/downloads","issues_url":"https://api.github.com/repos/mediamonks/kiai/issues{/number}","pulls_url":"https://api.github.com/repos/mediamonks/kiai/pulls{/number}","milestones_url":"https://api.github.com/repos/mediamonks/kiai/milestones{/number}","notifications_url":"https://api.github.com/repos/mediamonks/kiai/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mediamonks/kiai/labels{/name}","releases_url":"https://api.github.com/repos/mediamonks/kiai/releases{/id}","deployments_url":"https://api.github.com/repos/mediamonks/kiai/deployments","created_at":"2018-10-31T14:15:20Z","updated_at":"2018-10-31T14:31:49Z","pushed_at":"2018-10-31T18:10:49Z","git_url":"git://github.com/mediamonks/kiai.git","ssh_url":"git@github.com:mediamonks/kiai.git","clone_url":"https://github.com/mediamonks/kiai.git","svn_url":"https://github.com/mediamonks/kiai","homepage":null,"size":116,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"mediamonks:master","ref":"master","sha":"2caf6e0fc1dc8e7a4c94bcef74bdc22f88e5ca20","user":{"login":"mediamonks","id":11174980,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMTc0OTgw","avatar_url":"https://avatars0.githubusercontent.com/u/11174980?v=4","gravatar_id":"","url":"https://api.github.com/users/mediamonks","html_url":"https://github.com/mediamonks","followers_url":"https://api.github.com/users/mediamonks/followers","following_url":"https://api.github.com/users/mediamonks/following{/other_user}","gists_url":"https://api.github.com/users/mediamonks/gists{/gist_id}","starred_url":"https://api.github.com/users/mediamonks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mediamonks/subscriptions","organizations_url":"https://api.github.com/users/mediamonks/orgs","repos_url":"https://api.github.com/users/mediamonks/repos","events_url":"https://api.github.com/users/mediamonks/events{/privacy}","received_events_url":"https://api.github.com/users/mediamonks/received_events","type":"Organization","site_admin":false},"repo":{"id":155569063,"node_id":"MDEwOlJlcG9zaXRvcnkxNTU1NjkwNjM=","name":"kiai","full_name":"mediamonks/kiai","private":false,"owner":{"login":"mediamonks","id":11174980,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMTc0OTgw","avatar_url":"https://avatars0.githubusercontent.com/u/11174980?v=4","gravatar_id":"","url":"https://api.github.com/users/mediamonks","html_url":"https://github.com/mediamonks","followers_url":"https://api.github.com/users/mediamonks/followers","following_url":"https://api.github.com/users/mediamonks/following{/other_user}","gists_url":"https://api.github.com/users/mediamonks/gists{/gist_id}","starred_url":"https://api.github.com/users/mediamonks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mediamonks/subscriptions","organizations_url":"https://api.github.com/users/mediamonks/orgs","repos_url":"https://api.github.com/users/mediamonks/repos","events_url":"https://api.github.com/users/mediamonks/events{/privacy}","received_events_url":"https://api.github.com/users/mediamonks/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mediamonks/kiai","description":"Kiai VoiceAction Framework","fork":false,"url":"https://api.github.com/repos/mediamonks/kiai","forks_url":"https://api.github.com/repos/mediamonks/kiai/forks","keys_url":"https://api.github.com/repos/mediamonks/kiai/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mediamonks/kiai/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mediamonks/kiai/teams","hooks_url":"https://api.github.com/repos/mediamonks/kiai/hooks","issue_events_url":"https://api.github.com/repos/mediamonks/kiai/issues/events{/number}","events_url":"https://api.github.com/repos/mediamonks/kiai/events","assignees_url":"https://api.github.com/repos/mediamonks/kiai/assignees{/user}","branches_url":"https://api.github.com/repos/mediamonks/kiai/branches{/branch}","tags_url":"https://api.github.com/repos/mediamonks/kiai/tags","blobs_url":"https://api.github.com/repos/mediamonks/kiai/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mediamonks/kiai/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mediamonks/kiai/git/refs{/sha}","trees_url":"https://api.github.com/repos/mediamonks/kiai/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mediamonks/kiai/statuses/{sha}","languages_url":"https://api.github.com/repos/mediamonks/kiai/languages","stargazers_url":"https://api.github.com/repos/mediamonks/kiai/stargazers","contributors_url":"https://api.github.com/repos/mediamonks/kiai/contributors","subscribers_url":"https://api.github.com/repos/mediamonks/kiai/subscribers","subscription_url":"https://api.github.com/repos/mediamonks/kiai/subscription","commits_url":"https://api.github.com/repos/mediamonks/kiai/commits{/sha}","git_commits_url":"https://api.github.com/repos/mediamonks/kiai/git/commits{/sha}","comments_url":"https://api.github.com/repos/mediamonks/kiai/comments{/number}","issue_comment_url":"https://api.github.com/repos/mediamonks/kiai/issues/comments{/number}","contents_url":"https://api.github.com/repos/mediamonks/kiai/contents/{+path}","compare_url":"https://api.github.com/repos/mediamonks/kiai/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mediamonks/kiai/merges","archive_url":"https://api.github.com/repos/mediamonks/kiai/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mediamonks/kiai/downloads","issues_url":"https://api.github.com/repos/mediamonks/kiai/issues{/number}","pulls_url":"https://api.github.com/repos/mediamonks/kiai/pulls{/number}","milestones_url":"https://api.github.com/repos/mediamonks/kiai/milestones{/number}","notifications_url":"https://api.github.com/repos/mediamonks/kiai/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mediamonks/kiai/labels{/name}","releases_url":"https://api.github.com/repos/mediamonks/kiai/releases{/id}","deployments_url":"https://api.github.com/repos/mediamonks/kiai/deployments","created_at":"2018-10-31T14:15:20Z","updated_at":"2018-10-31T14:31:49Z","pushed_at":"2018-10-31T18:10:49Z","git_url":"git://github.com/mediamonks/kiai.git","ssh_url":"git@github.com:mediamonks/kiai.git","clone_url":"https://github.com/mediamonks/kiai.git","svn_url":"https://github.com/mediamonks/kiai","homepage":null,"size":116,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mediamonks/kiai/pulls/1"},"html":{"href":"https://github.com/mediamonks/kiai/pull/1"},"issue":{"href":"https://api.github.com/repos/mediamonks/kiai/issues/1"},"comments":{"href":"https://api.github.com/repos/mediamonks/kiai/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/mediamonks/kiai/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/mediamonks/kiai/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mediamonks/kiai/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/mediamonks/kiai/statuses/9c156634ab78be66f77119308d5bbc870058d4b7"}},"author_association":"NONE"}}
{"actor":{"display_login":"ThaNarie"}}