Skip to content

Commit

Permalink
add new check upload approval endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
AbstractUmbra committed Mar 24, 2024
1 parent 5a196bc commit f745f6f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
20 changes: 20 additions & 0 deletions hondana/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
9 changes: 9 additions & 0 deletions hondana/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
12 changes: 12 additions & 0 deletions hondana/types_/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"UploadedChapterPageAttributes",
"UploadedChapterDataResponse",
"UploadedChapterResponse",
"GetCheckApprovalRequired",
)


Expand Down Expand Up @@ -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

0 comments on commit f745f6f

Please sign in to comment.