Update and improve documentation for API.destroy_direct_message
authorHarmon <Harmon758@gmail.com>
Sat, 10 Apr 2021 21:46:50 +0000 (16:46 -0500)
committerHarmon <Harmon758@gmail.com>
Sat, 10 Apr 2021 21:46:50 +0000 (16:46 -0500)
Automatically use docstring for documentation
Improve method and documentation order
Add and update API documentation headers to match API reference index
Improve capitalization

docs/api.rst
tweepy/api.py

index ffb53917d9994c23871c270b51051d25e339b5a9..83cfaf4dd1d4b07103ab5c9ba1141360c1d5308f 100644 (file)
@@ -189,9 +189,14 @@ Mute, block, and report users
 
 .. automethod:: API.report_spam
 
+Direct Messages
+---------------
+
+Sending and receiving events
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. automethod:: API.destroy_direct_message
 
-Direct Message Methods
-----------------------
 
 .. method:: API.get_direct_message([id], [full_text])
 
@@ -234,18 +239,6 @@ Direct Message Methods
    :rtype: :class:`DirectMessage` object
 
 
-.. method:: API.destroy_direct_message(id)
-
-   Deletes the direct message specified in the required ID parameter. The
-   authenticating user must be the recipient of the specified direct message.
-   Direct Messages are only removed from the interface of the user context
-   provided. Other members of the conversation can still access the Direct
-   Messages.
-
-   :param id: The id of the Direct Message that should be deleted.
-   :rtype: None
-
-
 Account Methods
 ---------------
 
index c008118da5b95fb403ea45931aa8908f54ba7c2e..dd77d58c5d0372f75d4b04080e6f9aa470058b71 100644 (file)
@@ -2189,6 +2189,29 @@ class API:
             ), **kwargs
         )
 
+    # Sending and receiving events
+
+    def destroy_direct_message(self, id, **kwargs):
+        """destroy_direct_message(id)
+
+        Deletes the direct message specified in the required ID parameter. The
+        authenticating user must be the recipient of the specified direct
+        message. Direct Messages are only removed from the interface of the
+        user context provided. Other members of the conversation can still
+        access the Direct Messages.
+
+        :param id: The ID of the Direct Message that should be deleted.
+
+        :rtype: None
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/direct-messages/sending-and-receiving/api-reference/delete-message-event
+        """
+        return self.request(
+            'DELETE', 'direct_messages/events/destroy', endpoint_parameters=(
+                'id',
+            ), id=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
@@ -2409,15 +2432,6 @@ class API:
             json_payload=json_payload, **kwargs
         )
 
-    def destroy_direct_message(self, id, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/direct-messages/sending-and-receiving/api-reference/delete-message-event
-        """
-        return self.request(
-            'DELETE', 'direct_messages/events/destroy', endpoint_parameters=(
-                'id',
-            ), id=id, **kwargs
-        )
-
     @payload('json')
     def rate_limit_status(self, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status