fkl_parser/mir/implementation/
http_api_impl.rs

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