experimentia 3

This commit is contained in:
stupidcomputer 2024-10-09 06:19:01 -05:00
parent 024d1e9e54
commit d5d4c4492e

View File

@ -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):
"""
@ -167,3 +167,19 @@ class Gitea(WebgitClient):
repo_name
),
)
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",
},
)