harvest_api/request/
delete_time_entry_external_reference.rs

1use serde_json::json;
2use crate::model::*;
3use crate::HarvestClient;
4/**Create this with the associated client method.
5
6That method takes required values as arguments. Set optional values using builder methods on this struct.*/
7pub struct DeleteTimeEntryExternalReferenceRequest<'a> {
8    pub(crate) client: &'a HarvestClient,
9    pub time_entry_id: String,
10}
11impl<'a> DeleteTimeEntryExternalReferenceRequest<'a> {
12    pub async fn send(self) -> anyhow::Result<()> {
13        let mut r = self
14            .client
15            .client
16            .delete(
17                &format!(
18                    "/time_entries/{time_entry_id}/external_reference", time_entry_id =
19                    self.time_entry_id
20                ),
21            );
22        r = self.client.authenticate(r);
23        let res = r.send().await.unwrap().error_for_status();
24        match res {
25            Ok(res) => Ok(()),
26            Err(res) => {
27                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
28                Err(anyhow::anyhow!("{:?}", text))
29            }
30        }
31    }
32}