{"action":"created","comment":{"url":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls/comments/93911543","pull_request_review_id":14443081,"id":93911543,"diff_hunk":"@@ -2,22 +2,45 @@ package models\n \n import (\n \t\"fmt\"\n+\n+\t\"github.com/wantedly/developers-account-mapper/services\"\n )\n \n-// User stores login user name and GitHub username\n+// User stores login user name and accounts information\n type User struct {\n-\tLoginName string\n+\tLoginName      string\n \tGitHubUsername string\n+\tSlackUsername  string\n+\tSlackUserId    string\n }\n \n // NewUser creates new User instance\n-func NewUser(loginName string, githubUsername string) *User {\n+func NewUser(loginName string, githubUsername string, slackUsername string, slackUserId string) *User {\n \treturn &User{\n \t\tLoginName: loginName,\n \t\tGitHubUsername: githubUsername,\n+\t\tSlackUsername: slackUsername,\n+\t\tSlackUserId: slackUserId,\n \t}\n }\n \n+func (u *User) SetSlackUserId(newId string) *User {\n+\tu.SlackUserId = newId\n+\treturn u\n+}\n+\n+func (u *User) RetrieveSlackUserId() (*User, error) {\n+\tnameIdMap, err := services.SlackUserList()\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tu.SetSlackUserId(nameIdMap[u.SlackUsername])\n+\treturn u, nil\n+}\n+\n func (u *User) String() string {\n-\treturn fmt.Sprintf(\"%v:@%v\", u.LoginName, u.GitHubUsername)\n+\tif u.SlackUserId == \"\" {\n+\t\tu.RetrieveSlackUserId()","path":"models/user.go","position":null,"original_position":46,"commit_id":"8c5a955715e2037d23c132e331e39470792312ae","original_commit_id":"ef046330076c860ac5edf491c03a8c3a15078546","user":{"login":"dtan4","id":680124,"avatar_url":"https://avatars.githubusercontent.com/u/680124?v=3","gravatar_id":"","url":"https://api.github.com/users/dtan4","html_url":"https://github.com/dtan4","followers_url":"https://api.github.com/users/dtan4/followers","following_url":"https://api.github.com/users/dtan4/following{/other_user}","gists_url":"https://api.github.com/users/dtan4/gists{/gist_id}","starred_url":"https://api.github.com/users/dtan4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtan4/subscriptions","organizations_url":"https://api.github.com/users/dtan4/orgs","repos_url":"https://api.github.com/users/dtan4/repos","events_url":"https://api.github.com/users/dtan4/events{/privacy}","received_events_url":"https://api.github.com/users/dtan4/received_events","type":"User","site_admin":false},"body":"> Or, do you think we should assign like doing str, err := user.String and handle it?\r\n\r\nYou should do so, or remove calling `RetrieveSlackUserId` in `String()`.","created_at":"2016-12-27T09:21:09Z","updated_at":"2016-12-27T09:21:09Z","html_url":"https://github.com/wantedly/developers-account-mapper/pull/7#discussion_r93911543","pull_request_url":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls/comments/93911543"},"html":{"href":"https://github.com/wantedly/developers-account-mapper/pull/7#discussion_r93911543"},"pull_request":{"href":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls/7","id":98886949,"html_url":"https://github.com/wantedly/developers-account-mapper/pull/7","diff_url":"https://github.com/wantedly/developers-account-mapper/pull/7.diff","patch_url":"https://github.com/wantedly/developers-account-mapper/pull/7.patch","issue_url":"https://api.github.com/repos/wantedly/developers-account-mapper/issues/7","number":7,"state":"closed","locked":false,"title":"Introduce Slack Integration","user":{"login":"potsbo","id":7638553,"avatar_url":"https://avatars.githubusercontent.com/u/7638553?v=3","gravatar_id":"","url":"https://api.github.com/users/potsbo","html_url":"https://github.com/potsbo","followers_url":"https://api.github.com/users/potsbo/followers","following_url":"https://api.github.com/users/potsbo/following{/other_user}","gists_url":"https://api.github.com/users/potsbo/gists{/gist_id}","starred_url":"https://api.github.com/users/potsbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/potsbo/subscriptions","organizations_url":"https://api.github.com/users/potsbo/orgs","repos_url":"https://api.github.com/users/potsbo/repos","events_url":"https://api.github.com/users/potsbo/events{/privacy}","received_events_url":"https://api.github.com/users/potsbo/received_events","type":"User","site_admin":false},"body":"## WHY\r\n\r\nDevelopers need to map their Slack accounts and GitHub ones.\r\n\r\n## WHAT\r\n\r\nAdd Slack account map ability\r\n- [x] Add Slack service to fetch SlackID(not username)\r\n- [x] Store Slack account information DynamoDB\r\n\r\n## TEST\r\n```console\r\npotsbo@Shimpeis-MacBook-Pro-INS-% make && envchain wtd ./bin/developers-account-mapper register potsbo potsbo shimpei\r\ngo build -ldflags=\"-s -w -X \\\"main.Version=0.1.0\\\" -X \\\"main.Revision=ef04633\\\"\" -o bin/developers-account-mapper\r\nuser \"potsbo:@potsbo:<@shimpei:<CONSEALED>>\" added.\r\npotsbo@Shimpeis-MacBook-Pro-INS-% make && envchain wtd ./bin/developers-account-mapper list\r\nmake: `bin/developers-account-mapper' is up to date.\r\npotsbo:@potsbo:<@shimpei:<CONSEALED>>\r\n```\r\n\r\n## NOTE\r\n\r\n- Test is still not implemented, which has to be done\r\n","created_at":"2016-12-21T07:53:30Z","updated_at":"2016-12-27T09:21:09Z","closed_at":"2016-12-27T08:55:30Z","merged_at":"2016-12-27T08:55:30Z","merge_commit_sha":"fc4902900be1cc0cddf2a442278a6fa8b9934a3f","assignee":{"login":"dtan4","id":680124,"avatar_url":"https://avatars.githubusercontent.com/u/680124?v=3","gravatar_id":"","url":"https://api.github.com/users/dtan4","html_url":"https://github.com/dtan4","followers_url":"https://api.github.com/users/dtan4/followers","following_url":"https://api.github.com/users/dtan4/following{/other_user}","gists_url":"https://api.github.com/users/dtan4/gists{/gist_id}","starred_url":"https://api.github.com/users/dtan4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtan4/subscriptions","organizations_url":"https://api.github.com/users/dtan4/orgs","repos_url":"https://api.github.com/users/dtan4/repos","events_url":"https://api.github.com/users/dtan4/events{/privacy}","received_events_url":"https://api.github.com/users/dtan4/received_events","type":"User","site_admin":false},"assignees":[{"login":"dtan4","id":680124,"avatar_url":"https://avatars.githubusercontent.com/u/680124?v=3","gravatar_id":"","url":"https://api.github.com/users/dtan4","html_url":"https://github.com/dtan4","followers_url":"https://api.github.com/users/dtan4/followers","following_url":"https://api.github.com/users/dtan4/following{/other_user}","gists_url":"https://api.github.com/users/dtan4/gists{/gist_id}","starred_url":"https://api.github.com/users/dtan4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtan4/subscriptions","organizations_url":"https://api.github.com/users/dtan4/orgs","repos_url":"https://api.github.com/users/dtan4/repos","events_url":"https://api.github.com/users/dtan4/events{/privacy}","received_events_url":"https://api.github.com/users/dtan4/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls/7/commits","review_comments_url":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls/7/comments","review_comment_url":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wantedly/developers-account-mapper/issues/7/comments","statuses_url":"https://api.github.com/repos/wantedly/developers-account-mapper/statuses/8c5a955715e2037d23c132e331e39470792312ae","head":{"label":"wantedly:potsbo/slack-integration","ref":"potsbo/slack-integration","sha":"8c5a955715e2037d23c132e331e39470792312ae","user":{"login":"wantedly","id":1030053,"avatar_url":"https://avatars.githubusercontent.com/u/1030053?v=3","gravatar_id":"","url":"https://api.github.com/users/wantedly","html_url":"https://github.com/wantedly","followers_url":"https://api.github.com/users/wantedly/followers","following_url":"https://api.github.com/users/wantedly/following{/other_user}","gists_url":"https://api.github.com/users/wantedly/gists{/gist_id}","starred_url":"https://api.github.com/users/wantedly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wantedly/subscriptions","organizations_url":"https://api.github.com/users/wantedly/orgs","repos_url":"https://api.github.com/users/wantedly/repos","events_url":"https://api.github.com/users/wantedly/events{/privacy}","received_events_url":"https://api.github.com/users/wantedly/received_events","type":"Organization","site_admin":false},"repo":{"id":76331334,"name":"developers-account-mapper","full_name":"wantedly/developers-account-mapper","owner":{"login":"wantedly","id":1030053,"avatar_url":"https://avatars.githubusercontent.com/u/1030053?v=3","gravatar_id":"","url":"https://api.github.com/users/wantedly","html_url":"https://github.com/wantedly","followers_url":"https://api.github.com/users/wantedly/followers","following_url":"https://api.github.com/users/wantedly/following{/other_user}","gists_url":"https://api.github.com/users/wantedly/gists{/gist_id}","starred_url":"https://api.github.com/users/wantedly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wantedly/subscriptions","organizations_url":"https://api.github.com/users/wantedly/orgs","repos_url":"https://api.github.com/users/wantedly/repos","events_url":"https://api.github.com/users/wantedly/events{/privacy}","received_events_url":"https://api.github.com/users/wantedly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wantedly/developers-account-mapper","description":"Convert login name or account name to GitHub username.","fork":false,"url":"https://api.github.com/repos/wantedly/developers-account-mapper","forks_url":"https://api.github.com/repos/wantedly/developers-account-mapper/forks","keys_url":"https://api.github.com/repos/wantedly/developers-account-mapper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wantedly/developers-account-mapper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wantedly/developers-account-mapper/teams","hooks_url":"https://api.github.com/repos/wantedly/developers-account-mapper/hooks","issue_events_url":"https://api.github.com/repos/wantedly/developers-account-mapper/issues/events{/number}","events_url":"https://api.github.com/repos/wantedly/developers-account-mapper/events","assignees_url":"https://api.github.com/repos/wantedly/developers-account-mapper/assignees{/user}","branches_url":"https://api.github.com/repos/wantedly/developers-account-mapper/branches{/branch}","tags_url":"https://api.github.com/repos/wantedly/developers-account-mapper/tags","blobs_url":"https://api.github.com/repos/wantedly/developers-account-mapper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wantedly/developers-account-mapper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wantedly/developers-account-mapper/git/refs{/sha}","trees_url":"https://api.github.com/repos/wantedly/developers-account-mapper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wantedly/developers-account-mapper/statuses/{sha}","languages_url":"https://api.github.com/repos/wantedly/developers-account-mapper/languages","stargazers_url":"https://api.github.com/repos/wantedly/developers-account-mapper/stargazers","contributors_url":"https://api.github.com/repos/wantedly/developers-account-mapper/contributors","subscribers_url":"https://api.github.com/repos/wantedly/developers-account-mapper/subscribers","subscription_url":"https://api.github.com/repos/wantedly/developers-account-mapper/subscription","commits_url":"https://api.github.com/repos/wantedly/developers-account-mapper/commits{/sha}","git_commits_url":"https://api.github.com/repos/wantedly/developers-account-mapper/git/commits{/sha}","comments_url":"https://api.github.com/repos/wantedly/developers-account-mapper/comments{/number}","issue_comment_url":"https://api.github.com/repos/wantedly/developers-account-mapper/issues/comments{/number}","contents_url":"https://api.github.com/repos/wantedly/developers-account-mapper/contents/{+path}","compare_url":"https://api.github.com/repos/wantedly/developers-account-mapper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wantedly/developers-account-mapper/merges","archive_url":"https://api.github.com/repos/wantedly/developers-account-mapper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wantedly/developers-account-mapper/downloads","issues_url":"https://api.github.com/repos/wantedly/developers-account-mapper/issues{/number}","pulls_url":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls{/number}","milestones_url":"https://api.github.com/repos/wantedly/developers-account-mapper/milestones{/number}","notifications_url":"https://api.github.com/repos/wantedly/developers-account-mapper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wantedly/developers-account-mapper/labels{/name}","releases_url":"https://api.github.com/repos/wantedly/developers-account-mapper/releases{/id}","deployments_url":"https://api.github.com/repos/wantedly/developers-account-mapper/deployments","created_at":"2016-12-13T06:50:01Z","updated_at":"2016-12-16T00:56:34Z","pushed_at":"2016-12-27T09:19:35Z","git_url":"git://github.com/wantedly/developers-account-mapper.git","ssh_url":"git@github.com:wantedly/developers-account-mapper.git","clone_url":"https://github.com/wantedly/developers-account-mapper.git","svn_url":"https://github.com/wantedly/developers-account-mapper","homepage":null,"size":25,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"wantedly:master","ref":"master","sha":"8bae3dd31c69aec16cdf6a1932b1a17e5667114b","user":{"login":"wantedly","id":1030053,"avatar_url":"https://avatars.githubusercontent.com/u/1030053?v=3","gravatar_id":"","url":"https://api.github.com/users/wantedly","html_url":"https://github.com/wantedly","followers_url":"https://api.github.com/users/wantedly/followers","following_url":"https://api.github.com/users/wantedly/following{/other_user}","gists_url":"https://api.github.com/users/wantedly/gists{/gist_id}","starred_url":"https://api.github.com/users/wantedly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wantedly/subscriptions","organizations_url":"https://api.github.com/users/wantedly/orgs","repos_url":"https://api.github.com/users/wantedly/repos","events_url":"https://api.github.com/users/wantedly/events{/privacy}","received_events_url":"https://api.github.com/users/wantedly/received_events","type":"Organization","site_admin":false},"repo":{"id":76331334,"name":"developers-account-mapper","full_name":"wantedly/developers-account-mapper","owner":{"login":"wantedly","id":1030053,"avatar_url":"https://avatars.githubusercontent.com/u/1030053?v=3","gravatar_id":"","url":"https://api.github.com/users/wantedly","html_url":"https://github.com/wantedly","followers_url":"https://api.github.com/users/wantedly/followers","following_url":"https://api.github.com/users/wantedly/following{/other_user}","gists_url":"https://api.github.com/users/wantedly/gists{/gist_id}","starred_url":"https://api.github.com/users/wantedly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wantedly/subscriptions","organizations_url":"https://api.github.com/users/wantedly/orgs","repos_url":"https://api.github.com/users/wantedly/repos","events_url":"https://api.github.com/users/wantedly/events{/privacy}","received_events_url":"https://api.github.com/users/wantedly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wantedly/developers-account-mapper","description":"Convert login name or account name to GitHub username.","fork":false,"url":"https://api.github.com/repos/wantedly/developers-account-mapper","forks_url":"https://api.github.com/repos/wantedly/developers-account-mapper/forks","keys_url":"https://api.github.com/repos/wantedly/developers-account-mapper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wantedly/developers-account-mapper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wantedly/developers-account-mapper/teams","hooks_url":"https://api.github.com/repos/wantedly/developers-account-mapper/hooks","issue_events_url":"https://api.github.com/repos/wantedly/developers-account-mapper/issues/events{/number}","events_url":"https://api.github.com/repos/wantedly/developers-account-mapper/events","assignees_url":"https://api.github.com/repos/wantedly/developers-account-mapper/assignees{/user}","branches_url":"https://api.github.com/repos/wantedly/developers-account-mapper/branches{/branch}","tags_url":"https://api.github.com/repos/wantedly/developers-account-mapper/tags","blobs_url":"https://api.github.com/repos/wantedly/developers-account-mapper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wantedly/developers-account-mapper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wantedly/developers-account-mapper/git/refs{/sha}","trees_url":"https://api.github.com/repos/wantedly/developers-account-mapper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wantedly/developers-account-mapper/statuses/{sha}","languages_url":"https://api.github.com/repos/wantedly/developers-account-mapper/languages","stargazers_url":"https://api.github.com/repos/wantedly/developers-account-mapper/stargazers","contributors_url":"https://api.github.com/repos/wantedly/developers-account-mapper/contributors","subscribers_url":"https://api.github.com/repos/wantedly/developers-account-mapper/subscribers","subscription_url":"https://api.github.com/repos/wantedly/developers-account-mapper/subscription","commits_url":"https://api.github.com/repos/wantedly/developers-account-mapper/commits{/sha}","git_commits_url":"https://api.github.com/repos/wantedly/developers-account-mapper/git/commits{/sha}","comments_url":"https://api.github.com/repos/wantedly/developers-account-mapper/comments{/number}","issue_comment_url":"https://api.github.com/repos/wantedly/developers-account-mapper/issues/comments{/number}","contents_url":"https://api.github.com/repos/wantedly/developers-account-mapper/contents/{+path}","compare_url":"https://api.github.com/repos/wantedly/developers-account-mapper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wantedly/developers-account-mapper/merges","archive_url":"https://api.github.com/repos/wantedly/developers-account-mapper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wantedly/developers-account-mapper/downloads","issues_url":"https://api.github.com/repos/wantedly/developers-account-mapper/issues{/number}","pulls_url":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls{/number}","milestones_url":"https://api.github.com/repos/wantedly/developers-account-mapper/milestones{/number}","notifications_url":"https://api.github.com/repos/wantedly/developers-account-mapper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wantedly/developers-account-mapper/labels{/name}","releases_url":"https://api.github.com/repos/wantedly/developers-account-mapper/releases{/id}","deployments_url":"https://api.github.com/repos/wantedly/developers-account-mapper/deployments","created_at":"2016-12-13T06:50:01Z","updated_at":"2016-12-16T00:56:34Z","pushed_at":"2016-12-27T09:19:35Z","git_url":"git://github.com/wantedly/developers-account-mapper.git","ssh_url":"git@github.com:wantedly/developers-account-mapper.git","clone_url":"https://github.com/wantedly/developers-account-mapper.git","svn_url":"https://github.com/wantedly/developers-account-mapper","homepage":null,"size":25,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls/7"},"html":{"href":"https://github.com/wantedly/developers-account-mapper/pull/7"},"issue":{"href":"https://api.github.com/repos/wantedly/developers-account-mapper/issues/7"},"comments":{"href":"https://api.github.com/repos/wantedly/developers-account-mapper/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wantedly/developers-account-mapper/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/wantedly/developers-account-mapper/statuses/8c5a955715e2037d23c132e331e39470792312ae"}}}}
{"actor":{"display_login":"dtan4"}}