[−][src]Module egg_mode::direct
Structs and methods for working with direct messages.
Note that direct message access requires a special permissions level above regular read/write access. Your app must be configured to have "read, write, and direct message" access to use any function in this module, even the read-only ones.
Although the Twitter website and official apps display DMs as threads between the authenticated
user and specific other users, the API does not expose them like this. Separate calls to
received
and sent
are necessary to fully reconstruct a DM thread. You can partition on
sender_id
/receiver_id
and sort by their created_at
to weave the streams together.
Types
DirectMessage
/DMEntities
: A single DM and its associated entities. TheDMEntities
struct contains information about URLs, user mentions, and hashtags in the DM.Timeline
: Effectively the same astweet::Timeline
, but gives outDirectMessage
s instead. Returned by functions that traverse collections of DMs.ConversationTimeline
/DMConversations
: This struct and alias are part of the "conversations" wrapper for loading direct messages into per-recipient threads.
Functions
Lookup
These functions pull a user's DMs for viewing. sent
and received
can be cursored with
sub-views like with tweets, so they return a Timeline
instance that can be navigated at will.
sent
received
show
conversations
Actions
These functions are your basic write access to DMs. As a DM does not carry as much metadata as
a tweet, the send
action does not go through a builder struct like with DraftTweet
.
send
delete
Structs
ConversationTimeline | Helper struct to load both sent and received direct messages, pre-sorting them into conversations by their recipient. |
DMEntities | Container for URL, hashtag, mention, and media information associated with a direct message. |
DirectMessage | Represents a single direct message. |
Timeline | Helper struct to navigate collections of direct messages by requesting DMs older or newer than certain IDs. |
Functions
conversations | Create a |
delete | Delete the direct message with the given ID. |
received | Create a |
send | Send a new direct message to the given user. |
sent | Create a |
show | Lookup a single DM by its numeric ID. |
Type Definitions
DMConversations | Wrapper around a collection of direct messages, sorted by their recipient. |