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