From d5d4c4492e0e6dbf7b2f2dcdcbf5de66f8fab010 Mon Sep 17 00:00:00 2001 From: stupidcomputer Date: Wed, 9 Oct 2024 06:19:01 -0500 Subject: [PATCH] experimentia 3 --- bridge/webgit.py | 50 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/bridge/webgit.py b/bridge/webgit.py index c1d6f15..2d273ad 100644 --- a/bridge/webgit.py +++ b/bridge/webgit.py @@ -52,22 +52,6 @@ class WebgitClient: }, ) - def create_webhook(self, owner, repo_name, http_endpoint, events: list[str]): - return self.post( - self.api_prefix + "/repos/{}/{}/hooks".format( - owner, - repo_name, - ), - json={ - "name": "web", - "config": { - "url": http_endpoint, - "content_type": "json", - }, - "events": events, - }, - ) - def create_issue(self, owner, repo_name, title, body): return self.post( self.api_prefix + "/repos/{}/{}/issues".format( @@ -133,6 +117,22 @@ class Github(WebgitClient): } self.api_prefix = "https://api.github.com" + def create_webhook(self, owner, repo_name, http_endpoint, events: list[str]): + return self.post( + self.api_prefix + "/repos/{}/{}/hooks".format( + owner, + repo_name, + ), + json={ + "name": "web", + "config": { + "url": http_endpoint, + "content_type": "json", + }, + "events": events, + }, + ) + @dataclass class Gitea(WebgitClient): """ @@ -166,4 +166,20 @@ class Gitea(WebgitClient): owner, repo_name ), - ) \ No newline at end of file + ) + + def create_webhook(self, owner, repo_name, http_endpoint, events: list[str]): + return self.post( + self.api_prefix + "/repos/{}/{}/hooks".format( + owner, + repo_name, + ), + json={ + "config": { + "url": http_endpoint, + "content_type": "json", + }, + "events": events, + "type": "gitea", + }, + )