sendgrid2/request/
delete_subusers_subuser_name_monitor.rs1use serde_json::json;
2use crate::model::*;
3use crate::SendgridClient;
4pub struct DeleteSubusersSubuserNameMonitorRequest<'a> {
8 pub(crate) client: &'a SendgridClient,
9 pub subuser_name: String,
10}
11impl<'a> DeleteSubusersSubuserNameMonitorRequest<'a> {
12 pub async fn send(self) -> anyhow::Result<serde_json::Value> {
13 let mut r = self
14 .client
15 .client
16 .delete(
17 &format!(
18 "/v3/subusers/{subuser_name}/monitor", subuser_name = self
19 .subuser_name
20 ),
21 );
22 r = self.client.authenticate(r);
23 let res = r.send().await.unwrap().error_for_status();
24 match res {
25 Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
26 Err(res) => {
27 let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
28 Err(anyhow::anyhow!("{:?}", text))
29 }
30 }
31 }
32}