From d7f5b4d66d47baa12d9e986c39385618adef0e71 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Sun, 28 Apr 2019 19:34:52 +0200 Subject: Implement the rest of the scheduled status endpoints --- docs/index.rst | 16 ++++++++++++++++ mastodon/Mastodon.py | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index daae043..d6d0d04 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -777,6 +777,13 @@ These functions allow you to get information about single statuses. .. automethod:: Mastodon.status_favourited_by .. automethod:: Mastodon.status_card +Writing data: Scheduled statuses +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +These functions allow you to get information about scheduled statuses. + +.. automethod:: Mastodon.scheduled_statuses +.. automethod:: Mastodon.scheduled_status + Reading data: Notifications --------------------------- This function allows you to get information about a users notifications. @@ -891,6 +898,15 @@ interact with already posted statuses. .. automethod:: Mastodon.status_unpin .. automethod:: Mastodon.status_delete +Writing data: Scheduled statuses +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Mastodon allows you to schedule statuses (using `status_post()`_. +The functions in this section allow you to update or delete thusly +scheduled statuses. + +.. automethod:: Mastodon.scheduled_status_update +.. automethod:: Mastodon.scheduled_status_delete + Writing data: Notifications --------------------------- These functions allow you to clear all or some notifications. diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 97e8461..c037ceb 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -814,6 +814,17 @@ class Mastodon: """ return self.__api_request('GET', '/api/v1/scheduled_statuses') + @api_version("2.7.0", "2.7.0", __DICT_VERSION_SCHEDULED_STATUS) + def scheduled_status(self, id): + """ + Fetch information about the scheduled status with the given id. + + Returns a `scheduled toot dict`_. + """ + id = self.__unpack_id(id) + url = '/api/v1/scheduled_statuses/{0}'.format(str(id)) + return self.__api_request('GET', url) + ### # Reading data: Notifications ### @@ -1580,6 +1591,15 @@ class Mastodon: url = '/api/v1/scheduled_statuses/{0}'.format(str(id)) return self.__api_request('PUT', url, params) + @api_version("2.7.0", "2.7.0", "2.7.0") + def scheduled_status_delete(self, id): + """ + Deletes a scheduled status. + """ + id = self.__unpack_id(id) + url = '/api/v1/scheduled_statuses/{0}'.format(str(id)) + self.__api_request('DELETE', url) + ### # Writing data: Notifications ### -- cgit v1.2.3