From 36781699c135b3a4cd89973ef2f5079f123a0567 Mon Sep 17 00:00:00 2001 From: Erin Congden Date: Sun, 2 Apr 2017 20:20:38 -0700 Subject: Add (un)muting accounts and reading mutes/blocks --- mastodon/Mastodon.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'mastodon') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 641c415..1c9ca4b 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -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 ### -- cgit v1.2.3