From 65e49ec61414dc36afa6df84d581d77a1ac40afb Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Sat, 22 Feb 2020 19:50:24 +0100 Subject: [PATCH] Add bookmarks --- mastodon/Mastodon.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index d919be9..a986ec3 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -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 ### @@ -1927,6 +1939,29 @@ class Mastodon: id = self.__unpack_id(id) 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