Skip to main content

nominal_api_proto/proto/
nominal.internalcommandcredentials.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct MintCommandHubCredentialRequest {
4    #[prost(string, tag = "1")]
5    pub registration_id: ::prost::alloc::string::String,
6}
7#[derive(Clone, PartialEq, ::prost::Message)]
8pub struct MintCommandHubCredentialResponse {
9    #[prost(string, tag = "1")]
10    pub nats_jwt: ::prost::alloc::string::String,
11    #[prost(string, tag = "2")]
12    pub nats_url: ::prost::alloc::string::String,
13    #[prost(message, optional, tag = "3")]
14    pub expires_at: ::core::option::Option<
15        super::super::super::google::protobuf::Timestamp,
16    >,
17}
18/// Generated client implementations.
19pub mod internal_command_credential_service_client {
20    #![allow(
21        unused_variables,
22        dead_code,
23        missing_docs,
24        clippy::wildcard_imports,
25        clippy::let_unit_value,
26    )]
27    use tonic::codegen::*;
28    use tonic::codegen::http::Uri;
29    #[derive(Debug, Clone)]
30    pub struct InternalCommandCredentialServiceClient<T> {
31        inner: tonic::client::Grpc<T>,
32    }
33    impl InternalCommandCredentialServiceClient<tonic::transport::Channel> {
34        /// Attempt to create a new client by connecting to a given endpoint.
35        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
36        where
37            D: TryInto<tonic::transport::Endpoint>,
38            D::Error: Into<StdError>,
39        {
40            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
41            Ok(Self::new(conn))
42        }
43    }
44    impl<T> InternalCommandCredentialServiceClient<T>
45    where
46        T: tonic::client::GrpcService<tonic::body::Body>,
47        T::Error: Into<StdError>,
48        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
49        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
50    {
51        pub fn new(inner: T) -> Self {
52            let inner = tonic::client::Grpc::new(inner);
53            Self { inner }
54        }
55        pub fn with_origin(inner: T, origin: Uri) -> Self {
56            let inner = tonic::client::Grpc::with_origin(inner, origin);
57            Self { inner }
58        }
59        pub fn with_interceptor<F>(
60            inner: T,
61            interceptor: F,
62        ) -> InternalCommandCredentialServiceClient<InterceptedService<T, F>>
63        where
64            F: tonic::service::Interceptor,
65            T::ResponseBody: Default,
66            T: tonic::codegen::Service<
67                http::Request<tonic::body::Body>,
68                Response = http::Response<
69                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
70                >,
71            >,
72            <T as tonic::codegen::Service<
73                http::Request<tonic::body::Body>,
74            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
75        {
76            InternalCommandCredentialServiceClient::new(
77                InterceptedService::new(inner, interceptor),
78            )
79        }
80        /// Compress requests with the given encoding.
81        ///
82        /// This requires the server to support it otherwise it might respond with an
83        /// error.
84        #[must_use]
85        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
86            self.inner = self.inner.send_compressed(encoding);
87            self
88        }
89        /// Enable decompressing responses.
90        #[must_use]
91        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
92            self.inner = self.inner.accept_compressed(encoding);
93            self
94        }
95        /// Limits the maximum size of a decoded message.
96        ///
97        /// Default: `4MB`
98        #[must_use]
99        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
100            self.inner = self.inner.max_decoding_message_size(limit);
101            self
102        }
103        /// Limits the maximum size of an encoded message.
104        ///
105        /// Default: `usize::MAX`
106        #[must_use]
107        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
108            self.inner = self.inner.max_encoding_message_size(limit);
109            self
110        }
111        pub async fn mint_command_hub_credential(
112            &mut self,
113            request: impl tonic::IntoRequest<super::MintCommandHubCredentialRequest>,
114        ) -> std::result::Result<
115            tonic::Response<super::MintCommandHubCredentialResponse>,
116            tonic::Status,
117        > {
118            self.inner
119                .ready()
120                .await
121                .map_err(|e| {
122                    tonic::Status::unknown(
123                        format!("Service was not ready: {}", e.into()),
124                    )
125                })?;
126            let codec = tonic::codec::ProstCodec::default();
127            let path = http::uri::PathAndQuery::from_static(
128                "/nominal.internalcommandcredentials.v1.InternalCommandCredentialService/MintCommandHubCredential",
129            );
130            let mut req = request.into_request();
131            req.extensions_mut()
132                .insert(
133                    GrpcMethod::new(
134                        "nominal.internalcommandcredentials.v1.InternalCommandCredentialService",
135                        "MintCommandHubCredential",
136                    ),
137                );
138            self.inner.unary(req, path, codec).await
139        }
140    }
141}