Skip to content

Commit

Permalink
Edit Comments on Issues (#33)
Browse files Browse the repository at this point in the history
* just update comment

* Update src/api/issues.rs
  • Loading branch information
4meta5 authored Aug 18, 2020
1 parent 3fcb166 commit c688267
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/api/issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<str>,
) -> Result<models::issues::Comment> {
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<()> {
Expand Down

0 comments on commit c688267

Please sign in to comment.