1
Fork 0
mirror of https://github.com/RGBCube/GitHubWrapper synced 2025-07-12 17:17:35 +00:00

add http.data meth and make owner optional in delete_repo and fix repo licenses

This commit is contained in:
VarMonke 2022-04-17 11:26:55 +05:30
parent f75886bc92
commit cc44cb67e5
3 changed files with 22 additions and 8 deletions

View file

@ -60,7 +60,12 @@ class GHClient:
async def update_auth(self, username: str, token: str) -> None:
"""Allows you to input auth information after instantiating the client."""
await self.http.update_auth(username, token)
#check if username and token is valid
await self.http.update_auth(username=username, token=token)
try:
await self.http.get_self()
except exceptions.InvalidToken as exc:
raise exceptions.InvalidToken from exc
async def start(self) -> 'GHClient':
"""Main entry point to the wrapper, this creates the ClientSession."""
@ -124,7 +129,7 @@ class GHClient:
async def create_repo(self, name: str, description: str = 'Repository created using Github-Api-Wrapper.', public: bool = False,gitignore: str = None, license: str = None) -> Repository:
return Repository(await self.http.create_repo(name,description,public,gitignore,license), self.http.session)
async def delete_repo(self, owner: str = None, repo: str= None) -> None:
async def delete_repo(self, repo: str= None, owner: str = None) -> None:
"""Delete a Github repository, requires authorisation."""
owner = owner or self.username
return await self.http.delete_repo(owner, repo)