From 6903a345486bde8dad4b1da227606b3483edf9e0 Mon Sep 17 00:00:00 2001 From: George Garrington Date: Thu, 10 Oct 2024 16:43:55 +0200 Subject: [PATCH] Initial commit, implementing API call --- src/github/api/write.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/github/api/write.rs b/src/github/api/write.rs index 02d0000..82c6f21 100644 --- a/src/github/api/write.rs +++ b/src/github/api/write.rs @@ -392,6 +392,20 @@ impl GitHubWrite { Ok(()) } + pub(crate) fn remove_user_from_organization( + &self, + org: &str, + user: &str, + ) -> anyhow::Result<()> { + if !self.dry_run { + let method = Method::DELETE; + let url = &format!("/orgs/{org}/members/{user}"); + let response = self.client.req(method.clone(), url)?.send()?; + allow_not_found(response, method, url)?; + } + Ok(()) + } + /// Create or update a branch protection. pub(crate) fn upsert_branch_protection( &self,