diff options
-rw-r--r-- | docs/index.rst | 11 | ||||
-rw-r--r-- | mastodon/Mastodon.py | 35 |
2 files changed, 46 insertions, 0 deletions
diff --git a/docs/index.rst b/docs/index.rst index 90e8478..f9915e6 100644 --- a/docs/index.rst +++ b/docs/index.rst | |||
@@ -139,6 +139,7 @@ Relationship dicts | |||
139 | 'following': Boolean denoting whether you follow them | 139 | 'following': Boolean denoting whether you follow them |
140 | 'id': Numerical id (same one as <numerical id>) | 140 | 'id': Numerical id (same one as <numerical id>) |
141 | 'blocking': Boolean denoting whether you are blocking them | 141 | 'blocking': Boolean denoting whether you are blocking them |
142 | 'muting': Boolean denoting whether you are muting them | ||
142 | } | 143 | } |
143 | 144 | ||
144 | Notification dicts | 145 | Notification dicts |
@@ -238,6 +239,14 @@ their relationships. | |||
238 | .. automethod:: Mastodon.account_relationships | 239 | .. automethod:: Mastodon.account_relationships |
239 | .. automethod:: Mastodon.account_search | 240 | .. automethod:: Mastodon.account_search |
240 | 241 | ||
242 | Reading data: Mutes and blocks | ||
243 | ------------------------------ | ||
244 | These functions allow you to get information about accounts that are | ||
245 | muted or blocked by the logged in user. | ||
246 | |||
247 | .. automethod:: Mastodon.mutes | ||
248 | .. automethod:: Mastodon.blocks | ||
249 | |||
241 | Writing data: Statuses | 250 | Writing data: Statuses |
242 | ---------------------- | 251 | ---------------------- |
243 | These functions allow you to post statuses to Mastodon and to | 252 | 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 | |||
260 | .. automethod:: Mastodon.account_unfollow | 269 | .. automethod:: Mastodon.account_unfollow |
261 | .. automethod:: Mastodon.account_block | 270 | .. automethod:: Mastodon.account_block |
262 | .. automethod:: Mastodon.account_unblock | 271 | .. automethod:: Mastodon.account_unblock |
272 | .. automethod:: Mastodon.account_mute | ||
273 | .. automethod:: Mastodon.account_unmute | ||
263 | 274 | ||
264 | Writing data: Media | 275 | Writing data: Media |
265 | ------------------- | 276 | ------------------- |
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 641c415..1c9ca4b 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -330,6 +330,25 @@ class Mastodon: | |||
330 | return self.__api_request('GET', '/api/v1/accounts/search', params) | 330 | return self.__api_request('GET', '/api/v1/accounts/search', params) |
331 | 331 | ||
332 | ### | 332 | ### |
333 | # Reading data: Mutes and Blocks | ||
334 | ### | ||
335 | def mutes(self): | ||
336 | """ | ||
337 | Fetch a list of users muted by the authenticated user. | ||
338 | |||
339 | Returns a list of user dicts. | ||
340 | """ | ||
341 | return self.__api_request('GET', '/api/v1/mutes') | ||
342 | |||
343 | def blocks(self): | ||
344 | """ | ||
345 | Fetch a list of users blocked by the authenticated user. | ||
346 | |||
347 | Returns a list of user dicts. | ||
348 | """ | ||
349 | return self.__api_request('GET', '/api/v1/blocks') | ||
350 | |||
351 | ### | ||
333 | # Writing data: Statuses | 352 | # Writing data: Statuses |
334 | ### | 353 | ### |
335 | def status_post(self, status, in_reply_to_id = None, media_ids = None, sensitive = False, visibility = '', spoiler_text = None): | 354 | def status_post(self, status, in_reply_to_id = None, media_ids = None, sensitive = False, visibility = '', spoiler_text = None): |
@@ -462,6 +481,22 @@ class Mastodon: | |||
462 | """ | 481 | """ |
463 | return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unblock") | 482 | return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unblock") |
464 | 483 | ||
484 | def account_mute(self, id): | ||
485 | """ | ||
486 | Mute a user. | ||
487 | |||
488 | Returns a relationship dict containing the updated relationship to the user. | ||
489 | """ | ||
490 | return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/mute") | ||
491 | |||
492 | def account_unmute(self, id): | ||
493 | """ | ||
494 | Unmute a user. | ||
495 | |||
496 | Returns a relationship dict containing the updated relationship to the user. | ||
497 | """ | ||
498 | return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unmute") | ||
499 | |||
465 | ### | 500 | ### |
466 | # Writing data: Media | 501 | # Writing data: Media |
467 | ### | 502 | ### |