ydb_grpc_bindings/generated/
ydb.scripting.v1.rs

1/// Generated client implementations.
2pub mod scripting_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 ScriptingServiceClient<T> {
8        inner: tonic::client::Grpc<T>,
9    }
10    impl ScriptingServiceClient<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: 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> ScriptingServiceClient<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        ) -> ScriptingServiceClient<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            ScriptingServiceClient::new(InterceptedService::new(inner, interceptor))
54        }
55        /// Compress requests with the given encoding.
56        ///
57        /// This requires the server to support it otherwise it might respond with an
58        /// error.
59        #[must_use]
60        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
61            self.inner = self.inner.send_compressed(encoding);
62            self
63        }
64        /// Enable decompressing responses.
65        #[must_use]
66        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
67            self.inner = self.inner.accept_compressed(encoding);
68            self
69        }
70        /// Limits the maximum size of a decoded message.
71        ///
72        /// Default: `4MB`
73        #[must_use]
74        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
75            self.inner = self.inner.max_decoding_message_size(limit);
76            self
77        }
78        /// Limits the maximum size of an encoded message.
79        ///
80        /// Default: `usize::MAX`
81        #[must_use]
82        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
83            self.inner = self.inner.max_encoding_message_size(limit);
84            self
85        }
86        pub async fn execute_yql(
87            &mut self,
88            request: impl tonic::IntoRequest<super::super::ExecuteYqlRequest>,
89        ) -> std::result::Result<
90            tonic::Response<super::super::ExecuteYqlResponse>,
91            tonic::Status,
92        > {
93            self.inner
94                .ready()
95                .await
96                .map_err(|e| {
97                    tonic::Status::new(
98                        tonic::Code::Unknown,
99                        format!("Service was not ready: {}", e.into()),
100                    )
101                })?;
102            let codec = tonic::codec::ProstCodec::default();
103            let path = http::uri::PathAndQuery::from_static(
104                "/Ydb.Scripting.V1.ScriptingService/ExecuteYql",
105            );
106            let mut req = request.into_request();
107            req.extensions_mut()
108                .insert(
109                    GrpcMethod::new("Ydb.Scripting.V1.ScriptingService", "ExecuteYql"),
110                );
111            self.inner.unary(req, path, codec).await
112        }
113        /// Executes yql request with streaming result.
114        pub async fn stream_execute_yql(
115            &mut self,
116            request: impl tonic::IntoRequest<super::super::ExecuteYqlRequest>,
117        ) -> std::result::Result<
118            tonic::Response<
119                tonic::codec::Streaming<super::super::ExecuteYqlPartialResponse>,
120            >,
121            tonic::Status,
122        > {
123            self.inner
124                .ready()
125                .await
126                .map_err(|e| {
127                    tonic::Status::new(
128                        tonic::Code::Unknown,
129                        format!("Service was not ready: {}", e.into()),
130                    )
131                })?;
132            let codec = tonic::codec::ProstCodec::default();
133            let path = http::uri::PathAndQuery::from_static(
134                "/Ydb.Scripting.V1.ScriptingService/StreamExecuteYql",
135            );
136            let mut req = request.into_request();
137            req.extensions_mut()
138                .insert(
139                    GrpcMethod::new(
140                        "Ydb.Scripting.V1.ScriptingService",
141                        "StreamExecuteYql",
142                    ),
143                );
144            self.inner.server_streaming(req, path, codec).await
145        }
146        pub async fn explain_yql(
147            &mut self,
148            request: impl tonic::IntoRequest<super::super::ExplainYqlRequest>,
149        ) -> std::result::Result<
150            tonic::Response<super::super::ExplainYqlResponse>,
151            tonic::Status,
152        > {
153            self.inner
154                .ready()
155                .await
156                .map_err(|e| {
157                    tonic::Status::new(
158                        tonic::Code::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                "/Ydb.Scripting.V1.ScriptingService/ExplainYql",
165            );
166            let mut req = request.into_request();
167            req.extensions_mut()
168                .insert(
169                    GrpcMethod::new("Ydb.Scripting.V1.ScriptingService", "ExplainYql"),
170                );
171            self.inner.unary(req, path, codec).await
172        }
173    }
174}