feat!: get_reactionをget_reactionsに変更

feat: get_reactionsに足りていない引数を追加
feat/v13/notes
yupix 10 months ago
parent 42c1a0b21c
commit 835efe3b96
No known key found for this signature in database
GPG Key ID: 2FF705F5C56D9C06

@ -392,12 +392,19 @@ class ClientNoteActions(AbstractAction):
)
return Note(res["created_note"], client=self._client)
async def get_reaction(
self, note_id: str | None = None, reaction: str | None = None
async def get_reactions(
self,
note_id: str | None = None,
reaction: str | None = None,
*,
limit: int = 10,
since_id: str | None = None,
until_id: str | None = None,
) -> list[NoteReaction]:
note_id = note_id or self._note_id
return await self._client.note.reaction.action.get_reaction(
reaction=reaction, note_id=note_id
return await self._client.note.reaction.action.get_reactions(
reaction=reaction, note_id=note_id, limit=limit, since_id=since_id, until_id=until_id
)
)
async def reply(

@ -52,11 +52,30 @@ class ReactionActions(AbstractAction):
res: bool = await self.__session.request(route, json=data, auth=True, lower=True)
return bool(res)
async def get_reaction(
self, reaction: str | None = None, note_id: str | None = None, *, limit: int = 10
@cache(group="get_note_reaction")
async def get_reactions(
self,
note_id: str | None = None,
reaction: str | None = None,
*,
limit: int = 10,
since_id: str | None = None,
until_id: str | None = None,
) -> list[NoteReaction]:
note_id = note_id or self.__note_id
data = remove_dict_empty({"noteId": note_id, "limit": limit, "type": reaction})
if note_id is None:
raise ValueError("note_id is required.")
data = remove_dict_empty(
{
"noteId": note_id,
"limit": limit,
"type": reaction,
"sinceId": since_id,
"untilId": until_id,
}
)
res: list[INoteReaction] = await self.__session.request(
Route("POST", "/api/notes/reactions"),
json=data,

Loading…
Cancel
Save