Update and improve documentation for API.destroy_friendship
authorHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 18:57:52 +0000 (13:57 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 18:57:52 +0000 (13:57 -0500)
Automatically use docstring for documentation
Improve method and documentation order
Remove id parameter from documentation

docs/api.rst
tweepy/api.py

index 7b53af7e8ccface260de2aba94d89a3a8ae8c1d9..d7346552c1903edd9561664d72979c7413c74c2f 100644 (file)
@@ -137,6 +137,8 @@ Follow, search, and get users
 
 .. automethod:: API.create_friendship
 
+.. automethod:: API.destroy_friendship
+
 
 Direct Message Methods
 ----------------------
@@ -194,19 +196,6 @@ Direct Message Methods
    :rtype: None
 
 
-Friendship Methods
-------------------
-
-.. method:: API.destroy_friendship(id/screen_name/user_id)
-
-   Destroy a friendship with the specified user (aka unfollow).
-
-   :param id: |uid|
-   :param screen_name: |screen_name|
-   :param user_id: |user_id|
-   :rtype: :class:`User` object
-
-
 Account Methods
 ---------------
 
index 4006bebe43d31d5ae63ec3a6a682b484d36fb153..6f213947a6f138cfce12f3055ba5d29351196561 100644 (file)
@@ -1697,6 +1697,25 @@ class API:
             ), **kwargs
         )
 
+    @payload('user')
+    def destroy_friendship(self, **kwargs):
+        """destroy_friendship(*, screen_name, user_id)
+
+        Destroy a friendship with the specified user (aka unfollow).
+
+        :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/follow-search-get-users/api-reference/post-friendships-destroy
+        """
+        return self.request(
+            'POST', 'friendships/destroy', 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
@@ -1926,16 +1945,6 @@ class API:
             ), id=id, **kwargs
         )
 
-    @payload('user')
-    def destroy_friendship(self, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy
-        """
-        return self.request(
-            'POST', 'friendships/destroy', endpoint_parameters=(
-                'screen_name', 'user_id'
-            ), **kwargs
-        )
-
     @payload('json')
     def get_settings(self, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/get-account-settings