agentmail/types/agent.rs
1use serde::{Deserialize, Serialize};
2
3/// Request body for `agent_sign_up`: start onboarding a new agent, which
4/// emails a one-time code to `human_email` when given. `username` is the only
5/// required field; without `human_email` the inbox is created unattached to a
6/// human (attach one later with [`crate::Client::agent_attach_human`]).
7#[derive(Clone, Debug, Default, Serialize)]
8pub struct AgentSignup {
9 /// The human's email, which receives the verification code.
10 #[serde(skip_serializing_if = "Option::is_none")]
11 pub human_email: Option<String>,
12 /// The desired inbox username.
13 pub username: String,
14 /// Where the signup originated, optional.
15 #[serde(skip_serializing_if = "Option::is_none")]
16 pub source: Option<String>,
17 /// Referrer, optional.
18 #[serde(skip_serializing_if = "Option::is_none")]
19 pub referrer: Option<String>,
20}
21
22/// The response to `agent_sign_up`: the new organization, inbox, and
23/// its API key.
24#[derive(Clone, Debug, Deserialize)]
25pub struct AgentSignupResult {
26 /// The new organization id.
27 pub organization_id: String,
28 /// The new inbox id.
29 pub inbox_id: String,
30 /// The new inbox's API key.
31 pub api_key: String,
32}
33
34/// The result of `agent_verify`.
35#[derive(Clone, Debug, Deserialize)]
36pub struct AgentVerifyResult {
37 /// Whether the one-time code was accepted.
38 pub verified: bool,
39}
40
41/// Request body for `agent_attach_human`: email a claim link that connects a
42/// human to this agent's organization.
43#[derive(Clone, Debug, Default, Serialize)]
44pub struct AgentAttachHuman {
45 /// The human's email; they receive the claim link.
46 pub human_email: String,
47}
48
49/// The response to `agent_attach_human`.
50#[derive(Clone, Debug, Deserialize)]
51pub struct AgentAttachHumanResult {
52 /// The email the claim link was sent to.
53 pub human_email: String,
54 /// What to tell the human to do next.
55 pub instructions: String,
56}