Skip to main content

nominal_api_proto/proto/
nominal.public_app.authentication.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3pub struct HealthCheckRequest {}
4#[derive(Clone, Copy, PartialEq, ::prost::Message)]
5pub struct HealthCheckResponse {
6    #[prost(bool, tag = "1")]
7    pub will_expire: bool,
8}
9#[derive(Clone, Copy, PartialEq, ::prost::Message)]
10pub struct GetOidcInitRequest {}
11#[derive(Clone, PartialEq, ::prost::Message)]
12pub struct GetOidcInitResponse {
13    #[prost(string, tag = "1")]
14    pub client_id: ::prost::alloc::string::String,
15    #[prost(string, tag = "2")]
16    pub login_url: ::prost::alloc::string::String,
17    #[prost(string, repeated, tag = "3")]
18    pub redirect_uris: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
19}
20#[derive(Clone, PartialEq, ::prost::Message)]
21pub struct ExchangeAuthorizationCodeRequest {
22    #[prost(string, tag = "1")]
23    pub client_id: ::prost::alloc::string::String,
24    #[prost(string, tag = "2")]
25    pub code: ::prost::alloc::string::String,
26    #[prost(string, tag = "3")]
27    pub redirect_uri: ::prost::alloc::string::String,
28    #[prost(string, tag = "4")]
29    pub code_verifier: ::prost::alloc::string::String,
30}
31#[derive(Clone, PartialEq, ::prost::Message)]
32pub struct ExchangeAuthorizationCodeResponse {
33    #[prost(string, tag = "1")]
34    pub id_token: ::prost::alloc::string::String,
35    #[prost(int32, optional, tag = "2")]
36    pub expires_in: ::core::option::Option<i32>,
37    #[prost(string, optional, tag = "3")]
38    pub scope: ::core::option::Option<::prost::alloc::string::String>,
39    #[prost(string, optional, tag = "4")]
40    pub access_token: ::core::option::Option<::prost::alloc::string::String>,
41}
42#[derive(Clone, Copy, PartialEq, ::prost::Message)]
43pub struct GetNominalInstanceInfoRequest {}
44#[derive(Clone, PartialEq, ::prost::Message)]
45pub struct GetNominalInstanceInfoResponse {
46    #[prost(string, tag = "1")]
47    pub instance_name: ::prost::alloc::string::String,
48}
49#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
50#[repr(i32)]
51pub enum PublicAppAuthenticationError {
52    Unspecified = 0,
53    NotSupported = 1,
54    Unauthenticated = 2,
55    Expired = 3,
56    UnknownClient = 4,
57    UnknownRedirectUri = 5,
58    InvalidGrant = 6,
59    InvalidClientCredentials = 7,
60}
61impl PublicAppAuthenticationError {
62    /// String value of the enum field names used in the ProtoBuf definition.
63    ///
64    /// The values are not transformed in any way and thus are considered stable
65    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
66    pub fn as_str_name(&self) -> &'static str {
67        match self {
68            Self::Unspecified => "PUBLIC_APP_AUTHENTICATION_ERROR_UNSPECIFIED",
69            Self::NotSupported => "PUBLIC_APP_AUTHENTICATION_ERROR_NOT_SUPPORTED",
70            Self::Unauthenticated => "PUBLIC_APP_AUTHENTICATION_ERROR_UNAUTHENTICATED",
71            Self::Expired => "PUBLIC_APP_AUTHENTICATION_ERROR_EXPIRED",
72            Self::UnknownClient => "PUBLIC_APP_AUTHENTICATION_ERROR_UNKNOWN_CLIENT",
73            Self::UnknownRedirectUri => {
74                "PUBLIC_APP_AUTHENTICATION_ERROR_UNKNOWN_REDIRECT_URI"
75            }
76            Self::InvalidGrant => "PUBLIC_APP_AUTHENTICATION_ERROR_INVALID_GRANT",
77            Self::InvalidClientCredentials => {
78                "PUBLIC_APP_AUTHENTICATION_ERROR_INVALID_CLIENT_CREDENTIALS"
79            }
80        }
81    }
82    /// Creates an enum from field names used in the ProtoBuf definition.
83    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
84        match value {
85            "PUBLIC_APP_AUTHENTICATION_ERROR_UNSPECIFIED" => Some(Self::Unspecified),
86            "PUBLIC_APP_AUTHENTICATION_ERROR_NOT_SUPPORTED" => Some(Self::NotSupported),
87            "PUBLIC_APP_AUTHENTICATION_ERROR_UNAUTHENTICATED" => {
88                Some(Self::Unauthenticated)
89            }
90            "PUBLIC_APP_AUTHENTICATION_ERROR_EXPIRED" => Some(Self::Expired),
91            "PUBLIC_APP_AUTHENTICATION_ERROR_UNKNOWN_CLIENT" => Some(Self::UnknownClient),
92            "PUBLIC_APP_AUTHENTICATION_ERROR_UNKNOWN_REDIRECT_URI" => {
93                Some(Self::UnknownRedirectUri)
94            }
95            "PUBLIC_APP_AUTHENTICATION_ERROR_INVALID_GRANT" => Some(Self::InvalidGrant),
96            "PUBLIC_APP_AUTHENTICATION_ERROR_INVALID_CLIENT_CREDENTIALS" => {
97                Some(Self::InvalidClientCredentials)
98            }
99            _ => None,
100        }
101    }
102}
103/// Generated client implementations.
104pub mod public_app_authentication_service_client {
105    #![allow(
106        unused_variables,
107        dead_code,
108        missing_docs,
109        clippy::wildcard_imports,
110        clippy::let_unit_value,
111    )]
112    use tonic::codegen::*;
113    use tonic::codegen::http::Uri;
114    #[derive(Debug, Clone)]
115    pub struct PublicAppAuthenticationServiceClient<T> {
116        inner: tonic::client::Grpc<T>,
117    }
118    impl PublicAppAuthenticationServiceClient<tonic::transport::Channel> {
119        /// Attempt to create a new client by connecting to a given endpoint.
120        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
121        where
122            D: TryInto<tonic::transport::Endpoint>,
123            D::Error: Into<StdError>,
124        {
125            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
126            Ok(Self::new(conn))
127        }
128    }
129    impl<T> PublicAppAuthenticationServiceClient<T>
130    where
131        T: tonic::client::GrpcService<tonic::body::Body>,
132        T::Error: Into<StdError>,
133        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
134        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
135    {
136        pub fn new(inner: T) -> Self {
137            let inner = tonic::client::Grpc::new(inner);
138            Self { inner }
139        }
140        pub fn with_origin(inner: T, origin: Uri) -> Self {
141            let inner = tonic::client::Grpc::with_origin(inner, origin);
142            Self { inner }
143        }
144        pub fn with_interceptor<F>(
145            inner: T,
146            interceptor: F,
147        ) -> PublicAppAuthenticationServiceClient<InterceptedService<T, F>>
148        where
149            F: tonic::service::Interceptor,
150            T::ResponseBody: Default,
151            T: tonic::codegen::Service<
152                http::Request<tonic::body::Body>,
153                Response = http::Response<
154                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
155                >,
156            >,
157            <T as tonic::codegen::Service<
158                http::Request<tonic::body::Body>,
159            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
160        {
161            PublicAppAuthenticationServiceClient::new(
162                InterceptedService::new(inner, interceptor),
163            )
164        }
165        /// Compress requests with the given encoding.
166        ///
167        /// This requires the server to support it otherwise it might respond with an
168        /// error.
169        #[must_use]
170        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
171            self.inner = self.inner.send_compressed(encoding);
172            self
173        }
174        /// Enable decompressing responses.
175        #[must_use]
176        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
177            self.inner = self.inner.accept_compressed(encoding);
178            self
179        }
180        /// Limits the maximum size of a decoded message.
181        ///
182        /// Default: `4MB`
183        #[must_use]
184        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
185            self.inner = self.inner.max_decoding_message_size(limit);
186            self
187        }
188        /// Limits the maximum size of an encoded message.
189        ///
190        /// Default: `usize::MAX`
191        #[must_use]
192        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
193            self.inner = self.inner.max_encoding_message_size(limit);
194            self
195        }
196        pub async fn health_check(
197            &mut self,
198            request: impl tonic::IntoRequest<super::HealthCheckRequest>,
199        ) -> std::result::Result<
200            tonic::Response<super::HealthCheckResponse>,
201            tonic::Status,
202        > {
203            self.inner
204                .ready()
205                .await
206                .map_err(|e| {
207                    tonic::Status::unknown(
208                        format!("Service was not ready: {}", e.into()),
209                    )
210                })?;
211            let codec = tonic::codec::ProstCodec::default();
212            let path = http::uri::PathAndQuery::from_static(
213                "/nominal.public_app.authentication.v1.PublicAppAuthenticationService/HealthCheck",
214            );
215            let mut req = request.into_request();
216            req.extensions_mut()
217                .insert(
218                    GrpcMethod::new(
219                        "nominal.public_app.authentication.v1.PublicAppAuthenticationService",
220                        "HealthCheck",
221                    ),
222                );
223            self.inner.unary(req, path, codec).await
224        }
225        pub async fn get_oidc_init(
226            &mut self,
227            request: impl tonic::IntoRequest<super::GetOidcInitRequest>,
228        ) -> std::result::Result<
229            tonic::Response<super::GetOidcInitResponse>,
230            tonic::Status,
231        > {
232            self.inner
233                .ready()
234                .await
235                .map_err(|e| {
236                    tonic::Status::unknown(
237                        format!("Service was not ready: {}", e.into()),
238                    )
239                })?;
240            let codec = tonic::codec::ProstCodec::default();
241            let path = http::uri::PathAndQuery::from_static(
242                "/nominal.public_app.authentication.v1.PublicAppAuthenticationService/GetOidcInit",
243            );
244            let mut req = request.into_request();
245            req.extensions_mut()
246                .insert(
247                    GrpcMethod::new(
248                        "nominal.public_app.authentication.v1.PublicAppAuthenticationService",
249                        "GetOidcInit",
250                    ),
251                );
252            self.inner.unary(req, path, codec).await
253        }
254        pub async fn exchange_authorization_code(
255            &mut self,
256            request: impl tonic::IntoRequest<super::ExchangeAuthorizationCodeRequest>,
257        ) -> std::result::Result<
258            tonic::Response<super::ExchangeAuthorizationCodeResponse>,
259            tonic::Status,
260        > {
261            self.inner
262                .ready()
263                .await
264                .map_err(|e| {
265                    tonic::Status::unknown(
266                        format!("Service was not ready: {}", e.into()),
267                    )
268                })?;
269            let codec = tonic::codec::ProstCodec::default();
270            let path = http::uri::PathAndQuery::from_static(
271                "/nominal.public_app.authentication.v1.PublicAppAuthenticationService/ExchangeAuthorizationCode",
272            );
273            let mut req = request.into_request();
274            req.extensions_mut()
275                .insert(
276                    GrpcMethod::new(
277                        "nominal.public_app.authentication.v1.PublicAppAuthenticationService",
278                        "ExchangeAuthorizationCode",
279                    ),
280                );
281            self.inner.unary(req, path, codec).await
282        }
283        pub async fn get_nominal_instance_info(
284            &mut self,
285            request: impl tonic::IntoRequest<super::GetNominalInstanceInfoRequest>,
286        ) -> std::result::Result<
287            tonic::Response<super::GetNominalInstanceInfoResponse>,
288            tonic::Status,
289        > {
290            self.inner
291                .ready()
292                .await
293                .map_err(|e| {
294                    tonic::Status::unknown(
295                        format!("Service was not ready: {}", e.into()),
296                    )
297                })?;
298            let codec = tonic::codec::ProstCodec::default();
299            let path = http::uri::PathAndQuery::from_static(
300                "/nominal.public_app.authentication.v1.PublicAppAuthenticationService/GetNominalInstanceInfo",
301            );
302            let mut req = request.into_request();
303            req.extensions_mut()
304                .insert(
305                    GrpcMethod::new(
306                        "nominal.public_app.authentication.v1.PublicAppAuthenticationService",
307                        "GetNominalInstanceInfo",
308                    ),
309                );
310            self.inner.unary(req, path, codec).await
311        }
312    }
313}