pocketbase_rs/records/auth/mod.rs
1use serde::Deserialize;
2
3pub mod auth_refresh;
4pub mod auth_refresh_for_user;
5pub mod auth_with_password;
6pub mod impersonate;
7pub mod request_verification;
8
9/// Stores authentication details for a `PocketBase` user.
10///
11/// The `AuthStore` struct holds the authenticated user's record and a token
12/// used for making authenticated requests to the `PocketBase` API.
13#[derive(Clone, Debug, Deserialize)]
14pub struct AuthStore {
15 /// The authenticated user's record.
16 pub record: AuthStoreRecord,
17 /// The authentication token.
18 pub token: String,
19}
20
21/// Represents the details of an authenticated user's record.
22///
23/// The `AuthStoreRecord` struct contains information about the user,
24/// such as their ID, email, etc. and other metadata related to the
25/// collection they belong to.
26#[derive(Clone, Debug, Deserialize)]
27#[serde(rename_all = "camelCase")]
28pub struct AuthStoreRecord {
29 /// The user's unique ID.
30 pub id: String,
31 /// The ID of the collection the user belongs to.
32 pub collection_id: String,
33 /// The name of the collection the user belongs to.
34 pub collection_name: String,
35 /// The timestamp when the record was created.
36 pub created: String,
37 /// The timestamp when the record was last updated.
38 pub updated: String,
39 /// The user's email address.
40 pub email: String,
41 /// Indicates whether the user's email is publicly visible.
42 pub email_visibility: bool,
43 /// Indicates whether the user's email has been verified.
44 pub verified: bool,
45}