openfga_client/gen/
openfga.v1.tonic.rs

1// @generated
2/// Generated client implementations.
3pub mod open_fga_service_client {
4    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
5    use tonic::codegen::*;
6    use tonic::codegen::http::Uri;
7    #[derive(Debug, Clone)]
8    pub struct OpenFgaServiceClient<T> {
9        inner: tonic::client::Grpc<T>,
10    }
11    impl OpenFgaServiceClient<tonic::transport::Channel> {
12        /// Attempt to create a new client by connecting to a given endpoint.
13        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
14        where
15            D: TryInto<tonic::transport::Endpoint>,
16            D::Error: Into<StdError>,
17        {
18            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
19            Ok(Self::new(conn))
20        }
21    }
22    impl<T> OpenFgaServiceClient<T>
23    where
24        T: tonic::client::GrpcService<tonic::body::BoxBody>,
25        T::Error: Into<StdError>,
26        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
27        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
28    {
29        pub fn new(inner: T) -> Self {
30            let inner = tonic::client::Grpc::new(inner);
31            Self { inner }
32        }
33        pub fn with_origin(inner: T, origin: Uri) -> Self {
34            let inner = tonic::client::Grpc::with_origin(inner, origin);
35            Self { inner }
36        }
37        pub fn with_interceptor<F>(
38            inner: T,
39            interceptor: F,
40        ) -> OpenFgaServiceClient<InterceptedService<T, F>>
41        where
42            F: tonic::service::Interceptor,
43            T::ResponseBody: Default,
44            T: tonic::codegen::Service<
45                http::Request<tonic::body::BoxBody>,
46                Response = http::Response<
47                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
48                >,
49            >,
50            <T as tonic::codegen::Service<
51                http::Request<tonic::body::BoxBody>,
52            >>::Error: Into<StdError> + Send + Sync,
53        {
54            OpenFgaServiceClient::new(InterceptedService::new(inner, interceptor))
55        }
56        /// Compress requests with the given encoding.
57        ///
58        /// This requires the server to support it otherwise it might respond with an
59        /// error.
60        #[must_use]
61        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
62            self.inner = self.inner.send_compressed(encoding);
63            self
64        }
65        /// Enable decompressing responses.
66        #[must_use]
67        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
68            self.inner = self.inner.accept_compressed(encoding);
69            self
70        }
71        /// Limits the maximum size of a decoded message.
72        ///
73        /// Default: `4MB`
74        #[must_use]
75        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
76            self.inner = self.inner.max_decoding_message_size(limit);
77            self
78        }
79        /// Limits the maximum size of an encoded message.
80        ///
81        /// Default: `usize::MAX`
82        #[must_use]
83        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
84            self.inner = self.inner.max_encoding_message_size(limit);
85            self
86        }
87        pub async fn read(
88            &mut self,
89            request: impl tonic::IntoRequest<super::ReadRequest>,
90        ) -> std::result::Result<tonic::Response<super::ReadResponse>, tonic::Status> {
91            self.inner
92                .ready()
93                .await
94                .map_err(|e| {
95                    tonic::Status::new(
96                        tonic::Code::Unknown,
97                        format!("Service was not ready: {}", e.into()),
98                    )
99                })?;
100            let codec = tonic::codec::ProstCodec::default();
101            let path = http::uri::PathAndQuery::from_static(
102                "/openfga.v1.OpenFGAService/Read",
103            );
104            let mut req = request.into_request();
105            req.extensions_mut()
106                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "Read"));
107            self.inner.unary(req, path, codec).await
108        }
109        pub async fn write(
110            &mut self,
111            request: impl tonic::IntoRequest<super::WriteRequest>,
112        ) -> std::result::Result<tonic::Response<super::WriteResponse>, tonic::Status> {
113            self.inner
114                .ready()
115                .await
116                .map_err(|e| {
117                    tonic::Status::new(
118                        tonic::Code::Unknown,
119                        format!("Service was not ready: {}", e.into()),
120                    )
121                })?;
122            let codec = tonic::codec::ProstCodec::default();
123            let path = http::uri::PathAndQuery::from_static(
124                "/openfga.v1.OpenFGAService/Write",
125            );
126            let mut req = request.into_request();
127            req.extensions_mut()
128                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "Write"));
129            self.inner.unary(req, path, codec).await
130        }
131        pub async fn check(
132            &mut self,
133            request: impl tonic::IntoRequest<super::CheckRequest>,
134        ) -> std::result::Result<tonic::Response<super::CheckResponse>, tonic::Status> {
135            self.inner
136                .ready()
137                .await
138                .map_err(|e| {
139                    tonic::Status::new(
140                        tonic::Code::Unknown,
141                        format!("Service was not ready: {}", e.into()),
142                    )
143                })?;
144            let codec = tonic::codec::ProstCodec::default();
145            let path = http::uri::PathAndQuery::from_static(
146                "/openfga.v1.OpenFGAService/Check",
147            );
148            let mut req = request.into_request();
149            req.extensions_mut()
150                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "Check"));
151            self.inner.unary(req, path, codec).await
152        }
153        pub async fn batch_check(
154            &mut self,
155            request: impl tonic::IntoRequest<super::BatchCheckRequest>,
156        ) -> std::result::Result<
157            tonic::Response<super::BatchCheckResponse>,
158            tonic::Status,
159        > {
160            self.inner
161                .ready()
162                .await
163                .map_err(|e| {
164                    tonic::Status::new(
165                        tonic::Code::Unknown,
166                        format!("Service was not ready: {}", e.into()),
167                    )
168                })?;
169            let codec = tonic::codec::ProstCodec::default();
170            let path = http::uri::PathAndQuery::from_static(
171                "/openfga.v1.OpenFGAService/BatchCheck",
172            );
173            let mut req = request.into_request();
174            req.extensions_mut()
175                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "BatchCheck"));
176            self.inner.unary(req, path, codec).await
177        }
178        pub async fn expand(
179            &mut self,
180            request: impl tonic::IntoRequest<super::ExpandRequest>,
181        ) -> std::result::Result<tonic::Response<super::ExpandResponse>, tonic::Status> {
182            self.inner
183                .ready()
184                .await
185                .map_err(|e| {
186                    tonic::Status::new(
187                        tonic::Code::Unknown,
188                        format!("Service was not ready: {}", e.into()),
189                    )
190                })?;
191            let codec = tonic::codec::ProstCodec::default();
192            let path = http::uri::PathAndQuery::from_static(
193                "/openfga.v1.OpenFGAService/Expand",
194            );
195            let mut req = request.into_request();
196            req.extensions_mut()
197                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "Expand"));
198            self.inner.unary(req, path, codec).await
199        }
200        pub async fn read_authorization_models(
201            &mut self,
202            request: impl tonic::IntoRequest<super::ReadAuthorizationModelsRequest>,
203        ) -> std::result::Result<
204            tonic::Response<super::ReadAuthorizationModelsResponse>,
205            tonic::Status,
206        > {
207            self.inner
208                .ready()
209                .await
210                .map_err(|e| {
211                    tonic::Status::new(
212                        tonic::Code::Unknown,
213                        format!("Service was not ready: {}", e.into()),
214                    )
215                })?;
216            let codec = tonic::codec::ProstCodec::default();
217            let path = http::uri::PathAndQuery::from_static(
218                "/openfga.v1.OpenFGAService/ReadAuthorizationModels",
219            );
220            let mut req = request.into_request();
221            req.extensions_mut()
222                .insert(
223                    GrpcMethod::new(
224                        "openfga.v1.OpenFGAService",
225                        "ReadAuthorizationModels",
226                    ),
227                );
228            self.inner.unary(req, path, codec).await
229        }
230        pub async fn read_authorization_model(
231            &mut self,
232            request: impl tonic::IntoRequest<super::ReadAuthorizationModelRequest>,
233        ) -> std::result::Result<
234            tonic::Response<super::ReadAuthorizationModelResponse>,
235            tonic::Status,
236        > {
237            self.inner
238                .ready()
239                .await
240                .map_err(|e| {
241                    tonic::Status::new(
242                        tonic::Code::Unknown,
243                        format!("Service was not ready: {}", e.into()),
244                    )
245                })?;
246            let codec = tonic::codec::ProstCodec::default();
247            let path = http::uri::PathAndQuery::from_static(
248                "/openfga.v1.OpenFGAService/ReadAuthorizationModel",
249            );
250            let mut req = request.into_request();
251            req.extensions_mut()
252                .insert(
253                    GrpcMethod::new(
254                        "openfga.v1.OpenFGAService",
255                        "ReadAuthorizationModel",
256                    ),
257                );
258            self.inner.unary(req, path, codec).await
259        }
260        pub async fn write_authorization_model(
261            &mut self,
262            request: impl tonic::IntoRequest<super::WriteAuthorizationModelRequest>,
263        ) -> std::result::Result<
264            tonic::Response<super::WriteAuthorizationModelResponse>,
265            tonic::Status,
266        > {
267            self.inner
268                .ready()
269                .await
270                .map_err(|e| {
271                    tonic::Status::new(
272                        tonic::Code::Unknown,
273                        format!("Service was not ready: {}", e.into()),
274                    )
275                })?;
276            let codec = tonic::codec::ProstCodec::default();
277            let path = http::uri::PathAndQuery::from_static(
278                "/openfga.v1.OpenFGAService/WriteAuthorizationModel",
279            );
280            let mut req = request.into_request();
281            req.extensions_mut()
282                .insert(
283                    GrpcMethod::new(
284                        "openfga.v1.OpenFGAService",
285                        "WriteAuthorizationModel",
286                    ),
287                );
288            self.inner.unary(req, path, codec).await
289        }
290        pub async fn write_assertions(
291            &mut self,
292            request: impl tonic::IntoRequest<super::WriteAssertionsRequest>,
293        ) -> std::result::Result<
294            tonic::Response<super::WriteAssertionsResponse>,
295            tonic::Status,
296        > {
297            self.inner
298                .ready()
299                .await
300                .map_err(|e| {
301                    tonic::Status::new(
302                        tonic::Code::Unknown,
303                        format!("Service was not ready: {}", e.into()),
304                    )
305                })?;
306            let codec = tonic::codec::ProstCodec::default();
307            let path = http::uri::PathAndQuery::from_static(
308                "/openfga.v1.OpenFGAService/WriteAssertions",
309            );
310            let mut req = request.into_request();
311            req.extensions_mut()
312                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "WriteAssertions"));
313            self.inner.unary(req, path, codec).await
314        }
315        pub async fn read_assertions(
316            &mut self,
317            request: impl tonic::IntoRequest<super::ReadAssertionsRequest>,
318        ) -> std::result::Result<
319            tonic::Response<super::ReadAssertionsResponse>,
320            tonic::Status,
321        > {
322            self.inner
323                .ready()
324                .await
325                .map_err(|e| {
326                    tonic::Status::new(
327                        tonic::Code::Unknown,
328                        format!("Service was not ready: {}", e.into()),
329                    )
330                })?;
331            let codec = tonic::codec::ProstCodec::default();
332            let path = http::uri::PathAndQuery::from_static(
333                "/openfga.v1.OpenFGAService/ReadAssertions",
334            );
335            let mut req = request.into_request();
336            req.extensions_mut()
337                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "ReadAssertions"));
338            self.inner.unary(req, path, codec).await
339        }
340        pub async fn read_changes(
341            &mut self,
342            request: impl tonic::IntoRequest<super::ReadChangesRequest>,
343        ) -> std::result::Result<
344            tonic::Response<super::ReadChangesResponse>,
345            tonic::Status,
346        > {
347            self.inner
348                .ready()
349                .await
350                .map_err(|e| {
351                    tonic::Status::new(
352                        tonic::Code::Unknown,
353                        format!("Service was not ready: {}", e.into()),
354                    )
355                })?;
356            let codec = tonic::codec::ProstCodec::default();
357            let path = http::uri::PathAndQuery::from_static(
358                "/openfga.v1.OpenFGAService/ReadChanges",
359            );
360            let mut req = request.into_request();
361            req.extensions_mut()
362                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "ReadChanges"));
363            self.inner.unary(req, path, codec).await
364        }
365        pub async fn create_store(
366            &mut self,
367            request: impl tonic::IntoRequest<super::CreateStoreRequest>,
368        ) -> std::result::Result<
369            tonic::Response<super::CreateStoreResponse>,
370            tonic::Status,
371        > {
372            self.inner
373                .ready()
374                .await
375                .map_err(|e| {
376                    tonic::Status::new(
377                        tonic::Code::Unknown,
378                        format!("Service was not ready: {}", e.into()),
379                    )
380                })?;
381            let codec = tonic::codec::ProstCodec::default();
382            let path = http::uri::PathAndQuery::from_static(
383                "/openfga.v1.OpenFGAService/CreateStore",
384            );
385            let mut req = request.into_request();
386            req.extensions_mut()
387                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "CreateStore"));
388            self.inner.unary(req, path, codec).await
389        }
390        pub async fn update_store(
391            &mut self,
392            request: impl tonic::IntoRequest<super::UpdateStoreRequest>,
393        ) -> std::result::Result<
394            tonic::Response<super::UpdateStoreResponse>,
395            tonic::Status,
396        > {
397            self.inner
398                .ready()
399                .await
400                .map_err(|e| {
401                    tonic::Status::new(
402                        tonic::Code::Unknown,
403                        format!("Service was not ready: {}", e.into()),
404                    )
405                })?;
406            let codec = tonic::codec::ProstCodec::default();
407            let path = http::uri::PathAndQuery::from_static(
408                "/openfga.v1.OpenFGAService/UpdateStore",
409            );
410            let mut req = request.into_request();
411            req.extensions_mut()
412                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "UpdateStore"));
413            self.inner.unary(req, path, codec).await
414        }
415        pub async fn delete_store(
416            &mut self,
417            request: impl tonic::IntoRequest<super::DeleteStoreRequest>,
418        ) -> std::result::Result<
419            tonic::Response<super::DeleteStoreResponse>,
420            tonic::Status,
421        > {
422            self.inner
423                .ready()
424                .await
425                .map_err(|e| {
426                    tonic::Status::new(
427                        tonic::Code::Unknown,
428                        format!("Service was not ready: {}", e.into()),
429                    )
430                })?;
431            let codec = tonic::codec::ProstCodec::default();
432            let path = http::uri::PathAndQuery::from_static(
433                "/openfga.v1.OpenFGAService/DeleteStore",
434            );
435            let mut req = request.into_request();
436            req.extensions_mut()
437                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "DeleteStore"));
438            self.inner.unary(req, path, codec).await
439        }
440        pub async fn get_store(
441            &mut self,
442            request: impl tonic::IntoRequest<super::GetStoreRequest>,
443        ) -> std::result::Result<
444            tonic::Response<super::GetStoreResponse>,
445            tonic::Status,
446        > {
447            self.inner
448                .ready()
449                .await
450                .map_err(|e| {
451                    tonic::Status::new(
452                        tonic::Code::Unknown,
453                        format!("Service was not ready: {}", e.into()),
454                    )
455                })?;
456            let codec = tonic::codec::ProstCodec::default();
457            let path = http::uri::PathAndQuery::from_static(
458                "/openfga.v1.OpenFGAService/GetStore",
459            );
460            let mut req = request.into_request();
461            req.extensions_mut()
462                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "GetStore"));
463            self.inner.unary(req, path, codec).await
464        }
465        pub async fn list_stores(
466            &mut self,
467            request: impl tonic::IntoRequest<super::ListStoresRequest>,
468        ) -> std::result::Result<
469            tonic::Response<super::ListStoresResponse>,
470            tonic::Status,
471        > {
472            self.inner
473                .ready()
474                .await
475                .map_err(|e| {
476                    tonic::Status::new(
477                        tonic::Code::Unknown,
478                        format!("Service was not ready: {}", e.into()),
479                    )
480                })?;
481            let codec = tonic::codec::ProstCodec::default();
482            let path = http::uri::PathAndQuery::from_static(
483                "/openfga.v1.OpenFGAService/ListStores",
484            );
485            let mut req = request.into_request();
486            req.extensions_mut()
487                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "ListStores"));
488            self.inner.unary(req, path, codec).await
489        }
490        pub async fn streamed_list_objects(
491            &mut self,
492            request: impl tonic::IntoRequest<super::StreamedListObjectsRequest>,
493        ) -> std::result::Result<
494            tonic::Response<tonic::codec::Streaming<super::StreamedListObjectsResponse>>,
495            tonic::Status,
496        > {
497            self.inner
498                .ready()
499                .await
500                .map_err(|e| {
501                    tonic::Status::new(
502                        tonic::Code::Unknown,
503                        format!("Service was not ready: {}", e.into()),
504                    )
505                })?;
506            let codec = tonic::codec::ProstCodec::default();
507            let path = http::uri::PathAndQuery::from_static(
508                "/openfga.v1.OpenFGAService/StreamedListObjects",
509            );
510            let mut req = request.into_request();
511            req.extensions_mut()
512                .insert(
513                    GrpcMethod::new("openfga.v1.OpenFGAService", "StreamedListObjects"),
514                );
515            self.inner.server_streaming(req, path, codec).await
516        }
517        pub async fn list_objects(
518            &mut self,
519            request: impl tonic::IntoRequest<super::ListObjectsRequest>,
520        ) -> std::result::Result<
521            tonic::Response<super::ListObjectsResponse>,
522            tonic::Status,
523        > {
524            self.inner
525                .ready()
526                .await
527                .map_err(|e| {
528                    tonic::Status::new(
529                        tonic::Code::Unknown,
530                        format!("Service was not ready: {}", e.into()),
531                    )
532                })?;
533            let codec = tonic::codec::ProstCodec::default();
534            let path = http::uri::PathAndQuery::from_static(
535                "/openfga.v1.OpenFGAService/ListObjects",
536            );
537            let mut req = request.into_request();
538            req.extensions_mut()
539                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "ListObjects"));
540            self.inner.unary(req, path, codec).await
541        }
542        pub async fn list_users(
543            &mut self,
544            request: impl tonic::IntoRequest<super::ListUsersRequest>,
545        ) -> std::result::Result<
546            tonic::Response<super::ListUsersResponse>,
547            tonic::Status,
548        > {
549            self.inner
550                .ready()
551                .await
552                .map_err(|e| {
553                    tonic::Status::new(
554                        tonic::Code::Unknown,
555                        format!("Service was not ready: {}", e.into()),
556                    )
557                })?;
558            let codec = tonic::codec::ProstCodec::default();
559            let path = http::uri::PathAndQuery::from_static(
560                "/openfga.v1.OpenFGAService/ListUsers",
561            );
562            let mut req = request.into_request();
563            req.extensions_mut()
564                .insert(GrpcMethod::new("openfga.v1.OpenFGAService", "ListUsers"));
565            self.inner.unary(req, path, codec).await
566        }
567    }
568}