mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-09-16 07:12:31 +00:00
Update vendor (mattermost)
This commit is contained in:
30
vendor/github.com/mattermost/platform/model/command_response.go
generated
vendored
30
vendor/github.com/mattermost/platform/model/command_response.go
generated
vendored
@@ -5,6 +5,7 @@ package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
@@ -14,12 +15,12 @@ const (
|
||||
)
|
||||
|
||||
type CommandResponse struct {
|
||||
ResponseType string `json:"response_type"`
|
||||
Text string `json:"text"`
|
||||
Username string `json:"username"`
|
||||
IconURL string `json:"icon_url"`
|
||||
GotoLocation string `json:"goto_location"`
|
||||
Attachments interface{} `json:"attachments"`
|
||||
ResponseType string `json:"response_type"`
|
||||
Text string `json:"text"`
|
||||
Username string `json:"username"`
|
||||
IconURL string `json:"icon_url"`
|
||||
GotoLocation string `json:"goto_location"`
|
||||
Attachments []*SlackAttachment `json:"attachments"`
|
||||
}
|
||||
|
||||
func (o *CommandResponse) ToJson() string {
|
||||
@@ -34,10 +35,19 @@ func (o *CommandResponse) ToJson() string {
|
||||
func CommandResponseFromJson(data io.Reader) *CommandResponse {
|
||||
decoder := json.NewDecoder(data)
|
||||
var o CommandResponse
|
||||
err := decoder.Decode(&o)
|
||||
if err == nil {
|
||||
return &o
|
||||
} else {
|
||||
|
||||
if err := decoder.Decode(&o); err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Ensure attachment fields are stored as strings
|
||||
for _, attachment := range o.Attachments {
|
||||
for _, field := range attachment.Fields {
|
||||
if field.Value != nil {
|
||||
field.Value = fmt.Sprintf("%v", field.Value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &o
|
||||
}
|
||||
|
Reference in New Issue
Block a user