harvest_api/request/
delete_user_assignment.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 DeleteUserAssignmentRequest<'a> {
8    pub(crate) client: &'a HarvestClient,
9    pub project_id: String,
10    pub user_assignment_id: String,
11}
12impl<'a> DeleteUserAssignmentRequest<'a> {
13    pub async fn send(self) -> anyhow::Result<()> {
14        let mut r = self
15            .client
16            .client
17            .delete(
18                &format!(
19                    "/projects/{project_id}/user_assignments/{user_assignment_id}",
20                    project_id = self.project_id, user_assignment_id = self
21                    .user_assignment_id
22                ),
23            );
24        r = self.client.authenticate(r);
25        let res = r.send().await.unwrap().error_for_status();
26        match res {
27            Ok(res) => Ok(()),
28            Err(res) => {
29                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
30                Err(anyhow::anyhow!("{:?}", text))
31            }
32        }
33    }
34}