Skip to main content

nominal_api/conjure/objects/scout/integrations/api/
slack_webhook_integration.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct SlackWebhookIntegration {
16    #[builder(into)]
17    #[serde(rename = "teamName")]
18    team_name: String,
19    #[builder(into)]
20    #[serde(rename = "channel")]
21    channel: String,
22    #[builder(into)]
23    #[serde(rename = "channelId")]
24    channel_id: String,
25    #[builder(default, into)]
26    #[serde(rename = "slackInstance", skip_serializing_if = "Option::is_none", default)]
27    slack_instance: Option<super::SlackInstanceType>,
28}
29impl SlackWebhookIntegration {
30    /// Constructs a new instance of the type.
31    #[inline]
32    pub fn new(
33        team_name: impl Into<String>,
34        channel: impl Into<String>,
35        channel_id: impl Into<String>,
36    ) -> Self {
37        Self::builder()
38            .team_name(team_name)
39            .channel(channel)
40            .channel_id(channel_id)
41            .build()
42    }
43    #[inline]
44    pub fn team_name(&self) -> &str {
45        &*self.team_name
46    }
47    #[inline]
48    pub fn channel(&self) -> &str {
49        &*self.channel
50    }
51    #[inline]
52    pub fn channel_id(&self) -> &str {
53        &*self.channel_id
54    }
55    #[inline]
56    pub fn slack_instance(&self) -> Option<&super::SlackInstanceType> {
57        self.slack_instance.as_ref().map(|o| &*o)
58    }
59}