diff options
author | Lorenz Diener <[email protected]> | 2017-12-11 12:33:30 +0100 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2017-12-11 12:33:30 +0100 |
commit | d87ff6d490023690793a24e58a407b61df07aca5 (patch) | |
tree | 7dd3b9cabf292aaf173959017a46febf5bf146aa /mastodon | |
parent | 3ba917d363fd019fee009955cbae385b3b84319b (diff) | |
download | mastodon.py-d87ff6d490023690793a24e58a407b61df07aca5.tar.gz |
Version all endpoints where such a thing makes sense
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/Mastodon.py | 68 |
1 files changed, 61 insertions, 7 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 06c436d..da21e8e 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -25,7 +25,6 @@ try: | |||
25 | except ImportError: | 25 | except ImportError: |
26 | from urlparse import urlparse | 26 | from urlparse import urlparse |
27 | 27 | ||
28 | |||
29 | """ | 28 | """ |
30 | Version check decorator | 29 | Version check decorator |
31 | """ | 30 | """ |
@@ -253,6 +252,7 @@ class Mastodon: | |||
253 | ### | 252 | ### |
254 | # Reading data: Instances | 253 | # Reading data: Instances |
255 | ### | 254 | ### |
255 | @api_version("1.1.0") | ||
256 | def instance(self): | 256 | def instance(self): |
257 | """ | 257 | """ |
258 | Retrieve basic information about the instance, including the URI and administrative contact email. | 258 | Retrieve basic information about the instance, including the URI and administrative contact email. |
@@ -264,6 +264,7 @@ class Mastodon: | |||
264 | ### | 264 | ### |
265 | # Reading data: Timelines | 265 | # Reading data: Timelines |
266 | ## | 266 | ## |
267 | @api_version("1.0.0") | ||
267 | def timeline(self, timeline="home", max_id=None, since_id=None, limit=None): | 268 | def timeline(self, timeline="home", max_id=None, since_id=None, limit=None): |
268 | """ | 269 | """ |
269 | Fetch statuses, most recent ones first. Timeline can be 'home', 'local', 'public', | 270 | Fetch statuses, most recent ones first. Timeline can be 'home', 'local', 'public', |
@@ -289,7 +290,8 @@ class Mastodon: | |||
289 | params = self.__generate_params(params_initial, ['timeline']) | 290 | params = self.__generate_params(params_initial, ['timeline']) |
290 | url = '/api/v1/timelines/{0}'.format(timeline) | 291 | url = '/api/v1/timelines/{0}'.format(timeline) |
291 | return self.__api_request('GET', url, params) | 292 | return self.__api_request('GET', url, params) |
292 | 293 | ||
294 | @api_version("1.0.0") | ||
293 | def timeline_home(self, max_id=None, since_id=None, limit=None): | 295 | def timeline_home(self, max_id=None, since_id=None, limit=None): |
294 | """ | 296 | """ |
295 | Fetch the authenticated users home timeline (i.e. followed users and self). | 297 | Fetch the authenticated users home timeline (i.e. followed users and self). |
@@ -299,6 +301,7 @@ class Mastodon: | |||
299 | return self.timeline('home', max_id=max_id, since_id=since_id, | 301 | return self.timeline('home', max_id=max_id, since_id=since_id, |
300 | limit=limit) | 302 | limit=limit) |
301 | 303 | ||
304 | @api_version("1.0.0") | ||
302 | def timeline_local(self, max_id=None, since_id=None, limit=None): | 305 | def timeline_local(self, max_id=None, since_id=None, limit=None): |
303 | """ | 306 | """ |
304 | Fetches the local / instance-wide timeline, not including replies. | 307 | Fetches the local / instance-wide timeline, not including replies. |
@@ -308,6 +311,7 @@ class Mastodon: | |||
308 | return self.timeline('local', max_id=max_id, since_id=since_id, | 311 | return self.timeline('local', max_id=max_id, since_id=since_id, |
309 | limit=limit) | 312 | limit=limit) |
310 | 313 | ||
314 | @api_version("1.0.0") | ||
311 | def timeline_public(self, max_id=None, since_id=None, limit=None): | 315 | def timeline_public(self, max_id=None, since_id=None, limit=None): |
312 | """ | 316 | """ |
313 | Fetches the public / visible-network timeline, not including replies. | 317 | Fetches the public / visible-network timeline, not including replies. |
@@ -317,6 +321,7 @@ class Mastodon: | |||
317 | return self.timeline('public', max_id=max_id, since_id=since_id, | 321 | return self.timeline('public', max_id=max_id, since_id=since_id, |
318 | limit=limit) | 322 | limit=limit) |
319 | 323 | ||
324 | @api_version("1.0.0") | ||
320 | def timeline_hashtag(self, hashtag, local=False, max_id=None, since_id=None, limit=None): | 325 | def timeline_hashtag(self, hashtag, local=False, max_id=None, since_id=None, limit=None): |
321 | """ | 326 | """ |
322 | Fetch a timeline of toots with a given hashtag. The hashtag parameter | 327 | Fetch a timeline of toots with a given hashtag. The hashtag parameter |
@@ -348,6 +353,7 @@ class Mastodon: | |||
348 | ### | 353 | ### |
349 | # Reading data: Statuses | 354 | # Reading data: Statuses |
350 | ### | 355 | ### |
356 | @api_version("1.0.0") | ||
351 | def status(self, id): | 357 | def status(self, id): |
352 | """ | 358 | """ |
353 | Fetch information about a single toot. | 359 | Fetch information about a single toot. |
@@ -358,6 +364,7 @@ class Mastodon: | |||
358 | url = '/api/v1/statuses/{0}'.format(str(id)) | 364 | url = '/api/v1/statuses/{0}'.format(str(id)) |
359 | return self.__api_request('GET', url) | 365 | return self.__api_request('GET', url) |
360 | 366 | ||
367 | @api_version("1.0.0") | ||
361 | def status_card(self, id): | 368 | def status_card(self, id): |
362 | """ | 369 | """ |
363 | Fetch a card associated with a status. A card describes an object (such as an | 370 | Fetch a card associated with a status. A card describes an object (such as an |
@@ -369,6 +376,7 @@ class Mastodon: | |||
369 | url = '/api/v1/statuses/{0}/card'.format(str(id)) | 376 | url = '/api/v1/statuses/{0}/card'.format(str(id)) |
370 | return self.__api_request('GET', url) | 377 | return self.__api_request('GET', url) |
371 | 378 | ||
379 | @api_version("1.0.0") | ||
372 | def status_context(self, id): | 380 | def status_context(self, id): |
373 | """ | 381 | """ |
374 | Fetch information about ancestors and descendants of a toot. | 382 | Fetch information about ancestors and descendants of a toot. |
@@ -379,6 +387,7 @@ class Mastodon: | |||
379 | url = '/api/v1/statuses/{0}/context'.format(str(id)) | 387 | url = '/api/v1/statuses/{0}/context'.format(str(id)) |
380 | return self.__api_request('GET', url) | 388 | return self.__api_request('GET', url) |
381 | 389 | ||
390 | @api_version("1.0.0") | ||
382 | def status_reblogged_by(self, id): | 391 | def status_reblogged_by(self, id): |
383 | """ | 392 | """ |
384 | Fetch a list of users that have reblogged a status. | 393 | Fetch a list of users that have reblogged a status. |
@@ -389,6 +398,7 @@ class Mastodon: | |||
389 | url = '/api/v1/statuses/{0}/reblogged_by'.format(str(id)) | 398 | url = '/api/v1/statuses/{0}/reblogged_by'.format(str(id)) |
390 | return self.__api_request('GET', url) | 399 | return self.__api_request('GET', url) |
391 | 400 | ||
401 | @api_version("1.0.0") | ||
392 | def status_favourited_by(self, id): | 402 | def status_favourited_by(self, id): |
393 | """ | 403 | """ |
394 | Fetch a list of users that have favourited a status. | 404 | Fetch a list of users that have favourited a status. |
@@ -402,6 +412,7 @@ class Mastodon: | |||
402 | ### | 412 | ### |
403 | # Reading data: Notifications | 413 | # Reading data: Notifications |
404 | ### | 414 | ### |
415 | @api_version("1.0.0") | ||
405 | def notifications(self, id=None, max_id=None, since_id=None, limit=None): | 416 | def notifications(self, id=None, max_id=None, since_id=None, limit=None): |
406 | """ | 417 | """ |
407 | Fetch notifications (mentions, favourites, reblogs, follows) for the authenticated | 418 | Fetch notifications (mentions, favourites, reblogs, follows) for the authenticated |
@@ -428,6 +439,7 @@ class Mastodon: | |||
428 | ### | 439 | ### |
429 | # Reading data: Accounts | 440 | # Reading data: Accounts |
430 | ### | 441 | ### |
442 | @api_version("1.0.0") | ||
431 | def account(self, id): | 443 | def account(self, id): |
432 | """ | 444 | """ |
433 | Fetch account information by user id. | 445 | Fetch account information by user id. |
@@ -437,7 +449,8 @@ class Mastodon: | |||
437 | id = self.__unpack_id(id) | 449 | id = self.__unpack_id(id) |
438 | url = '/api/v1/accounts/{0}'.format(str(id)) | 450 | url = '/api/v1/accounts/{0}'.format(str(id)) |
439 | return self.__api_request('GET', url) | 451 | return self.__api_request('GET', url) |
440 | 452 | ||
453 | @api_version("1.0.0") | ||
441 | def account_verify_credentials(self): | 454 | def account_verify_credentials(self): |
442 | """ | 455 | """ |
443 | Fetch authenticated user's account information. | 456 | Fetch authenticated user's account information. |
@@ -446,6 +459,7 @@ class Mastodon: | |||
446 | """ | 459 | """ |
447 | return self.__api_request('GET', '/api/v1/accounts/verify_credentials') | 460 | return self.__api_request('GET', '/api/v1/accounts/verify_credentials') |
448 | 461 | ||
462 | @api_version("1.0.0") | ||
449 | def account_statuses(self, id, max_id=None, since_id=None, limit=None): | 463 | def account_statuses(self, id, max_id=None, since_id=None, limit=None): |
450 | """ | 464 | """ |
451 | Fetch statuses by user id. Same options as timeline are permitted. | 465 | Fetch statuses by user id. Same options as timeline are permitted. |
@@ -463,6 +477,7 @@ class Mastodon: | |||
463 | url = '/api/v1/accounts/{0}/statuses'.format(str(id)) | 477 | url = '/api/v1/accounts/{0}/statuses'.format(str(id)) |
464 | return self.__api_request('GET', url, params) | 478 | return self.__api_request('GET', url, params) |
465 | 479 | ||
480 | @api_version("1.0.0") | ||
466 | def account_following(self, id, max_id=None, since_id=None, limit=None): | 481 | def account_following(self, id, max_id=None, since_id=None, limit=None): |
467 | """ | 482 | """ |
468 | Fetch users the given user is following. | 483 | Fetch users the given user is following. |
@@ -480,6 +495,7 @@ class Mastodon: | |||
480 | url = '/api/v1/accounts/{0}/following'.format(str(id)) | 495 | url = '/api/v1/accounts/{0}/following'.format(str(id)) |
481 | return self.__api_request('GET', url, params) | 496 | return self.__api_request('GET', url, params) |
482 | 497 | ||
498 | @api_version("1.0.0") | ||
483 | def account_followers(self, id, max_id=None, since_id=None, limit=None): | 499 | def account_followers(self, id, max_id=None, since_id=None, limit=None): |
484 | """ | 500 | """ |
485 | Fetch users the given user is followed by. | 501 | Fetch users the given user is followed by. |
@@ -496,11 +512,12 @@ class Mastodon: | |||
496 | params = self.__generate_params(locals(), ['id']) | 512 | params = self.__generate_params(locals(), ['id']) |
497 | url = '/api/v1/accounts/{0}/followers'.format(str(id)) | 513 | url = '/api/v1/accounts/{0}/followers'.format(str(id)) |
498 | return self.__api_request('GET', url, params) | 514 | return self.__api_request('GET', url, params) |
499 | 515 | ||
516 | @api_version("1.0.0") | ||
500 | def account_relationships(self, id): | 517 | def account_relationships(self, id): |
501 | """ | 518 | """ |
502 | Fetch relationships (following, followed_by, blocking) of the logged in user to | 519 | Fetch relationship (following, followed_by, blocking, follow requested) of |
503 | a given account. id can be a list. | 520 | the logged in user to a given account. id can be a list. |
504 | 521 | ||
505 | Returns a list of relationship dicts. | 522 | Returns a list of relationship dicts. |
506 | """ | 523 | """ |
@@ -509,6 +526,7 @@ class Mastodon: | |||
509 | return self.__api_request('GET', '/api/v1/accounts/relationships', | 526 | return self.__api_request('GET', '/api/v1/accounts/relationships', |
510 | params) | 527 | params) |
511 | 528 | ||
529 | @api_version("1.0.0") | ||
512 | def account_search(self, q, limit=None): | 530 | def account_search(self, q, limit=None): |
513 | """ | 531 | """ |
514 | Fetch matching accounts. Will lookup an account remotely if the search term is | 532 | Fetch matching accounts. Will lookup an account remotely if the search term is |
@@ -522,6 +540,7 @@ class Mastodon: | |||
522 | ### | 540 | ### |
523 | # Reading data: Searching | 541 | # Reading data: Searching |
524 | ### | 542 | ### |
543 | @api_version("1.1.0") | ||
525 | def search(self, q, resolve=False): | 544 | def search(self, q, resolve=False): |
526 | """ | 545 | """ |
527 | Fetch matching hashtags, accounts and statuses. Will search federated | 546 | Fetch matching hashtags, accounts and statuses. Will search federated |
@@ -535,6 +554,7 @@ class Mastodon: | |||
535 | ### | 554 | ### |
536 | # Reading data: Mutes and Blocks | 555 | # Reading data: Mutes and Blocks |
537 | ### | 556 | ### |
557 | @api_version("1.1.0") | ||
538 | def mutes(self, max_id=None, since_id=None, limit=None): | 558 | def mutes(self, max_id=None, since_id=None, limit=None): |
539 | """ | 559 | """ |
540 | Fetch a list of users muted by the authenticated user. | 560 | Fetch a list of users muted by the authenticated user. |
@@ -550,6 +570,7 @@ class Mastodon: | |||
550 | params = self.__generate_params(locals()) | 570 | params = self.__generate_params(locals()) |
551 | return self.__api_request('GET', '/api/v1/mutes', params) | 571 | return self.__api_request('GET', '/api/v1/mutes', params) |
552 | 572 | ||
573 | @api_version("1.0.0") | ||
553 | def blocks(self, max_id=None, since_id=None, limit=None): | 574 | def blocks(self, max_id=None, since_id=None, limit=None): |
554 | """ | 575 | """ |
555 | Fetch a list of users blocked by the authenticated user. | 576 | Fetch a list of users blocked by the authenticated user. |
@@ -568,6 +589,7 @@ class Mastodon: | |||
568 | ### | 589 | ### |
569 | # Reading data: Reports | 590 | # Reading data: Reports |
570 | ### | 591 | ### |
592 | @api_version("1.1.0") | ||
571 | def reports(self): | 593 | def reports(self): |
572 | """ | 594 | """ |
573 | Fetch a list of reports made by the authenticated user. | 595 | Fetch a list of reports made by the authenticated user. |
@@ -582,6 +604,7 @@ class Mastodon: | |||
582 | ### | 604 | ### |
583 | # Reading data: Favourites | 605 | # Reading data: Favourites |
584 | ### | 606 | ### |
607 | @api_version("1.0.0") | ||
585 | def favourites(self, max_id=None, since_id=None, limit=None): | 608 | def favourites(self, max_id=None, since_id=None, limit=None): |
586 | """ | 609 | """ |
587 | Fetch the authenticated user's favourited statuses. | 610 | Fetch the authenticated user's favourited statuses. |
@@ -600,6 +623,7 @@ class Mastodon: | |||
600 | ### | 623 | ### |
601 | # Reading data: Follow requests | 624 | # Reading data: Follow requests |
602 | ### | 625 | ### |
626 | @api_version("1.0.0") | ||
603 | def follow_requests(self, max_id=None, since_id=None, limit=None): | 627 | def follow_requests(self, max_id=None, since_id=None, limit=None): |
604 | """ | 628 | """ |
605 | Fetch the authenticated user's incoming follow requests. | 629 | Fetch the authenticated user's incoming follow requests. |
@@ -618,6 +642,7 @@ class Mastodon: | |||
618 | ### | 642 | ### |
619 | # Reading data: Domain blocks | 643 | # Reading data: Domain blocks |
620 | ### | 644 | ### |
645 | @api_version("1.4.0") | ||
621 | def domain_blocks(self, max_id=None, since_id=None, limit=None): | 646 | def domain_blocks(self, max_id=None, since_id=None, limit=None): |
622 | """ | 647 | """ |
623 | Fetch the authenticated user's blocked domains. | 648 | Fetch the authenticated user's blocked domains. |
@@ -636,6 +661,7 @@ class Mastodon: | |||
636 | ### | 661 | ### |
637 | # Writing data: Statuses | 662 | # Writing data: Statuses |
638 | ### | 663 | ### |
664 | @api_version("1.0.0") | ||
639 | def status_post(self, status, in_reply_to_id=None, media_ids=None, | 665 | def status_post(self, status, in_reply_to_id=None, media_ids=None, |
640 | sensitive=False, visibility='', spoiler_text=None): | 666 | sensitive=False, visibility='', spoiler_text=None): |
641 | """ | 667 | """ |
@@ -697,6 +723,7 @@ class Mastodon: | |||
697 | params = self.__generate_params(params_initial) | 723 | params = self.__generate_params(params_initial) |
698 | return self.__api_request('POST', '/api/v1/statuses', params) | 724 | return self.__api_request('POST', '/api/v1/statuses', params) |
699 | 725 | ||
726 | @api_version("1.0.0") | ||
700 | def toot(self, status): | 727 | def toot(self, status): |
701 | """ | 728 | """ |
702 | Synonym for status_post that only takes the status text as input. | 729 | Synonym for status_post that only takes the status text as input. |
@@ -707,6 +734,7 @@ class Mastodon: | |||
707 | """ | 734 | """ |
708 | return self.status_post(status) | 735 | return self.status_post(status) |
709 | 736 | ||
737 | @api_version("1.0.0") | ||
710 | def status_delete(self, id): | 738 | def status_delete(self, id): |
711 | """ | 739 | """ |
712 | Delete a status | 740 | Delete a status |
@@ -717,6 +745,7 @@ class Mastodon: | |||
717 | url = '/api/v1/statuses/{0}'.format(str(id)) | 745 | url = '/api/v1/statuses/{0}'.format(str(id)) |
718 | return self.__api_request('DELETE', url) | 746 | return self.__api_request('DELETE', url) |
719 | 747 | ||
748 | @api_version("1.0.0") | ||
720 | def status_reblog(self, id): | 749 | def status_reblog(self, id): |
721 | """ | 750 | """ |
722 | Reblog a status. | 751 | Reblog a status. |
@@ -727,6 +756,7 @@ class Mastodon: | |||
727 | url = '/api/v1/statuses/{0}/reblog'.format(str(id)) | 756 | url = '/api/v1/statuses/{0}/reblog'.format(str(id)) |
728 | return self.__api_request('POST', url) | 757 | return self.__api_request('POST', url) |
729 | 758 | ||
759 | @api_version("1.0.0") | ||
730 | def status_unreblog(self, id): | 760 | def status_unreblog(self, id): |
731 | """ | 761 | """ |
732 | Un-reblog a status. | 762 | Un-reblog a status. |
@@ -737,6 +767,7 @@ class Mastodon: | |||
737 | url = '/api/v1/statuses/{0}/unreblog'.format(str(id)) | 767 | url = '/api/v1/statuses/{0}/unreblog'.format(str(id)) |
738 | return self.__api_request('POST', url) | 768 | return self.__api_request('POST', url) |
739 | 769 | ||
770 | @api_version("1.0.0") | ||
740 | def status_favourite(self, id): | 771 | def status_favourite(self, id): |
741 | """ | 772 | """ |
742 | Favourite a status. | 773 | Favourite a status. |
@@ -747,6 +778,7 @@ class Mastodon: | |||
747 | url = '/api/v1/statuses/{0}/favourite'.format(str(id)) | 778 | url = '/api/v1/statuses/{0}/favourite'.format(str(id)) |
748 | return self.__api_request('POST', url) | 779 | return self.__api_request('POST', url) |
749 | 780 | ||
781 | @api_version("1.0.0") | ||
750 | def status_unfavourite(self, id): | 782 | def status_unfavourite(self, id): |
751 | """ | 783 | """ |
752 | Un-favourite a status. | 784 | Un-favourite a status. |
@@ -756,7 +788,8 @@ class Mastodon: | |||
756 | id = self.__unpack_id(id) | 788 | id = self.__unpack_id(id) |
757 | url = '/api/v1/statuses/{0}/unfavourite'.format(str(id)) | 789 | url = '/api/v1/statuses/{0}/unfavourite'.format(str(id)) |
758 | return self.__api_request('POST', url) | 790 | return self.__api_request('POST', url) |
759 | 791 | ||
792 | @api_version("1.4.0") | ||
760 | def status_mute(self, id): | 793 | def status_mute(self, id): |
761 | """ | 794 | """ |
762 | Mute notifications for a status. | 795 | Mute notifications for a status. |
@@ -767,6 +800,7 @@ class Mastodon: | |||
767 | url = '/api/v1/statuses/{0}/mute'.format(str(id)) | 800 | url = '/api/v1/statuses/{0}/mute'.format(str(id)) |
768 | return self.__api_request('POST', url) | 801 | return self.__api_request('POST', url) |
769 | 802 | ||
803 | @api_version("1.4.0") | ||
770 | def status_unmute(self, id): | 804 | def status_unmute(self, id): |
771 | """ | 805 | """ |
772 | Unmute notifications for a status. | 806 | Unmute notifications for a status. |
@@ -780,6 +814,7 @@ class Mastodon: | |||
780 | ### | 814 | ### |
781 | # Writing data: Notifications | 815 | # Writing data: Notifications |
782 | ### | 816 | ### |
817 | @api_version("1.0.0") | ||
783 | def notifications_clear(self): | 818 | def notifications_clear(self): |
784 | """ | 819 | """ |
785 | Clear out a users notifications | 820 | Clear out a users notifications |
@@ -787,6 +822,7 @@ class Mastodon: | |||
787 | return self.__api_request('POST', '/api/v1/notifications/clear') | 822 | return self.__api_request('POST', '/api/v1/notifications/clear') |
788 | 823 | ||
789 | 824 | ||
825 | @api_version("1.3.0") | ||
790 | def notifications_dismiss(self, id): | 826 | def notifications_dismiss(self, id): |
791 | """ | 827 | """ |
792 | Deletes a single notification | 828 | Deletes a single notification |
@@ -798,6 +834,7 @@ class Mastodon: | |||
798 | ### | 834 | ### |
799 | # Writing data: Accounts | 835 | # Writing data: Accounts |
800 | ### | 836 | ### |
837 | @api_version("1.0.0") | ||
801 | def account_follow(self, id): | 838 | def account_follow(self, id): |
802 | """ | 839 | """ |
803 | Follow a user. | 840 | Follow a user. |
@@ -808,6 +845,7 @@ class Mastodon: | |||
808 | url = '/api/v1/accounts/{0}/follow'.format(str(id)) | 845 | url = '/api/v1/accounts/{0}/follow'.format(str(id)) |
809 | return self.__api_request('POST', url) | 846 | return self.__api_request('POST', url) |
810 | 847 | ||
848 | @api_version("1.0.0") | ||
811 | def follows(self, uri): | 849 | def follows(self, uri): |
812 | """ | 850 | """ |
813 | Follow a remote user by uri (username@domain). | 851 | Follow a remote user by uri (username@domain). |
@@ -817,6 +855,7 @@ class Mastodon: | |||
817 | params = self.__generate_params(locals()) | 855 | params = self.__generate_params(locals()) |
818 | return self.__api_request('POST', '/api/v1/follows', params) | 856 | return self.__api_request('POST', '/api/v1/follows', params) |
819 | 857 | ||
858 | @api_version("1.0.0") | ||
820 | def account_unfollow(self, id): | 859 | def account_unfollow(self, id): |
821 | """ | 860 | """ |
822 | Unfollow a user. | 861 | Unfollow a user. |
@@ -827,6 +866,7 @@ class Mastodon: | |||
827 | url = '/api/v1/accounts/{0}/unfollow'.format(str(id)) | 866 | url = '/api/v1/accounts/{0}/unfollow'.format(str(id)) |
828 | return self.__api_request('POST', url) | 867 | return self.__api_request('POST', url) |
829 | 868 | ||
869 | @api_version("1.0.0") | ||
830 | def account_block(self, id): | 870 | def account_block(self, id): |
831 | """ | 871 | """ |
832 | Block a user. | 872 | Block a user. |
@@ -837,6 +877,7 @@ class Mastodon: | |||
837 | url = '/api/v1/accounts/{0}/block'.format(str(id)) | 877 | url = '/api/v1/accounts/{0}/block'.format(str(id)) |
838 | return self.__api_request('POST', url) | 878 | return self.__api_request('POST', url) |
839 | 879 | ||
880 | @api_version("1.0.0") | ||
840 | def account_unblock(self, id): | 881 | def account_unblock(self, id): |
841 | """ | 882 | """ |
842 | Unblock a user. | 883 | Unblock a user. |
@@ -847,6 +888,7 @@ class Mastodon: | |||
847 | url = '/api/v1/accounts/{0}/unblock'.format(str(id)) | 888 | url = '/api/v1/accounts/{0}/unblock'.format(str(id)) |
848 | return self.__api_request('POST', url) | 889 | return self.__api_request('POST', url) |
849 | 890 | ||
891 | @api_version("1.1.0") | ||
850 | def account_mute(self, id): | 892 | def account_mute(self, id): |
851 | """ | 893 | """ |
852 | Mute a user. | 894 | Mute a user. |
@@ -857,6 +899,7 @@ class Mastodon: | |||
857 | url = '/api/v1/accounts/{0}/mute'.format(str(id)) | 899 | url = '/api/v1/accounts/{0}/mute'.format(str(id)) |
858 | return self.__api_request('POST', url) | 900 | return self.__api_request('POST', url) |
859 | 901 | ||
902 | @api_version("1.1.0") | ||
860 | def account_unmute(self, id): | 903 | def account_unmute(self, id): |
861 | """ | 904 | """ |
862 | Unmute a user. | 905 | Unmute a user. |
@@ -867,6 +910,7 @@ class Mastodon: | |||
867 | url = '/api/v1/accounts/{0}/unmute'.format(str(id)) | 910 | url = '/api/v1/accounts/{0}/unmute'.format(str(id)) |
868 | return self.__api_request('POST', url) | 911 | return self.__api_request('POST', url) |
869 | 912 | ||
913 | @api_version("1.1.1") | ||
870 | def account_update_credentials(self, display_name=None, note=None, | 914 | def account_update_credentials(self, display_name=None, note=None, |
871 | avatar=None, header=None): | 915 | avatar=None, header=None): |
872 | """ | 916 | """ |
@@ -883,6 +927,7 @@ class Mastodon: | |||
883 | ### | 927 | ### |
884 | # Writing data: Reports | 928 | # Writing data: Reports |
885 | ### | 929 | ### |
930 | @api_version("1.1.0") | ||
886 | def report(self, account_id, status_ids, comment): | 931 | def report(self, account_id, status_ids, comment): |
887 | """ | 932 | """ |
888 | Report statuses to the instances administrators. | 933 | Report statuses to the instances administrators. |
@@ -899,6 +944,7 @@ class Mastodon: | |||
899 | ### | 944 | ### |
900 | # Writing data: Follow requests | 945 | # Writing data: Follow requests |
901 | ### | 946 | ### |
947 | @api_version("1.0.0") | ||
902 | def follow_request_authorize(self, id): | 948 | def follow_request_authorize(self, id): |
903 | """ | 949 | """ |
904 | Accept an incoming follow request. | 950 | Accept an incoming follow request. |
@@ -909,6 +955,7 @@ class Mastodon: | |||
909 | url = '/api/v1/follow_requests/{0}/authorize'.format(str(id)) | 955 | url = '/api/v1/follow_requests/{0}/authorize'.format(str(id)) |
910 | return self.__api_request('POST', url) | 956 | return self.__api_request('POST', url) |
911 | 957 | ||
958 | @api_version("1.0.0") | ||
912 | def follow_request_reject(self, id): | 959 | def follow_request_reject(self, id): |
913 | """ | 960 | """ |
914 | Reject an incoming follow request. | 961 | Reject an incoming follow request. |
@@ -922,6 +969,7 @@ class Mastodon: | |||
922 | ### | 969 | ### |
923 | # Writing data: Media | 970 | # Writing data: Media |
924 | ### | 971 | ### |
972 | @api_version("1.0.0") | ||
925 | def media_post(self, media_file, mime_type=None, description=None): | 973 | def media_post(self, media_file, mime_type=None, description=None): |
926 | """ | 974 | """ |
927 | Post an image. media_file can either be image data or | 975 | Post an image. media_file can either be image data or |
@@ -956,6 +1004,7 @@ class Mastodon: | |||
956 | ### | 1004 | ### |
957 | # Writing data: Domain blocks | 1005 | # Writing data: Domain blocks |
958 | ### | 1006 | ### |
1007 | @api_version("1.4.0") | ||
959 | def domain_block(self, domain=None): | 1008 | def domain_block(self, domain=None): |
960 | """ | 1009 | """ |
961 | Add a block for all statuses originating from the specified domain for the logged-in user. | 1010 | Add a block for all statuses originating from the specified domain for the logged-in user. |
@@ -963,6 +1012,7 @@ class Mastodon: | |||
963 | params = self.__generate_params(locals()) | 1012 | params = self.__generate_params(locals()) |
964 | return self.__api_request('POST', '/api/v1/domain_blocks', params) | 1013 | return self.__api_request('POST', '/api/v1/domain_blocks', params) |
965 | 1014 | ||
1015 | @api_version("1.4.0") | ||
966 | def domain_unblock(self, domain=None): | 1016 | def domain_unblock(self, domain=None): |
967 | """ | 1017 | """ |
968 | Remove a domain block for the logged-in user. | 1018 | Remove a domain block for the logged-in user. |
@@ -1043,6 +1093,7 @@ class Mastodon: | |||
1043 | ### | 1093 | ### |
1044 | # Streaming | 1094 | # Streaming |
1045 | ### | 1095 | ### |
1096 | @api_version("1.1.0") | ||
1046 | def stream_user(self, listener, async=False): | 1097 | def stream_user(self, listener, async=False): |
1047 | """ | 1098 | """ |
1048 | Streams events that are relevant to the authorized user, i.e. home | 1099 | Streams events that are relevant to the authorized user, i.e. home |
@@ -1051,6 +1102,7 @@ class Mastodon: | |||
1051 | """ | 1102 | """ |
1052 | return self.__stream('/api/v1/streaming/user', listener, async=async) | 1103 | return self.__stream('/api/v1/streaming/user', listener, async=async) |
1053 | 1104 | ||
1105 | @api_version("1.1.0") | ||
1054 | def stream_public(self, listener, async=False): | 1106 | def stream_public(self, listener, async=False): |
1055 | """ | 1107 | """ |
1056 | Streams public events. 'listener' should be a subclass of StreamListener | 1108 | Streams public events. 'listener' should be a subclass of StreamListener |
@@ -1058,6 +1110,7 @@ class Mastodon: | |||
1058 | """ | 1110 | """ |
1059 | return self.__stream('/api/v1/streaming/public', listener, async=async) | 1111 | return self.__stream('/api/v1/streaming/public', listener, async=async) |
1060 | 1112 | ||
1113 | @api_version("1.1.0") | ||
1061 | def stream_local(self, listener, async=False): | 1114 | def stream_local(self, listener, async=False): |
1062 | """ | 1115 | """ |
1063 | Streams local events. 'listener' should be a subclass of StreamListener | 1116 | Streams local events. 'listener' should be a subclass of StreamListener |
@@ -1066,6 +1119,7 @@ class Mastodon: | |||
1066 | """ | 1119 | """ |
1067 | return self.__stream('/api/v1/streaming/public/local', listener, async=async) | 1120 | return self.__stream('/api/v1/streaming/public/local', listener, async=async) |
1068 | 1121 | ||
1122 | @api_version("1.1.0") | ||
1069 | def stream_hashtag(self, tag, listener, async=False): | 1123 | def stream_hashtag(self, tag, listener, async=False): |
1070 | """ | 1124 | """ |
1071 | Returns all public statuses for the hashtag 'tag'. 'listener' should be | 1125 | Returns all public statuses for the hashtag 'tag'. 'listener' should be |