aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2017-12-13 22:16:10 +0100
committerLorenz Diener <[email protected]>2017-12-13 22:16:10 +0100
commit0b5c0ae5ccb61a42ed19ee9c5b46de65979b9060 (patch)
tree13f4f8ab3a31a5e1fad6e27a45a1f27774c807f9
parentb840766ed77ea0cac84ada7cb27a9b23ffda0a09 (diff)
downloadmastodon.py-0b5c0ae5ccb61a42ed19ee9c5b46de65979b9060.tar.gz
Add remaining list endpoints
-rw-r--r--mastodon/.Mastodon.py.kate-swpbin0 -> 106 bytes
-rw-r--r--mastodon/Mastodon.py61
2 files changed, 60 insertions, 1 deletions
diff --git a/mastodon/.Mastodon.py.kate-swp b/mastodon/.Mastodon.py.kate-swp
new file mode 100644
index 0000000..60f8d57
--- /dev/null
+++ b/mastodon/.Mastodon.py.kate-swp
Binary files differ
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 44e0538..3b02881 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -666,6 +666,25 @@ class Mastodon:
666 id = self.__unpack_id(id) 666 id = self.__unpack_id(id)
667 return self.__api_request('GET', '/api/v1/lists/{0}'.format(id)) 667 return self.__api_request('GET', '/api/v1/lists/{0}'.format(id))
668 668
669 @api_version("2.1.0")
670 def list_accounts(self, id, max_id=None, since_id=None, limit=None):
671 """
672 Get the accounts that are on the given list. A `limit` of 0 can
673 be specified to get all accounts without pagination.
674
675 Returns a list of `user dicts`_.
676 """
677 id = self.__unpack_id(id)
678
679 if max_id != None:
680 max_id = self.__unpack_id(max_id)
681
682 if since_id != None:
683 since_id = self.__unpack_id(since_id)
684
685 params = self.__generate_params(locals(), ['id'])
686 return self.__api_request('GET', '/api/v1/lists/{0}/accounts'.format(id))
687
669 ### 688 ###
670 # Reading data: Mutes and Blocks 689 # Reading data: Mutes and Blocks
671 ### 690 ###
@@ -1086,6 +1105,42 @@ class Mastodon:
1086 id = self.__unpack_id(id) 1105 id = self.__unpack_id(id)
1087 self.__api_request('DELETE', '/api/v1/lists/{0}'.format(id)) 1106 self.__api_request('DELETE', '/api/v1/lists/{0}'.format(id))
1088 1107
1108 @api_version("2.1.0")
1109 def list_delete(self, id):
1110 """
1111 Delete a list.
1112 """
1113 id = self.__unpack_id(id)
1114 self.__api_request('DELETE', '/api/v1/lists/{0}'.format(id))
1115
1116 @api_version("2.1.0")
1117 def list_accounts_add(self, id, account_ids):
1118 """
1119 Add the account(s) given in `account_ids` to the list.
1120 """
1121 id = self.__unpack_id(id)
1122
1123 if not isinstance(account_ids, list):
1124 account_ids = [account_ids]
1125 account_ids = list(map(lambda x: self.__unpack_id(x), account_ids))
1126
1127 params = self.__generate_params(locals(), ['id'])
1128 return self.__api_request('POST', '/api/v1/lists/{0}/accounts'.format(id), params)
1129
1130 @api_version("2.1.0")
1131 def list_accounts_delete(self, id, account_ids):
1132 """
1133 Remove the account(s) given in `account_ids` from the list.
1134 """
1135 id = self.__unpack_id(id)
1136
1137 if not isinstance(account_ids, list):
1138 account_ids = [account_ids]
1139 account_ids = list(map(lambda x: self.__unpack_id(x), account_ids))
1140
1141 params = self.__generate_params(locals(), ['id'])
1142 return self.__api_request('DELETE', '/api/v1/lists/{0}/accounts'.format(id), params)
1143
1089 ### 1144 ###
1090 # Writing data: Reports 1145 # Writing data: Reports
1091 ### 1146 ###
@@ -1099,7 +1154,11 @@ class Mastodon:
1099 Returns a `report dict`_. 1154 Returns a `report dict`_.
1100 """ 1155 """
1101 account_id = self.__unpack_id(account_id) 1156 account_id = self.__unpack_id(account_id)
1102 status_ids = map(lambda x: self.__unpack_id(x), status_ids) 1157
1158 if not isinstance(status_ids, list):
1159 status_ids = [status_ids]
1160 status_ids = list(map(lambda x: self.__unpack_id(x), status_ids))
1161
1103 params = self.__generate_params(locals()) 1162 params = self.__generate_params(locals())
1104 return self.__api_request('POST', '/api/v1/reports/', params) 1163 return self.__api_request('POST', '/api/v1/reports/', params)
1105 1164
Powered by cgit v1.2.3 (git 2.41.0)