From: Harmon Date: Tue, 6 Apr 2021 23:57:57 +0000 (-0500) Subject: Update and improve documentation for API.destroy_favorite X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f4942fa4470e3818de72dffc4b70548db30aa35f;p=tweepy.git Update and improve documentation for API.destroy_favorite Automatically use docstring for documentation Improve method and documentation order Add documentation for include_entities parameter Improve formatting and capitalization of reference --- diff --git a/docs/api.rst b/docs/api.rst index 3997d8b..82b6670 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -47,6 +47,8 @@ Post, retrieve, and engage with Tweets .. automethod:: API.create_favorite +.. automethod:: API.destroy_favorite + Status methods -------------- @@ -443,18 +445,6 @@ Account Methods :rtype: :class:`User` object -Favorite Methods ----------------- - -.. method:: API.destroy_favorite(id) - - Un-favorites the status specified in the ID parameter as the authenticating - user. - - :param id: |sid| - :rtype: :class:`Status` object - - Block Methods ------------- diff --git a/tweepy/api.py b/tweepy/api.py index 38e9683..a5972fa 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -586,6 +586,26 @@ class API: ), id=id, **kwargs ) + @payload('status') + def destroy_favorite(self, id, **kwargs): + """destroy_favorite(id, *, include_entities) + + Un-favorites the status specified in the ``id`` parameter as the + authenticating user. + + :param id: |sid| + :param include_entities: |include_entities| + + :rtype: :class:`Status` object + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-favorites-destroy + """ + return self.request( + 'POST', 'favorites/destroy', endpoint_parameters=( + 'id', 'include_entities' + ), id=id, **kwargs + ) + @payload('status') def update_status(self, status, **kwargs): """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-update @@ -1102,16 +1122,6 @@ class API: ), **kwargs ) - @payload('status') - def destroy_favorite(self, id, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-favorites-destroy - """ - return self.request( - 'POST', 'favorites/destroy', endpoint_parameters=( - 'id', 'include_entities' - ), id=id, **kwargs - ) - @payload('user') def create_block(self, **kwargs): """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-blocks-create