gitea_sdk/api/issues/comments/
get.rs

1use crate::{error::Result, model::issues::Comment, Client};
2
3#[derive(Debug, Clone)]
4pub struct GetCommentBuilder {
5    owner: String,
6    repo: String,
7    comment: i64,
8}
9
10impl GetCommentBuilder {
11    pub fn new(owner: impl ToString, repo: impl ToString, comment: i64) -> Self {
12        Self {
13            comment,
14            owner: owner.to_string(),
15            repo: repo.to_string(),
16        }
17    }
18
19    /// Sends the request to get a comment on an issue.
20    pub async fn send(self, client: &Client) -> Result<Comment> {
21        let owner = &self.owner;
22        let repo = &self.repo;
23        let comment = self.comment;
24        let req = client
25            .get(format!("repos/{owner}/{repo}/issues/comments/{comment}"))
26            .build()?;
27        let res = client.make_request(req).await?;
28        client.parse_response(res).await
29    }
30}