From 8637e408f557c69bd73380c0839d285bd1271dd8 Mon Sep 17 00:00:00 2001 From: RGBCube <78925721+RGBCube@users.noreply.github.com> Date: Mon, 27 Jun 2022 14:12:12 +0300 Subject: [PATCH] Add gist comment routes --- github/internals/http.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/github/internals/http.py b/github/internals/http.py index 98c1b85..f7ec551 100644 --- a/github/internals/http.py +++ b/github/internals/http.py @@ -66,7 +66,7 @@ class RateLimits(NamedTuple): # Deployments # Emojis DONE # Enterprise administration -# Gists DONE(1st part) +# Gists DONE # Git database # Gitignore DONE # Interactions @@ -855,6 +855,30 @@ class HTTPClient: return await self.request("GET", f"/users/{username}/gists", params=params) + async def list_gist_comments( + self, *, gist_id: 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"/gists/{gist_id}/comments", params=params) + + async def create_gist_comment(self, *, gist_id: str, body: str): + return await self.request("POST", f"/gists/{gist_id}/comments", json={"body": body}) + + async def get_gist_comment(self, *, gist_id: str, comment_id: str): + return await self.request("GET", f"/gists/{gist_id}/comments/{comment_id}") + + async def update_gist_comment(self, *, gist_id: str, comment_id: str, body: str): + return await self.request("PATCH", f"/gists/{gist_id}/comments/{comment_id}", json={"body": body}) + + async def delete_gist_comment(self, *, gist_id: str, comment_id: str): + return await self.request("DELETE", f"/gists/{gist_id}/comments/{comment_id}") + # === LICENSES === # async def get_all_commonly_used_licenses(self):