gimpey_db_gateway/generated/
refresh_token.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct GeoLocation {
4    #[prost(string, optional, tag = "1")]
5    pub country: ::core::option::Option<::prost::alloc::string::String>,
6    #[prost(string, optional, tag = "2")]
7    pub region: ::core::option::Option<::prost::alloc::string::String>,
8    #[prost(string, optional, tag = "3")]
9    pub city: ::core::option::Option<::prost::alloc::string::String>,
10}
11#[derive(Clone, PartialEq, ::prost::Message)]
12pub struct Device {
13    #[prost(string, optional, tag = "1")]
14    pub model: ::core::option::Option<::prost::alloc::string::String>,
15    #[prost(string, optional, tag = "2")]
16    pub os: ::core::option::Option<::prost::alloc::string::String>,
17    #[prost(string, optional, tag = "3")]
18    pub screen: ::core::option::Option<::prost::alloc::string::String>,
19}
20#[derive(Clone, PartialEq, ::prost::Message)]
21pub struct Browser {
22    #[prost(string, optional, tag = "1")]
23    pub name: ::core::option::Option<::prost::alloc::string::String>,
24    #[prost(string, optional, tag = "2")]
25    pub version: ::core::option::Option<::prost::alloc::string::String>,
26    #[prost(string, optional, tag = "3")]
27    pub engine: ::core::option::Option<::prost::alloc::string::String>,
28}
29#[derive(Clone, PartialEq, ::prost::Message)]
30pub struct Meta {
31    #[prost(string, optional, tag = "1")]
32    pub ip_address: ::core::option::Option<::prost::alloc::string::String>,
33    #[prost(message, optional, tag = "2")]
34    pub geo_location: ::core::option::Option<GeoLocation>,
35    #[prost(message, optional, tag = "3")]
36    pub device: ::core::option::Option<Device>,
37    #[prost(message, optional, tag = "4")]
38    pub browser: ::core::option::Option<Browser>,
39}
40/// This is synced to the `refresh_token` table in the database.
41#[derive(Clone, PartialEq, ::prost::Message)]
42pub struct RefreshToken {
43    #[prost(string, tag = "1")]
44    pub id: ::prost::alloc::string::String,
45    #[prost(string, tag = "2")]
46    pub session_id: ::prost::alloc::string::String,
47    #[prost(string, tag = "3")]
48    pub account_id: ::prost::alloc::string::String,
49    #[prost(string, tag = "4")]
50    pub token_hash: ::prost::alloc::string::String,
51    #[prost(string, tag = "5")]
52    pub fingerprint_hash: ::prost::alloc::string::String,
53    #[prost(string, tag = "6")]
54    pub user_agent: ::prost::alloc::string::String,
55    #[prost(message, optional, tag = "7")]
56    pub issued_at: ::core::option::Option<::prost_types::Timestamp>,
57    #[prost(message, optional, tag = "8")]
58    pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
59    #[prost(string, optional, tag = "9")]
60    pub rotated_from: ::core::option::Option<::prost::alloc::string::String>,
61    #[prost(bool, tag = "10")]
62    pub is_revoked: bool,
63    #[prost(message, optional, tag = "11")]
64    pub meta: ::core::option::Option<Meta>,
65}
66#[derive(Clone, PartialEq, ::prost::Message)]
67pub struct CreateRefreshTokenRequest {
68    #[prost(string, tag = "1")]
69    pub session_id: ::prost::alloc::string::String,
70    #[prost(string, tag = "2")]
71    pub account_id: ::prost::alloc::string::String,
72    #[prost(string, tag = "3")]
73    pub token_hash: ::prost::alloc::string::String,
74    #[prost(string, tag = "4")]
75    pub fingerprint_hash: ::prost::alloc::string::String,
76    #[prost(string, tag = "5")]
77    pub user_agent: ::prost::alloc::string::String,
78    #[prost(uint64, tag = "6")]
79    pub issued_at: u64,
80    #[prost(uint64, tag = "7")]
81    pub expires_at: u64,
82    #[prost(message, optional, tag = "8")]
83    pub meta: ::core::option::Option<Meta>,
84}
85#[derive(Clone, PartialEq, ::prost::Message)]
86pub struct CreateRefreshTokenResponse {
87    #[prost(string, tag = "1")]
88    pub id: ::prost::alloc::string::String,
89}
90#[derive(Clone, PartialEq, ::prost::Message)]
91pub struct GetRefreshTokenRequest {
92    #[prost(string, tag = "1")]
93    pub token_hash: ::prost::alloc::string::String,
94}
95#[derive(Clone, PartialEq, ::prost::Message)]
96pub struct GetRefreshTokenResponse {
97    #[prost(string, tag = "1")]
98    pub id: ::prost::alloc::string::String,
99    #[prost(string, tag = "2")]
100    pub session_id: ::prost::alloc::string::String,
101    #[prost(string, tag = "3")]
102    pub account_id: ::prost::alloc::string::String,
103    #[prost(string, tag = "4")]
104    pub fingerprint_hash: ::prost::alloc::string::String,
105    #[prost(string, tag = "5")]
106    pub user_agent: ::prost::alloc::string::String,
107    #[prost(uint64, tag = "6")]
108    pub expires_at: u64,
109}
110/// Generated client implementations.
111pub mod refresh_token_service_client {
112    #![allow(
113        unused_variables,
114        dead_code,
115        missing_docs,
116        clippy::wildcard_imports,
117        clippy::let_unit_value,
118    )]
119    use tonic::codegen::*;
120    use tonic::codegen::http::Uri;
121    #[derive(Debug, Clone)]
122    pub struct RefreshTokenServiceClient<T> {
123        inner: tonic::client::Grpc<T>,
124    }
125    impl RefreshTokenServiceClient<tonic::transport::Channel> {
126        /// Attempt to create a new client by connecting to a given endpoint.
127        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
128        where
129            D: TryInto<tonic::transport::Endpoint>,
130            D::Error: Into<StdError>,
131        {
132            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
133            Ok(Self::new(conn))
134        }
135    }
136    impl<T> RefreshTokenServiceClient<T>
137    where
138        T: tonic::client::GrpcService<tonic::body::Body>,
139        T::Error: Into<StdError>,
140        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
141        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
142    {
143        pub fn new(inner: T) -> Self {
144            let inner = tonic::client::Grpc::new(inner);
145            Self { inner }
146        }
147        pub fn with_origin(inner: T, origin: Uri) -> Self {
148            let inner = tonic::client::Grpc::with_origin(inner, origin);
149            Self { inner }
150        }
151        pub fn with_interceptor<F>(
152            inner: T,
153            interceptor: F,
154        ) -> RefreshTokenServiceClient<InterceptedService<T, F>>
155        where
156            F: tonic::service::Interceptor,
157            T::ResponseBody: Default,
158            T: tonic::codegen::Service<
159                http::Request<tonic::body::Body>,
160                Response = http::Response<
161                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
162                >,
163            >,
164            <T as tonic::codegen::Service<
165                http::Request<tonic::body::Body>,
166            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
167        {
168            RefreshTokenServiceClient::new(InterceptedService::new(inner, interceptor))
169        }
170        /// Compress requests with the given encoding.
171        ///
172        /// This requires the server to support it otherwise it might respond with an
173        /// error.
174        #[must_use]
175        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
176            self.inner = self.inner.send_compressed(encoding);
177            self
178        }
179        /// Enable decompressing responses.
180        #[must_use]
181        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
182            self.inner = self.inner.accept_compressed(encoding);
183            self
184        }
185        /// Limits the maximum size of a decoded message.
186        ///
187        /// Default: `4MB`
188        #[must_use]
189        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
190            self.inner = self.inner.max_decoding_message_size(limit);
191            self
192        }
193        /// Limits the maximum size of an encoded message.
194        ///
195        /// Default: `usize::MAX`
196        #[must_use]
197        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
198            self.inner = self.inner.max_encoding_message_size(limit);
199            self
200        }
201        pub async fn create_refresh_token(
202            &mut self,
203            request: impl tonic::IntoRequest<super::CreateRefreshTokenRequest>,
204        ) -> std::result::Result<
205            tonic::Response<super::CreateRefreshTokenResponse>,
206            tonic::Status,
207        > {
208            self.inner
209                .ready()
210                .await
211                .map_err(|e| {
212                    tonic::Status::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                "/refresh_token.RefreshTokenService/CreateRefreshToken",
219            );
220            let mut req = request.into_request();
221            req.extensions_mut()
222                .insert(
223                    GrpcMethod::new(
224                        "refresh_token.RefreshTokenService",
225                        "CreateRefreshToken",
226                    ),
227                );
228            self.inner.unary(req, path, codec).await
229        }
230        pub async fn get_refresh_token(
231            &mut self,
232            request: impl tonic::IntoRequest<super::GetRefreshTokenRequest>,
233        ) -> std::result::Result<
234            tonic::Response<super::GetRefreshTokenResponse>,
235            tonic::Status,
236        > {
237            self.inner
238                .ready()
239                .await
240                .map_err(|e| {
241                    tonic::Status::unknown(
242                        format!("Service was not ready: {}", e.into()),
243                    )
244                })?;
245            let codec = tonic::codec::ProstCodec::default();
246            let path = http::uri::PathAndQuery::from_static(
247                "/refresh_token.RefreshTokenService/GetRefreshToken",
248            );
249            let mut req = request.into_request();
250            req.extensions_mut()
251                .insert(
252                    GrpcMethod::new(
253                        "refresh_token.RefreshTokenService",
254                        "GetRefreshToken",
255                    ),
256                );
257            self.inner.unary(req, path, codec).await
258        }
259    }
260}