org.springframework.social.twitter.api
Interface DirectMessageOperations


public interface DirectMessageOperations

Interface defining the Twitter operations for working with direct messages.


Method Summary
 void deleteDirectMessage(long messageId)
          Deletes a direct message for the authenticated user.
 java.util.List<DirectMessage> getDirectMessagesReceived()
          Retrieve the 20 most recently received direct messages for the authenticating user.
 java.util.List<DirectMessage> getDirectMessagesSent()
          Retrieve the 20 most recently sent direct messages for the authenticating user.
 void sendDirectMessage(long toUserId, java.lang.String text)
          Sends a direct message to another Twitter user.
 void sendDirectMessage(java.lang.String toScreenName, java.lang.String text)
          Sends a direct message to another Twitter user.
 

Method Detail

getDirectMessagesReceived

java.util.List<DirectMessage> getDirectMessagesReceived()
Retrieve the 20 most recently received direct messages for the authenticating user.

Returns:
a collection of DirectMessage with the authenticating user as the recipient.

getDirectMessagesSent

java.util.List<DirectMessage> getDirectMessagesSent()
Retrieve the 20 most recently sent direct messages for the authenticating user.

Returns:
a collection of DirectMessage with the authenticating user as the sender.

sendDirectMessage

void sendDirectMessage(java.lang.String toScreenName,
                       java.lang.String text)
Sends a direct message to another Twitter user. The recipient of the message must follow the authenticated user in order for the message to be delivered. If the recipient is not following the authenticated user, an InvalidMessageRecipientException will be thrown.

Parameters:
toScreenName - the screen name of the recipient of the messages.
text - the message text.
Throws:
InvalidMessageRecipientException - if the recipient is not following the authenticating user.
DuplicateTweetException - if the message duplicates a previously sent message.

sendDirectMessage

void sendDirectMessage(long toUserId,
                       java.lang.String text)
Sends a direct message to another Twitter user. The recipient of the message must follow the authenticated user in order for the message to be delivered. If the recipient is not following the authenticated user, an InvalidMessageRecipientException will be thrown.

Parameters:
toUserId - the Twitter user ID of the recipient of the messages.
text - the message text.
Throws:
InvalidMessageRecipientException - if the recipient is not following the authenticating user.
DuplicateTweetException - if the message duplicates a previously sent message.

deleteDirectMessage

void deleteDirectMessage(long messageId)
Deletes a direct message for the authenticated user.

Parameters:
messageId - the ID of the message to be removed.