From c6882674f95f02f0b02d9dde323444cc354573e4 Mon Sep 17 00:00:00 2001 From: Amar Singh Date: Tue, 18 Aug 2020 04:00:18 -0400 Subject: [PATCH] Edit Comments on Issues (#33) * just update comment * Update src/api/issues.rs --- src/api/issues.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/api/issues.rs b/src/api/issues.rs index 3f3267ae..0e1b2e8f 100644 --- a/src/api/issues.rs +++ b/src/api/issues.rs @@ -531,6 +531,33 @@ impl<'octo> IssueHandler<'octo> { self.crab.get(route, None::<&()>).await } + /// Updates a comment in the issue. + /// ```no_run + /// # async fn run() -> octocrab::Result<()> { + /// let comment = octocrab::instance() + /// .issues("owner", "repo") + /// .update_comment(101, "Beep Boop") + /// .await?; + /// # Ok(()) + /// # } + /// ``` + pub async fn update_comment( + &self, + comment_id: u64, + body: impl AsRef, + ) -> Result { + let route = format!( + "/repos/{owner}/{repo}/issues/comments/{comment_id}", + owner = self.owner, + repo = self.repo, + comment_id = comment_id + ); + + self.crab + .post(route, Some(&serde_json::json!({ "body": body.as_ref() }))) + .await + } + /// Deletes a comment in an issue. /// ```no_run /// # async fn run() -> octocrab::Result<()> {