Skip to content

Commit

Permalink
added getTwitterImage
Browse files Browse the repository at this point in the history
  • Loading branch information
takke committed Jan 15, 2014
1 parent 6b14852 commit 2445400
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions twitter4j-core/src/main/java/twitter4j/TwitterImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,14 @@ public DirectMessage sendDirectMessage(String screenName, String text) throws Tw
new HttpParameter[]{new HttpParameter("screen_name", screenName), new HttpParameter("text", text)}));
}

/**
* {@inheritDoc}
*/
@Override
public InputStream getTwitterImage(String url) throws TwitterException {
return get(url).asStream();
}

/* Friends & Followers Resources */

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package twitter4j.api;

import java.io.InputStream;

import twitter4j.DirectMessage;
import twitter4j.Paging;
import twitter4j.ResponseList;
Expand Down Expand Up @@ -127,4 +129,13 @@ DirectMessage sendDirectMessage(long userId, String text)
DirectMessage sendDirectMessage(String screenName, String text)
throws TwitterException;

/**
* Returns a stream of the image included in direct messages.
*
* @return InputStream
* @throws TwitterException when Twitter service or network is unavailable
* @see <a href="https://dev.twitter.com/discussions/24255">Access media shared in direct messages | Twitter Developers</a>
*/
InputStream getTwitterImage(String url)
throws TwitterException;
}

0 comments on commit 2445400

Please sign in to comment.