From 75b7fc7779a3ae23e89129b3ae455c1479245e2f Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Sat, 22 Jun 2019 21:56:08 +0200 Subject: Document new report dict fields --- docs/index.rst | 20 +++++++++++++------- mastodon/Mastodon.py | 18 +++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index f4de1b8..4e98a3a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -673,17 +673,23 @@ Report dicts .. code-block:: python - mastodon.reports()[0] + mastodon.admin_reports()[0] # Returns the following dictionary { 'id': # Numerical id of the report 'action_taken': # True if a moderator or admin has processed the - # report, False otherwise. Note that no indication as to - # what action was taken is given and that an admin simply - # marking the report as processed and not doing anything else - # will set this field to True. Note also that now that there - # is no way to get any updated report lists, this will - # always be false. + # report, False otherwise. + + # The following fields are only present in the report dicts returned by moderation API: + 'comment': # Text comment submitted with the report + 'created_at': # Time at which this report was created, as a datetime object + 'updated_at': # Last time this report has been updated, as a datetime object + 'account': # Account dict of the user that filed this report + 'target_account': # Account that has been reported with this report + 'assigned_account': # If the report as been assigned to an account, + # account dict of that account (None if not) + 'action_taken_by_account': # Account dict of the account that processed this report + 'statuses': # List of statuses attached to the report, as toot dicts } Push subscription dicts diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 5b521d1..b1c55b1 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -202,7 +202,7 @@ class Mastodon: __DICT_VERSION_SEARCHRESULT = bigger_version(bigger_version(bigger_version("1.0.0", __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS), __DICT_VERSION_HASHTAG) __DICT_VERSION_ACTIVITY = "2.1.2" - __DICT_VERSION_REPORT = "1.1.0" + __DICT_VERSION_REPORT = "2.9.1" __DICT_VERSION_PUSH = "2.4.0" __DICT_VERSION_PUSH_NOTIF = "2.4.0" __DICT_VERSION_FILTER = "2.4.3" @@ -210,7 +210,6 @@ class Mastodon: __DICT_VERSION_SCHEDULED_STATUS = bigger_version("2.7.0", __DICT_VERSION_STATUS) __DICT_VERSION_PREFERENCES = "2.8.0" __DICT_VERSION_ADMIN_ACCOUNT = "2.9.1" - __DICT_VERSION_ADMIN_REPORT = "2.9.1" ### # Registering apps @@ -2474,10 +2473,10 @@ class Mastodon: self.__api_request('POST', '/api/v1/admin/accounts/{0}/action'.format(id), params) - @api_version("2.9.1", "2.9.1", __DICT_VERSION_ADMIN_REPORT) + @api_version("2.9.1", "2.9.1", __DICT_VERSION_REPORT) def admin_reports(self, resolved=False, account_id=None, target_account_id=None, max_id=None, min_id=None, since_id=None, limit=None): """ - Get a list of reports. + Fetches the list of reports. Set `resolved` to True to search for resolved reports. `account_id` and `target_account_id` can be used to get reports filed by or about a specific user. @@ -2506,8 +2505,13 @@ class Mastodon: return self.__api_request('GET', '/api/v1/admin/reports', params) def admin_report(self, id): - pass - #GET /api/v1/admin/reports/:id Get a specific report + """ + Fetches the report with the given id. + + Returns a `report dict`_. + """ + id = self.__unpack_id(id) + return self.__api_request('GET', '/api/v1/admin/reports/{0}'.format(id)) def admin_report_assign(self, id): pass @@ -2801,7 +2805,7 @@ class Mastodon: """ Parse dates in certain known json fields, if possible. """ - known_date_fields = ["created_at", "week", "day", "expires_at", "scheduled_at"] + known_date_fields = ["created_at", "week", "day", "expires_at", "scheduled_at", "updated_at"] for k, v in json_object.items(): if k in known_date_fields: if v != None: -- cgit v1.2.3