Update and improve documentation for API.unretweet
authorHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 13:39:41 +0000 (08:39 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 13:39:41 +0000 (08:39 -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 f851b6aff150d9e50c228bc83f62e4b9c322d087..af402620e7d57a823915a1da6ccaaebd1d749e01 100644 (file)
@@ -53,6 +53,8 @@ Post, retrieve, and engage with Tweets
 
 .. automethod:: API.retweet
 
+.. automethod:: API.unretweet
+
 
 Status methods
 --------------
@@ -155,14 +157,6 @@ Status methods
    :rtype: :class:`Status` object
 
 
-.. method:: API.unretweet(id)
-
-   Untweets a retweeted status. Requires the id of the retweet to unretweet.
-
-   :param id: |sid|
-   :rtype: :class:`Status` object
-
-
 User methods
 ------------
 
index ef8e5a6f71920d2f7e392514f1852533649b9628..aa89068477c45a0ad0c7eadeb39940354e687914 100644 (file)
@@ -645,6 +645,26 @@ class API:
             ), **kwargs
         )
 
+    @payload('status')
+    def unretweet(self, id, **kwargs):
+        """unretweet(id, *, trim_user)
+
+        Untweets a retweeted status. Requires the ID of the retweet to
+        unretweet.
+
+        :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-unretweet-id
+        """
+        return self.request(
+            'POST', f'statuses/unretweet/{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
@@ -844,16 +864,6 @@ class API:
             ), command='STATUS', media_id=media_id, upload_api=True, **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
-        """
-        return self.request(
-            'POST', f'statuses/unretweet/{id}', endpoint_parameters=(
-                'trim_user',
-            ), **kwargs
-        )
-
     @payload('user')
     def get_user(self, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-users-show