mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-07-24 23:17:43 +00:00
Add styple guide and clean user routes
This commit is contained in:
parent
f4c51d4298
commit
9b271c297d
1 changed files with 24 additions and 5 deletions
|
@ -32,13 +32,19 @@ class RateLimits(NamedTuple):
|
||||||
reset_time: Optional[datetime]
|
reset_time: Optional[datetime]
|
||||||
last_request: Optional[datetime]
|
last_request: Optional[datetime]
|
||||||
|
|
||||||
|
# ====== STYLE GUIDE ===== #
|
||||||
|
# All route method names should be
|
||||||
|
# The exact same from the GitHub API
|
||||||
|
# Docs, excluding 'the', 'a' etc
|
||||||
|
# Names should be shortened, e.g:
|
||||||
|
# Information -> Info
|
||||||
|
# Repository -> Repo
|
||||||
|
|
||||||
# ========= TODO ========= #
|
# ========= TODO ========= #
|
||||||
# Make a good paginator
|
# Make a good paginator
|
||||||
# Make objects for all API Types
|
# Make objects for all API Types
|
||||||
# Make the requests return TypedDicts with those objects
|
# Make the requests return TypedDicts with those objects
|
||||||
# Make specific errors
|
# Make specific errors
|
||||||
# Make route /users/{username}/hovercard
|
|
||||||
# Make it so an error gets raised when the cooldown is reached
|
# Make it so an error gets raised when the cooldown is reached
|
||||||
# Make markdown raw request route (???)
|
# Make markdown raw request route (???)
|
||||||
|
|
||||||
|
@ -198,10 +204,10 @@ class HTTPClient:
|
||||||
|
|
||||||
# === USERS === #
|
# === USERS === #
|
||||||
|
|
||||||
async def get_logged_in_user(self):
|
async def get_authenticated_user(self):
|
||||||
return await self.request("GET", "/user")
|
return await self.request("GET", "/user")
|
||||||
|
|
||||||
async def update_logged_in_user(
|
async def update_authenticated_user(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
name: Optional[str] = None,
|
name: Optional[str] = None,
|
||||||
|
@ -247,8 +253,21 @@ class HTTPClient:
|
||||||
async def get_user(self, *, username: str):
|
async def get_user(self, *, username: str):
|
||||||
return await self.request("GET", f"/users/{username}")
|
return await self.request("GET", f"/users/{username}")
|
||||||
|
|
||||||
# TODO: /users/{username}/hovercard
|
async def get_context_info_for_user(
|
||||||
# IDK what to name it
|
self,
|
||||||
|
*,
|
||||||
|
username: str,
|
||||||
|
subject_type: Optional[Literal["organization", "repository", "user", "pull_request"]] = None,
|
||||||
|
subject_id: Optional[int] = None,
|
||||||
|
):
|
||||||
|
params = {}
|
||||||
|
|
||||||
|
if subject_type:
|
||||||
|
params["subject_type"] = subject_type
|
||||||
|
if subject_id:
|
||||||
|
params["subject_id"] = subject_id
|
||||||
|
|
||||||
|
return await self.request("GET", f"/users/{username}/hovercard", params=params)
|
||||||
|
|
||||||
# === REPOS === #
|
# === REPOS === #
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue