From da859de4571ded886f7275b3ecbe311ebec7e239 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Mon, 30 Jul 2018 15:16:46 +0200 Subject: Muting / Hide Reblogs changes --- mastodon/Mastodon.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'mastodon') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 9a9b2d9..05c6f26 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -162,7 +162,7 @@ class Mastodon: __DICT_VERSION_INSTANCE = bigger_version("2.3.0", __DICT_VERSION_ACCOUNT) __DICT_VERSION_HASHTAG = "1.0.0" __DICT_VERSION_EMOJI = "2.1.0" - __DICT_VERSION_RELATIONSHIP = "1.4.0" + __DICT_VERSION_RELATIONSHIP = "2.3.4" __DICT_VERSION_NOTIFICATION = bigger_version(bigger_version("1.0.0", __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS) __DICT_VERSION_CONTEXT = bigger_version("1.0.0", __DICT_VERSION_STATUS) __DICT_VERSION_LIST = "2.1.0" @@ -1267,16 +1267,23 @@ class Mastodon: ### # Writing data: Accounts ### - @api_version("1.0.0", "1.4.0", __DICT_VERSION_RELATIONSHIP) - def account_follow(self, id): + @api_version("1.0.0", "2.3.4", __DICT_VERSION_RELATIONSHIP) + def account_follow(self, id, reblogs=True): """ Follow a user. + Set "reblogs" to False to hide boosts by the followed user. + Returns a `relationship dict`_ containing the updated relationship to the user. """ id = self.__unpack_id(id) + params = self.__generate_params(locals()) + + if params["reblogs"] == None: + del params["reblogs"] + url = '/api/v1/accounts/{0}/follow'.format(str(id)) - return self.__api_request('POST', url) + return self.__api_request('POST', url, params) @api_version("1.0.0", "2.1.0", __DICT_VERSION_ACCOUNT) def follows(self, uri): @@ -1321,11 +1328,14 @@ class Mastodon: url = '/api/v1/accounts/{0}/unblock'.format(str(id)) return self.__api_request('POST', url) - @api_version("1.1.0", "1.4.0", __DICT_VERSION_RELATIONSHIP) - def account_mute(self, id): + @api_version("1.1.0", "2.3.4", __DICT_VERSION_RELATIONSHIP) + def account_mute(self, id, notifications=True): """ Mute a user. + Set "notifications" to False to receive notifications even though the user is + muted from timelines. + Returns a `relationship dict`_ containing the updated relationship to the user. """ id = self.__unpack_id(id) -- cgit v1.2.3