aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2018-06-04 14:54:26 +0200
committerLorenz Diener <[email protected]>2018-06-04 14:54:26 +0200
commit620687a07922f66e6e278b74050b5384e0131c36 (patch)
treec2a41abfb999b0d574b49fe5728d79710ca2257c /mastodon
parentbe77f4e8ab93dcfecb0fb306479a3eae3e2001cb (diff)
downloadmastodon.py-620687a07922f66e6e278b74050b5384e0131c36.tar.gz
Add pinning/unpinning, media_update
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py40
1 files changed, 38 insertions, 2 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index e616aa3..b9e880d 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -111,7 +111,7 @@ class Mastodon:
111 __DICT_VERSION_MENTION = "1.0.0" 111 __DICT_VERSION_MENTION = "1.0.0"
112 __DICT_VERSION_MEDIA = "2.3.0" 112 __DICT_VERSION_MEDIA = "2.3.0"
113 __DICT_VERSION_ACCOUNT = "2.3.0" 113 __DICT_VERSION_ACCOUNT = "2.3.0"
114 __DICT_VERSION_STATUS = bigger_version(bigger_version(bigger_version(bigger_version("2.0.0", 114 __DICT_VERSION_STATUS = bigger_version(bigger_version(bigger_version(bigger_version("2.1.0",
115 __DICT_VERSION_MEDIA), __DICT_VERSION_ACCOUNT), __DICT_VERSION_APPLICATION), __DICT_VERSION_MENTION) 115 __DICT_VERSION_MEDIA), __DICT_VERSION_ACCOUNT), __DICT_VERSION_APPLICATION), __DICT_VERSION_MENTION)
116 __DICT_VERSION_INSTANCE = bigger_version("2.3.0", __DICT_VERSION_ACCOUNT) 116 __DICT_VERSION_INSTANCE = bigger_version("2.3.0", __DICT_VERSION_ACCOUNT)
117 __DICT_VERSION_HASHTAG = "1.0.0" 117 __DICT_VERSION_HASHTAG = "1.0.0"
@@ -761,7 +761,7 @@ class Mastodon:
761 @api_version("2.1.0", "2.1.0", __DICT_VERSION_LIST) 761 @api_version("2.1.0", "2.1.0", __DICT_VERSION_LIST)
762 def account_lists(self, id): 762 def account_lists(self, id):
763 """ 763 """
764 Get all of the logged in users lists which the specified user is 764 Get all of the logged-in users lists which the specified user is
765 a member of. 765 a member of.
766 766
767 Returns a list of `list dicts`_. 767 Returns a list of `list dicts`_.
@@ -1108,6 +1108,28 @@ class Mastodon:
1108 url = '/api/v1/statuses/{0}/unmute'.format(str(id)) 1108 url = '/api/v1/statuses/{0}/unmute'.format(str(id))
1109 return self.__api_request('POST', url) 1109 return self.__api_request('POST', url)
1110 1110
1111 @api_version("2.1.0", "2.1.0", __DICT_VERSION_STATUS)
1112 def status_pin(self, id):
1113 """
1114 Pin a status for the logged-in user.
1115
1116 Returns a `toot dict`_ with the now pinned status
1117 """
1118 id = self.__unpack_id(id)
1119 url = '/api/v1/statuses/{0}/pin'.format(str(id))
1120 return self.__api_request('POST', url)
1121
1122 @api_version("2.1.0", "2.1.0", __DICT_VERSION_STATUS)
1123 def status_unpin(self, id):
1124 """
1125 Unpin a pinned status for the logged-in user.
1126
1127 Returns a `toot dict`_ with the status that used to be pinned.
1128 """
1129 id = self.__unpack_id(id)
1130 url = '/api/v1/statuses/{0}/unpin'.format(str(id))
1131 return self.__api_request('POST', url)
1132
1111 ### 1133 ###
1112 # Writing data: Notifications 1134 # Writing data: Notifications
1113 ### 1135 ###
@@ -1402,7 +1424,21 @@ class Mastodon:
1402 return self.__api_request('POST', '/api/v1/media', 1424 return self.__api_request('POST', '/api/v1/media',
1403 files={'file': media_file_description}, 1425 files={'file': media_file_description},
1404 params={'description': description, 'focus': focus}) 1426 params={'description': description, 'focus': focus})
1427
1428 @api_version("2.3.0", "2.3.0", __DICT_VERSION_MEDIA)
1429 def media_update(self, id, description=None, focus=None):
1430 """
1431 Update the metadata of the media file with the given `id`. `description` and
1432 `focus` are as in `media_post()`_ .
1433 """
1434 id = self.__unpack_id(id)
1405 1435
1436 if focus != None:
1437 focus = str(focus[0]) + "," + str(focus[1])
1438
1439 params = self.__generate_params(locals(), ['id'])
1440 return self.__api_request('PUT', '/api/v1/media/{0}'.format(str(id)), params)
1441
1406 ### 1442 ###
1407 # Writing data: Domain blocks 1443 # Writing data: Domain blocks
1408 ### 1444 ###
Powered by cgit v1.2.3 (git 2.41.0)