1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize)]
pub struct Auth0User {
pub user_id: String,
pub email: String,
pub email_verified: bool,
pub name: Option<String>,
pub picture: Option<String>,
}
impl Auth0User {
/// Creates a new `Auth0User`.
///
/// This struct is typically deserialized from Auth0 API responses, but
/// `new()` is provided for convenience in tests or manual construction.
///
/// # Parameters
///
/// | Parameter | Type | Description |
/// |------------------|-----------------|--------------------------------------------------|
/// | `user_id` | `String` | Auth0 user ID (e.g. `"auth0|64a1b2c3d4e5f6"`) |
/// | `email` | `String` | User's email address |
/// | `email_verified` | `bool` | Whether the email has been verified |
/// | `name` | `Option<String>`| Full display name, if provided |
/// | `picture` | `Option<String>`| URL of the user's profile picture, if provided |
///
/// # Example
///
/// ```rust
/// use auth0_integration::models::Auth0User;
///
/// let user = Auth0User::new(
/// "auth0|64a1b2c3d4e5f6".to_string(),
/// "jane@example.com".to_string(),
/// true,
/// Some("Jane Doe".to_string()),
/// None,
/// );
/// ```
pub fn new(
user_id: String,
email: String,
email_verified: bool,
name: Option<String>,
picture: Option<String>,
) -> Self {
Self { user_id, email, email_verified, name, picture }
}
}