mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-07-24 23:17:43 +00:00
Add deploy keys routes
This commit is contained in:
parent
464c830ebc
commit
4e30980514
1 changed files with 30 additions and 2 deletions
|
@ -55,7 +55,7 @@ class RateLimits(NamedTuple):
|
||||||
# Commits
|
# Commits
|
||||||
# Dependabot
|
# Dependabot
|
||||||
# Dependency Graph
|
# Dependency Graph
|
||||||
# Deploy keys
|
# Deploy keys DONE
|
||||||
# Deployments
|
# Deployments
|
||||||
# Emojis DONE
|
# Emojis DONE
|
||||||
# Enterprise administration
|
# Enterprise administration
|
||||||
|
@ -862,4 +862,32 @@ class HTTPClient:
|
||||||
return await self.request("GET", "/codes_of_conduct")
|
return await self.request("GET", "/codes_of_conduct")
|
||||||
|
|
||||||
async def get_code_of_conduct(self, *, key: str):
|
async def get_code_of_conduct(self, *, key: str):
|
||||||
return await self.request("GET", f"/codes_of_conduct/{key}")
|
return await self.request("GET", f"/codes_of_conduct/{key}")
|
||||||
|
|
||||||
|
# === DEPLOY KEYS === #
|
||||||
|
|
||||||
|
async def list_deploy_keys(self, *, owner: str, repo: str, per_page: Optional[int] = None, page: Optional[int] = None):
|
||||||
|
params = {}
|
||||||
|
|
||||||
|
if per_page:
|
||||||
|
params["per_page"] = per_page
|
||||||
|
if page:
|
||||||
|
params["page"] = page
|
||||||
|
|
||||||
|
return await self.request("GET", f"/repos/{owner}/{repo}/keys", params=params)
|
||||||
|
|
||||||
|
async def create_deploy_key(self, *, owner: str, repo: str, title: Optional[str] = None, key: str, read_only: Optional[bool] = None):
|
||||||
|
data = {"key": key}
|
||||||
|
|
||||||
|
if title:
|
||||||
|
data["title"] = title
|
||||||
|
if read_only:
|
||||||
|
data["read_only"] = read_only
|
||||||
|
|
||||||
|
return await self.request("POST", f"/repos/{owner}/{repo}/keys", data=data)
|
||||||
|
|
||||||
|
async def get_deploy_key(self, *, owner: str, repo: str, key_id: int):
|
||||||
|
return await self.request("GET", f"/repos/{owner}/{repo}/keys/{key_id}")
|
||||||
|
|
||||||
|
async def delete_deploy_key(self, *, owner: str, repo: str, key_id: int):
|
||||||
|
return await self.request("DELETE", f"/repos/{owner}/{repo}/keys/{key_id}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue