Skip to content

Commit

Permalink
feat: MuteUserをMutedUserに変更
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Feb 9, 2024
1 parent 3a9707f commit d6f494d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions mipac/actions/mute.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from mipac.abstract.action import AbstractAction
from mipac.errors.base import ParameterError
from mipac.http import HTTPClient, Route
from mipac.models.mute import MuteUser
from mipac.types.mute import IMuteUser
from mipac.models.mute import MutedUser
from mipac.types.mute import IMutedUser
from mipac.utils.format import remove_dict_empty
from mipac.utils.pagination import Pagination

Expand Down Expand Up @@ -70,7 +70,7 @@ async def gets(
since_id: str | None = None,
until_id: str | None = None,
get_all: bool = True,
) -> AsyncGenerator[MuteUser, None]:
) -> AsyncGenerator[MutedUser, None]:
if limit > 100:
raise ParameterError("limit は100以下である必要があります")

Expand All @@ -79,14 +79,14 @@ async def gets(

body = remove_dict_empty({"limit": limit, "sinceId": since_id, "untilId": until_id})

pagination = Pagination[IMuteUser](
pagination = Pagination[IMutedUser](
self._session, Route("POST", "/api/mute/list"), json=body
)

while True:
raw_mute_users = await pagination.next()
for raw_mute_user in raw_mute_users:
yield MuteUser(raw_mute_user, client=self._client)
yield MutedUser(raw_mute_user, client=self._client)

if get_all is False or pagination.is_final:
break
14 changes: 7 additions & 7 deletions mipac/models/mute.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
from typing import TYPE_CHECKING

from mipac.models.user import UserDetailedNotMe
from mipac.types.mute import IMuteUser
from mipac.types.mute import IMutedUser
from mipac.utils.format import str_to_datetime

if TYPE_CHECKING:
from mipac.manager.client import ClientManager


class MuteUser:
def __init__(self, raw_mute_user: IMuteUser, *, client: ClientManager) -> None:
self.__raw_mute_user: IMuteUser = raw_mute_user
class MutedUser:
def __init__(self, raw_mute_user: IMutedUser, *, client: ClientManager) -> None:
self.__raw_mute_user: IMutedUser = raw_mute_user
self.__client: ClientManager = client

@property
Expand All @@ -40,8 +40,8 @@ def mutee_id(self) -> str:
def mutee(self) -> UserDetailedNotMe:
return UserDetailedNotMe(self.__raw_mute_user["mutee"], client=self.__client)

def __eq__(self, __value: MuteUser) -> bool:
return isinstance(__value, MuteUser) and self.id == __value.id
def __eq__(self, __value: MutedUser) -> bool:
return isinstance(__value, MutedUser) and self.id == __value.id

def __ne__(self, __value: MuteUser) -> bool:
def __ne__(self, __value: MutedUser) -> bool:
return not self.__eq__(__value)
2 changes: 1 addition & 1 deletion mipac/types/mute.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from mipac.types.user import IUserDetailed


class IMuteUser(TypedDict):
class IMutedUser(TypedDict):
id: str
created_at: str
expires_at: str | None
Expand Down

0 comments on commit d6f494d

Please sign in to comment.