{"action":"created","comment":{"url":"https://api.github.com/repos/quybeans/winterfell/pulls/comments/141790398","pull_request_review_id":66059616,"id":141790398,"diff_hunk":"@@ -0,0 +1,214 @@\n+// Copyright (C) 2016-2017 Ark Maxim, Inc.\n+\n+package uniq.mqttchat.client\n+\n+// scalastyle:off underscore.import\n+import scala.io.StdIn\n+\n+import uniq.networking.mqtt.base.BaseClient\n+import uniq.networking.mqtt.base.BaseClient._\n+import uniq.networking.mqtt.base.model.MQTTACLRule\n+import uniq.networking.mqtt.base.model.MQTTACLRuleName\n+import uniq.networking.mqtt.base.model.MQTTUser\n+import uniq.networking.mqtt.base.model.MQTTUserACLRules\n+// scalastyle:on underscore.import\n+\n+final case class AdminClient(\n+  username: String,\n+  password: String) extends BaseClient(username, password) {\n+  override def login: Boolean = {\n+    super.login\n+  }\n+\n+// scalastyle:off cyclomatic.complexity\n+  override def printCommand: Unit = {\n+    println(\"1. Create an user\")\n+    println(\"2. Delete an user\")\n+    println(\"3. List all users\")\n+    println(\"4. Add an access control rule\")\n+    println(\"5. Delete an access control rule\")\n+    println(\"6. List all access control rules\")\n+    println(\"7. List all access control rules by username\")\n+    println(\"8. Create chat channel\")\n+    println(\"9. Delete a chat channel\")\n+    println(\"10 Ban user from a chat channel\")\n+    println(\"0. exit\")\n+    val cmd = StdIn.readLine(\"Please select your option: \")\n+    cmd match {\n+      case \"1\" => createUser\n+      case \"2\" => deleteUser\n+      case \"3\" => listAllUsers\n+      case \"4\" => addACLRule\n+      case \"5\" => deleteACLRule\n+      case \"6\" => listAllACLRules\n+      case \"7\" => listACLRulesByUsername\n+      case \"8\" => createChatChannel\n+      case \"9\" => deleteChatChannel\n+      case \"10\" => banUserFromChatChannel\n+      case _ =>\n+        this.disconnect\n+        System.exit(0)\n+    }\n+    println(\"Press any key to continue...\")\n+    StdIn.readLine()\n+    printCommand\n+  }\n+// scalastyle:on cyclomatic.complexity\n+\n+  private def getListAllUsers: List[MQTTUser] = {\n+    val result = httpRequest(userURL.format(\"\"), GET)\n+    io.circe.parser.decode[List[MQTTUser]](result.body).toTry.get\n+  }\n+\n+  private def listAllUsers: Unit = {\n+    getListAllUsers.foreach(x => println(x.username))\n+  }\n+\n+  private def listAllACLRules: Unit = {\n+    val result = httpRequest(aclURL, GET)\n+    val listUser = io.circe.parser.decode[List[MQTTACLRule]](result.body).toTry.get\n+    printf(\"%-10s\\t%-30s\\t%-5s\\t%-5s\\n\", \"username\", \"topic\", \"read\", \"write\")\n+    listUser.foreach(x =>","path":"src/main/scala/uniq/mqttchat/client/AdminClient.scala","position":71,"original_position":71,"commit_id":"b6e882ca00215c406777b99d26f465012307dc08","original_commit_id":"b6e882ca00215c406777b99d26f465012307dc08","user":{"login":"chequochuu","id":9390540,"avatar_url":"https://avatars3.githubusercontent.com/u/9390540?v=4","gravatar_id":"","url":"https://api.github.com/users/chequochuu","html_url":"https://github.com/chequochuu","followers_url":"https://api.github.com/users/chequochuu/followers","following_url":"https://api.github.com/users/chequochuu/following{/other_user}","gists_url":"https://api.github.com/users/chequochuu/gists{/gist_id}","starred_url":"https://api.github.com/users/chequochuu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chequochuu/subscriptions","organizations_url":"https://api.github.com/users/chequochuu/orgs","repos_url":"https://api.github.com/users/chequochuu/repos","events_url":"https://api.github.com/users/chequochuu/events{/privacy}","received_events_url":"https://api.github.com/users/chequochuu/received_events","type":"User","site_admin":false},"body":"use more meaningful variable ","created_at":"2017-09-29T05:03:06Z","updated_at":"2017-09-29T05:03:06Z","html_url":"https://github.com/quybeans/winterfell/pull/1#discussion_r141790398","pull_request_url":"https://api.github.com/repos/quybeans/winterfell/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/quybeans/winterfell/pulls/comments/141790398"},"html":{"href":"https://github.com/quybeans/winterfell/pull/1#discussion_r141790398"},"pull_request":{"href":"https://api.github.com/repos/quybeans/winterfell/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/quybeans/winterfell/pulls/1","id":143372760,"html_url":"https://github.com/quybeans/winterfell/pull/1","diff_url":"https://github.com/quybeans/winterfell/pull/1.diff","patch_url":"https://github.com/quybeans/winterfell/pull/1.patch","issue_url":"https://api.github.com/repos/quybeans/winterfell/issues/1","number":1,"state":"open","locked":false,"title":"MQTT chat client and manager client","user":{"login":"hoanghongkhang","id":10369652,"avatar_url":"https://avatars0.githubusercontent.com/u/10369652?v=4","gravatar_id":"","url":"https://api.github.com/users/hoanghongkhang","html_url":"https://github.com/hoanghongkhang","followers_url":"https://api.github.com/users/hoanghongkhang/followers","following_url":"https://api.github.com/users/hoanghongkhang/following{/other_user}","gists_url":"https://api.github.com/users/hoanghongkhang/gists{/gist_id}","starred_url":"https://api.github.com/users/hoanghongkhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoanghongkhang/subscriptions","organizations_url":"https://api.github.com/users/hoanghongkhang/orgs","repos_url":"https://api.github.com/users/hoanghongkhang/repos","events_url":"https://api.github.com/users/hoanghongkhang/events{/privacy}","received_events_url":"https://api.github.com/users/hoanghongkhang/received_events","type":"User","site_admin":false},"body":"- added subscribe unsubscribe topic function and publish message function to UserClient\r\n- added create & delete chat channel and ban user from chat channel function to AdminClient control panel","created_at":"2017-09-27T12:00:00Z","updated_at":"2017-09-29T05:03:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"878ed1d5bd854078b0d22373c5c9bb5dece51214","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/quybeans/winterfell/pulls/1/commits","review_comments_url":"https://api.github.com/repos/quybeans/winterfell/pulls/1/comments","review_comment_url":"https://api.github.com/repos/quybeans/winterfell/pulls/comments{/number}","comments_url":"https://api.github.com/repos/quybeans/winterfell/issues/1/comments","statuses_url":"https://api.github.com/repos/quybeans/winterfell/statuses/b6e882ca00215c406777b99d26f465012307dc08","head":{"label":"hoanghongkhang:master","ref":"master","sha":"b6e882ca00215c406777b99d26f465012307dc08","user":{"login":"hoanghongkhang","id":10369652,"avatar_url":"https://avatars0.githubusercontent.com/u/10369652?v=4","gravatar_id":"","url":"https://api.github.com/users/hoanghongkhang","html_url":"https://github.com/hoanghongkhang","followers_url":"https://api.github.com/users/hoanghongkhang/followers","following_url":"https://api.github.com/users/hoanghongkhang/following{/other_user}","gists_url":"https://api.github.com/users/hoanghongkhang/gists{/gist_id}","starred_url":"https://api.github.com/users/hoanghongkhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoanghongkhang/subscriptions","organizations_url":"https://api.github.com/users/hoanghongkhang/orgs","repos_url":"https://api.github.com/users/hoanghongkhang/repos","events_url":"https://api.github.com/users/hoanghongkhang/events{/privacy}","received_events_url":"https://api.github.com/users/hoanghongkhang/received_events","type":"User","site_admin":false},"repo":{"id":105009400,"name":"winterfell","full_name":"hoanghongkhang/winterfell","owner":{"login":"hoanghongkhang","id":10369652,"avatar_url":"https://avatars0.githubusercontent.com/u/10369652?v=4","gravatar_id":"","url":"https://api.github.com/users/hoanghongkhang","html_url":"https://github.com/hoanghongkhang","followers_url":"https://api.github.com/users/hoanghongkhang/followers","following_url":"https://api.github.com/users/hoanghongkhang/following{/other_user}","gists_url":"https://api.github.com/users/hoanghongkhang/gists{/gist_id}","starred_url":"https://api.github.com/users/hoanghongkhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoanghongkhang/subscriptions","organizations_url":"https://api.github.com/users/hoanghongkhang/orgs","repos_url":"https://api.github.com/users/hoanghongkhang/repos","events_url":"https://api.github.com/users/hoanghongkhang/events{/privacy}","received_events_url":"https://api.github.com/users/hoanghongkhang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hoanghongkhang/winterfell","description":null,"fork":true,"url":"https://api.github.com/repos/hoanghongkhang/winterfell","forks_url":"https://api.github.com/repos/hoanghongkhang/winterfell/forks","keys_url":"https://api.github.com/repos/hoanghongkhang/winterfell/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hoanghongkhang/winterfell/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hoanghongkhang/winterfell/teams","hooks_url":"https://api.github.com/repos/hoanghongkhang/winterfell/hooks","issue_events_url":"https://api.github.com/repos/hoanghongkhang/winterfell/issues/events{/number}","events_url":"https://api.github.com/repos/hoanghongkhang/winterfell/events","assignees_url":"https://api.github.com/repos/hoanghongkhang/winterfell/assignees{/user}","branches_url":"https://api.github.com/repos/hoanghongkhang/winterfell/branches{/branch}","tags_url":"https://api.github.com/repos/hoanghongkhang/winterfell/tags","blobs_url":"https://api.github.com/repos/hoanghongkhang/winterfell/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hoanghongkhang/winterfell/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hoanghongkhang/winterfell/git/refs{/sha}","trees_url":"https://api.github.com/repos/hoanghongkhang/winterfell/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hoanghongkhang/winterfell/statuses/{sha}","languages_url":"https://api.github.com/repos/hoanghongkhang/winterfell/languages","stargazers_url":"https://api.github.com/repos/hoanghongkhang/winterfell/stargazers","contributors_url":"https://api.github.com/repos/hoanghongkhang/winterfell/contributors","subscribers_url":"https://api.github.com/repos/hoanghongkhang/winterfell/subscribers","subscription_url":"https://api.github.com/repos/hoanghongkhang/winterfell/subscription","commits_url":"https://api.github.com/repos/hoanghongkhang/winterfell/commits{/sha}","git_commits_url":"https://api.github.com/repos/hoanghongkhang/winterfell/git/commits{/sha}","comments_url":"https://api.github.com/repos/hoanghongkhang/winterfell/comments{/number}","issue_comment_url":"https://api.github.com/repos/hoanghongkhang/winterfell/issues/comments{/number}","contents_url":"https://api.github.com/repos/hoanghongkhang/winterfell/contents/{+path}","compare_url":"https://api.github.com/repos/hoanghongkhang/winterfell/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hoanghongkhang/winterfell/merges","archive_url":"https://api.github.com/repos/hoanghongkhang/winterfell/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hoanghongkhang/winterfell/downloads","issues_url":"https://api.github.com/repos/hoanghongkhang/winterfell/issues{/number}","pulls_url":"https://api.github.com/repos/hoanghongkhang/winterfell/pulls{/number}","milestones_url":"https://api.github.com/repos/hoanghongkhang/winterfell/milestones{/number}","notifications_url":"https://api.github.com/repos/hoanghongkhang/winterfell/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hoanghongkhang/winterfell/labels{/name}","releases_url":"https://api.github.com/repos/hoanghongkhang/winterfell/releases{/id}","deployments_url":"https://api.github.com/repos/hoanghongkhang/winterfell/deployments","created_at":"2017-09-27T11:22:55Z","updated_at":"2017-09-27T11:56:16Z","pushed_at":"2017-09-29T04:47:59Z","git_url":"git://github.com/hoanghongkhang/winterfell.git","ssh_url":"git@github.com:hoanghongkhang/winterfell.git","clone_url":"https://github.com/hoanghongkhang/winterfell.git","svn_url":"https://github.com/hoanghongkhang/winterfell","homepage":null,"size":274,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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":"quybeans:master","ref":"master","sha":"a7b26a2a426c96a3b239153134cfe310ac96bf8f","user":{"login":"quybeans","id":16681786,"avatar_url":"https://avatars2.githubusercontent.com/u/16681786?v=4","gravatar_id":"","url":"https://api.github.com/users/quybeans","html_url":"https://github.com/quybeans","followers_url":"https://api.github.com/users/quybeans/followers","following_url":"https://api.github.com/users/quybeans/following{/other_user}","gists_url":"https://api.github.com/users/quybeans/gists{/gist_id}","starred_url":"https://api.github.com/users/quybeans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quybeans/subscriptions","organizations_url":"https://api.github.com/users/quybeans/orgs","repos_url":"https://api.github.com/users/quybeans/repos","events_url":"https://api.github.com/users/quybeans/events{/privacy}","received_events_url":"https://api.github.com/users/quybeans/received_events","type":"User","site_admin":false},"repo":{"id":104843222,"name":"winterfell","full_name":"quybeans/winterfell","owner":{"login":"quybeans","id":16681786,"avatar_url":"https://avatars2.githubusercontent.com/u/16681786?v=4","gravatar_id":"","url":"https://api.github.com/users/quybeans","html_url":"https://github.com/quybeans","followers_url":"https://api.github.com/users/quybeans/followers","following_url":"https://api.github.com/users/quybeans/following{/other_user}","gists_url":"https://api.github.com/users/quybeans/gists{/gist_id}","starred_url":"https://api.github.com/users/quybeans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quybeans/subscriptions","organizations_url":"https://api.github.com/users/quybeans/orgs","repos_url":"https://api.github.com/users/quybeans/repos","events_url":"https://api.github.com/users/quybeans/events{/privacy}","received_events_url":"https://api.github.com/users/quybeans/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/quybeans/winterfell","description":null,"fork":false,"url":"https://api.github.com/repos/quybeans/winterfell","forks_url":"https://api.github.com/repos/quybeans/winterfell/forks","keys_url":"https://api.github.com/repos/quybeans/winterfell/keys{/key_id}","collaborators_url":"https://api.github.com/repos/quybeans/winterfell/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/quybeans/winterfell/teams","hooks_url":"https://api.github.com/repos/quybeans/winterfell/hooks","issue_events_url":"https://api.github.com/repos/quybeans/winterfell/issues/events{/number}","events_url":"https://api.github.com/repos/quybeans/winterfell/events","assignees_url":"https://api.github.com/repos/quybeans/winterfell/assignees{/user}","branches_url":"https://api.github.com/repos/quybeans/winterfell/branches{/branch}","tags_url":"https://api.github.com/repos/quybeans/winterfell/tags","blobs_url":"https://api.github.com/repos/quybeans/winterfell/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/quybeans/winterfell/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/quybeans/winterfell/git/refs{/sha}","trees_url":"https://api.github.com/repos/quybeans/winterfell/git/trees{/sha}","statuses_url":"https://api.github.com/repos/quybeans/winterfell/statuses/{sha}","languages_url":"https://api.github.com/repos/quybeans/winterfell/languages","stargazers_url":"https://api.github.com/repos/quybeans/winterfell/stargazers","contributors_url":"https://api.github.com/repos/quybeans/winterfell/contributors","subscribers_url":"https://api.github.com/repos/quybeans/winterfell/subscribers","subscription_url":"https://api.github.com/repos/quybeans/winterfell/subscription","commits_url":"https://api.github.com/repos/quybeans/winterfell/commits{/sha}","git_commits_url":"https://api.github.com/repos/quybeans/winterfell/git/commits{/sha}","comments_url":"https://api.github.com/repos/quybeans/winterfell/comments{/number}","issue_comment_url":"https://api.github.com/repos/quybeans/winterfell/issues/comments{/number}","contents_url":"https://api.github.com/repos/quybeans/winterfell/contents/{+path}","compare_url":"https://api.github.com/repos/quybeans/winterfell/compare/{base}...{head}","merges_url":"https://api.github.com/repos/quybeans/winterfell/merges","archive_url":"https://api.github.com/repos/quybeans/winterfell/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/quybeans/winterfell/downloads","issues_url":"https://api.github.com/repos/quybeans/winterfell/issues{/number}","pulls_url":"https://api.github.com/repos/quybeans/winterfell/pulls{/number}","milestones_url":"https://api.github.com/repos/quybeans/winterfell/milestones{/number}","notifications_url":"https://api.github.com/repos/quybeans/winterfell/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/quybeans/winterfell/labels{/name}","releases_url":"https://api.github.com/repos/quybeans/winterfell/releases{/id}","deployments_url":"https://api.github.com/repos/quybeans/winterfell/deployments","created_at":"2017-09-26T06:10:50Z","updated_at":"2017-09-28T03:29:27Z","pushed_at":"2017-09-29T04:48:01Z","git_url":"git://github.com/quybeans/winterfell.git","ssh_url":"git@github.com:quybeans/winterfell.git","clone_url":"https://github.com/quybeans/winterfell.git","svn_url":"https://github.com/quybeans/winterfell","homepage":null,"size":148,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/quybeans/winterfell/pulls/1"},"html":{"href":"https://github.com/quybeans/winterfell/pull/1"},"issue":{"href":"https://api.github.com/repos/quybeans/winterfell/issues/1"},"comments":{"href":"https://api.github.com/repos/quybeans/winterfell/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/quybeans/winterfell/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/quybeans/winterfell/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/quybeans/winterfell/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/quybeans/winterfell/statuses/b6e882ca00215c406777b99d26f465012307dc08"}},"author_association":"NONE"}}
{"actor":{"display_login":"chequochuu"}}