aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2019-06-22 21:56:08 +0200
committerLorenz Diener <[email protected]>2019-06-22 21:56:08 +0200
commit75b7fc7779a3ae23e89129b3ae455c1479245e2f (patch)
treeb01ea64bdf74e2c8ecb9a5e8f0948600517fcf62
parent9e6745ef8a7463675f914b0ab6cf89ef5f6eb0dd (diff)
downloadmastodon.py-75b7fc7779a3ae23e89129b3ae455c1479245e2f.tar.gz
Document new report dict fields
-rw-r--r--docs/index.rst20
-rw-r--r--mastodon/Mastodon.py18
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
673 673
674.. code-block:: python 674.. code-block:: python
675 675
676 mastodon.reports()[0] 676 mastodon.admin_reports()[0]
677 # Returns the following dictionary 677 # Returns the following dictionary
678 { 678 {
679 'id': # Numerical id of the report 679 'id': # Numerical id of the report
680 'action_taken': # True if a moderator or admin has processed the 680 'action_taken': # True if a moderator or admin has processed the
681 # report, False otherwise. Note that no indication as to 681 # report, False otherwise.
682 # what action was taken is given and that an admin simply 682
683 # marking the report as processed and not doing anything else 683 # The following fields are only present in the report dicts returned by moderation API:
684 # will set this field to True. Note also that now that there 684 'comment': # Text comment submitted with the report
685 # is no way to get any updated report lists, this will 685 'created_at': # Time at which this report was created, as a datetime object
686 # always be false. 686 'updated_at': # Last time this report has been updated, as a datetime object
687 'account': # Account dict of the user that filed this report
688 'target_account': # Account that has been reported with this report
689 'assigned_account': # If the report as been assigned to an account,
690 # account dict of that account (None if not)
691 'action_taken_by_account': # Account dict of the account that processed this report
692 'statuses': # List of statuses attached to the report, as toot dicts
687 } 693 }
688 694
689Push subscription dicts 695Push 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:
202 __DICT_VERSION_SEARCHRESULT = bigger_version(bigger_version(bigger_version("1.0.0", 202 __DICT_VERSION_SEARCHRESULT = bigger_version(bigger_version(bigger_version("1.0.0",
203 __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS), __DICT_VERSION_HASHTAG) 203 __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS), __DICT_VERSION_HASHTAG)
204 __DICT_VERSION_ACTIVITY = "2.1.2" 204 __DICT_VERSION_ACTIVITY = "2.1.2"
205 __DICT_VERSION_REPORT = "1.1.0" 205 __DICT_VERSION_REPORT = "2.9.1"
206 __DICT_VERSION_PUSH = "2.4.0" 206 __DICT_VERSION_PUSH = "2.4.0"
207 __DICT_VERSION_PUSH_NOTIF = "2.4.0" 207 __DICT_VERSION_PUSH_NOTIF = "2.4.0"
208 __DICT_VERSION_FILTER = "2.4.3" 208 __DICT_VERSION_FILTER = "2.4.3"
@@ -210,7 +210,6 @@ class Mastodon:
210 __DICT_VERSION_SCHEDULED_STATUS = bigger_version("2.7.0", __DICT_VERSION_STATUS) 210 __DICT_VERSION_SCHEDULED_STATUS = bigger_version("2.7.0", __DICT_VERSION_STATUS)
211 __DICT_VERSION_PREFERENCES = "2.8.0" 211 __DICT_VERSION_PREFERENCES = "2.8.0"
212 __DICT_VERSION_ADMIN_ACCOUNT = "2.9.1" 212 __DICT_VERSION_ADMIN_ACCOUNT = "2.9.1"
213 __DICT_VERSION_ADMIN_REPORT = "2.9.1"
214 213
215 ### 214 ###
216 # Registering apps 215 # Registering apps
@@ -2474,10 +2473,10 @@ class Mastodon:
2474 2473
2475 self.__api_request('POST', '/api/v1/admin/accounts/{0}/action'.format(id), params) 2474 self.__api_request('POST', '/api/v1/admin/accounts/{0}/action'.format(id), params)
2476 2475
2477 @api_version("2.9.1", "2.9.1", __DICT_VERSION_ADMIN_REPORT) 2476 @api_version("2.9.1", "2.9.1", __DICT_VERSION_REPORT)
2478 def admin_reports(self, resolved=False, account_id=None, target_account_id=None, max_id=None, min_id=None, since_id=None, limit=None): 2477 def admin_reports(self, resolved=False, account_id=None, target_account_id=None, max_id=None, min_id=None, since_id=None, limit=None):
2479 """ 2478 """
2480 Get a list of reports. 2479 Fetches the list of reports.
2481 2480
2482 Set `resolved` to True to search for resolved reports. `account_id` and `target_account_id` 2481 Set `resolved` to True to search for resolved reports. `account_id` and `target_account_id`
2483 can be used to get reports filed by or about a specific user. 2482 can be used to get reports filed by or about a specific user.
@@ -2506,8 +2505,13 @@ class Mastodon:
2506 return self.__api_request('GET', '/api/v1/admin/reports', params) 2505 return self.__api_request('GET', '/api/v1/admin/reports', params)
2507 2506
2508 def admin_report(self, id): 2507 def admin_report(self, id):
2509 pass 2508 """
2510 #GET /api/v1/admin/reports/:id Get a specific report 2509 Fetches the report with the given id.
2510
2511 Returns a `report dict`_.
2512 """
2513 id = self.__unpack_id(id)
2514 return self.__api_request('GET', '/api/v1/admin/reports/{0}'.format(id))
2511 2515
2512 def admin_report_assign(self, id): 2516 def admin_report_assign(self, id):
2513 pass 2517 pass
@@ -2801,7 +2805,7 @@ class Mastodon:
2801 """ 2805 """
2802 Parse dates in certain known json fields, if possible. 2806 Parse dates in certain known json fields, if possible.
2803 """ 2807 """
2804 known_date_fields = ["created_at", "week", "day", "expires_at", "scheduled_at"] 2808 known_date_fields = ["created_at", "week", "day", "expires_at", "scheduled_at", "updated_at"]
2805 for k, v in json_object.items(): 2809 for k, v in json_object.items():
2806 if k in known_date_fields: 2810 if k in known_date_fields:
2807 if v != None: 2811 if v != None:
Powered by cgit v1.2.3 (git 2.41.0)