From c9ae215f9942d0faba22937560e33c5cb3a4ce68 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 10 Apr 2021 10:18:20 -0500 Subject: [PATCH] Update and improve documentation for API.create_mute Automatically use docstring for documentation Improve method and documentation order Remove id parameter from documentation --- docs/api.rst | 12 ++---------- tweepy/api.py | 30 ++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 0033461..e2e5024 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -183,6 +183,8 @@ Mute, block, and report users .. automethod:: API.destroy_block +.. automethod:: API.create_mute + Direct Message Methods ---------------------- @@ -257,16 +259,6 @@ Account Methods Mute Methods ------------ -.. method:: API.create_mute(id/screen_name/user_id) - - Mutes 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 - - .. method:: API.destroy_mute(id/screen_name/user_id) Un-mutes the user specified in the ID parameter for the authenticating user. diff --git a/tweepy/api.py b/tweepy/api.py index 8065067..28705da 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -2138,6 +2138,26 @@ class API: ), **kwargs ) + @payload('user') + def create_mute(self, **kwargs): + """create_mute(*, screen_name, user_id) + + Mutes the user specified in the ID parameter for the authenticating + user. + + :param screen_name: |screen_name| + :param user_id: |user_id| + + :rtype: :class:`User` object + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-create + """ + return self.request( + 'POST', 'mutes/users/create', endpoint_parameters=( + 'screen_name', 'user_id' + ), **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 @@ -2377,16 +2397,6 @@ class API: ), use_cache=False, **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 - """ - return self.request( - 'POST', 'mutes/users/create', endpoint_parameters=( - 'screen_name', 'user_id' - ), **kwargs - ) - @payload('user') def destroy_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-destroy -- 2.25.1