commit:     5be6334cad6979cb6e8578cbbfab9c01a2d2bb12
Author:     Thomas Bracht Laumann Jespersen <t <AT> laumann <DOT> xyz>
AuthorDate: Sat Mar 14 15:18:55 2026 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Mar 14 15:31:05 2026 +0000
URL:        
https://gitweb.gentoo.org/proj/assign-pull-requests.git/commit/?id=5be6334c

codebergapi: add request_review()

On Codeberg, reviews can be requested of teams, not just single
users. The teams must be specified with just their names, the
organization is implied by the organization that owns the repository.

Signed-off-by: Thomas Bracht Laumann Jespersen <t <AT> laumann.xyz>
Part-of: https://github.com/gentoo/assign-pull-requests/pull/12
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 codebergapi.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/codebergapi.py b/codebergapi.py
index 0bc296a..2bb5cc2 100644
--- a/codebergapi.py
+++ b/codebergapi.py
@@ -103,6 +103,15 @@ class CodebergAPI:
     def delete_comment(self, comment_id: int) -> None:
         
self.session.delete(f"{self.repos_baseurl}/issues/comments/{comment_id}")
 
+    def request_review(
+        self, pr_id, reviewers: list[str] = [], team_reviewers: list[str] = []
+    ) -> None:
+        # 
https://codeberg.org/api/swagger#/repository/repoCreatePullReviewRequests
+        self.session.post(
+            f"{self.repos_baseurl}/pulls/{pr_id}/requested_reviewers",
+            json={"reviewers": reviewers, "team_reviewers": team_reviewers},
+        )
+
     def teams(self, org: str) -> Generator[None, dict, None]:
         # https://codeberg.org/api/swagger#/organization/orgListTeams
         #

Reply via email to