nominal_api/conjure/objects/scout/webhook/template/api/
test_webhook_request.rs1#[derive(
3 Debug,
4 Clone,
5 conjure_object::serde::Serialize,
6 conjure_object::serde::Deserialize,
7 PartialEq,
8 Eq,
9 PartialOrd,
10 Ord,
11 Hash
12)]
13#[serde(crate = "conjure_object::serde")]
14#[conjure_object::private::staged_builder::staged_builder]
15#[builder(crate = conjure_object::private::staged_builder, update, inline)]
16pub struct TestWebhookRequest {
17 #[serde(rename = "integrationRid")]
18 integration_rid: super::super::super::super::integrations::api::IntegrationRid,
19 #[builder(into)]
20 #[serde(rename = "template")]
21 template: String,
22 #[builder(
23 default,
24 map(
25 key(type = String, into),
26 value(
27 custom(
28 type = impl
29 conjure_object::serde::Serialize,
30 convert = |v|conjure_object::Any::new(
31 v
32 ).expect("value failed to serialize")
33 )
34 )
35 )
36 )]
37 #[serde(
38 rename = "sampleContext",
39 skip_serializing_if = "std::collections::BTreeMap::is_empty",
40 default
41 )]
42 sample_context: std::collections::BTreeMap<String, conjure_object::Any>,
43 #[builder(default, into)]
44 #[serde(rename = "eventType", skip_serializing_if = "Option::is_none", default)]
45 event_type: Option<String>,
46}
47impl TestWebhookRequest {
48 #[inline]
50 pub fn new(
51 integration_rid: super::super::super::super::integrations::api::IntegrationRid,
52 template: impl Into<String>,
53 ) -> Self {
54 Self::builder().integration_rid(integration_rid).template(template).build()
55 }
56 #[inline]
58 pub fn integration_rid(
59 &self,
60 ) -> &super::super::super::super::integrations::api::IntegrationRid {
61 &self.integration_rid
62 }
63 #[inline]
65 pub fn template(&self) -> &str {
66 &*self.template
67 }
68 #[inline]
70 pub fn sample_context(
71 &self,
72 ) -> &std::collections::BTreeMap<String, conjure_object::Any> {
73 &self.sample_context
74 }
75 #[inline]
77 pub fn event_type(&self) -> Option<&str> {
78 self.event_type.as_ref().map(|o| &**o)
79 }
80}