Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
add docstrings for bans/calendar methods
Browse files Browse the repository at this point in the history
  • Loading branch information
SecondThundeR committed Apr 17, 2022
1 parent 5a36643 commit 2dc8aea
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions shikithon/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,18 @@ def get_anime_topics(self, anime_id: int, page: int = 1, limit: int = 1, kind: S
return [Topic(**topic) for topic in res]

def get_bans_list(self, page: int = 1, limit: int = 1) -> list[Ban]:
"""
Returns list of recent bans on Shikimori.
Current API method returns `limit + 1` elements, if API has next page.
Parameters:
page (int): Number of page (Defaults to 1)
limit (int): Number of results (Default to 1)
Returns:
list[Ban]: list of recent bans
"""
if page < 1 or page > 100000:
page = 1

Expand All @@ -363,6 +375,15 @@ def get_bans_list(self, page: int = 1, limit: int = 1) -> list[Ban]:
return [Ban(**ban) for ban in res]

def get_current_calendar(self, censored: Censorship = Censorship.CENSORED) -> list[CalendarEvent]:
"""
Returns current calendar events.
Parameters:
censored (Censorship): Status of censorship (Defaults to Censorship.CENSORED)
Returns:
list[CalendarEvent]: list of calendar events
"""
query: Dict[str, str] = {
"censored": censored.value
}
Expand Down

0 comments on commit 2dc8aea

Please sign in to comment.