From f745f6fd29a2ec12b404b2b2c51239205ec0cb55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20N=C3=B8rgaard?= Date: Sun, 24 Mar 2024 00:31:42 +0000 Subject: [PATCH] add new check upload approval endpoint --- hondana/client.py | 20 ++++++++++++++++++++ hondana/http.py | 9 +++++++++ hondana/types_/upload.py | 12 ++++++++++++ 3 files changed, 41 insertions(+) diff --git a/hondana/client.py b/hondana/client.py index 1f8d819..da3f7d9 100644 --- a/hondana/client.py +++ b/hondana/client.py @@ -4088,3 +4088,23 @@ async def get_subscriptions( break return CustomListCollection(self._http, data, lists) + + @require_authentication + async def check_upload_approval_required(self, *, manga_id: str, locale: common.LanguageCode) -> bool: + """|coro| + + This method will check if moderator approval will be required for uploading to a manga. + + Parameters + ----------- + manga_id: :class:`str` + The ID of the manga we will be checking against. + locale: :class:`hondana.types_.common.LanguageCode` + The locale we will be uploading. + + Returns + -------- + :class:`bool` + """ + data = await self._http.check_approval_required(manga_id, locale) + return data["requiresApproval"] diff --git a/hondana/http.py b/hondana/http.py index cf6c9dd..3d6a225 100755 --- a/hondana/http.py +++ b/hondana/http.py @@ -2256,3 +2256,12 @@ def get_subscription_list( query["includes"] = includes.to_query() return self.request(route, params=query) + + def check_approval_required( + self, manga_id: str, locale: common.LanguageCode + ) -> Response[upload.GetCheckApprovalRequired]: + route = Route("POST", "/upload/check-approval-required") + + query: dict[str, Any] = {"manga": manga_id, "locale": locale} + + return self.request(route, json=query) diff --git a/hondana/types_/upload.py b/hondana/types_/upload.py index a92e82c..8176fe8 100644 --- a/hondana/types_/upload.py +++ b/hondana/types_/upload.py @@ -40,6 +40,7 @@ "UploadedChapterPageAttributes", "UploadedChapterDataResponse", "UploadedChapterResponse", + "GetCheckApprovalRequired", ) @@ -185,3 +186,14 @@ class UploadedChapterResponse(TypedDict): result: Literal["ok", "error"] errors: list[ErrorType] data: list[UploadedChapterDataResponse] + + +class GetCheckApprovalRequired(TypedDict): + """ + result: Literal[``"ok"``, ``"error"``] + + requiresApproval: :class:`bool` + """ + + result: Literal["ok", "error"] + requiresApproval: bool