Skip to main content

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

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct CreateTemporaryCredentialsRequest {
4    #[prost(string, tag = "1")]
5    pub email: ::prost::alloc::string::String,
6}
7#[derive(Clone, Copy, PartialEq, ::prost::Message)]
8pub struct CreateTemporaryCredentialsResponse {}
9#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
10#[repr(i32)]
11pub enum TemporaryCredentialsError {
12    Unspecified = 0,
13    TemporaryCredentialsUnavailable = 1,
14    GuestEmailNotAllowed = 2,
15}
16impl TemporaryCredentialsError {
17    /// String value of the enum field names used in the ProtoBuf definition.
18    ///
19    /// The values are not transformed in any way and thus are considered stable
20    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
21    pub fn as_str_name(&self) -> &'static str {
22        match self {
23            Self::Unspecified => "TEMPORARY_CREDENTIALS_ERROR_UNSPECIFIED",
24            Self::TemporaryCredentialsUnavailable => {
25                "TEMPORARY_CREDENTIALS_ERROR_TEMPORARY_CREDENTIALS_UNAVAILABLE"
26            }
27            Self::GuestEmailNotAllowed => {
28                "TEMPORARY_CREDENTIALS_ERROR_GUEST_EMAIL_NOT_ALLOWED"
29            }
30        }
31    }
32    /// Creates an enum from field names used in the ProtoBuf definition.
33    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
34        match value {
35            "TEMPORARY_CREDENTIALS_ERROR_UNSPECIFIED" => Some(Self::Unspecified),
36            "TEMPORARY_CREDENTIALS_ERROR_TEMPORARY_CREDENTIALS_UNAVAILABLE" => {
37                Some(Self::TemporaryCredentialsUnavailable)
38            }
39            "TEMPORARY_CREDENTIALS_ERROR_GUEST_EMAIL_NOT_ALLOWED" => {
40                Some(Self::GuestEmailNotAllowed)
41            }
42            _ => None,
43        }
44    }
45}
46/// Generated client implementations.
47pub mod temporary_credentials_service_client {
48    #![allow(
49        unused_variables,
50        dead_code,
51        missing_docs,
52        clippy::wildcard_imports,
53        clippy::let_unit_value,
54    )]
55    use tonic::codegen::*;
56    use tonic::codegen::http::Uri;
57    #[derive(Debug, Clone)]
58    pub struct TemporaryCredentialsServiceClient<T> {
59        inner: tonic::client::Grpc<T>,
60    }
61    impl TemporaryCredentialsServiceClient<tonic::transport::Channel> {
62        /// Attempt to create a new client by connecting to a given endpoint.
63        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
64        where
65            D: TryInto<tonic::transport::Endpoint>,
66            D::Error: Into<StdError>,
67        {
68            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
69            Ok(Self::new(conn))
70        }
71    }
72    impl<T> TemporaryCredentialsServiceClient<T>
73    where
74        T: tonic::client::GrpcService<tonic::body::Body>,
75        T::Error: Into<StdError>,
76        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
77        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
78    {
79        pub fn new(inner: T) -> Self {
80            let inner = tonic::client::Grpc::new(inner);
81            Self { inner }
82        }
83        pub fn with_origin(inner: T, origin: Uri) -> Self {
84            let inner = tonic::client::Grpc::with_origin(inner, origin);
85            Self { inner }
86        }
87        pub fn with_interceptor<F>(
88            inner: T,
89            interceptor: F,
90        ) -> TemporaryCredentialsServiceClient<InterceptedService<T, F>>
91        where
92            F: tonic::service::Interceptor,
93            T::ResponseBody: Default,
94            T: tonic::codegen::Service<
95                http::Request<tonic::body::Body>,
96                Response = http::Response<
97                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
98                >,
99            >,
100            <T as tonic::codegen::Service<
101                http::Request<tonic::body::Body>,
102            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
103        {
104            TemporaryCredentialsServiceClient::new(
105                InterceptedService::new(inner, interceptor),
106            )
107        }
108        /// Compress requests with the given encoding.
109        ///
110        /// This requires the server to support it otherwise it might respond with an
111        /// error.
112        #[must_use]
113        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
114            self.inner = self.inner.send_compressed(encoding);
115            self
116        }
117        /// Enable decompressing responses.
118        #[must_use]
119        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
120            self.inner = self.inner.accept_compressed(encoding);
121            self
122        }
123        /// Limits the maximum size of a decoded message.
124        ///
125        /// Default: `4MB`
126        #[must_use]
127        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
128            self.inner = self.inner.max_decoding_message_size(limit);
129            self
130        }
131        /// Limits the maximum size of an encoded message.
132        ///
133        /// Default: `usize::MAX`
134        #[must_use]
135        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
136            self.inner = self.inner.max_encoding_message_size(limit);
137            self
138        }
139        pub async fn create_temporary_credentials(
140            &mut self,
141            request: impl tonic::IntoRequest<super::CreateTemporaryCredentialsRequest>,
142        ) -> std::result::Result<
143            tonic::Response<super::CreateTemporaryCredentialsResponse>,
144            tonic::Status,
145        > {
146            self.inner
147                .ready()
148                .await
149                .map_err(|e| {
150                    tonic::Status::unknown(
151                        format!("Service was not ready: {}", e.into()),
152                    )
153                })?;
154            let codec = tonic::codec::ProstCodec::default();
155            let path = http::uri::PathAndQuery::from_static(
156                "/nominal.authentication.temporary_credentials.v1.TemporaryCredentialsService/CreateTemporaryCredentials",
157            );
158            let mut req = request.into_request();
159            req.extensions_mut()
160                .insert(
161                    GrpcMethod::new(
162                        "nominal.authentication.temporary_credentials.v1.TemporaryCredentialsService",
163                        "CreateTemporaryCredentials",
164                    ),
165                );
166            self.inner.unary(req, path, codec).await
167        }
168    }
169}