pivotal_tracker/
me.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4use crate::{
5	account::{Account, AccountID},
6	client::{Client, RequestError},
7	membership_summary::MembershipSummary,
8	person::Person,
9	personal_settings::PersonalSettings,
10	project::ProjectID,
11	time_zone::TimeZone,
12	workspace::WorkspaceID,
13};
14
15impl Client {
16	pub async fn get_me(&self) -> Result<Me, RequestError> {
17		self
18			.request::<Me, _>(|client, base_url| client.get(format!("{base_url}/me")))
19			.await
20	}
21}
22
23/// [Pivotal Tracker API](https://www.pivotaltracker.com/help/api/rest/v5#me_resource)
24#[derive(Serialize, Deserialize, Debug)]
25pub struct Me {
26	#[serde(flatten)]
27	pub person: Person,
28
29	/// This field is read only.
30	pub account_ids: Option<Vec<AccountID>>,
31	pub accounts: Vec<Account>,
32
33	/// A string that can be used as the API authentication token
34	/// (`X-TrackerToken`) to authenticate future API requests as being on
35	/// behalf of the current user.
36	///
37	/// This field is read only.
38	pub api_token: String,
39	pub created_at: DateTime<Utc>,
40
41	/// `true` if the authenticated user's profile is associated with a Google
42	/// Email identity and the current request is authenticated with that
43	/// identity.
44	///
45	/// This field is read only.
46	pub has_google_identity: bool,
47	pub personal_settings: Option<PersonalSettings>,
48
49	/// This field is read only.
50	pub project_ids: Option<Vec<ProjectID>>,
51	pub projects: Vec<MembershipSummary>,
52
53	/// This field is read only.
54	pub receives_in_app_notifications: bool,
55
56	/// This field is read only.
57	pub time_zone: TimeZone,
58	pub updated_at: DateTime<Utc>,
59
60	/// This field is read only.
61	pub workspace_ids: Option<Vec<WorkspaceID>>,
62}