.. automethod:: API.destroy_direct_message
+.. automethod:: API.list_direct_messages
+
.. method:: API.get_direct_message([id], [full_text])
:rtype: :class:`DirectMessage` object
-.. method:: API.list_direct_messages([count], [cursor])
-
- Returns all Direct Message events (both sent and received) within the last
- 30 days. Sorted in reverse-chronological order.
-
- :param count: |count|
- :param cursor: |cursor|
- :rtype: list of :class:`DirectMessage` objects
-
-
.. method:: API.send_direct_message(recipient_id, text, [quick_reply_type], \
[attachment_type], [attachment_media_id])
), id=id, **kwargs
)
+ @pagination(mode='dm_cursor')
+ @payload('direct_message', list=True)
+ def list_direct_messages(self, **kwargs):
+ """list_direct_messages(*, count, cursor)
+
+ Returns all Direct Message events (both sent and received) within the
+ last 30 days. Sorted in reverse-chronological order.
+
+ :param count: |count|
+ :param cursor: |cursor|
+
+ :rtype: list of :class:`DirectMessage` objects
+
+ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/direct-messages/sending-and-receiving/api-reference/list-events
+ """
+ return self.request(
+ 'GET', 'direct_messages/events/list', endpoint_parameters=(
+ 'count', 'cursor'
+ ), **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
), id=id, **kwargs
)
- @pagination(mode='dm_cursor')
- @payload('direct_message', list=True)
- def list_direct_messages(self, **kwargs):
- """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/direct-messages/sending-and-receiving/api-reference/list-events
- """
- return self.request(
- 'GET', 'direct_messages/events/list', endpoint_parameters=(
- 'count', 'cursor'
- ), **kwargs
- )
-
@payload('direct_message')
def send_direct_message(self, recipient_id, text, *, quick_reply_options=None,
attachment_type=None, attachment_media_id=None,