Skip to main content

nominal_api/conjure/objects/timeseries/logicalseries/api/
visual_crossing_locator.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct VisualCrossingLocator {
16    #[serde(rename = "location")]
17    location: super::LocationName,
18    #[builder(default, into)]
19    #[serde(rename = "endpoint", skip_serializing_if = "Option::is_none", default)]
20    endpoint: Option<super::VisualCrossingEndpointUri>,
21    #[serde(rename = "field")]
22    field: super::FieldName,
23    #[serde(rename = "type")]
24    type_: super::VisualCrossingType,
25}
26impl VisualCrossingLocator {
27    /// Constructs a new instance of the type.
28    #[inline]
29    pub fn new(
30        location: super::LocationName,
31        field: super::FieldName,
32        type_: super::VisualCrossingType,
33    ) -> Self {
34        Self::builder().location(location).field(field).type_(type_).build()
35    }
36    /// Location to fetch data from.  Can be any arbitrary string (i.e. name, abbreviation,
37    /// zip code, lat/long, etc.) as remote endpoint performs location resolution.
38    #[inline]
39    pub fn location(&self) -> &super::LocationName {
40        &self.location
41    }
42    /// Defaults to HISTORY.  Endpoint to fetch data from for this series.
43    #[inline]
44    pub fn endpoint(&self) -> Option<&super::VisualCrossingEndpointUri> {
45        self.endpoint.as_ref().map(|o| &*o)
46    }
47    #[inline]
48    pub fn field(&self) -> &super::FieldName {
49        &self.field
50    }
51    #[inline]
52    pub fn type_(&self) -> &super::VisualCrossingType {
53        &self.type_
54    }
55}