Skip to main content

nominal_api/conjure/clients/scout/
units_service.rs

1use conjure_http::endpoint;
2/// The Units Service serves as a comprehensive catalog of the units of measurement supported by scout. Units, by
3/// default, follow the UCUM convention for representation.
4#[conjure_http::conjure_client(name = "UnitsService")]
5pub trait UnitsService<
6    #[response_body]
7    I: Iterator<
8            Item = Result<conjure_http::private::Bytes, conjure_http::private::Error>,
9        >,
10> {
11    /// Returns all known units, grouped by the physical property they measure.
12    #[endpoint(
13        method = GET,
14        path = "/units/v1/units",
15        name = "getAllUnits",
16        accept = conjure_http::client::StdResponseDeserializer
17    )]
18    fn get_all_units(
19        &self,
20        #[auth]
21        auth_: &conjure_object::BearerToken,
22    ) -> Result<
23        super::super::super::objects::scout::units::api::GetUnitsResponse,
24        conjure_http::private::Error,
25    >;
26    /// Returns information for a unit symbol if available. Returns as empty if the provided symbol cannot be parsed.
27    #[endpoint(
28        method = POST,
29        path = "/units/v1/units/get-unit",
30        name = "getUnit",
31        accept = conjure_http::client::conjure::CollectionResponseDeserializer
32    )]
33    fn get_unit(
34        &self,
35        #[auth]
36        auth_: &conjure_object::BearerToken,
37        #[body(serializer = conjure_http::client::StdRequestSerializer)]
38        unit: &super::super::super::objects::scout::units::api::UnitSymbol,
39    ) -> Result<
40        Option<super::super::super::objects::scout::units::api::Unit>,
41        conjure_http::private::Error,
42    >;
43    /// Returns information for the unit symbols if available. If the provided symbol cannot be parsed, it will be
44    /// omitted from the map.
45    #[endpoint(
46        method = POST,
47        path = "/units/v1/units/get-batch-units",
48        name = "getBatchUnits",
49        accept = conjure_http::client::conjure::CollectionResponseDeserializer
50    )]
51    fn get_batch_units(
52        &self,
53        #[auth]
54        auth_: &conjure_object::BearerToken,
55        #[body(serializer = conjure_http::client::StdRequestSerializer)]
56        units: &std::collections::BTreeSet<
57            super::super::super::objects::scout::units::api::UnitSymbol,
58        >,
59    ) -> Result<
60        std::collections::BTreeMap<
61            super::super::super::objects::scout::units::api::UnitSymbol,
62            super::super::super::objects::scout::units::api::Unit,
63        >,
64        conjure_http::private::Error,
65    >;
66    /// Returns the set of cataloged units that can be converted to and from the given unit.
67    /// No commensurable units does not imply the unit is invalid. Use /get-unit to check for validity.
68    #[endpoint(
69        method = POST,
70        path = "/units/v1/units/commensurable-units",
71        name = "getCommensurableUnits",
72        accept = conjure_http::client::conjure::CollectionResponseDeserializer
73    )]
74    fn get_commensurable_units(
75        &self,
76        #[auth]
77        auth_: &conjure_object::BearerToken,
78        #[body(serializer = conjure_http::client::StdRequestSerializer)]
79        unit: &super::super::super::objects::scout::units::api::UnitSymbol,
80    ) -> Result<
81        std::collections::BTreeSet<
82            super::super::super::objects::scout::units::api::Unit,
83        >,
84        conjure_http::private::Error,
85    >;
86}
87/// The Units Service serves as a comprehensive catalog of the units of measurement supported by scout. Units, by
88/// default, follow the UCUM convention for representation.
89#[conjure_http::conjure_client(name = "UnitsService")]
90pub trait AsyncUnitsService<
91    #[response_body]
92    I: conjure_http::private::Stream<
93            Item = Result<conjure_http::private::Bytes, conjure_http::private::Error>,
94        >,
95> {
96    /// Returns all known units, grouped by the physical property they measure.
97    #[endpoint(
98        method = GET,
99        path = "/units/v1/units",
100        name = "getAllUnits",
101        accept = conjure_http::client::StdResponseDeserializer
102    )]
103    async fn get_all_units(
104        &self,
105        #[auth]
106        auth_: &conjure_object::BearerToken,
107    ) -> Result<
108        super::super::super::objects::scout::units::api::GetUnitsResponse,
109        conjure_http::private::Error,
110    >;
111    /// Returns information for a unit symbol if available. Returns as empty if the provided symbol cannot be parsed.
112    #[endpoint(
113        method = POST,
114        path = "/units/v1/units/get-unit",
115        name = "getUnit",
116        accept = conjure_http::client::conjure::CollectionResponseDeserializer
117    )]
118    async fn get_unit(
119        &self,
120        #[auth]
121        auth_: &conjure_object::BearerToken,
122        #[body(serializer = conjure_http::client::StdRequestSerializer)]
123        unit: &super::super::super::objects::scout::units::api::UnitSymbol,
124    ) -> Result<
125        Option<super::super::super::objects::scout::units::api::Unit>,
126        conjure_http::private::Error,
127    >;
128    /// Returns information for the unit symbols if available. If the provided symbol cannot be parsed, it will be
129    /// omitted from the map.
130    #[endpoint(
131        method = POST,
132        path = "/units/v1/units/get-batch-units",
133        name = "getBatchUnits",
134        accept = conjure_http::client::conjure::CollectionResponseDeserializer
135    )]
136    async fn get_batch_units(
137        &self,
138        #[auth]
139        auth_: &conjure_object::BearerToken,
140        #[body(serializer = conjure_http::client::StdRequestSerializer)]
141        units: &std::collections::BTreeSet<
142            super::super::super::objects::scout::units::api::UnitSymbol,
143        >,
144    ) -> Result<
145        std::collections::BTreeMap<
146            super::super::super::objects::scout::units::api::UnitSymbol,
147            super::super::super::objects::scout::units::api::Unit,
148        >,
149        conjure_http::private::Error,
150    >;
151    /// Returns the set of cataloged units that can be converted to and from the given unit.
152    /// No commensurable units does not imply the unit is invalid. Use /get-unit to check for validity.
153    #[endpoint(
154        method = POST,
155        path = "/units/v1/units/commensurable-units",
156        name = "getCommensurableUnits",
157        accept = conjure_http::client::conjure::CollectionResponseDeserializer
158    )]
159    async fn get_commensurable_units(
160        &self,
161        #[auth]
162        auth_: &conjure_object::BearerToken,
163        #[body(serializer = conjure_http::client::StdRequestSerializer)]
164        unit: &super::super::super::objects::scout::units::api::UnitSymbol,
165    ) -> Result<
166        std::collections::BTreeSet<
167            super::super::super::objects::scout::units::api::Unit,
168        >,
169        conjure_http::private::Error,
170    >;
171}
172/// The Units Service serves as a comprehensive catalog of the units of measurement supported by scout. Units, by
173/// default, follow the UCUM convention for representation.
174#[conjure_http::conjure_client(name = "UnitsService", local)]
175pub trait LocalAsyncUnitsService<
176    #[response_body]
177    I: conjure_http::private::Stream<
178            Item = Result<conjure_http::private::Bytes, conjure_http::private::Error>,
179        >,
180> {
181    /// Returns all known units, grouped by the physical property they measure.
182    #[endpoint(
183        method = GET,
184        path = "/units/v1/units",
185        name = "getAllUnits",
186        accept = conjure_http::client::StdResponseDeserializer
187    )]
188    async fn get_all_units(
189        &self,
190        #[auth]
191        auth_: &conjure_object::BearerToken,
192    ) -> Result<
193        super::super::super::objects::scout::units::api::GetUnitsResponse,
194        conjure_http::private::Error,
195    >;
196    /// Returns information for a unit symbol if available. Returns as empty if the provided symbol cannot be parsed.
197    #[endpoint(
198        method = POST,
199        path = "/units/v1/units/get-unit",
200        name = "getUnit",
201        accept = conjure_http::client::conjure::CollectionResponseDeserializer
202    )]
203    async fn get_unit(
204        &self,
205        #[auth]
206        auth_: &conjure_object::BearerToken,
207        #[body(serializer = conjure_http::client::StdRequestSerializer)]
208        unit: &super::super::super::objects::scout::units::api::UnitSymbol,
209    ) -> Result<
210        Option<super::super::super::objects::scout::units::api::Unit>,
211        conjure_http::private::Error,
212    >;
213    /// Returns information for the unit symbols if available. If the provided symbol cannot be parsed, it will be
214    /// omitted from the map.
215    #[endpoint(
216        method = POST,
217        path = "/units/v1/units/get-batch-units",
218        name = "getBatchUnits",
219        accept = conjure_http::client::conjure::CollectionResponseDeserializer
220    )]
221    async fn get_batch_units(
222        &self,
223        #[auth]
224        auth_: &conjure_object::BearerToken,
225        #[body(serializer = conjure_http::client::StdRequestSerializer)]
226        units: &std::collections::BTreeSet<
227            super::super::super::objects::scout::units::api::UnitSymbol,
228        >,
229    ) -> Result<
230        std::collections::BTreeMap<
231            super::super::super::objects::scout::units::api::UnitSymbol,
232            super::super::super::objects::scout::units::api::Unit,
233        >,
234        conjure_http::private::Error,
235    >;
236    /// Returns the set of cataloged units that can be converted to and from the given unit.
237    /// No commensurable units does not imply the unit is invalid. Use /get-unit to check for validity.
238    #[endpoint(
239        method = POST,
240        path = "/units/v1/units/commensurable-units",
241        name = "getCommensurableUnits",
242        accept = conjure_http::client::conjure::CollectionResponseDeserializer
243    )]
244    async fn get_commensurable_units(
245        &self,
246        #[auth]
247        auth_: &conjure_object::BearerToken,
248        #[body(serializer = conjure_http::client::StdRequestSerializer)]
249        unit: &super::super::super::objects::scout::units::api::UnitSymbol,
250    ) -> Result<
251        std::collections::BTreeSet<
252            super::super::super::objects::scout::units::api::Unit,
253        >,
254        conjure_http::private::Error,
255    >;
256}