diff options
author | Hanzei <Hanzei@users.noreply.github.com> | 2018-08-20 18:21:16 +0200 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2018-08-20 09:21:16 -0700 |
commit | 56d92de3f20fa1d89c2d2c09b03e933a1325af8b (patch) | |
tree | 29fb0302e2ec3c694be6219e9e26ee76518b1072 /model/post.go | |
parent | 0aa0adb9113455da719877f2a3553df1e0ee0a97 (diff) | |
download | chat-56d92de3f20fa1d89c2d2c09b03e933a1325af8b.tar.gz chat-56d92de3f20fa1d89c2d2c09b03e933a1325af8b.tar.bz2 chat-56d92de3f20fa1d89c2d2c09b03e933a1325af8b.zip |
Add ToJson() to PostActionIntegrationResponse (#9247)
* Add ToJson() to PostActionIntegrationResponse
This commits adds a ToJson() methode to PostActionIntegrationResponse.
It also adds tests for other ToJson() methods
* Add PostActionIntegrationResponseFromJson function
* Add PostActionIntegrationRequesteFromJson() function
* Fix test names
* Add testcase
Diffstat (limited to 'model/post.go')
-rw-r--r-- | model/post.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/model/post.go b/model/post.go index bec31aea7..635493c9d 100644 --- a/model/post.go +++ b/model/post.go @@ -352,6 +352,29 @@ func (r *PostActionIntegrationRequest) ToJson() string { return string(b) } +func PostActionIntegrationRequesteFromJson(data io.Reader) *PostActionIntegrationRequest { + var o *PostActionIntegrationRequest + err := json.NewDecoder(data).Decode(&o) + if err != nil { + return nil + } + return o +} + +func (r *PostActionIntegrationResponse) ToJson() string { + b, _ := json.Marshal(r) + return string(b) +} + +func PostActionIntegrationResponseFromJson(data io.Reader) *PostActionIntegrationResponse { + var o *PostActionIntegrationResponse + err := json.NewDecoder(data).Decode(&o) + if err != nil { + return nil + } + return o +} + func (o *Post) Attachments() []*SlackAttachment { if attachments, ok := o.Props["attachments"].([]*SlackAttachment); ok { return attachments |