Skip to content

Commit

Permalink
feat!: ClientReactionActionsの対象のIDを指定する引数を削除 #140
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Jun 18, 2024
1 parent 54a0ac6 commit 4f965fe
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions mipac/actions/reaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def __init__(self, note_id: str, *, session: HTTPClient, client: ClientManager)
self.__note_id: str = note_id

@override
async def add(self, reaction: str, *, note_id: str | None = None) -> bool:
async def add(self, reaction: str) -> bool:
"""Add reaction to note
Endpoint: `/api/notes/reactions/create`
Expand All @@ -119,37 +119,26 @@ async def add(self, reaction: str, *, note_id: str | None = None) -> bool:
----------
reaction : str
reaction
note_id : str, optional
note id, by default None
Returns
-------
bool
success or not
"""
note_id = note_id or self.__note_id

return await super().add(reaction=reaction, note_id=note_id)
return await super().add(reaction=reaction, note_id=self.__note_id)

@override
async def remove(self, *, note_id: str | None = None) -> bool:
async def remove(self) -> bool:
"""Remove reaction from note
Endpoint: `/api/notes/reactions/delete`
Parameters
----------
note_id : str, optional
note id, by default None
Returns
-------
bool
success or not
"""
note_id = note_id or self.__note_id

return await super().remove(note_id=note_id)
return await super().remove(note_id=self.__note_id)

@override
async def get_reactions(
Expand All @@ -158,13 +147,9 @@ async def get_reactions(
limit: int = 10,
since_id: str | None = None,
until_id: str | None = None,
*,
note_id: str | None = None,
) -> list[NoteReaction]:
note_id = note_id or self.__note_id

return await super().get_reactions(
type=type, note_id=note_id, limit=limit, since_id=since_id, until_id=until_id
type=type, note_id=self.__note_id, limit=limit, since_id=since_id, until_id=until_id
)

@override
Expand All @@ -174,13 +159,9 @@ async def fetch_reactions(
limit: int = 10,
since_id: str | None = None,
until_id: str | None = None,
*,
note_id: str | None = None,
) -> list[NoteReaction]:
note_id = note_id or self.__note_id

return await super().fetch_reactions(
type=type, note_id=note_id, limit=limit, since_id=since_id, until_id=until_id
type=type, note_id=self.__note_id, limit=limit, since_id=since_id, until_id=until_id
)


Expand Down

0 comments on commit 4f965fe

Please sign in to comment.