github.com/mattermosttest/mattermost-server/v5@v5.0.0-20200917143240-9dfa12e121f9/model/channel_search.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 const CHANNEL_SEARCH_DEFAULT_LIMIT = 50 12 13 type ChannelSearch struct { 14 Term string `json:"term"` 15 ExcludeDefaultChannels bool `json:"exclude_default_channels"` 16 NotAssociatedToGroup string `json:"not_associated_to_group"` 17 TeamIds []string `json:"team_ids"` 18 GroupConstrained bool `json:"group_constrained"` 19 ExcludeGroupConstrained bool `json:"exclude_group_constrained"` 20 Public bool `json:"public"` 21 Private bool `json:"private"` 22 IncludeDeleted bool `json:"include_deleted"` 23 Deleted bool `json:"deleted"` 24 Page *int `json:"page,omitempty"` 25 PerPage *int `json:"per_page,omitempty"` 26 } 27 28 // ToJson convert a Channel to a json string 29 func (c *ChannelSearch) ToJson() string { 30 b, _ := json.Marshal(c) 31 return string(b) 32 } 33 34 // ChannelSearchFromJson will decode the input and return a Channel 35 func ChannelSearchFromJson(data io.Reader) *ChannelSearch { 36 var cs *ChannelSearch 37 json.NewDecoder(data).Decode(&cs) 38 return cs 39 }