1#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct GetAllUnitsResponse {
4 #[prost(map = "string, message", tag = "1")]
5 pub units_by_property: ::std::collections::HashMap<
6 ::prost::alloc::string::String,
7 get_all_units_response::GetUnitsResponseUnitsByPropertyWrapper,
8 >,
9}
10pub mod get_all_units_response {
12 #[derive(Clone, PartialEq, ::prost::Message)]
13 pub struct GetUnitsResponseUnitsByPropertyWrapper {
14 #[prost(message, repeated, tag = "1")]
15 pub value: ::prost::alloc::vec::Vec<super::Unit>,
16 }
17}
18#[derive(Clone, PartialEq, ::prost::Message)]
19pub struct Unit {
20 #[prost(string, optional, tag = "1")]
21 pub name: ::core::option::Option<::prost::alloc::string::String>,
22 #[prost(string, tag = "2")]
23 pub symbol: ::prost::alloc::string::String,
24 #[prost(string, optional, tag = "3")]
27 pub property: ::core::option::Option<::prost::alloc::string::String>,
28 #[prost(message, optional, tag = "4")]
31 pub dimension: ::core::option::Option<UnitDimension>,
32 #[prost(string, tag = "5")]
33 pub system: ::prost::alloc::string::String,
34}
35#[derive(Clone, PartialEq, ::prost::Message)]
37pub struct UnitDimension {
38 #[prost(map = "string, int32", tag = "1")]
39 pub base_dimensions: ::std::collections::HashMap<
40 ::prost::alloc::string::String,
41 i32,
42 >,
43}
44#[derive(Clone, Copy, PartialEq, ::prost::Message)]
45pub struct GetAllUnitsRequest {}
46#[derive(Clone, PartialEq, ::prost::Message)]
47pub struct GetUnitRequest {
48 #[prost(string, tag = "1")]
49 pub unit: ::prost::alloc::string::String,
50}
51#[derive(Clone, PartialEq, ::prost::Message)]
52pub struct GetUnitResponse {
53 #[prost(message, optional, tag = "1")]
54 pub unit: ::core::option::Option<Unit>,
55}
56#[derive(Clone, PartialEq, ::prost::Message)]
57pub struct GetBatchUnitsRequest {
58 #[prost(string, repeated, tag = "1")]
59 pub units: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
60}
61#[derive(Clone, PartialEq, ::prost::Message)]
62pub struct GetBatchUnitsResponse {
63 #[prost(map = "string, message", tag = "1")]
64 pub responses: ::std::collections::HashMap<::prost::alloc::string::String, Unit>,
65}
66#[derive(Clone, PartialEq, ::prost::Message)]
67pub struct GetCommensurableUnitsRequest {
68 #[prost(string, tag = "1")]
69 pub unit: ::prost::alloc::string::String,
70}
71#[derive(Clone, PartialEq, ::prost::Message)]
72pub struct GetCommensurableUnitsResponse {
73 #[prost(message, repeated, tag = "1")]
74 pub units: ::prost::alloc::vec::Vec<Unit>,
75}
76#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
78#[repr(i32)]
79pub enum ScoutError {
80 CannotDeserializeSearchToken = 0,
81 InvalidRange = 1,
83 RequestedPageSizeTooLarge = 2,
84}
85impl ScoutError {
86 pub fn as_str_name(&self) -> &'static str {
91 match self {
92 Self::CannotDeserializeSearchToken => {
93 "SCOUT_ERROR_CANNOT_DESERIALIZE_SEARCH_TOKEN"
94 }
95 Self::InvalidRange => "SCOUT_ERROR_INVALID_RANGE",
96 Self::RequestedPageSizeTooLarge => {
97 "SCOUT_ERROR_REQUESTED_PAGE_SIZE_TOO_LARGE"
98 }
99 }
100 }
101 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
103 match value {
104 "SCOUT_ERROR_CANNOT_DESERIALIZE_SEARCH_TOKEN" => {
105 Some(Self::CannotDeserializeSearchToken)
106 }
107 "SCOUT_ERROR_INVALID_RANGE" => Some(Self::InvalidRange),
108 "SCOUT_ERROR_REQUESTED_PAGE_SIZE_TOO_LARGE" => {
109 Some(Self::RequestedPageSizeTooLarge)
110 }
111 _ => None,
112 }
113 }
114}
115pub mod units_service_client {
117 #![allow(
118 unused_variables,
119 dead_code,
120 missing_docs,
121 clippy::wildcard_imports,
122 clippy::let_unit_value,
123 )]
124 use tonic::codegen::*;
125 use tonic::codegen::http::Uri;
126 #[derive(Debug, Clone)]
129 pub struct UnitsServiceClient<T> {
130 inner: tonic::client::Grpc<T>,
131 }
132 impl UnitsServiceClient<tonic::transport::Channel> {
133 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
135 where
136 D: TryInto<tonic::transport::Endpoint>,
137 D::Error: Into<StdError>,
138 {
139 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
140 Ok(Self::new(conn))
141 }
142 }
143 impl<T> UnitsServiceClient<T>
144 where
145 T: tonic::client::GrpcService<tonic::body::Body>,
146 T::Error: Into<StdError>,
147 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
148 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
149 {
150 pub fn new(inner: T) -> Self {
151 let inner = tonic::client::Grpc::new(inner);
152 Self { inner }
153 }
154 pub fn with_origin(inner: T, origin: Uri) -> Self {
155 let inner = tonic::client::Grpc::with_origin(inner, origin);
156 Self { inner }
157 }
158 pub fn with_interceptor<F>(
159 inner: T,
160 interceptor: F,
161 ) -> UnitsServiceClient<InterceptedService<T, F>>
162 where
163 F: tonic::service::Interceptor,
164 T::ResponseBody: Default,
165 T: tonic::codegen::Service<
166 http::Request<tonic::body::Body>,
167 Response = http::Response<
168 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
169 >,
170 >,
171 <T as tonic::codegen::Service<
172 http::Request<tonic::body::Body>,
173 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
174 {
175 UnitsServiceClient::new(InterceptedService::new(inner, interceptor))
176 }
177 #[must_use]
182 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
183 self.inner = self.inner.send_compressed(encoding);
184 self
185 }
186 #[must_use]
188 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
189 self.inner = self.inner.accept_compressed(encoding);
190 self
191 }
192 #[must_use]
196 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
197 self.inner = self.inner.max_decoding_message_size(limit);
198 self
199 }
200 #[must_use]
204 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
205 self.inner = self.inner.max_encoding_message_size(limit);
206 self
207 }
208 pub async fn get_all_units(
210 &mut self,
211 request: impl tonic::IntoRequest<super::GetAllUnitsRequest>,
212 ) -> std::result::Result<
213 tonic::Response<super::GetAllUnitsResponse>,
214 tonic::Status,
215 > {
216 self.inner
217 .ready()
218 .await
219 .map_err(|e| {
220 tonic::Status::unknown(
221 format!("Service was not ready: {}", e.into()),
222 )
223 })?;
224 let codec = tonic::codec::ProstCodec::default();
225 let path = http::uri::PathAndQuery::from_static(
226 "/nominal.units.v1.UnitsService/GetAllUnits",
227 );
228 let mut req = request.into_request();
229 req.extensions_mut()
230 .insert(GrpcMethod::new("nominal.units.v1.UnitsService", "GetAllUnits"));
231 self.inner.unary(req, path, codec).await
232 }
233 pub async fn get_unit(
235 &mut self,
236 request: impl tonic::IntoRequest<super::GetUnitRequest>,
237 ) -> std::result::Result<
238 tonic::Response<super::GetUnitResponse>,
239 tonic::Status,
240 > {
241 self.inner
242 .ready()
243 .await
244 .map_err(|e| {
245 tonic::Status::unknown(
246 format!("Service was not ready: {}", e.into()),
247 )
248 })?;
249 let codec = tonic::codec::ProstCodec::default();
250 let path = http::uri::PathAndQuery::from_static(
251 "/nominal.units.v1.UnitsService/GetUnit",
252 );
253 let mut req = request.into_request();
254 req.extensions_mut()
255 .insert(GrpcMethod::new("nominal.units.v1.UnitsService", "GetUnit"));
256 self.inner.unary(req, path, codec).await
257 }
258 pub async fn get_batch_units(
261 &mut self,
262 request: impl tonic::IntoRequest<super::GetBatchUnitsRequest>,
263 ) -> std::result::Result<
264 tonic::Response<super::GetBatchUnitsResponse>,
265 tonic::Status,
266 > {
267 self.inner
268 .ready()
269 .await
270 .map_err(|e| {
271 tonic::Status::unknown(
272 format!("Service was not ready: {}", e.into()),
273 )
274 })?;
275 let codec = tonic::codec::ProstCodec::default();
276 let path = http::uri::PathAndQuery::from_static(
277 "/nominal.units.v1.UnitsService/GetBatchUnits",
278 );
279 let mut req = request.into_request();
280 req.extensions_mut()
281 .insert(
282 GrpcMethod::new("nominal.units.v1.UnitsService", "GetBatchUnits"),
283 );
284 self.inner.unary(req, path, codec).await
285 }
286 pub async fn get_commensurable_units(
289 &mut self,
290 request: impl tonic::IntoRequest<super::GetCommensurableUnitsRequest>,
291 ) -> std::result::Result<
292 tonic::Response<super::GetCommensurableUnitsResponse>,
293 tonic::Status,
294 > {
295 self.inner
296 .ready()
297 .await
298 .map_err(|e| {
299 tonic::Status::unknown(
300 format!("Service was not ready: {}", e.into()),
301 )
302 })?;
303 let codec = tonic::codec::ProstCodec::default();
304 let path = http::uri::PathAndQuery::from_static(
305 "/nominal.units.v1.UnitsService/GetCommensurableUnits",
306 );
307 let mut req = request.into_request();
308 req.extensions_mut()
309 .insert(
310 GrpcMethod::new(
311 "nominal.units.v1.UnitsService",
312 "GetCommensurableUnits",
313 ),
314 );
315 self.inner.unary(req, path, codec).await
316 }
317 }
318}