Package twitter4j.v1
Interface DirectMessagesResources
public interface DirectMessagesResources
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroyDirectMessage
(long id) Deletes the direct message specified in the required ID parameter.getDirectMessages
(int count) Returns all Direct Message events (both sent and received) within the last 30 days.getDirectMessages
(int count, String cursor) Returns all Direct Message events (both sent and received) within the last 30 days.getDMImageAsStream
(String url) Returns a stream of the image included in direct messages.sendDirectMessage
(long userId, String text) Sends a new direct message to the specified user from the authenticating user.sendDirectMessage
(long userId, String text, long mediaId) Sends a new direct message to the specified user from the authenticating user.sendDirectMessage
(long userId, String text, String quickReplyResponse) Sends a new direct message to the specified user from the authenticating user.sendDirectMessage
(long userId, String text, QuickReply... quickReplies) Sends a new direct message to the specified user from the authenticating user.sendDirectMessage
(String screenName, String text) Sends a new direct message to the specified user from the authenticating user.showDirectMessage
(long id) Returns a single Direct Message event by the given id.
-
Method Details
-
getDirectMessages
Returns all Direct Message events (both sent and received) within the last 30 days. Sorted in reverse-chronological order.
This method calls https://api.twitter.com/1.1/direct_messages/events/list.json
Requests / 15-min window (user auth) 15/user- Parameters:
count
- Max number of events to be returned. 20 default. 50 max.- Returns:
- List
- Throws:
TwitterException
- when Twitter service or network is unavailable- Since:
- Twitter4J 4.0.7
- See Also:
-
getDirectMessages
Returns all Direct Message events (both sent and received) within the last 30 days. Sorted in reverse-chronological order.
This method calls https://api.twitter.com/1.1/direct_messages/events/list.json- Parameters:
count
- Max number of events to be returned. 20 default. 50 max.cursor
- For paging through result sets greater than 1 page, use the “next_cursor” property from the previous request.- Returns:
- List
- Throws:
TwitterException
- when Twitter service or network is unavailable- Since:
- Twitter4J 4.0.7
- See Also:
-
showDirectMessage
Returns a single Direct Message event by the given id.
This method has not been finalized and the interface is subject to change in incompatible ways.
This method calls https://api.twitter.com/1.1/direct_messages/events/show.json- Parameters:
id
- message id- Returns:
- DirectMessage
- Throws:
TwitterException
- when Twitter service or network is unavailable- Since:
- Twitter4J 2.1.9
- See Also:
-
destroyDirectMessage
Deletes the direct message specified in the required ID parameter.
This method calls https://api.twitter.com/1.1/direct_messages/events/destroy.json- Parameters:
id
- The id of the Direct Message event that should be deleted.- Throws:
TwitterException
- when Twitter service or network is unavailable- Since:
- Twitter4J 2.0.1
- See Also:
-
sendDirectMessage
DirectMessage sendDirectMessage(long userId, String text, QuickReply... quickReplies) throws TwitterException Sends a new direct message to the specified user from the authenticating user. Requires both the user and text parameters below. The text will be trimmed if the length of the text is exceeding 140 characters.
This method calls https://dev.twitter.com/rest/reference/post/direct_messages/events/new- Parameters:
userId
- the user id of the user to whom send the direct messagetext
- The text of your direct message.quickReplies
- Quick Replies- Returns:
- DirectMessage
- Throws:
TwitterException
- when Twitter service or network is unavailable- Since:
- Twitter4j 2.1.0
- See Also:
-
sendDirectMessage
DirectMessage sendDirectMessage(long userId, String text, String quickReplyResponse) throws TwitterException Sends a new direct message to the specified user from the authenticating user. Requires both the user and text parameters below. The text will be trimmed if the length of the text is exceeding 140 characters.
This method calls https://dev.twitter.com/rest/reference/post/direct_messages/events/new- Parameters:
userId
- the user id of the user to whom send the direct messagetext
- The text of your direct message.quickReplyResponse
- Quick Reply response- Returns:
- DirectMessage
- Throws:
TwitterException
- when Twitter service or network is unavailable- Since:
- Twitter4j 2.1.0
- See Also:
-
sendDirectMessage
Sends a new direct message to the specified user from the authenticating user. Requires both the user and text parameters below. The text will be trimmed if the length of the text is exceeding 140 characters.
This method calls https://dev.twitter.com/rest/reference/post/direct_messages/events/new- Parameters:
userId
- the user id of the user to whom send the direct messagetext
- The text of your direct message.mediaId
- id of media attachment- Returns:
- DirectMessage
- Throws:
TwitterException
- when Twitter service or network is unavailable- Since:
- Twitter4J 4.0.7
- See Also:
-
sendDirectMessage
Sends a new direct message to the specified user from the authenticating user. Requires both the user and text parameters below. The text will be trimmed if the length of the text is exceeding 140 characters.
This method calls https://dev.twitter.com/rest/reference/post/direct_messages/events/new- Parameters:
userId
- the user id of the user to whom send the direct messagetext
- The text of your direct message.- Returns:
- DirectMessage
- Throws:
TwitterException
- when Twitter service or network is unavailable- Since:
- Twitter4J 4.0.7
- See Also:
-
sendDirectMessage
Sends a new direct message to the specified user from the authenticating user. Requires both the user and text parameters below. The text will be trimmed if the length of the text is exceeding 140 characters.
This method calls https://api.twitter.com/1.1/direct_messages/new- Parameters:
screenName
- the screen name of the user to whom send the direct messagetext
- The text of your direct message.- Returns:
- DirectMessage
- Throws:
TwitterException
- when Twitter service or network is unavailable- See Also:
-
getDMImageAsStream
Returns a stream of the image included in direct messages.- Parameters:
url
- image url- Returns:
- InputStream
- Throws:
TwitterException
- when Twitter service or network is unavailable- Since:
- Twitter4J 3.0.6
- See Also:
-