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

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
SecondThundeR committed Aug 5, 2022
2 parents 18ce30e + 3fb7429 commit 4b85d4c
Show file tree
Hide file tree
Showing 6 changed files with 266 additions and 49 deletions.
282 changes: 236 additions & 46 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "shikithon"
version = "0.8.0"
version = "0.9.0"
description = "Yet another Python wrapper for Shikimori API"
authors = [
"SecondThundeR <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion shikithon/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Contains package version and some magic for importing API object."""
from shikithon.api import API

__version__ = '0.8.0'
__version__ = '0.9.0'
__all__ = ['API']
19 changes: 19 additions & 0 deletions shikithon/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from shikithon.enums.style import OwnerType
from shikithon.enums.topic import (EntryTopics, ForumType, NewsTopics,
TopicLinkedType, TopicsType)
from shikithon.enums.user_rate import UserRateType
from shikithon.enums.video import VideoKind
from shikithon.exceptions import (AccessTokenException, MissingAppName,
MissingAuthCode, MissingClientID,
Expand Down Expand Up @@ -2787,6 +2788,24 @@ def create_user_image(
request_type=RequestType.POST)
return Utils.validate_return_data(response, data_model=CreatedUserImage)

@protected_method('user_rates')
def delete_entire_user_rates(self, user_rate_type: UserRateType):
logger.debug('Executing "/api/user_rates/:type/cleanup" method')
response: Union[Dict[str, Any], int] = self._request(
self._endpoints.user_rates_cleanup(user_rate_type.value),
headers=self._authorization_header,
request_type=RequestType.DELETE)
return Utils.validate_return_data(response)

@protected_method('user_rates')
def reset_all_user_rates(self, user_rate_type: UserRateType):
logger.debug('Executing "/api/user_rates/:type/reset" method')
response: Union[Dict[str, Any], int] = self._request(
self._endpoints.user_rates_reset(user_rate_type.value),
headers=self._authorization_header,
request_type=RequestType.DELETE)
return Utils.validate_return_data(response)

def users(self,
page: Optional[int] = None,
limit: Optional[int] = None) -> Optional[List[User]]:
Expand Down
8 changes: 8 additions & 0 deletions shikithon/enums/user_rate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Enums for /api/user_rates."""
from enum import Enum


class UserRateType(Enum):
"""Contains constants related for getting certain type of user rate."""
ANIME = 'anime'
MANGA = 'manga'
2 changes: 1 addition & 1 deletion shikithon/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ class User(BaseModel):
common_info: Optional[List[str]]
show_comments: Optional[bool]
in_friends: Optional[bool]
is_ignored: Optional[str]
is_ignored: Optional[bool]
stats: Optional[Stats]
style_id: Optional[int]

0 comments on commit 4b85d4c

Please sign in to comment.