nominal_api/proto/
nominal.connect.download.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct GetLatestConnectUriRequest {
4    #[prost(string, tag = "1")]
5    pub platform: ::prost::alloc::string::String,
6}
7#[derive(Clone, PartialEq, ::prost::Message)]
8pub struct GetLatestVersionRequest {
9    #[prost(string, tag = "1")]
10    pub platform: ::prost::alloc::string::String,
11}
12#[derive(Clone, PartialEq, ::prost::Message)]
13pub struct GetLatestConnectUriResponse {
14    #[prost(string, tag = "1")]
15    pub uri: ::prost::alloc::string::String,
16}
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct GetLatestVersionResponse {
19    #[prost(string, optional, tag = "1")]
20    pub version: ::core::option::Option<::prost::alloc::string::String>,
21}
22#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
23#[repr(i32)]
24pub enum ConnectDownloadServiceError {
25    Unspecified = 0,
26    ConnectNotAvailable = 1,
27}
28impl ConnectDownloadServiceError {
29    /// String value of the enum field names used in the ProtoBuf definition.
30    ///
31    /// The values are not transformed in any way and thus are considered stable
32    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
33    pub fn as_str_name(&self) -> &'static str {
34        match self {
35            Self::Unspecified => "CONNECT_DOWNLOAD_SERVICE_ERROR_UNSPECIFIED",
36            Self::ConnectNotAvailable => {
37                "CONNECT_DOWNLOAD_SERVICE_ERROR_CONNECT_NOT_AVAILABLE"
38            }
39        }
40    }
41    /// Creates an enum from field names used in the ProtoBuf definition.
42    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
43        match value {
44            "CONNECT_DOWNLOAD_SERVICE_ERROR_UNSPECIFIED" => Some(Self::Unspecified),
45            "CONNECT_DOWNLOAD_SERVICE_ERROR_CONNECT_NOT_AVAILABLE" => {
46                Some(Self::ConnectNotAvailable)
47            }
48            _ => None,
49        }
50    }
51}
52/// Generated client implementations.
53pub mod connect_download_service_client {
54    #![allow(
55        unused_variables,
56        dead_code,
57        missing_docs,
58        clippy::wildcard_imports,
59        clippy::let_unit_value,
60    )]
61    use tonic::codegen::*;
62    use tonic::codegen::http::Uri;
63    /// Service for downloading Connect binaries
64    #[derive(Debug, Clone)]
65    pub struct ConnectDownloadServiceClient<T> {
66        inner: tonic::client::Grpc<T>,
67    }
68    impl ConnectDownloadServiceClient<tonic::transport::Channel> {
69        /// Attempt to create a new client by connecting to a given endpoint.
70        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
71        where
72            D: TryInto<tonic::transport::Endpoint>,
73            D::Error: Into<StdError>,
74        {
75            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
76            Ok(Self::new(conn))
77        }
78    }
79    impl<T> ConnectDownloadServiceClient<T>
80    where
81        T: tonic::client::GrpcService<tonic::body::Body>,
82        T::Error: Into<StdError>,
83        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
84        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
85    {
86        pub fn new(inner: T) -> Self {
87            let inner = tonic::client::Grpc::new(inner);
88            Self { inner }
89        }
90        pub fn with_origin(inner: T, origin: Uri) -> Self {
91            let inner = tonic::client::Grpc::with_origin(inner, origin);
92            Self { inner }
93        }
94        pub fn with_interceptor<F>(
95            inner: T,
96            interceptor: F,
97        ) -> ConnectDownloadServiceClient<InterceptedService<T, F>>
98        where
99            F: tonic::service::Interceptor,
100            T::ResponseBody: Default,
101            T: tonic::codegen::Service<
102                http::Request<tonic::body::Body>,
103                Response = http::Response<
104                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
105                >,
106            >,
107            <T as tonic::codegen::Service<
108                http::Request<tonic::body::Body>,
109            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
110        {
111            ConnectDownloadServiceClient::new(
112                InterceptedService::new(inner, interceptor),
113            )
114        }
115        /// Compress requests with the given encoding.
116        ///
117        /// This requires the server to support it otherwise it might respond with an
118        /// error.
119        #[must_use]
120        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
121            self.inner = self.inner.send_compressed(encoding);
122            self
123        }
124        /// Enable decompressing responses.
125        #[must_use]
126        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
127            self.inner = self.inner.accept_compressed(encoding);
128            self
129        }
130        /// Limits the maximum size of a decoded message.
131        ///
132        /// Default: `4MB`
133        #[must_use]
134        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
135            self.inner = self.inner.max_decoding_message_size(limit);
136            self
137        }
138        /// Limits the maximum size of an encoded message.
139        ///
140        /// Default: `usize::MAX`
141        #[must_use]
142        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
143            self.inner = self.inner.max_encoding_message_size(limit);
144            self
145        }
146        /// Get a pre-signed URL for downloading the latest version of Connect for a given platform
147        pub async fn get_latest_connect_uri(
148            &mut self,
149            request: impl tonic::IntoRequest<super::GetLatestConnectUriRequest>,
150        ) -> std::result::Result<
151            tonic::Response<super::GetLatestConnectUriResponse>,
152            tonic::Status,
153        > {
154            self.inner
155                .ready()
156                .await
157                .map_err(|e| {
158                    tonic::Status::unknown(
159                        format!("Service was not ready: {}", e.into()),
160                    )
161                })?;
162            let codec = tonic::codec::ProstCodec::default();
163            let path = http::uri::PathAndQuery::from_static(
164                "/nominal.connect.download.v1.ConnectDownloadService/GetLatestConnectUri",
165            );
166            let mut req = request.into_request();
167            req.extensions_mut()
168                .insert(
169                    GrpcMethod::new(
170                        "nominal.connect.download.v1.ConnectDownloadService",
171                        "GetLatestConnectUri",
172                    ),
173                );
174            self.inner.unary(req, path, codec).await
175        }
176        /// Get the latest version string of Connect for a given platform
177        pub async fn get_latest_version(
178            &mut self,
179            request: impl tonic::IntoRequest<super::GetLatestVersionRequest>,
180        ) -> std::result::Result<
181            tonic::Response<super::GetLatestVersionResponse>,
182            tonic::Status,
183        > {
184            self.inner
185                .ready()
186                .await
187                .map_err(|e| {
188                    tonic::Status::unknown(
189                        format!("Service was not ready: {}", e.into()),
190                    )
191                })?;
192            let codec = tonic::codec::ProstCodec::default();
193            let path = http::uri::PathAndQuery::from_static(
194                "/nominal.connect.download.v1.ConnectDownloadService/GetLatestVersion",
195            );
196            let mut req = request.into_request();
197            req.extensions_mut()
198                .insert(
199                    GrpcMethod::new(
200                        "nominal.connect.download.v1.ConnectDownloadService",
201                        "GetLatestVersion",
202                    ),
203                );
204            self.inner.unary(req, path, codec).await
205        }
206    }
207}