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