io_msgraph/v1/rest/users/contact_folders/
delete.rs1use alloc::format;
7
8use io_http::rfc6750::bearer::HttpAuthBearer;
9use log::{debug, trace};
10use url::Url;
11
12use crate::{
13 coroutine::*,
14 msgraph_try,
15 v1::send::{
16 MSGRAPH_API_BASE, MsgraphNoResponse, MsgraphSend, MsgraphSendError, MsgraphSendOutput,
17 user_path,
18 },
19};
20
21pub struct MsgraphContactFolderDelete {
23 send: MsgraphSend<MsgraphNoResponse>,
24}
25
26impl MsgraphContactFolderDelete {
27 pub fn new(auth: &HttpAuthBearer, user_id: &str, id: &str) -> Result<Self, MsgraphSendError> {
29 debug!("prepare microsoft graph contact folder deletion");
30 trace!("id: {id:?}");
31
32 let user = user_path(user_id);
33 let url = Url::parse(MSGRAPH_API_BASE)?.join(&format!("{user}/contactFolders/{id}"))?;
34 let send = MsgraphSend::delete(auth, url);
35
36 Ok(Self { send })
37 }
38}
39
40impl MsgraphCoroutine for MsgraphContactFolderDelete {
41 type Yield = MsgraphYield;
42 type Return = Result<MsgraphSendOutput<MsgraphNoResponse>, MsgraphSendError>;
43
44 fn resume(&mut self, arg: Option<&[u8]>) -> MsgraphCoroutineState<Self::Yield, Self::Return> {
45 let out = msgraph_try!(&mut self.send, arg);
46 debug!("contact folder deleted");
47 trace!("out: {out:?}");
48 MsgraphCoroutineState::Complete(Ok(out))
49 }
50}