Update and improve documentation for API.add_list_member
authorHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 15:39:28 +0000 (10:39 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 15:39:28 +0000 (10:39 -0500)
Automatically use docstring for documentation
Improve method and documentation order
Improve parameter order in documentation

docs/api.rst
tweepy/api.py

index ec410b941c4eabee0b09a602e877460bf279db86..96317e512235d9b1b4cbd3e38009d905d6c506bb 100644 (file)
@@ -94,6 +94,8 @@ Create and manage lists
 
 .. automethod:: API.destroy_list
 
+.. automethod:: API.add_list_member
+
 
 User methods
 ------------
@@ -615,21 +617,6 @@ List Methods
    :rtype: :class:`List` object
 
 
-.. method:: API.add_list_member(list_id/slug, screen_name/user_id, \
-                                [owner_id/owner_screen_name])
-
-   Add a member to a list. The authenticated user must own the list to be able
-   to add members to it. Lists are limited to 5,000 members.
-
-   :param list_id: |list_id|
-   :param slug: |slug|
-   :param screen_name: |screen_name|
-   :param user_id: |user_id|
-   :param owner_id: |owner_id|
-   :param owner_screen_name: |owner_screen_name|
-   :rtype: :class:`List` object
-
-
 .. method:: API.add_list_members(list_id/slug, screen_name/user_id, \
                                  [owner_id/owner_screen_name])
 
index 93350db2a4f54f3be5471dd81e4534e092022f39..58972060ef4d39fe14069dff8f163bf5b354e163 100644 (file)
@@ -1194,6 +1194,32 @@ class API:
             ), **kwargs
         )
 
+    @payload('list')
+    def add_list_member(self, **kwargs):
+        """add_list_member(*, list_id, slug, user_id, screen_name, \
+                           owner_screen_name, owner_id)
+
+        Add a member to a list. The authenticated user must own the list to be
+        able to add members to it. Lists are limited to 5,000 members.
+
+        :param list_id: |list_id|
+        :param slug: |slug|
+        :param user_id: |user_id|
+        :param screen_name: |screen_name|
+        :param owner_screen_name: |owner_screen_name|
+        :param owner_id: |owner_id|
+
+        :rtype: :class:`List` object
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create
+        """
+        return self.request(
+            'POST', 'lists/members/create', endpoint_parameters=(
+                'list_id', 'slug', 'user_id', 'screen_name',
+                'owner_screen_name', 'owner_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
@@ -1781,17 +1807,6 @@ class API:
             ), **kwargs
         )
 
-    @payload('list')
-    def add_list_member(self, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create
-        """
-        return self.request(
-            'POST', 'lists/members/create', endpoint_parameters=(
-                'list_id', 'slug', 'user_id', 'screen_name',
-                'owner_screen_name', 'owner_id'
-            ), **kwargs
-        )
-
     @payload('list')
     def remove_list_member(self, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy