aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2019-04-27 22:13:27 +0200
committerLorenz Diener <[email protected]>2019-04-27 22:13:27 +0200
commit72e3290d8c9ed1dc0babf66ef70a6835a0dcacf4 (patch)
tree01901380caebea143aacd2da07e83bc254cebbbd /mastodon
parent4deeb7875ba1439f3162d90e108cf41fce22f6de (diff)
downloadmastodon.py-72e3290d8c9ed1dc0babf66ef70a6835a0dcacf4.tar.gz
Add endorsements (with docs and tests)
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py39
1 files changed, 38 insertions, 1 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index d272a33..ca7dbd6 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -924,6 +924,20 @@ class Mastodon:
924 return self.__api_request('GET', '/api/v1/suggestions') 924 return self.__api_request('GET', '/api/v1/suggestions')
925 925
926 ### 926 ###
927 # Reading data: Endorsements
928 ###
929 @api_version("2.5.0", "2.5.0", __DICT_VERSION_ACCOUNT)
930 def endorsements(self):
931 """
932 Fetch list of users endorsemed by the logged-in user.
933
934 Returns a list of `user dicts`_.
935
936 """
937 return self.__api_request('GET', '/api/v1/endorsements')
938
939
940 ###
927 # Reading data: Searching 941 # Reading data: Searching
928 ### 942 ###
929 @api_version("1.1.0", "2.1.0", __DICT_VERSION_SEARCHRESULT) 943 @api_version("1.1.0", "2.1.0", __DICT_VERSION_SEARCHRESULT)
@@ -1463,8 +1477,9 @@ class Mastodon:
1463 Returns a `relationship dict`_ containing the updated relationship to the user. 1477 Returns a `relationship dict`_ containing the updated relationship to the user.
1464 """ 1478 """
1465 id = self.__unpack_id(id) 1479 id = self.__unpack_id(id)
1480 params = self.__generate_params(locals(), ['id'])
1466 url = '/api/v1/accounts/{0}/mute'.format(str(id)) 1481 url = '/api/v1/accounts/{0}/mute'.format(str(id))
1467 return self.__api_request('POST', url) 1482 return self.__api_request('POST', url, params)
1468 1483
1469 @api_version("1.1.0", "1.4.0", __DICT_VERSION_RELATIONSHIP) 1484 @api_version("1.1.0", "1.4.0", __DICT_VERSION_RELATIONSHIP)
1470 def account_unmute(self, id): 1485 def account_unmute(self, id):
@@ -1545,6 +1560,28 @@ class Mastodon:
1545 return self.__api_request('PATCH', '/api/v1/accounts/update_credentials', params, files=files) 1560 return self.__api_request('PATCH', '/api/v1/accounts/update_credentials', params, files=files)
1546 1561
1547 1562
1563 @api_version("2.5.0", "2.5.0", __DICT_VERSION_RELATIONSHIP)
1564 def account_pin(self, id):
1565 """
1566 Pin / endorse a user.
1567
1568 Returns a `relationship dict`_ containing the updated relationship to the user.
1569 """
1570 id = self.__unpack_id(id)
1571 url = '/api/v1/accounts/{0}/pin'.format(str(id))
1572 return self.__api_request('POST', url)
1573
1574 @api_version("2.5.0", "2.5.0", __DICT_VERSION_RELATIONSHIP)
1575 def account_unpin(self, id):
1576 """
1577 Unpin / un-endorse a user.
1578
1579 Returns a `relationship dict`_ containing the updated relationship to the user.
1580 """
1581 id = self.__unpack_id(id)
1582 url = '/api/v1/accounts/{0}/unpin'.format(str(id))
1583 return self.__api_request('POST', url)
1584
1548 ### 1585 ###
1549 # Writing data: Keyword filters 1586 # Writing data: Keyword filters
1550 ### 1587 ###
Powered by cgit v1.2.3 (git 2.41.0)