1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use serde::Deserialize;
use serde::Serialize;
use crate::mir::Flow;
use crate::mir::implementation::HttpEndpoint;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)]
pub struct HttpApiImpl {
pub name: String,
pub target_aggregate: String,
pub target_entity: String,
pub qualified: String,
pub endpoint: HttpEndpoint,
pub flow: Option<Flow>,
}
impl HttpApiImpl {
pub fn new(name: String) -> Self {
HttpApiImpl {
name,
..Default::default()
}
}
pub fn target(&self) -> String {
if !self.target_aggregate.is_empty() {
return self.target_aggregate.clone();
}
if !self.target_entity.is_empty() {
return self.target_entity.clone();
}
return "".to_string();
}
}