mattermost_rust_client/models/
create_outgoing_webhook_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
12
13
14#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
15pub struct CreateOutgoingWebhookRequest {
16    /// The ID of the team that the webhook watchs
17    #[serde(rename = "team_id")]
18    pub team_id: String,
19    /// The ID of a public channel that the webhook watchs
20    #[serde(rename = "channel_id", skip_serializing_if = "Option::is_none")]
21    pub channel_id: Option<String>,
22    /// The ID of the owner of the webhook if different than the requester. Required in [local mode](https://docs.mattermost.com/administration/mmctl-cli-tool.html#local-mode).
23    #[serde(rename = "creator_id", skip_serializing_if = "Option::is_none")]
24    pub creator_id: Option<String>,
25    /// The description for this outgoing webhook
26    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
27    pub description: Option<String>,
28    /// The display name for this outgoing webhook
29    #[serde(rename = "display_name")]
30    pub display_name: String,
31    /// List of words for the webhook to trigger on
32    #[serde(rename = "trigger_words")]
33    pub trigger_words: Vec<String>,
34    /// When to trigger the webhook, `0` when a trigger word is present at all and `1` if the message starts with a trigger word
35    #[serde(rename = "trigger_when", skip_serializing_if = "Option::is_none")]
36    pub trigger_when: Option<i32>,
37    /// The URLs to POST the payloads to when the webhook is triggered
38    #[serde(rename = "callback_urls")]
39    pub callback_urls: Vec<String>,
40    /// The format to POST the data in, either `application/json` or `application/x-www-form-urlencoded`
41    #[serde(rename = "content_type", skip_serializing_if = "Option::is_none")]
42    pub content_type: Option<String>,
43}
44
45impl CreateOutgoingWebhookRequest {
46    pub fn new(team_id: String, display_name: String, trigger_words: Vec<String>, callback_urls: Vec<String>) -> CreateOutgoingWebhookRequest {
47        CreateOutgoingWebhookRequest {
48            team_id,
49            channel_id: None,
50            creator_id: None,
51            description: None,
52            display_name,
53            trigger_words,
54            trigger_when: None,
55            callback_urls,
56            content_type: None,
57        }
58    }
59}
60
61