experimentia 3
This commit is contained in:
parent
024d1e9e54
commit
d5d4c4492e
@ -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):
|
def create_issue(self, owner, repo_name, title, body):
|
||||||
return self.post(
|
return self.post(
|
||||||
self.api_prefix + "/repos/{}/{}/issues".format(
|
self.api_prefix + "/repos/{}/{}/issues".format(
|
||||||
@ -133,6 +117,22 @@ class Github(WebgitClient):
|
|||||||
}
|
}
|
||||||
self.api_prefix = "https://api.github.com"
|
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
|
@dataclass
|
||||||
class Gitea(WebgitClient):
|
class Gitea(WebgitClient):
|
||||||
"""
|
"""
|
||||||
@ -167,3 +167,19 @@ class Gitea(WebgitClient):
|
|||||||
repo_name
|
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",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user