From 6fdf18eebc4458f542009c61907fa2dd22b050ea Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Fri, 25 Nov 2016 20:46:20 +0100 Subject: [PATCH] Documentation for notifications --- docs/index.rst | 22 +++++++++++++++++++--- mastodon/Mastodon.py | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index eb4bd27..d7ade82 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -57,6 +57,8 @@ User dicts ~~~~~~~~~~ .. code-block:: python + mastodon.account() + # Returns the following dictionary: { 'display_name': The user's display name 'acct': The user's account name as username@domain (@domain omitted for local users) @@ -100,7 +102,7 @@ Relationship dicts .. code-block:: python mastodon.account_follow() - # Returns + # Returns the following dictionary: { 'followed_by': Boolean denoting whether they follow you back 'following': Boolean denoting whether you follow them @@ -108,12 +110,26 @@ Relationship dicts 'blocking': Boolean denoting whether you are blocking them } +Notification dicts +~~~~~~~~~~~~~~~~~~ +.. code-block:: python + + mastodon.notifications() + # Returns the following dictionary: + { + 'id': id of the notification. + 'type': "mention", "reblog", "favourite" or "follow". + 'status': In case of "mention", the mentioning status. + In case of reblog / favourite, the reblogged / favourited status. + 'account': User dict of the user from whom the notification originates. + } + Context dicts ~~~~~~~~~~~~~ .. code-block:: python mastodon.status_context() - # Returns + # Returns the following dictionary: { 'descendants': A list of toot dicts 'ancestors': A list of toot dicts @@ -124,7 +140,7 @@ Media dicts .. code-block:: python mastodon.media_post("image.jpg", "image/jpeg") - # Returns + # Returns the following dictionary: { 'text_url': The display text for the media (what shows up in toots) 'preview_url': The URL for the media preview diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 36f20d2..eb13859 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -209,7 +209,7 @@ class Mastodon: Fetch notifications (mentions, favourites, reblogs, follows) for the authenticated user. - Returns: TODO + Returns a list of notification dicts. """ return self.__api_request('GET', '/api/v1/notifications')