aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2017-04-26 11:56:47 +0200
committerLorenz Diener <[email protected]>2017-04-26 11:56:47 +0200
commit4a2f6d0fb90958aab54dab86666ed6034d0e1929 (patch)
tree7caadbeaf5a51840735af151afe0626d856255f9 /mastodon/Mastodon.py
parent6a2c394c506eb8a4943f4612702dbf2e0283078e (diff)
downloadmastodon.py-4a2f6d0fb90958aab54dab86666ed6034d0e1929.tar.gz
Added some missing API methods
Diffstat (limited to 'mastodon/Mastodon.py')
-rw-r--r--mastodon/Mastodon.py21
1 files changed, 19 insertions, 2 deletions
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:
321 ### 321 ###
322 # Reading data: Notifications 322 # Reading data: Notifications
323 ### 323 ###
324 def notifications(self): 324 def notifications(self, id = None):
325 """ 325 """
326 Fetch notifications (mentions, favourites, reblogs, follows) for the authenticated 326 Fetch notifications (mentions, favourites, reblogs, follows) for the authenticated
327 user. 327 user.
328 328
329 Can be passed an id to fetch a single notification.
330
329 Returns a list of notification dicts. 331 Returns a list of notification dicts.
330 """ 332 """
331 return self.__api_request('GET', '/api/v1/notifications') 333 if id == None:
334 return self.__api_request('GET', '/api/v1/notifications')
335 else:
336 return self.__api_request('GET', '/api/v1/notifications/' + str(id))
332 337
333 ### 338 ###
334 # Reading data: Accounts 339 # Reading data: Accounts
@@ -406,6 +411,9 @@ class Mastodon:
406 return self.__api_request('GET', '/api/v1/accounts/search', params) 411 return self.__api_request('GET', '/api/v1/accounts/search', params)
407 412
408 413
414 ###
415 # Reading data: Searching
416 ###
409 def content_search(self, q, resolve = False): 417 def content_search(self, q, resolve = False):
410 """ 418 """
411 Fetch matching hashtags, accounts and statuses. Will search federated 419 Fetch matching hashtags, accounts and statuses. Will search federated
@@ -561,6 +569,15 @@ class Mastodon:
561 return self.__api_request('POST', '/api/v1/statuses/' + str(id) + "/unfavourite") 569 return self.__api_request('POST', '/api/v1/statuses/' + str(id) + "/unfavourite")
562 570
563 ### 571 ###
572 # Writing data: Notifications
573 ###
574 def notifications_clear(self):
575 """
576 Clear out a users notifications
577 """
578 return self.__api_request('GET', '/api/v1/notifications/clear')
579
580 ###
564 # Writing data: Accounts 581 # Writing data: Accounts
565 ### 582 ###
566 def account_follow(self, id): 583 def account_follow(self, id):
Powered by cgit v1.2.3 (git 2.41.0)