swf_builders/services/task/
common.rs1use super::*;
2
3pub struct InputDataModelDefinitionBuilder {
6 input: InputDataModelDefinition,
7}
8
9impl InputDataModelDefinitionBuilder {
10 pub fn new() -> Self {
11 Self {
12 input: InputDataModelDefinition::default(),
13 }
14 }
15
16 pub fn from(&mut self, value: Value) -> &mut Self {
18 self.input.from = Some(value);
19 self
20 }
21
22 pub fn build(self) -> InputDataModelDefinition {
24 self.input
25 }
26}
27
28impl Default for InputDataModelDefinitionBuilder {
29 fn default() -> Self {
30 Self::new()
31 }
32}
33
34pub struct OutputDataModelDefinitionBuilder {
37 output: OutputDataModelDefinition,
38}
39
40impl OutputDataModelDefinitionBuilder {
41 pub fn new() -> Self {
42 Self {
43 output: OutputDataModelDefinition::default(),
44 }
45 }
46
47 pub fn r#as(&mut self, value: Value) -> &mut Self {
49 self.output.as_ = Some(value);
50 self
51 }
52
53 pub fn build(self) -> OutputDataModelDefinition {
55 self.output
56 }
57}
58
59impl Default for OutputDataModelDefinitionBuilder {
60 fn default() -> Self {
61 Self::new()
62 }
63}
64
65pub struct EventDefinitionBuilder {
68 event: EventDefinition,
69}
70
71impl EventDefinitionBuilder {
72 pub fn new() -> Self {
73 Self {
74 event: EventDefinition::default(),
75 }
76 }
77
78 pub fn with(&mut self, name: &str, value: Value) -> &mut Self {
80 self.event.with.insert(name.to_string(), value);
81 self
82 }
83
84 pub fn with_attributes(&mut self, attrs: HashMap<String, Value>) -> &mut Self {
86 self.event.with = attrs;
87 self
88 }
89
90 pub fn build(self) -> EventDefinition {
92 self.event
93 }
94}
95
96impl Default for EventDefinitionBuilder {
97 fn default() -> Self {
98 Self::new()
99 }
100}