mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-31 04:58:12 +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]
|
||||
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 ========= #
|
||||
# Make a good paginator
|
||||
# Make objects for all API Types
|
||||
# Make the requests return TypedDicts with those objects
|
||||
# Make specific errors
|
||||
# Make route /users/{username}/hovercard
|
||||
# Make it so an error gets raised when the cooldown is reached
|
||||
# Make markdown raw request route (???)
|
||||
|
||||
|
@ -198,10 +204,10 @@ class HTTPClient:
|
|||
|
||||
# === USERS === #
|
||||
|
||||
async def get_logged_in_user(self):
|
||||
async def get_authenticated_user(self):
|
||||
return await self.request("GET", "/user")
|
||||
|
||||
async def update_logged_in_user(
|
||||
async def update_authenticated_user(
|
||||
self,
|
||||
*,
|
||||
name: Optional[str] = None,
|
||||
|
@ -247,8 +253,21 @@ class HTTPClient:
|
|||
async def get_user(self, *, username: str):
|
||||
return await self.request("GET", f"/users/{username}")
|
||||
|
||||
# TODO: /users/{username}/hovercard
|
||||
# IDK what to name it
|
||||
async def get_context_info_for_user(
|
||||
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 === #
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue