From 5ff12bd779553c4af0eb011e287d8f2943993dde Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 7 Apr 2021 10:36:36 -0500 Subject: [PATCH] Update and improve documentation for API.destroy_list Automatically use docstring for documentation Improve method and documentation order --- docs/api.rst | 14 ++------------ tweepy/api.py | 32 ++++++++++++++++++++++---------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 48af170..ec410b9 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -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]) diff --git a/tweepy/api.py b/tweepy/api.py index 53dbd35..93350db 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -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 -- 2.25.1