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
use crate::{Client, Error, types::*};
impl Client {
/// POST /v0/agent/sign-up, start onboarding a new agent. Emails a one-time
/// code to `human_email`; confirm it with [`Client::agent_verify`]. Runs
/// before any credential exists, so the client's bearer token (if any) is
/// irrelevant.
pub async fn agent_sign_up(&self, signup: AgentSignup) -> Result<AgentSignupResult, Error> {
self.request(
reqwest::Method::POST,
"/v0/agent/sign-up",
&[],
Some(&signup),
)
.await
}
/// POST /v0/agent/verify, confirm the one-time code from
/// [`Client::agent_sign_up`].
pub async fn agent_verify(&self, otp_code: &str) -> Result<AgentVerifyResult, Error> {
self.request(
reqwest::Method::POST,
"/v0/agent/verify",
&[],
Some(&serde_json::json!({ "otp_code": otp_code })),
)
.await
}
/// POST /v0/agent/human, email a claim link that connects a human to this
/// agent's organization. They complete the link in their browser.
pub async fn agent_attach_human(
&self,
attach: AgentAttachHuman,
) -> Result<AgentAttachHumanResult, Error> {
self.request(reqwest::Method::POST, "/v0/agent/human", &[], Some(&attach))
.await
}
}