Update and improve documentation for API.destroy_list
authorHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 15:36:36 +0000 (10:36 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 15:38:13 +0000 (10:38 -0500)
Automatically use docstring for documentation
Improve method and documentation order

docs/api.rst
tweepy/api.py

index 48af170297faa669550bf07206e7d3f962cd95ce..ec410b941c4eabee0b09a602e877460bf279db86 100644 (file)
@@ -92,6 +92,8 @@ Create and manage lists
 
 .. automethod:: API.create_list
 
+.. automethod:: API.destroy_list
+
 
 User methods
 ------------
@@ -597,18 +599,6 @@ Search Methods
 List Methods
 ------------
 
-.. method:: API.destroy_list([owner_screen_name/owner_id], list_id/slug)
-
-   Deletes the specified list.
-   The authenticated user must own the list to be able to destroy it.
-
-   :param owner_screen_name: |owner_screen_name|
-   :param owner_id: |owner_id|
-   :param list_id: |list_id|
-   :param slug: |slug|
-   :rtype: :class:`List` object
-
-
 .. method:: API.update_list(list_id/slug, [name], [mode], [description], \
                             [owner_screen_name/owner_id])
 
index 53dbd3500aa836908f440907b1f7e9d598c92a70..93350db2a4f54f3be5471dd81e4534e092022f39 100644 (file)
@@ -1172,6 +1172,28 @@ class API:
             ), name=name, **kwargs
         )
 
+    @payload('list')
+    def destroy_list(self, **kwargs):
+        """destroy_list(*, owner_screen_name, owner_id, list_id, slug)
+
+        Deletes the specified list.
+        The authenticated user must own the list to be able to destroy it.
+
+        :param owner_screen_name: |owner_screen_name|
+        :param owner_id: |owner_id|
+        :param list_id: |list_id|
+        :param slug: |slug|
+
+        :rtype: :class:`List` object
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy
+        """
+        return self.request(
+            'POST', 'lists/destroy', endpoint_parameters=(
+                'owner_screen_name', 'owner_id', 'list_id', 'slug'
+            ), **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
@@ -1748,16 +1770,6 @@ class API:
         """
         return self.request('POST', f'saved_searches/destroy/{id}', **kwargs)
 
-    @payload('list')
-    def destroy_list(self, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy
-        """
-        return self.request(
-            'POST', 'lists/destroy', endpoint_parameters=(
-                'owner_screen_name', 'owner_id', 'list_id', 'slug'
-            ), **kwargs
-        )
-
     @payload('list')
     def update_list(self, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-update