github.com/gigforks/mattermost-server@v4.9.1-0.20180619094218-800d97fa55d0+incompatible/model/security_bulletin.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 type SecurityBulletin struct { 12 Id string `json:"id"` 13 AppliesToVersion string `json:"applies_to_version"` 14 } 15 16 type SecurityBulletins []SecurityBulletin 17 18 func (me *SecurityBulletin) ToJson() string { 19 b, _ := json.Marshal(me) 20 return string(b) 21 } 22 23 func SecurityBulletinFromJson(data io.Reader) *SecurityBulletin { 24 var o *SecurityBulletin 25 json.NewDecoder(data).Decode(&o) 26 return o 27 } 28 29 func (me SecurityBulletins) ToJson() string { 30 if b, err := json.Marshal(me); err != nil { 31 return "[]" 32 } else { 33 return string(b) 34 } 35 } 36 37 func SecurityBulletinsFromJson(data io.Reader) SecurityBulletins { 38 var o SecurityBulletins 39 json.NewDecoder(data).Decode(&o) 40 return o 41 }