mattermost_client/openapi/models/
search_posts_request.rs

1/*
2 * Mattermost API Reference
3 *
4 * There is also a work-in-progress [Postman API reference](https://documenter.getpostman.com/view/4508214/RW8FERUn).
5 *
6 * The version of the OpenAPI document: 4.0.0
7 * Contact: feedback@mattermost.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11#[derive(Clone, Debug, PartialEq, Default, serde::Serialize, serde::Deserialize)]
12pub struct SearchPostsRequest {
13    /// The search terms as inputed by the user. To search for posts from a user include `from:someusername`, using a user's username. To search in a specific channel include `in:somechannel`, using the channel name (not the display name).
14    #[serde(rename = "terms")]
15    pub terms: String,
16    /// Set to true if an Or search should be performed vs an And search.
17    #[serde(rename = "is_or_search")]
18    pub is_or_search: bool,
19    /// Offset from UTC of user timezone for date searches.
20    #[serde(rename = "time_zone_offset", skip_serializing_if = "Option::is_none")]
21    pub time_zone_offset: Option<i32>,
22    /// Set to true if deleted channels should be included in the search. (archived channels)
23    #[serde(
24        rename = "include_deleted_channels",
25        skip_serializing_if = "Option::is_none"
26    )]
27    pub include_deleted_channels: Option<bool>,
28    /// The page to select. (Only works with Elasticsearch)
29    #[serde(rename = "page", skip_serializing_if = "Option::is_none")]
30    pub page: Option<i32>,
31    /// The number of posts per page. (Only works with Elasticsearch)
32    #[serde(rename = "per_page", skip_serializing_if = "Option::is_none")]
33    pub per_page: Option<i32>,
34}
35
36impl SearchPostsRequest {
37    pub fn new(terms: String, is_or_search: bool) -> SearchPostsRequest {
38        SearchPostsRequest {
39            terms,
40            is_or_search,
41            time_zone_offset: None,
42            include_deleted_channels: None,
43            page: None,
44            per_page: None,
45        }
46    }
47}