diff options
author | Lorenz Diener <[email protected]> | 2018-06-05 14:10:53 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2018-06-05 14:10:53 +0200 |
commit | 392dd3d61d7f8080faa56e0b7ac9bd09b21ef218 (patch) | |
tree | 0442378491710573ec21493e3d9d7c6de6317640 /docs | |
parent | 37cd1a489befe9e6914a77958133952066105296 (diff) | |
download | mastodon.py-392dd3d61d7f8080faa56e0b7ac9bd09b21ef218.tar.gz |
Add webpush support
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.rst | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/docs/index.rst b/docs/index.rst index dc9423f..ef96273 100644 --- a/docs/index.rst +++ b/docs/index.rst | |||
@@ -529,6 +529,23 @@ Report dicts | |||
529 | # will set this field to True. | 529 | # will set this field to True. |
530 | } | 530 | } |
531 | 531 | ||
532 | Push subscription dicts | ||
533 | ~~~~~~~~~~~~~~~~~~~~~~~ | ||
534 | .. _push subscription dict: | ||
535 | |||
536 | .. code-block:: python | ||
537 | |||
538 | mastodon.push_subscription() | ||
539 | # Returns the following dictionary | ||
540 | { | ||
541 | 'id': # Numerical id of the push subscription | ||
542 | 'endpoint': # Endpoint URL for the subscription | ||
543 | 'server_key': # Server pubkey used for signature verification | ||
544 | 'alerts': # Subscribed events - dict that may contain keys 'follow', | ||
545 | # 'favourite', 'reblog' and 'mention', with value True | ||
546 | # if webpushes have been requested for those events. | ||
547 | } | ||
548 | |||
532 | App registration and user authentication | 549 | App registration and user authentication |
533 | ---------------------------------------- | 550 | ---------------------------------------- |
534 | Before you can use the mastodon API, you have to register your | 551 | Before you can use the mastodon API, you have to register your |
@@ -805,6 +822,7 @@ StreamListener | |||
805 | .. automethod:: StreamListener.on_update | 822 | .. automethod:: StreamListener.on_update |
806 | .. automethod:: StreamListener.on_notification | 823 | .. automethod:: StreamListener.on_notification |
807 | .. automethod:: StreamListener.on_delete | 824 | .. automethod:: StreamListener.on_delete |
825 | .. automethod:: StreamListener.on_abort | ||
808 | .. automethod:: StreamListener.handle_heartbeat | 826 | .. automethod:: StreamListener.handle_heartbeat |
809 | 827 | ||
810 | CallbackStreamListener | 828 | CallbackStreamListener |
@@ -812,12 +830,31 @@ CallbackStreamListener | |||
812 | 830 | ||
813 | .. autoclass:: CallbackStreamListener | 831 | .. autoclass:: CallbackStreamListener |
814 | 832 | ||
815 | .. _Mastodon: https://github.com/tootsuite/mastodon | 833 | Push subscriptions |
816 | .. _Mastodon flagship instance: http://mastodon.social/ | 834 | ------------------ |
817 | .. _Mastodon api docs: https://github.com/tootsuite/documentation/ | 835 | These functions allow you to manage webpush subscriptions and to decrypt received |
836 | pushes. Note that the intended setup is not mastodon pushing directly to a users client - | ||
837 | the push endpoint should usually be a relay server that then takes care of delivering the | ||
838 | (encrypted) push to the end user via some mechanism, where it can then be decrypted and | ||
839 | displayed. | ||
840 | |||
841 | Mastodon allows an application to have one webpush subscription per user at a time. | ||
842 | |||
843 | .. automethod:: Mastodon.push_subscription | ||
844 | .. automethod:: Mastodon.push_subscription_set | ||
845 | .. automethod:: Mastodon.push_subscription_update | ||
846 | |||
847 | .. push_subscription_generate_keys(): | ||
848 | |||
849 | .. automethod:: Mastodon.push_subscription_generate_keys | ||
850 | .. automethod:: Mastodon.push_subscription_decrypt_push | ||
818 | 851 | ||
819 | Acknowledgements | 852 | Acknowledgements |
820 | ---------------- | 853 | ---------------- |
821 | Mastodon.py contains work by a large amount of contributors, many of which have | 854 | Mastodon.py contains work by a large amount of contributors, many of which have |
822 | put significant work into making it a better library. You can find some information | 855 | put significant work into making it a better library. You can find some information |
823 | about who helped with which particular feature or fix in the changelog. | 856 | about who helped with which particular feature or fix in the changelog. |
857 | |||
858 | .. _Mastodon: https://github.com/tootsuite/mastodon | ||
859 | .. _Mastodon flagship instance: http://mastodon.social/ | ||
860 | .. _Mastodon api docs: https://github.com/tootsuite/documentation/ \ No newline at end of file | ||