summaryrefslogtreecommitdiffstats
path: root/plugin/rpcplugin/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/rpcplugin/api.go')
-rw-r--r--plugin/rpcplugin/api.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/plugin/rpcplugin/api.go b/plugin/rpcplugin/api.go
index 76c6e3039..5b5b11a62 100644
--- a/plugin/rpcplugin/api.go
+++ b/plugin/rpcplugin/api.go
@@ -32,6 +32,14 @@ func (api *LocalAPI) LoadPluginConfiguration(args struct{}, reply *[]byte) error
return nil
}
+func (api *LocalAPI) RegisterCommand(args *model.Command, reply *APITeamReply) error {
+ return api.api.RegisterCommand(args)
+}
+
+func (api *LocalAPI) UnregisterCommand(args *APIUnregisterCommandArgs, reply *APITeamReply) error {
+ return api.api.UnregisterCommand(args.TeamId, args.Trigger)
+}
+
type APIErrorReply struct {
Error *model.AppError
}
@@ -344,6 +352,22 @@ func (api *RemoteAPI) LoadPluginConfiguration(dest interface{}) error {
return json.Unmarshal(config, dest)
}
+func (api *RemoteAPI) RegisterCommand(command *model.Command) error {
+ return api.client.Call("LocalAPI.RegisterCommand", command, nil)
+}
+
+type APIUnregisterCommandArgs struct {
+ TeamId string
+ Trigger string
+}
+
+func (api *RemoteAPI) UnregisterCommand(teamId, trigger string) error {
+ return api.client.Call("LocalAPI.UnregisterCommand", &APIUnregisterCommandArgs{
+ TeamId: teamId,
+ Trigger: trigger,
+ }, nil)
+}
+
func (api *RemoteAPI) CreateUser(user *model.User) (*model.User, *model.AppError) {
var reply APIUserReply
if err := api.client.Call("LocalAPI.CreateUser", user, &reply); err != nil {