Add bookmarks

This commit is contained in:
Lorenz Diener 2020-02-22 19:50:24 +01:00
pare 05e2bcb967
commit 65e49ec614

Veure arxiu

@ -1612,6 +1612,18 @@ class Mastodon:
return self.__api_request('GET', '/api/v1/markers', params)
###
# Reading data: Bookmarks
###
@api_version("3.1.0", "3.1.0", __DICT_VERSION_STATUS)
def bookmarks(self):
"""
Get a list of statuses bookmarked by the logged-in user.
Returns a list of `toot dicts`_.
"""
return self.__api_request('GET', '/api/v1/bookmarks')
###
# Writing data: Statuses
###
@ -1928,6 +1940,29 @@ class Mastodon:
url = '/api/v1/statuses/{0}/unpin'.format(str(id))
return self.__api_request('POST', url)
@api_version("3.1.0", "3.1.0", __DICT_VERSION_STATUS)
def status_bookmark(self, id):
"""
Bookmark a status as the logged-in user.
Returns a `toot dict`_ with the now bookmarked status
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/bookmark'.format(str(id))
return self.__api_request('POST', url)
@api_version("3.1.0", "3.1.0", __DICT_VERSION_STATUS)
def status_unbookmark(self, id):
"""
Unbookmark a bookmarked status for the logged-in user.
Returns a `toot dict`_ with the status that used to be bookmarked.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/unbookmark'.format(str(id))
return self.__api_request('POST', url)
###
# Writing data: Scheduled statuses
###