github.com/cryptomisa/mattermost-server@v5.11.1+incompatible/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  }