diff options
author | Chris <ccbrown112@gmail.com> | 2017-12-08 13:55:41 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-08 13:55:41 -0600 |
commit | 4c17bdff1bb871fb31520b7b547f584c53ed854f (patch) | |
tree | edf1e3295d6ff7d67281efc585b2e913b4efda3d /plugin/rpcplugin/api.go | |
parent | 7ed1177a2b676aa4c93515268642c855cfe57a37 (diff) | |
download | chat-4c17bdff1bb871fb31520b7b547f584c53ed854f.tar.gz chat-4c17bdff1bb871fb31520b7b547f584c53ed854f.tar.bz2 chat-4c17bdff1bb871fb31520b7b547f584c53ed854f.zip |
Add plugin slash command support (#7941)
* add plugin slash command support
* remove unused string
* rebase
Diffstat (limited to 'plugin/rpcplugin/api.go')
-rw-r--r-- | plugin/rpcplugin/api.go | 24 |
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 { |