aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErin Congden <[email protected]>2017-04-02 20:53:32 -0700
committerErin Congden <[email protected]>2017-04-02 21:53:25 -0700
commitca0b6c115bcb8f6b79b22f5ccd648a2d6b7d7fc5 (patch)
tree73230e27007bd901d639ae8be1a98ed14206727c
parent38ebcda76bc0c264f8384f55c5b32bf049b2d6be (diff)
downloadmastodon.py-ca0b6c115bcb8f6b79b22f5ccd648a2d6b7d7fc5.tar.gz
Added follow requests support
-rw-r--r--docs/index.rst16
-rw-r--r--mastodon/Mastodon.py31
2 files changed, 47 insertions, 0 deletions
diff --git a/docs/index.rst b/docs/index.rst
index 9dc37e5..8be642a 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -99,6 +99,7 @@ User dicts
99 'header': URL for their header image 99 'header': URL for their header image
100 'id': Same as <numerical id> 100 'id': Same as <numerical id>
101 'username': The username (what you @ them with) 101 'username': The username (what you @ them with)
102 'locked': Denotes whether the account can be followed without a follow request
102 } 103 }
103 104
104Toot dicts 105Toot dicts
@@ -140,6 +141,7 @@ Relationship dicts
140 'id': Numerical id (same one as <numerical id>) 141 'id': Numerical id (same one as <numerical id>)
141 'blocking': Boolean denoting whether you are blocking them 142 'blocking': Boolean denoting whether you are blocking them
142 'muting': Boolean denoting whether you are muting them 143 'muting': Boolean denoting whether you are muting them
144 'requested': Boolean denoting whether you have sent them a follow request
143 } 145 }
144 146
145Notification dicts 147Notification dicts
@@ -254,6 +256,13 @@ by the authenticated user.
254 256
255.. authomethod:: Mastodon.favourites 257.. authomethod:: Mastodon.favourites
256 258
259Reading data: Follow requests
260-----------------------------
261This function allows you to get a list of pending incoming follow
262requests for the authenticated user.
263
264.. automethod:: Mastodon.follow_requests
265
257Writing data: Statuses 266Writing data: Statuses
258---------------------- 267----------------------
259These functions allow you to post statuses to Mastodon and to 268These functions allow you to post statuses to Mastodon and to
@@ -279,6 +288,13 @@ These functions allow you to interact with other accounts: To (un)follow and
279.. automethod:: Mastodon.account_mute 288.. automethod:: Mastodon.account_mute
280.. automethod:: Mastodon.account_unmute 289.. automethod:: Mastodon.account_unmute
281 290
291Writing data: Follow requests
292-----------------------------
293These functions allow you to accept or reject incoming follow requests.
294
295.. automethod:: Mastodon.follow_request_authorize
296.. automethod:: Mastodon.follow_request_reject
297
282Writing data: Media 298Writing data: Media
283------------------- 299-------------------
284This function allows you to upload media to Mastodon. The returned 300This function allows you to upload media to Mastodon. The returned
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index d42c13f..06fe8a1 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -360,6 +360,18 @@ class Mastodon:
360 return self.__api_request('GET', '/api/v1/favourites') 360 return self.__api_request('GET', '/api/v1/favourites')
361 361
362 ### 362 ###
363 # Reading data: Follow requests
364 ###
365 def follow_requests(self, max_id = None, since_id = None, limit = None):
366 """
367 Fetch the authenticated user's incoming follow requests.
368
369 Returns a list of user dicts.
370 """
371 params = self.__generate_params(locals())
372 return self.__api_request('GET', '/api/v1/follow_requests', params)
373
374 ###
363 # Writing data: Statuses 375 # Writing data: Statuses
364 ### 376 ###
365 def status_post(self, status, in_reply_to_id = None, media_ids = None, sensitive = False, visibility = '', spoiler_text = None): 377 def status_post(self, status, in_reply_to_id = None, media_ids = None, sensitive = False, visibility = '', spoiler_text = None):
@@ -510,6 +522,25 @@ class Mastodon:
510 return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unmute") 522 return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unmute")
511 523
512 ### 524 ###
525 # Writing data: Follow requests
526 ###
527 def follow_request_authorize(self, id):
528 """
529 Accept an incoming follow request.
530
531 Returns a user dict of the authorized account.
532 """
533 return self.__api_request('POST', '/api/v1/follow_requests/' + str(id) + "/authorize")
534
535 def follow_request_reject(self, id):
536 """
537 Reject an incoming follow request.
538
539 Returns a user dict of the rejected account.
540 """
541 return self.__api_request('POST', '/api/v1/follow_requests/' + str(id) + "/reject")
542
543 ###
513 # Writing data: Media 544 # Writing data: Media
514 ### 545 ###
515 def media_post(self, media_file, mime_type = None): 546 def media_post(self, media_file, mime_type = None):
Powered by cgit v1.2.3 (git 2.41.0)