From 4a2f6d0fb90958aab54dab86666ed6034d0e1929 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Wed, 26 Apr 2017 11:56:47 +0200 Subject: Added some missing API methods --- mastodon/Mastodon.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'mastodon') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 215482e..e670a7f 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -321,14 +321,19 @@ class Mastodon: ### # Reading data: Notifications ### - def notifications(self): + def notifications(self, id = None): """ Fetch notifications (mentions, favourites, reblogs, follows) for the authenticated user. + Can be passed an id to fetch a single notification. + Returns a list of notification dicts. """ - return self.__api_request('GET', '/api/v1/notifications') + if id == None: + return self.__api_request('GET', '/api/v1/notifications') + else: + return self.__api_request('GET', '/api/v1/notifications/' + str(id)) ### # Reading data: Accounts @@ -406,6 +411,9 @@ class Mastodon: return self.__api_request('GET', '/api/v1/accounts/search', params) + ### + # Reading data: Searching + ### def content_search(self, q, resolve = False): """ Fetch matching hashtags, accounts and statuses. Will search federated @@ -560,6 +568,15 @@ class Mastodon: """ return self.__api_request('POST', '/api/v1/statuses/' + str(id) + "/unfavourite") + ### + # Writing data: Notifications + ### + def notifications_clear(self): + """ + Clear out a users notifications + """ + return self.__api_request('GET', '/api/v1/notifications/clear') + ### # Writing data: Accounts ### -- cgit v1.2.3