summaryrefslogtreecommitdiffstats
path: root/app/plugin/api.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-08-02 01:36:54 -0700
committerGitHub <noreply@github.com>2017-08-02 01:36:54 -0700
commit65817e13c7900ea81947e40e177459cfea8acee4 (patch)
tree8dfc88db36844e4186b4110753be8de976da6371 /app/plugin/api.go
parentc6bf235ec2a8613d8ef35607e2aeb8c0cb629f45 (diff)
downloadchat-65817e13c7900ea81947e40e177459cfea8acee4.tar.gz
chat-65817e13c7900ea81947e40e177459cfea8acee4.tar.bz2
chat-65817e13c7900ea81947e40e177459cfea8acee4.zip
PLT-6965 jira integration (plus plugin scaffolding) (#6918)
* plugin scaffolding / jira integration * add vendored testify packages * webhook fix * don't change i18n ids * support configuration watching * add basic jira plugin configuration to admin console * fix eslint errors * fix another eslint warning * polish * undo unintentional config.json commit >:( * test fix * add jira plugin diagnostics, remove dm support, add bot tag, generate web-safe secrets * rebase, implement requested changes * requested changes * remove tests and minimize makefile change * add missing license headers * add missing comma * remove bad line from Makefile
Diffstat (limited to 'app/plugin/api.go')
-rw-r--r--app/plugin/api.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/app/plugin/api.go b/app/plugin/api.go
new file mode 100644
index 000000000..ceea51969
--- /dev/null
+++ b/app/plugin/api.go
@@ -0,0 +1,37 @@
+// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package plugin
+
+import (
+ "net/http"
+
+ "github.com/gorilla/mux"
+ "github.com/mattermost/platform/model"
+)
+
+type API interface {
+ // Loads the plugin's configuration
+ LoadPluginConfiguration(dest interface{}) error
+
+ // The plugin's router
+ PluginRouter() *mux.Router
+
+ // Gets a team by its name
+ GetTeamByName(name string) (*model.Team, *model.AppError)
+
+ // Gets a user by its name
+ GetUserByName(name string) (*model.User, *model.AppError)
+
+ // Gets a channel by its name
+ GetChannelByName(teamId, name string) (*model.Channel, *model.AppError)
+
+ // Gets a direct message channel
+ GetDirectChannel(userId1, userId2 string) (*model.Channel, *model.AppError)
+
+ // Creates a post
+ CreatePost(post *model.Post, teamId string) (*model.Post, *model.AppError)
+
+ // Returns a localized string. If a request is given, its headers will be used to pick a locale.
+ I18n(id string, r *http.Request) string
+}