From 1d1b6fb0713fc88091671d7b1ddcc50ad2f9402e Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 10 Apr 2021 09:41:57 -0500 Subject: [PATCH] Update and improve documentation for API.blocks_ids Automatically use docstring for documentation Improve method and documentation order Add API documentation header to match API reference index Add documentation for stringify_ids parameter Improve return type reference Improve capitalization --- docs/api.rst | 13 +++++-------- tweepy/api.py | 34 +++++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 92dfd55..7d24ce6 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -168,6 +168,11 @@ Manage account settings and profile .. automethod:: API.destroy_saved_search +Mute, block, and report users +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automethod:: API.blocks_ids + Direct Message Methods ---------------------- @@ -272,14 +277,6 @@ Block Methods :rtype: list of :class:`User` objects -.. method:: API.blocks_ids([cursor]) - - Returns an array of numeric user ids the authenticating user is blocking. - - :param cursor: |cursor| - :rtype: list of Integers - - Mute Methods ------------ diff --git a/tweepy/api.py b/tweepy/api.py index 9b4228b..67ba279 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -2005,6 +2005,29 @@ class API: """ return self.request('POST', f'saved_searches/destroy/{id}', **kwargs) + # Mute, block, and report users + + @pagination(mode='cursor') + @payload('ids') + def blocks_ids(self, **kwargs): + """blocks_ids(*, stringify_ids, cursor) + + Returns an array of numeric user IDs the authenticating user is + blocking. + + :param stringify_ids: |stringify_ids| + :param cursor: |cursor| + + :rtype: list of :class:`int` + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/get-blocks-ids + """ + return self.request( + 'GET', 'blocks/ids', endpoint_parameters=( + 'stringify_ids', 'cursor', + ), **kwargs + ) + def media_upload(self, filename, *, file=None, chunked=False, media_category=None, additional_owners=None, **kwargs): """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/overview @@ -2317,17 +2340,6 @@ class API: ), **kwargs ) - @pagination(mode='cursor') - @payload('ids') - def blocks_ids(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/get-blocks-ids - """ - return self.request( - 'GET', 'blocks/ids', endpoint_parameters=( - 'stringify_ids', 'cursor', - ), **kwargs - ) - @payload('user') def report_spam(self, **kwargs): """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam -- 2.25.1