Add follow suggestions

This commit is contained in:
Lorenz Diener 2018-07-30 16:20:56 +02:00
pare 300c2882ae
commit cf2d0ebc82
S'han modificat 2 arxius amb 39 adicions i 0 eliminacions

Veure arxiu

@ -677,6 +677,11 @@ their relationships.
.. automethod:: Mastodon.account_relationships
.. automethod:: Mastodon.account_search
Reading data: Follow suggestions
--------------------------------
.. automethod:: Mastodon.suggestions
Reading data: Lists
-------------------
These functions allow you to view information about lists.
@ -774,6 +779,11 @@ These functions allow you to interact with other accounts: To (un)follow and
.. automethod:: Mastodon.account_unmute
.. automethod:: Mastodon.account_update_credentials
Writing data: Follow suggestions
--------------------------------
.. automethod:: Mastodon.suggestion_delete
Writing data: Lists
-------------------
These functions allow you to create, maintain and delete lists.

Veure arxiu

@ -832,6 +832,19 @@ class Mastodon:
url = '/api/v1/accounts/{0}/lists'.format(str(id))
return self.__api_request('GET', url, params)
###
# Reading data: Follow suggestions
###
@api_version("2.4.3", "2.4.3", __DICT_VERSION_ACCOUNT)
def suggestions(self):
"""
Fetch follow suggestions for the logged-in user.
Returns a list of `user dicts`_.
"""
return self.__api_request('GET', '/api/v1/suggestions')
###
# Reading data: Searching
###
@ -867,8 +880,11 @@ class Mastodon:
"""
Fetch trending-hashtag information, if the instance provides such information.
Does not require authentication.
Returns a list of `hashtag dicts`_, sorted by the instances trending algorithm,
descending.
"""
return self.__api_request('GET', '/api/v1/trends')
@ -1452,6 +1468,19 @@ class Mastodon:
params = self.__generate_params(params_initial)
return self.__api_request('PATCH', '/api/v1/accounts/update_credentials', params, files=files)
###
# Writing data: Follow suggestions
###
@api_version("2.4.3", "2.4.3", __DICT_VERSION_ACCOUNT)
def suggestion_delete(self, account_id):
"""
Remove a single user from the follow suggestions.
"""
account_id = self.__unpack_id(account_id)
url = '/api/v1/suggestions/{0}'.format(str(account_id))
self.__api_request('DELETE', url)
###
# Writing data: Lists
###