aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2018-06-05 14:10:53 +0200
committerLorenz Diener <[email protected]>2018-06-05 14:10:53 +0200
commit392dd3d61d7f8080faa56e0b7ac9bd09b21ef218 (patch)
tree0442378491710573ec21493e3d9d7c6de6317640 /docs/index.rst
parent37cd1a489befe9e6914a77958133952066105296 (diff)
downloadmastodon.py-392dd3d61d7f8080faa56e0b7ac9bd09b21ef218.tar.gz
Add webpush support
Diffstat (limited to 'docs/index.rst')
-rw-r--r--docs/index.rst43
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
532Push 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
532App registration and user authentication 549App registration and user authentication
533---------------------------------------- 550----------------------------------------
534Before you can use the mastodon API, you have to register your 551Before 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
810CallbackStreamListener 828CallbackStreamListener
@@ -812,12 +830,31 @@ CallbackStreamListener
812 830
813.. autoclass:: CallbackStreamListener 831.. autoclass:: CallbackStreamListener
814 832
815.. _Mastodon: https://github.com/tootsuite/mastodon 833Push subscriptions
816.. _Mastodon flagship instance: http://mastodon.social/ 834------------------
817.. _Mastodon api docs: https://github.com/tootsuite/documentation/ 835These functions allow you to manage webpush subscriptions and to decrypt received
836pushes. Note that the intended setup is not mastodon pushing directly to a users client -
837the 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
839displayed.
840
841Mastodon 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
819Acknowledgements 852Acknowledgements
820---------------- 853----------------
821Mastodon.py contains work by a large amount of contributors, many of which have 854Mastodon.py contains work by a large amount of contributors, many of which have
822put significant work into making it a better library. You can find some information 855put significant work into making it a better library. You can find some information
823about who helped with which particular feature or fix in the changelog. 856about 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
Powered by cgit v1.2.3 (git 2.41.0)