agentmail/types/
accounts.rs1use serde::{Deserialize, Serialize};
2
3use crate::util::QueryBuilder;
4
5#[derive(Clone, Debug, Deserialize)]
8pub struct Account {
9 pub account_id: String,
11 pub app_id: String,
13 #[serde(default)]
15 pub app_name: Option<String>,
16 pub inbox_id: String,
18 pub pod_id: String,
20 pub organization_id: String,
22 pub first_signed_in_at: String,
24 pub last_signed_in_at: String,
26 pub sign_in_count: u64,
28 #[serde(default)]
30 pub status: Option<String>,
31 #[serde(default)]
33 pub disabled_at: Option<String>,
34}
35
36#[derive(Clone, Debug, Default)]
39pub struct AccountsListFilters {
40 pub limit: Option<u32>,
42 pub page_token: Option<String>,
44 pub ascending: Option<bool>,
46}
47
48impl AccountsListFilters {
49 pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
50 QueryBuilder::new()
51 .opt("limit", self.limit.as_ref())
52 .opt("page_token", self.page_token.as_ref())
53 .opt("ascending", self.ascending.as_ref())
54 .build()
55 }
56}
57
58#[derive(Clone, Debug, Default, Serialize)]
60pub struct UpdateAccount {
61 #[serde(skip_serializing_if = "Option::is_none")]
63 pub status: Option<String>,
64}
65
66#[derive(Clone, Debug, Deserialize)]
68pub struct AccountList {
69 pub count: u64,
71 #[serde(default)]
73 pub accounts: Vec<Account>,
74 #[serde(default)]
76 pub next_page_token: Option<String>,
77}