diff options
Diffstat (limited to 'plugin/api.go')
-rw-r--r-- | plugin/api.go | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/plugin/api.go b/plugin/api.go index d62c2f069..842cef4f6 100644 --- a/plugin/api.go +++ b/plugin/api.go @@ -4,6 +4,7 @@ package plugin import ( + "github.com/hashicorp/go-plugin" "github.com/mattermost/mattermost-server/model" ) @@ -104,17 +105,24 @@ type API interface { // UpdatePost updates a post. UpdatePost(post *model.Post) (*model.Post, *model.AppError) - // KeyValueStore returns an object for accessing the persistent key value storage. - KeyValueStore() KeyValueStore -} - -type KeyValueStore interface { // Set will store a key-value pair, unique per plugin. - Set(key string, value []byte) *model.AppError + KVSet(key string, value []byte) *model.AppError // Get will retrieve a value based on the key. Returns nil for non-existent keys. - Get(key string) ([]byte, *model.AppError) + KVGet(key string) ([]byte, *model.AppError) // Delete will remove a key-value pair. Returns nil for non-existent keys. - Delete(key string) *model.AppError + KVDelete(key string) *model.AppError + + // PublishWebSocketEvent sends an event to WebSocket connections. + // event is the type and will be prepended with "custom_<pluginid>_" + // payload is the data sent with the event. Interface values must be primitive Go types or mattermost-server/model types + // broadcast determines to which users to send the event + PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast) +} + +var Handshake = plugin.HandshakeConfig{ + ProtocolVersion: 1, + MagicCookieKey: "MATTERMOST_PLUGIN", + MagicCookieValue: "Securely message teams, anywhere.", } |