2022-11-30 23:39:08 +00:00
|
|
|
# suggestions.py - follow suggestion endpoints
|
|
|
|
|
2023-06-19 21:35:03 +00:00
|
|
|
from mastodon.versions import _DICT_VERSION_ACCOUNT
|
|
|
|
from mastodon.utility import api_version
|
2022-11-30 23:39:08 +00:00
|
|
|
|
2023-06-19 21:35:03 +00:00
|
|
|
from mastodon.internals import Mastodon as Internals
|
|
|
|
from mastodon.types import NonPaginatableList, Account, IdType
|
|
|
|
from typing import Union
|
2023-01-02 13:39:16 +00:00
|
|
|
|
2022-11-30 23:39:08 +00:00
|
|
|
class Mastodon(Internals):
|
|
|
|
###
|
|
|
|
# Reading data: Follow suggestions
|
|
|
|
###
|
|
|
|
@api_version("2.4.3", "2.4.3", _DICT_VERSION_ACCOUNT)
|
2023-06-19 21:35:03 +00:00
|
|
|
def suggestions(self) -> NonPaginatableList[Account]:
|
2022-11-30 23:39:08 +00:00
|
|
|
"""
|
|
|
|
Fetch follow suggestions for the logged-in user.
|
|
|
|
"""
|
|
|
|
return self.__api_request('GET', '/api/v1/suggestions')
|
|
|
|
|
|
|
|
###
|
|
|
|
# Writing data: Follow suggestions
|
|
|
|
###
|
|
|
|
@api_version("2.4.3", "2.4.3", _DICT_VERSION_ACCOUNT)
|
2023-06-19 21:35:03 +00:00
|
|
|
def suggestion_delete(self, account_id: Union[Account, IdType]):
|
2022-11-30 23:39:08 +00:00
|
|
|
"""
|
|
|
|
Remove the user with the given `account_id` from the follow suggestions.
|
|
|
|
"""
|
|
|
|
account_id = self.__unpack_id(account_id)
|
2022-12-02 21:04:23 +00:00
|
|
|
self.__api_request('DELETE', f'/api/v1/suggestions/{account_id}')
|