github.com/mattermosttest/mattermost-server/v5@v5.0.0-20200917143240-9dfa12e121f9/model/plugin_event_data.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See LICENSE.txt for license information. 3 4 package model 5 6 import ( 7 "encoding/json" 8 "io" 9 ) 10 11 // PluginEventData used to notify peers about plugin changes. 12 type PluginEventData struct { 13 Id string `json:"id"` 14 } 15 16 func (p *PluginEventData) ToJson() string { 17 b, _ := json.Marshal(p) 18 return string(b) 19 } 20 21 func PluginEventDataFromJson(data io.Reader) PluginEventData { 22 var m PluginEventData 23 json.NewDecoder(data).Decode(&m) 24 return m 25 }