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

docs/api.rst
tweepy/api.py

index dcd936887813536c555cb18c5055906e1ff7fa3d..f851b6aff150d9e50c228bc83f62e4b9c322d087 100644 (file)
@@ -51,6 +51,8 @@ Post, retrieve, and engage with Tweets
 
 .. automethod:: API.destroy_status
 
+.. automethod:: API.retweet
+
 
 Status methods
 --------------
@@ -153,14 +155,6 @@ Status methods
    :rtype: :class:`Status` object
 
 
-.. method:: API.retweet(id)
-
-   Retweets a tweet. Requires the id of the tweet you are retweeting.
-
-   :param id: |sid|
-   :rtype: :class:`Status` object
-
-
 .. method:: API.unretweet(id)
 
    Untweets a retweeted status. Requires the id of the retweet to unretweet.
index 9ca0a129014f82e118f686f4e22456f5040630bb..ef8e5a6f71920d2f7e392514f1852533649b9628 100644 (file)
@@ -626,6 +626,25 @@ class API:
             ), **kwargs
         )
 
+    @payload('status')
+    def retweet(self, id, **kwargs):
+        """retweet(id, *, trim_user)
+
+        Retweets a Tweet. Requires the ID of the Tweet you are retweeting.
+
+        :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-retweet-id
+        """
+        return self.request(
+            'POST', f'statuses/retweet/{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
@@ -825,16 +844,6 @@ class API:
             ), command='STATUS', media_id=media_id, upload_api=True, **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
-        """
-        return self.request(
-            'POST', f'statuses/retweet/{id}', endpoint_parameters=(
-                'trim_user',
-            ), **kwargs
-        )
-
     @payload('status')
     def unretweet(self, id, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-unretweet-id