Update and improve documentation for API.destroy_status
authorHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 13:31:39 +0000 (08:31 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 13:31:39 +0000 (08:31 -0500)
Automatically use docstring for documentation
Improve method and documentation order
Add documentation for trim_user parameter
Improve formatting

docs/api.rst
tweepy/api.py

index 82b66700e7f65c29ce5577d87c719643ca8a03d8..dcd936887813536c555cb18c5055906e1ff7fa3d 100644 (file)
@@ -49,6 +49,8 @@ Post, retrieve, and engage with Tweets
 
 .. automethod:: API.destroy_favorite
 
+.. automethod:: API.destroy_status
+
 
 Status methods
 --------------
@@ -151,15 +153,6 @@ Status methods
    :rtype: :class:`Status` object
 
 
-.. method:: API.destroy_status(id)
-
-   Destroy the status specified by the id parameter. The authenticated user
-   must be the author of the status to destroy.
-
-   :param id: |sid|
-   :rtype: :class:`Status` object
-
-
 .. method:: API.retweet(id)
 
    Retweets a tweet. Requires the id of the tweet you are retweeting.
index a5972fad176315d287eb69545be48e305e0dfc90..9ca0a129014f82e118f686f4e22456f5040630bb 100644 (file)
@@ -606,6 +606,26 @@ class API:
             ), id=id, **kwargs
         )
 
+    @payload('status')
+    def destroy_status(self, id, **kwargs):
+        """destroy_status(id, *, trim_user)
+
+        Destroy the status specified by the ``id`` parameter. The authenticated
+        user must be the author of the status to destroy.
+
+        :param id: |sid|
+        :param trim_user: |trim_user|
+
+        :rtype: :class:`Status` object
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-destroy-id
+        """
+        return self.request(
+            'POST', f'statuses/destroy/{id}', endpoint_parameters=(
+                'trim_user',
+            ), **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
@@ -805,16 +825,6 @@ class API:
             ), command='STATUS', media_id=media_id, upload_api=True, **kwargs
         )
 
-    @payload('status')
-    def destroy_status(self, id, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-destroy-id
-        """
-        return self.request(
-            'POST', f'statuses/destroy/{id}', endpoint_parameters=(
-                'trim_user',
-            ), **kwargs
-        )
-
     @payload('status')
     def retweet(self, id, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-retweet-id