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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
use serde::{Deserialize, Serialize};
/// Request body for `create_inbox`. All fields optional; the API
/// generates a username when none is given.
#[derive(Clone, Debug, Default, Serialize)]
pub struct CreateInbox {
/// Local part of the address; random when omitted.
#[serde(skip_serializing_if = "Option::is_none")]
pub username: Option<String>,
/// A verified domain (or subdomain of one); defaults to `agentmail.to`.
#[serde(skip_serializing_if = "Option::is_none")]
pub domain: Option<String>,
/// Human-readable sender name shown in email clients.
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
/// Your own idempotency/reference id for this inbox.
#[serde(skip_serializing_if = "Option::is_none")]
pub client_id: Option<String>,
/// Initial traffic state: `active` (default) or `paused`.
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
/// Arbitrary JSON stored alongside the inbox.
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<serde_json::Value>,
}
/// Request body for `update_inbox`. Fields left `None` are omitted
/// and stay unchanged; set `metadata` to `Some(Value::Null)` to clear it.
#[derive(Clone, Debug, Default, Serialize)]
pub struct UpdateInbox {
/// Replace the human-readable sender name.
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
/// `active` to resume traffic, `paused` to hold it.
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
/// Replace the stored metadata.
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<serde_json::Value>,
}
/// An agent-owned inbox, as the API returns it.
#[derive(Clone, Debug, Deserialize)]
pub struct Inbox {
/// Unique id, used in every message call.
pub inbox_id: String,
/// The address itself, e.g. `my-agent@agentmail.to`.
pub email: String,
/// Human-readable sender name, when set.
#[serde(default)]
pub display_name: Option<String>,
/// Owning pod, when the account uses pods.
#[serde(default)]
pub pod_id: Option<String>,
/// Your reference id from creation, when set.
#[serde(default)]
pub client_id: Option<String>,
/// Whether the inbox accepts traffic: `active` or `paused`.
#[serde(default)]
pub status: Option<String>,
/// Arbitrary JSON stored alongside the inbox.
#[serde(default)]
pub metadata: Option<serde_json::Value>,
/// RFC 3339 last-update timestamp.
#[serde(default)]
pub updated_at: Option<String>,
/// RFC 3339 creation timestamp.
#[serde(default)]
pub created_at: Option<String>,
}
/// One page of inboxes from `list_inboxes_page`.
#[derive(Clone, Debug, Deserialize)]
pub struct InboxList {
/// Total inboxes in the account (not just this page).
pub count: u64,
/// This page of inboxes.
#[serde(default)]
pub inboxes: Vec<Inbox>,
/// Cursor for the next page; `None` on the last page.
#[serde(default)]
pub next_page_token: Option<String>,
}
/// Body for `authorize_inbox`: complete a human authorization started in the
/// browser. The `auth_token` comes from that flow.
#[derive(Clone, Debug, Default, Serialize)]
pub struct AuthorizeInbox {
/// The one-time token from the browser authorization flow.
pub auth_token: String,
/// Confirm the app's disclosure on the human's behalf.
#[serde(skip_serializing_if = "Option::is_none")]
pub accept_disclosure: Option<bool>,
}
/// The response to `authorize_inbox`.
#[derive(Clone, Debug, Deserialize)]
pub struct AuthorizeInboxResult {
/// The API key minted for the authorized inbox.
pub api_key_id: String,
/// What to do next (return to the browser).
pub instructions: String,
}