Add (un)muting accounts and reading mutes/blocks

This commit is contained in:
Erin Congden 2017-04-02 20:20:38 -07:00
pare 9eaf955bfc
commit 36781699c1
S'han modificat 2 arxius amb 46 adicions i 0 eliminacions

Veure arxiu

@ -139,6 +139,7 @@ Relationship dicts
'following': Boolean denoting whether you follow them
'id': Numerical id (same one as <numerical id>)
'blocking': Boolean denoting whether you are blocking them
'muting': Boolean denoting whether you are muting them
}
Notification dicts
@ -238,6 +239,14 @@ their relationships.
.. automethod:: Mastodon.account_relationships
.. automethod:: Mastodon.account_search
Reading data: Mutes and blocks
------------------------------
These functions allow you to get information about accounts that are
muted or blocked by the logged in user.
.. automethod:: Mastodon.mutes
.. automethod:: Mastodon.blocks
Writing data: Statuses
----------------------
These functions allow you to post statuses to Mastodon and to
@ -260,6 +269,8 @@ These functions allow you to interact with other accounts: To (un)follow and
.. automethod:: Mastodon.account_unfollow
.. automethod:: Mastodon.account_block
.. automethod:: Mastodon.account_unblock
.. automethod:: Mastodon.account_mute
.. automethod:: Mastodon.account_unmute
Writing data: Media
-------------------

Veure arxiu

@ -329,6 +329,25 @@ class Mastodon:
params = self.__generate_params(locals())
return self.__api_request('GET', '/api/v1/accounts/search', params)
###
# Reading data: Mutes and Blocks
###
def mutes(self):
"""
Fetch a list of users muted by the authenticated user.
Returns a list of user dicts.
"""
return self.__api_request('GET', '/api/v1/mutes')
def blocks(self):
"""
Fetch a list of users blocked by the authenticated user.
Returns a list of user dicts.
"""
return self.__api_request('GET', '/api/v1/blocks')
###
# Writing data: Statuses
###
@ -462,6 +481,22 @@ class Mastodon:
"""
return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unblock")
def account_mute(self, id):
"""
Mute a user.
Returns a relationship dict containing the updated relationship to the user.
"""
return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/mute")
def account_unmute(self, id):
"""
Unmute a user.
Returns a relationship dict containing the updated relationship to the user.
"""
return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unmute")
###
# Writing data: Media
###