From cc6794811483fe691a7c099c2706d54a33979c1a Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 10 Apr 2021 10:16:18 -0500 Subject: [PATCH] Update and improve documentation for API.destroy_block Automatically use docstring for documentation Improve method and documentation order Add include_entities and skip_status parameters to documentation Remove id parameter from documentation --- docs/api.rst | 16 ++-------------- tweepy/api.py | 33 +++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 96141ce..0033461 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -181,6 +181,8 @@ Mute, block, and report users .. automethod:: API.create_block +.. automethod:: API.destroy_block + Direct Message Methods ---------------------- @@ -252,20 +254,6 @@ Account Methods :rtype: :class:`JSON` object -Block Methods -------------- - -.. method:: API.destroy_block(id/screen_name/user_id) - - Un-blocks the user specified in the ID parameter for the authenticating - user. - - :param id: |uid| - :param screen_name: |screen_name| - :param user_id: |user_id| - :rtype: :class:`User` object - - Mute Methods ------------ diff --git a/tweepy/api.py b/tweepy/api.py index b543e54..8065067 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -2115,6 +2115,29 @@ class API: ), **kwargs ) + @payload('user') + def destroy_block(self, **kwargs): + """destroy_block(*, screen_name, user_id, include_entities, \ + skip_status) + + Un-blocks the user specified in the ID parameter for the authenticating + user. + + :param screen_name: |screen_name| + :param user_id: |user_id| + :param include_entities: |include_entities| + :param skip_status: |skip_status| + + :rtype: :class:`User` object + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-blocks-destroy + """ + return self.request( + 'POST', 'blocks/destroy', endpoint_parameters=( + 'screen_name', 'user_id', 'include_entities', 'skip_status' + ), **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 @@ -2354,16 +2377,6 @@ class API: ), use_cache=False, **kwargs ) - @payload('user') - def destroy_block(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-blocks-destroy - """ - return self.request( - 'POST', 'blocks/destroy', endpoint_parameters=( - 'screen_name', 'user_id', 'include_entities', 'skip_status' - ), **kwargs - ) - @payload('user') def create_mute(self, **kwargs): """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-create -- 2.25.1