Added follow requests support

This commit is contained in:
Erin Congden 2017-04-02 20:53:32 -07:00
pare 38ebcda76b
commit ca0b6c115b
S'han modificat 2 arxius amb 47 adicions i 0 eliminacions

Veure arxiu

@ -99,6 +99,7 @@ User dicts
'header': URL for their header image
'id': Same as <numerical id>
'username': The username (what you @ them with)
'locked': Denotes whether the account can be followed without a follow request
}
Toot dicts
@ -140,6 +141,7 @@ Relationship dicts
'id': Numerical id (same one as <numerical id>)
'blocking': Boolean denoting whether you are blocking them
'muting': Boolean denoting whether you are muting them
'requested': Boolean denoting whether you have sent them a follow request
}
Notification dicts
@ -254,6 +256,13 @@ by the authenticated user.
.. authomethod:: Mastodon.favourites
Reading data: Follow requests
-----------------------------
This function allows you to get a list of pending incoming follow
requests for the authenticated user.
.. automethod:: Mastodon.follow_requests
Writing data: Statuses
----------------------
These functions allow you to post statuses to Mastodon and to
@ -279,6 +288,13 @@ These functions allow you to interact with other accounts: To (un)follow and
.. automethod:: Mastodon.account_mute
.. automethod:: Mastodon.account_unmute
Writing data: Follow requests
-----------------------------
These functions allow you to accept or reject incoming follow requests.
.. automethod:: Mastodon.follow_request_authorize
.. automethod:: Mastodon.follow_request_reject
Writing data: Media
-------------------
This function allows you to upload media to Mastodon. The returned

Veure arxiu

@ -359,6 +359,18 @@ class Mastodon:
"""
return self.__api_request('GET', '/api/v1/favourites')
###
# Reading data: Follow requests
###
def follow_requests(self, max_id = None, since_id = None, limit = None):
"""
Fetch the authenticated user's incoming follow requests.
Returns a list of user dicts.
"""
params = self.__generate_params(locals())
return self.__api_request('GET', '/api/v1/follow_requests', params)
###
# Writing data: Statuses
###
@ -509,6 +521,25 @@ class Mastodon:
"""
return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unmute")
###
# Writing data: Follow requests
###
def follow_request_authorize(self, id):
"""
Accept an incoming follow request.
Returns a user dict of the authorized account.
"""
return self.__api_request('POST', '/api/v1/follow_requests/' + str(id) + "/authorize")
def follow_request_reject(self, id):
"""
Reject an incoming follow request.
Returns a user dict of the rejected account.
"""
return self.__api_request('POST', '/api/v1/follow_requests/' + str(id) + "/reject")
###
# Writing data: Media
###