aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/index.rst29
-rw-r--r--mastodon/Mastodon.py22
2 files changed, 46 insertions, 5 deletions
diff --git a/docs/index.rst b/docs/index.rst
index d3acc41..daae043 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -328,7 +328,34 @@ Mention dicts
328 'acct': # Mentioned users account name (including domain) 328 'acct': # Mentioned users account name (including domain)
329 'id': # Mentioned users (local) account ID 329 'id': # Mentioned users (local) account ID
330 } 330 }
331 331
332Scheduled toot dicts
333~~~~~~~~~~~~~~~~~~~~
334.. _scheduled toot dict:
335
336.. code-block:: python
337
338 api2.status_post("text", scheduled_at=the_future)
339 # Returns the following dictionary:
340 {
341 'id': # Scheduled toot ID (note: Not the id of the toot once it gets posted!)
342 'scheduled_at': # datetime object describing when the toot is to be posted
343 'params': # Parameters for the scheduled toot, specifically
344 {
345 'text': # Toot text
346 'in_reply_to_id': # ID of the toot this one is a reply to
347 'media_ids': # IDs of media attached to this toot
348 'sensitive': # Whether this toot is sensitive or not
349 'visibility': # Visibility of the toot
350 'idempotency': # Idempotency key for the scheduled toot
351 'scheduled_at': # Present, but generally "None"
352 'spoiler_text': # CW text for this toot
353 'application_id': # ID of the application that scheduled the toot
354 'poll': # Poll parameters, as a poll dict
355 },
356 'media_attachments': # Array of media dicts for the attachments to the scheduled toot
357 }
358
332Conversation dicts 359Conversation dicts
333~~~~~~~~~~~~~~~~~~ 360~~~~~~~~~~~~~~~~~~
334.. _conversation dict: 361.. _conversation dict:
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index d4c458f..97e8461 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -803,6 +803,18 @@ class Mastodon:
803 return self.__api_request('GET', url) 803 return self.__api_request('GET', url)
804 804
805 ### 805 ###
806 # Reading data: Scheduled statuses
807 ###
808 @api_version("2.7.0", "2.7.0", __DICT_VERSION_SCHEDULED_STATUS)
809 def scheduled_statuses(self):
810 """
811 Fetch a list of scheduled statuses
812
813 Returns a list of `scheduled toot dicts`_.
814 """
815 return self.__api_request('GET', '/api/v1/scheduled_statuses')
816
817 ###
806 # Reading data: Notifications 818 # Reading data: Notifications
807 ### 819 ###
808 @api_version("1.0.0", "2.6.0", __DICT_VERSION_NOTIFICATION) 820 @api_version("1.0.0", "2.6.0", __DICT_VERSION_NOTIFICATION)
@@ -1358,7 +1370,7 @@ class Mastodon:
1358 in_reply_to_id = self.__unpack_id(in_reply_to_id) 1370 in_reply_to_id = self.__unpack_id(in_reply_to_id)
1359 1371
1360 if scheduled_at != None: 1372 if scheduled_at != None:
1361 scheduled_at = scheduled_at.isoformat() 1373 scheduled_at = scheduled_at.astimezone(pytz.utc).isoformat()
1362 1374
1363 params_initial = locals() 1375 params_initial = locals()
1364 1376
@@ -1554,15 +1566,17 @@ class Mastodon:
1554 # Writing data: Scheduled statuses 1566 # Writing data: Scheduled statuses
1555 ### 1567 ###
1556 @api_version("2.7.0", "2.7.0", __DICT_VERSION_SCHEDULED_STATUS) 1568 @api_version("2.7.0", "2.7.0", __DICT_VERSION_SCHEDULED_STATUS)
1557 def update_scheduled_status(self, id, scheduled_at): 1569 def scheduled_status_update(self, id, scheduled_at):
1558 """ 1570 """
1559 Update the scheduled time of a scheduled status. 1571 Update the scheduled time of a scheduled status.
1560 1572
1561 New time must be at least 5 minutes into the future. 1573 New time must be at least 5 minutes into the future.
1574
1575 Returns a `scheduled toot dict`_
1562 """ 1576 """
1563 scheduled_at = scheduled_at.isoformat() 1577 scheduled_at = scheduled_at.astimezone(pytz.utc).isoformat()
1564 id = self.__unpack_id(id) 1578 id = self.__unpack_id(id)
1565 self.__generate_params(locals(), ['id']) 1579 params = self.__generate_params(locals(), ['id'])
1566 url = '/api/v1/scheduled_statuses/{0}'.format(str(id)) 1580 url = '/api/v1/scheduled_statuses/{0}'.format(str(id))
1567 return self.__api_request('PUT', url, params) 1581 return self.__api_request('PUT', url, params)
1568 1582
Powered by cgit v1.2.3 (git 2.41.0)