diff --git a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/chat/ChatService.java b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/chat/ChatService.java index 9206f382..6e0f43c3 100644 --- a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/chat/ChatService.java +++ b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/chat/ChatService.java @@ -1,6 +1,8 @@ package i5.las2peer.services.socialBotManagerService.chat; import com.fasterxml.jackson.annotation.JsonProperty; +import i5.las2peer.services.socialBotManagerService.chat.github.GitHubIssueMediator; +import i5.las2peer.services.socialBotManagerService.chat.github.GitHubPRMediator; /** * This enum lists all available messenger services. The string value has to @@ -23,6 +25,12 @@ public enum ChatService { @JsonProperty("Moodle Forum") MOODLE_FORUM("Moodle Forum", MoodleForumMediator.class), + @JsonProperty("GitHub Issues") + GITHUB_ISSUES("GitHub Issues", GitHubIssueMediator.class), + + @JsonProperty("GitHub Pull Requests") + GITHUB_PR("GitHub Pull Requests", GitHubPRMediator.class), + UNKNOWN("", null); /** diff --git a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/model/Messenger.java b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/model/Messenger.java index e36163a2..4d904fdf 100644 --- a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/model/Messenger.java +++ b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/model/Messenger.java @@ -18,7 +18,9 @@ import javax.websocket.DeploymentException; import i5.las2peer.services.socialBotManagerService.chat.*; -import i5.las2peer.services.socialBotManagerService.chat.xAPI.ChatStatement; +import i5.las2peer.services.socialBotManagerService.chat.github.GitHubAppHelper; +import i5.las2peer.services.socialBotManagerService.chat.github.GitHubIssueMediator; +import i5.las2peer.services.socialBotManagerService.chat.github.GitHubPRMediator; import i5.las2peer.services.socialBotManagerService.database.SQLDatabase; import i5.las2peer.services.socialBotManagerService.nlu.Entity; import i5.las2peer.services.socialBotManagerService.nlu.Intent; @@ -86,6 +88,20 @@ public Messenger(String id, String chatService, String token, SQLDatabase databa case MOODLE_FORUM: this.chatMediator = new MoodleForumMediator(token); break; + case GITHUB_ISSUES: + try { + this.chatMediator = new GitHubIssueMediator(token); + } catch (GitHubAppHelper.GitHubAppHelperException e) { + throw new AuthTokenException(e.getMessage()); + } + break; + case GITHUB_PR: + try { + this.chatMediator = new GitHubPRMediator(token); + } catch (GitHubAppHelper.GitHubAppHelperException e) { + throw new AuthTokenException(e.getMessage()); + } + break; default: throw new ParseBotException("Unimplemented chat service: " + chatService); }