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

docs/api.rst
tweepy/api.py

index 014841b0f011be6d67d22466a61d6ef4f4517eaa..48af170297faa669550bf07206e7d3f962cd95ce 100644 (file)
@@ -90,6 +90,8 @@ Create and manage lists
 
 .. automethod:: API.lists_subscriptions
 
+.. automethod:: API.create_list
+
 
 User methods
 ------------
@@ -595,17 +597,6 @@ Search Methods
 List Methods
 ------------
 
-.. method:: API.create_list(name, [mode], [description])
-
-   Creates a new list for the authenticated user.
-   Note that you can create up to 1000 lists per account.
-
-   :param name: The name of the new list.
-   :param mode: |list_mode|
-   :param description: The description of the list you are creating.
-   :rtype: :class:`List` object
-
-
 .. method:: API.destroy_list([owner_screen_name/owner_id], list_id/slug)
 
    Deletes the specified list.
index 96462e6356ce19dc630326aaa9bcc0ae14a18b91..53dbd3500aa836908f440907b1f7e9d598c92a70 100644 (file)
@@ -1151,6 +1151,27 @@ class API:
             ), **kwargs
         )
 
+    @payload('list')
+    def create_list(self, name, **kwargs):
+        """create_list(name, *, mode, description)
+
+        Creates a new list for the authenticated user.
+        Note that you can create up to 1000 lists per account.
+
+        :param name: The name of the new list.
+        :param mode: |list_mode|
+        :param description: The description of the list you are creating.
+
+        :rtype: :class:`List` object
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-create
+        """
+        return self.request(
+            'POST', 'lists/create', endpoint_parameters=(
+                'name', 'mode', 'description'
+            ), name=name, **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
@@ -1727,16 +1748,6 @@ class API:
         """
         return self.request('POST', f'saved_searches/destroy/{id}', **kwargs)
 
-    @payload('list')
-    def create_list(self, name, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-create
-        """
-        return self.request(
-            'POST', 'lists/create', endpoint_parameters=(
-                'name', 'mode', 'description'
-            ), name=name, **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