diff options
Diffstat (limited to 'model/post.go')
-rw-r--r-- | model/post.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/model/post.go b/model/post.go index 82cc0a0e9..d903156eb 100644 --- a/model/post.go +++ b/model/post.go @@ -96,6 +96,12 @@ type PostPatch struct { HasReactions *bool `json:"has_reactions"` } +type SearchParameter struct { + Terms *string `json:"terms"` + IsOrSearch *bool `json:"is_or_search"` + TimeZoneOffset *int `json:"time_zone_offset"` +} + func (o *PostPatch) WithRewrittenImageURLs(f func(string) string) *PostPatch { copy := *o if copy.Message != nil { @@ -359,6 +365,26 @@ func PostPatchFromJson(data io.Reader) *PostPatch { return &post } +func (o *SearchParameter) SearchParameterToJson() string { + b, err := json.Marshal(o) + if err != nil { + return "" + } + + return string(b) +} + +func SearchParameterFromJson(data io.Reader) *SearchParameter { + decoder := json.NewDecoder(data) + var searchParam SearchParameter + err := decoder.Decode(&searchParam) + if err != nil { + return nil + } + + return &searchParam +} + func (o *Post) ChannelMentions() []string { return ChannelMentions(o.Message) } |