aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py32
1 files changed, 22 insertions, 10 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 57fadb3..896d87d 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -235,7 +235,7 @@ class Mastodon:
235 __DICT_VERSION_HASHTAG = "2.3.4" 235 __DICT_VERSION_HASHTAG = "2.3.4"
236 __DICT_VERSION_EMOJI = "3.0.0" 236 __DICT_VERSION_EMOJI = "3.0.0"
237 __DICT_VERSION_RELATIONSHIP = "3.3.0" 237 __DICT_VERSION_RELATIONSHIP = "3.3.0"
238 __DICT_VERSION_NOTIFICATION = bigger_version(bigger_version("1.0.0", __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS) 238 __DICT_VERSION_NOTIFICATION = bigger_version(bigger_version("3.5.0", __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS)
239 __DICT_VERSION_CONTEXT = bigger_version("1.0.0", __DICT_VERSION_STATUS) 239 __DICT_VERSION_CONTEXT = bigger_version("1.0.0", __DICT_VERSION_STATUS)
240 __DICT_VERSION_LIST = "2.1.0" 240 __DICT_VERSION_LIST = "2.1.0"
241 __DICT_VERSION_CARD = "3.2.0" 241 __DICT_VERSION_CARD = "3.2.0"
@@ -1080,15 +1080,25 @@ class Mastodon:
1080 ### 1080 ###
1081 # Reading data: Notifications 1081 # Reading data: Notifications
1082 ### 1082 ###
1083 @api_version("1.0.0", "2.9.0", __DICT_VERSION_NOTIFICATION) 1083 @api_version("1.0.0", "3.5.0", __DICT_VERSION_NOTIFICATION)
1084 def notifications(self, id=None, account_id=None, max_id=None, min_id=None, since_id=None, limit=None, exclude_types=None, mentions_only=None): 1084 def notifications(self, id=None, account_id=None, max_id=None, min_id=None, since_id=None, limit=None, exclude_types=None, types=None, mentions_only=None):
1085 """ 1085 """
1086 Fetch notifications (mentions, favourites, reblogs, follows) for the logged-in 1086 Fetch notifications (mentions, favourites, reblogs, follows) for the logged-in
1087 user. Pass `account_id` to get only notifications originating from the given account. 1087 user. Pass `account_id` to get only notifications originating from the given account.
1088 1088
1089 Parameter `exclude_types` is an array of the following `follow`, `favourite`, `reblog`, 1089 There are different types of notifications:
1090 `mention`, `poll`, `follow_request`. Specifying `mentions_only` is a deprecated way to 1090 * `follow` - A user followed the logged in user
1091 set `exclude_types` to all but mentions. 1091 * `follow_request` - A user has requested to follow the logged in user (for locked accounts)
1092 * `favourite` - A user favourited a post by the logged in user
1093 * `reblog` - A user reblogged a post by the logged in user
1094 * `mention` - A user mentioned the logged in user
1095 * `poll` - A poll the logged in user created or voted in has ended
1096 * `update` - A status the logged in user has reblogged (and only those, as of 4.0.0) has been edited
1097 * `status` - A user that the logged in user has enabned notifications for has enabled `notify` (see `account_follow()`_)
1098 * `admin.sign_up` - For accounts with appropriate permissions (TODO: document which those are when adding the permission API): A new user has signed up
1099 * `admin.report ` - For accounts with appropriate permissions (TODO: document which those are when adding the permission API): A new report has been received
1100 Parameters `exclude_types` or alternately `types` are array of these types, specifying them will in- or exclude the
1101 types of notifications given. Specifying `mentions_only` is a deprecated way to set `exclude_types` to all but mentions.
1092 1102
1093 Can be passed an `id` to fetch a single notification. 1103 Can be passed an `id` to fetch a single notification.
1094 1104
@@ -1097,11 +1107,13 @@ class Mastodon:
1097 if mentions_only is not None: 1107 if mentions_only is not None:
1098 if exclude_types is not None: 1108 if exclude_types is not None:
1099 if mentions_only: 1109 if mentions_only:
1100 exclude_types = ["follow", "favourite", 1110 if self.verify_minimum_version("3.5.0", cached=True):
1101 "reblog", "poll", "follow_request"] 1111 types = ["mention"]
1112 else:
1113 exclude_types = ["follow", "favourite",
1114 "reblog", "poll", "follow_request"]
1102 else: 1115 else:
1103 raise MastodonIllegalArgumentError( 1116 raise MastodonIllegalArgumentError('Cannot specify exclude_types when mentions_only is present')
1104 'Cannot specify exclude_types when mentions_only is present')
1105 del mentions_only 1117 del mentions_only
1106 1118
1107 if max_id is not None: 1119 if max_id is not None:
Powered by cgit v1.2.3 (git 2.41.0)