summaryrefslogtreecommitdiffstats
path: root/plugin/api.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-11-27 17:23:35 -0500
committerGitHub <noreply@github.com>2017-11-27 17:23:35 -0500
commit6176bcff6977bda71f4fde10a52dde6d7d7ceb9a (patch)
treeb4a4a22879f4b88ffc4fb59f46ca69d441569ddd /plugin/api.go
parente85ec3830164ffdfbe8fd5696ab99446b38a01ef (diff)
downloadchat-6176bcff6977bda71f4fde10a52dde6d7d7ceb9a.tar.gz
chat-6176bcff6977bda71f4fde10a52dde6d7d7ceb9a.tar.bz2
chat-6176bcff6977bda71f4fde10a52dde6d7d7ceb9a.zip
PLT-8131 (part2) Add plugin key value store support (#7902)
* Add plugin key value store support * Add localization strings * Updates per feedback
Diffstat (limited to 'plugin/api.go')
-rw-r--r--plugin/api.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/plugin/api.go b/plugin/api.go
index 8d27bc794..4bcfd112b 100644
--- a/plugin/api.go
+++ b/plugin/api.go
@@ -79,6 +79,20 @@ type API interface {
// GetPost gets a post.
GetPost(postId string) (*model.Post, *model.AppError)
- // Update post updates a post.
+ // 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
+
+ // Get will retrieve a value based on the key. Returns nil for non-existent keys.
+ Get(key string) ([]byte, *model.AppError)
+
+ // Delete will remove a key-value pair. Returns nil for non-existent keys.
+ Delete(key string) *model.AppError
}