From 07b8758d61a9a01064913a739e314dbcc34b0b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ben=20P=C3=BCschel?= Date: Fri, 30 Aug 2024 14:40:21 +0200 Subject: [PATCH] feat: Support `remove_assignees` on issue API Refs: #631 --- src/api/issues.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/api/issues.rs b/src/api/issues.rs index 90ffb1a9..f10494cf 100644 --- a/src/api/issues.rs +++ b/src/api/issues.rs @@ -233,6 +233,31 @@ impl<'octo> IssueHandler<'octo> { .await } + /// Removes one or more assignees from an issue. + /// ```no_run + /// # async fn run() -> octocrab::Result<()> { + /// # let octocrab = octocrab::Octocrab::default(); + /// let issue = octocrab.issues("owner", "repo").remove_assignees(101, &["username1", "username2"]).await?; + /// # Ok(()) + /// # } + /// ``` + pub async fn remove_assignees( + &self, + number: u64, + assignees: &[&str], + ) -> Result { + let route = format!( + "/repos/{owner}/{repo}/issues/{issue}/assignees", + owner = self.owner, + repo = self.repo, + issue = number + ); + + self.crab + .delete(route, Some(&serde_json::json!({ "assignees": assignees }))) + .await + } + /// Checks if a user has permission to be assigned to an issue in /// the repository. /// ```no_run