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 --- docs/index.rst | 4 ++++ mastodon/Mastodon.py | 22 ++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index c930523..ad6584e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -338,10 +338,14 @@ Relationship dicts 'followed_by': # Boolean denoting whether the specified user follows the logged-in user 'blocking': # Boolean denoting whether the logged-in user has blocked the specified user 'muting': # Boolean denoting whether the logged-in user has muted the specified user + 'muting_notifications': # Boolean denoting wheter the logged-in user has muted notifications + # related to the specified user 'requested': # Boolean denoting whether the logged-in user has sent the specified # user a follow request 'domain_blocking': # Boolean denoting whether the logged-in user has blocked the # specified users domain + 'showing_reblogs': # Boolean denoting whether the specified users reblogs show up on the + # logged-in users Timeline } Notification dicts 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