experimentia 3

This commit is contained in:
stupidcomputer 2024-10-09 06:19:01 -05:00
parent 024d1e9e54
commit d5d4c4492e
1 changed files with 33 additions and 17 deletions

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):
"""
@ -166,4 +166,20 @@ class Gitea(WebgitClient):
owner,
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",
},
)