Skip to content

Commit

Permalink
chore: FollowActions.remove メソッドを非推奨に、代わりにdeleteメソッドを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Feb 21, 2024
1 parent 69c89a7 commit df2ba4f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions mipac/actions/follow.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,26 @@ async def add(self, *, user_id: str) -> PartialUser:
"""
return await self.create(user_id=user_id)

async def delete(self, *, user_id: str) -> PartialUser:
data = {"userId": user_id}
raw_user: IPartialUser = await self._session.request(
Route("POST", "/api/following/delete"), json=data, auth=True
)
return PartialUser(raw_user=raw_user, client=self._client)

@deprecated
async def remove(self, *, user_id: str) -> PartialUser:
"""
Unfollow a user
"""対象のユーザーのフォローを解除します
.. deprecated:: 0.6.1
Use :meth:`mipac.actions.follow.SharedFollowActions.delete` instead.
Returns
-------
PartialUser
The user that you unfollowed
"""
data = {"userId": user_id}
raw_user: IPartialUser = await self._session.request(
Route("POST", "/api/following/delete"), json=data, auth=True
)
return PartialUser(raw_user=raw_user, client=self._client)
return await self.delete(user_id=user_id)

async def invalidate(self, *, user_id: str) -> PartialUser:
"""
Expand Down Expand Up @@ -89,6 +95,10 @@ async def add(self, *, user_id: str | None = None) -> PartialUser:

return await super().add(user_id=user_id)

@override
async def delete(self, *, user_id: str) -> PartialUser:
return await super().delete(user_id=user_id)

@override
async def remove(self, *, user_id: str | None = None) -> PartialUser:
user_id = user_id or self.__user_id
Expand Down

0 comments on commit df2ba4f

Please sign in to comment.