ydb_grpc/generated/
ydb.auth.v1.rs

1/// Generated client implementations.
2pub mod auth_service_client {
3    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
4    use tonic::codegen::*;
5    use tonic::codegen::http::Uri;
6    #[derive(Debug, Clone)]
7    pub struct AuthServiceClient<T> {
8        inner: tonic::client::Grpc<T>,
9    }
10    impl AuthServiceClient<tonic::transport::Channel> {
11        /// Attempt to create a new client by connecting to a given endpoint.
12        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
13        where
14            D: std::convert::TryInto<tonic::transport::Endpoint>,
15            D::Error: Into<StdError>,
16        {
17            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
18            Ok(Self::new(conn))
19        }
20    }
21    impl<T> AuthServiceClient<T>
22    where
23        T: tonic::client::GrpcService<tonic::body::BoxBody>,
24        T::Error: Into<StdError>,
25        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
26        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
27    {
28        pub fn new(inner: T) -> Self {
29            let inner = tonic::client::Grpc::new(inner);
30            Self { inner }
31        }
32        pub fn with_origin(inner: T, origin: Uri) -> Self {
33            let inner = tonic::client::Grpc::with_origin(inner, origin);
34            Self { inner }
35        }
36        pub fn with_interceptor<F>(
37            inner: T,
38            interceptor: F,
39        ) -> AuthServiceClient<InterceptedService<T, F>>
40        where
41            F: tonic::service::Interceptor,
42            T::ResponseBody: Default,
43            T: tonic::codegen::Service<
44                http::Request<tonic::body::BoxBody>,
45                Response = http::Response<
46                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
47                >,
48            >,
49            <T as tonic::codegen::Service<
50                http::Request<tonic::body::BoxBody>,
51            >>::Error: Into<StdError> + Send + Sync,
52        {
53            AuthServiceClient::new(InterceptedService::new(inner, interceptor))
54        }
55        /// Compress requests with the given encoding.
56        /// This requires the server to support it otherwise it might respond with an
57        /// error.
58        #[must_use]
59        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
60            self.inner = self.inner.send_compressed(encoding);
61            self
62        }
63        /// Enable decompressing responses.
64        #[must_use]
65        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
66            self.inner = self.inner.accept_compressed(encoding);
67            self
68        }
69        /// Perform login using built-in auth system
70        pub async fn login(
71            &mut self,
72            request: impl tonic::IntoRequest<super::super::LoginRequest>,
73        ) -> Result<tonic::Response<super::super::LoginResponse>, tonic::Status> {
74            self.inner
75                .ready()
76                .await
77                .map_err(|e| {
78                    tonic::Status::new(
79                        tonic::Code::Unknown,
80                        format!("Service was not ready: {}", e.into()),
81                    )
82                })?;
83            let codec = tonic::codec::ProstCodec::default();
84            let path = http::uri::PathAndQuery::from_static(
85                "/Ydb.Auth.V1.AuthService/Login",
86            );
87            self.inner.unary(request.into_request(), path, codec).await
88        }
89    }
90}