gitea_sdk/api/issues/comments/
get.rs

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