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", + }, + )