gitea_sdk/api/issues/comments/
delete.rs

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
use crate::{error::Result, Client};

#[derive(Debug, Clone)]
pub struct DeleteCommentBuilder {
    owner: String,
    repo: String,
    comment: i64,
}

impl DeleteCommentBuilder {
    pub fn new(owner: impl ToString, repo: impl ToString, comment: i64) -> Self {
        Self {
            owner: owner.to_string(),
            repo: repo.to_string(),
            comment,
        }
    }

    /// Sends the request to delete a comment.
    pub async fn send(&self, client: &Client) -> Result<()> {
        let req = client
            .delete(format!(
                "repos/{}/{}/issues/comments/{}",
                self.owner, self.repo, self.comment
            ))
            .build()?;
        let _ = client.make_request(req).await?;
        Ok(())
    }
}