github.com/vnforks/kid/v5@v5.22.1-0.20200408055009-b89d99c65676/model/suggest_command.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 SuggestCommand struct { 12 Suggestion string `json:"suggestion"` 13 Description string `json:"description"` 14 } 15 16 func (o *SuggestCommand) ToJson() string { 17 b, _ := json.Marshal(o) 18 return string(b) 19 } 20 21 func SuggestCommandFromJson(data io.Reader) *SuggestCommand { 22 var o *SuggestCommand 23 json.NewDecoder(data).Decode(&o) 24 return o 25 }