Package twitter4j.v1

Interface DirectMessagesResources


public interface DirectMessagesResources
  • Method Details

    • getDirectMessages

      DirectMessageList getDirectMessages(int count) throws TwitterException
      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

      DirectMessageList getDirectMessages(int count, String cursor) throws TwitterException
      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

      DirectMessage showDirectMessage(long id) throws TwitterException
      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

      void destroyDirectMessage(long id) throws TwitterException
      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 message
      text - 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 message
      text - 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

      DirectMessage sendDirectMessage(long userId, String text, long mediaId) 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 message
      text - 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

      DirectMessage sendDirectMessage(long userId, String text) 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 message
      text - 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

      DirectMessage sendDirectMessage(String screenName, String text) 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://api.twitter.com/1.1/direct_messages/new
      Parameters:
      screenName - the screen name of the user to whom send the direct message
      text - The text of your direct message.
      Returns:
      DirectMessage
      Throws:
      TwitterException - when Twitter service or network is unavailable
      See Also:
    • getDMImageAsStream

      InputStream getDMImageAsStream(String url) throws TwitterException
      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: