public interface DirectMessageOperations
Modifier and Type | Method and Description |
---|---|
void |
deleteDirectMessage(long messageId)
Deletes a direct message for the authenticated user.
|
DirectMessage |
getDirectMessage(long id)
Gets a direct message by its ID.
|
List<DirectMessage> |
getDirectMessagesReceived()
Retrieve the 20 most recently received direct messages for the authenticating user.
|
List<DirectMessage> |
getDirectMessagesReceived(int page,
int pageSize)
Retrieve received direct messages for the authenticating user.
|
List<DirectMessage> |
getDirectMessagesReceived(int page,
int pageSize,
long sinceId,
long maxId)
Retrieve received direct messages for the authenticating user.
|
List<DirectMessage> |
getDirectMessagesSent()
Retrieve the 20 most recent direct messages sent by the authenticating user.
|
List<DirectMessage> |
getDirectMessagesSent(int page,
int pageSize)
Retrieve direct messages sent by the authenticating user.
|
List<DirectMessage> |
getDirectMessagesSent(int page,
int pageSize,
long sinceId,
long maxId)
Retrieve direct messages sent by the authenticating user.
|
DirectMessage |
sendDirectMessage(long toUserId,
String text)
Sends a direct message to another Twitter user.
|
DirectMessage |
sendDirectMessage(String toScreenName,
String text)
Sends a direct message to another Twitter user.
|
List<DirectMessage> getDirectMessagesReceived()
DirectMessage
with the authenticating user as the recipient.org.springframework.social.MissingAuthorizationException
- if TwitterTemplate was not created with OAuth credentials.org.springframework.social.ApiException
- if there is an error while communicating with Twitter.List<DirectMessage> getDirectMessagesReceived(int page, int pageSize)
page
- The page to returnpageSize
- The number of DirectMessage
s per page. Should be less than or equal to 200. (Will return at most 200 entries, even if pageSize is greater than 200.)DirectMessage
with the authenticating user as the recipient.org.springframework.social.MissingAuthorizationException
- if TwitterTemplate was not created with OAuth credentials.org.springframework.social.ApiException
- if there is an error while communicating with Twitter.List<DirectMessage> getDirectMessagesReceived(int page, int pageSize, long sinceId, long maxId)
page
- The page to returnpageSize
- The number of DirectMessage
s per page. Should be less than or equal to 200. (Will return at most 200 entries, even if pageSize is greater than 200.)sinceId
- The minimum DirectMessage
ID to return in the resultsmaxId
- The maximum DirectMessage
ID to return in the resultsDirectMessage
with the authenticating user as the recipient.org.springframework.social.MissingAuthorizationException
- if TwitterTemplate was not created with OAuth credentials.org.springframework.social.ApiException
- if there is an error while communicating with Twitter.List<DirectMessage> getDirectMessagesSent()
DirectMessage
with the authenticating user as the sender.org.springframework.social.ApiException
- if there is an error while communicating with Twitter.org.springframework.social.MissingAuthorizationException
- if TwitterTemplate was not created with OAuth credentials.List<DirectMessage> getDirectMessagesSent(int page, int pageSize)
page
- The page to returnpageSize
- The number of DirectMessage
s per page. Should be less than or equal to 200. (Will return at most 200 entries, even if pageSize is greater than 200.)DirectMessage
with the authenticating user as the sender.org.springframework.social.ApiException
- if there is an error while communicating with Twitter.org.springframework.social.MissingAuthorizationException
- if TwitterTemplate was not created with OAuth credentials.List<DirectMessage> getDirectMessagesSent(int page, int pageSize, long sinceId, long maxId)
page
- The page to returnpageSize
- The number of DirectMessage
s per page. Should be less than or equal to 200. (Will return at most 200 entries, even if pageSize is greater than 200.)sinceId
- The minimum DirectMessage
ID to return in the resultsmaxId
- The maximum DirectMessage
ID to return in the resultsDirectMessage
with the authenticating user as the sender.org.springframework.social.ApiException
- if there is an error while communicating with Twitter.org.springframework.social.MissingAuthorizationException
- if TwitterTemplate was not created with OAuth credentials.DirectMessage getDirectMessage(long id)
id
- the message IDorg.springframework.social.ApiException
- if there is an error while communicating with Twitter.org.springframework.social.MissingAuthorizationException
- if TwitterTemplate was not created with OAuth credentials.DirectMessage sendDirectMessage(String toScreenName, String text)
InvalidMessageRecipientException
will be thrown.toScreenName
- the screen name of the recipient of the messages.text
- the message text.DirectMessage
org.springframework.social.ApiException
- if there is an error while communicating with Twitter.InvalidMessageRecipientException
- if the recipient is not following the authenticating user.org.springframework.social.DuplicateStatusException
- if the message duplicates a previously sent message.MessageTooLongException
- if the message length exceeds Twitter's 140 character limit.org.springframework.social.MissingAuthorizationException
- if TwitterTemplate was not created with OAuth credentials.DirectMessage sendDirectMessage(long toUserId, String text)
InvalidMessageRecipientException
will be thrown.toUserId
- the Twitter user ID of the recipient of the messages.text
- the message text.DirectMessage
org.springframework.social.ApiException
- if there is an error while communicating with Twitter.InvalidMessageRecipientException
- if the recipient is not following the authenticating user.org.springframework.social.DuplicateStatusException
- if the message duplicates a previously sent message.MessageTooLongException
- if the message length exceeds Twitter's 140 character limit.org.springframework.social.MissingAuthorizationException
- if TwitterTemplate was not created with OAuth credentials.void deleteDirectMessage(long messageId)
messageId
- the ID of the message to be removed.org.springframework.social.ApiException
- if there is an error while communicating with Twitter.org.springframework.social.MissingAuthorizationException
- if TwitterTemplate was not created with OAuth credentials.