abs_data/builders/
dataflow_identifier_builder.rs

1use crate::models::typed::dataflow_identifier::DataflowIdentifier;
2use crate::models::typed::version::Version;
3
4pub struct DataflowIdentifierBuilder {
5    agency_id: Option<Box<str>>,
6    structure_id: Box<str>,
7    version: Option<Version>,
8}
9
10impl DataflowIdentifierBuilder {
11    pub fn new(structure_id: &str) -> Self {
12        DataflowIdentifierBuilder {
13            agency_id: None,
14            structure_id: structure_id.into(),
15            version: None,
16        }
17    }
18
19    pub fn agency_id(mut self, agency_id: &str) -> Self {
20        self.agency_id = Some(agency_id.into());
21        self
22    }
23
24    pub fn version(mut self, version: &Version) -> Self {
25        self.version = Some(version.clone());
26        self
27    }
28
29    pub fn build(self) -> DataflowIdentifier {
30        DataflowIdentifier::new(self.agency_id, self.structure_id, self.version)
31    }
32}