akahu_client/models/
me.rs

1//! User profile models for the Akahu API.
2
3use serde::{Deserialize, Serialize};
4
5use crate::UserId;
6
7/// Represents the authenticated user's profile information.
8///
9/// This model contains basic information about the user who authorized your application.
10/// The availability of certain fields (such as email) depends on whether your application
11/// has been granted the appropriate scopes (e.g., `AKAHU` scope for email access).
12///
13/// [<https://developers.akahu.nz/reference/get_me>]
14#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
15pub struct User {
16    /// The unique identifier for the user in the Akahu system.
17    ///
18    /// [<https://developers.akahu.nz/reference/get_me>]
19    #[serde(rename = "_id")]
20    pub id: UserId,
21
22    /// The timestamp when this user account was created.
23    ///
24    /// This represents when the user first registered with Akahu.
25    ///
26    /// [<https://developers.akahu.nz/reference/get_me>]
27    pub created_at: chrono::DateTime<chrono::Utc>,
28
29    /// The user's first name.
30    ///
31    /// This is the first name the user provided when registering with Akahu.
32    ///
33    /// [<https://developers.akahu.nz/reference/get_me>]
34    #[serde(default, skip_serializing_if = "Option::is_none")]
35    pub first_name: Option<String>,
36
37    /// The user's last name.
38    ///
39    /// This is the last name the user provided when registering with Akahu.
40    ///
41    /// [<https://developers.akahu.nz/reference/get_me>]
42    #[serde(default, skip_serializing_if = "Option::is_none")]
43    pub last_name: Option<String>,
44
45    /// The user's email address.
46    ///
47    /// This is the email address the user used to register their Akahu account.
48    ///
49    /// **Note:** This field is only visible if your application has been granted
50    /// the `AKAHU` scope, which provides access to the user's profile information.
51    ///
52    /// [<https://developers.akahu.nz/reference/get_me>]
53    #[serde(default, skip_serializing_if = "Option::is_none")]
54    pub email: Option<String>,
55
56    /// The timestamp when the user granted access to your application.
57    ///
58    /// This represents when the user authorized your app through the OAuth flow.
59    ///
60    /// [<https://developers.akahu.nz/reference/get_me>]
61    #[serde(default, skip_serializing_if = "Option::is_none")]
62    pub access_granted_at: Option<chrono::DateTime<chrono::Utc>>,
63}