Skip to content

Commit

Permalink
(friends/ids followers/ids) add count param
Browse files Browse the repository at this point in the history
  • Loading branch information
mumei committed May 19, 2014
1 parent ee322a7 commit 56dfd54
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
24 changes: 24 additions & 0 deletions twitter4j-core/src/main/java/twitter4j/TwitterImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,24 @@ public IDs getFriendsIDs(long userId, long cursor) throws TwitterException {
"&cursor=" + cursor));
}

@Override
public IDs getFriendsIDs(long userId, long cursor, int count) throws TwitterException {
return factory.createIDs(get(conf.getRestBaseURL() + "friends/ids.json?user_id=" + userId +
"&cursor=" + cursor + "&count=" + count));
}

@Override
public IDs getFriendsIDs(String screenName, long cursor) throws TwitterException {
return factory.createIDs(get(conf.getRestBaseURL() + "friends/ids.json?screen_name=" + screenName
+ "&cursor=" + cursor));
}

@Override
public IDs getFriendsIDs(String screenName, long cursor, int count) throws TwitterException {
return factory.createIDs(get(conf.getRestBaseURL() + "friends/ids.json?screen_name=" + screenName
+ "&cursor=" + cursor + "&count=" + count));
}

@Override
public IDs getFollowersIDs(long cursor) throws TwitterException {
return factory.createIDs(get(conf.getRestBaseURL() + "followers/ids.json?cursor=" + cursor));
Expand All @@ -319,12 +331,24 @@ public IDs getFollowersIDs(long userId, long cursor) throws TwitterException {
+ "&cursor=" + cursor));
}

@Override
public IDs getFollowersIDs(long userId, long cursor, int count) throws TwitterException {
return factory.createIDs(get(conf.getRestBaseURL() + "followers/ids.json?user_id=" + userId
+ "&cursor=" + cursor + "&count=" + count));
}

@Override
public IDs getFollowersIDs(String screenName, long cursor) throws TwitterException {
return factory.createIDs(get(conf.getRestBaseURL() + "followers/ids.json?screen_name="
+ screenName + "&cursor=" + cursor));
}

@Override
public IDs getFollowersIDs(String screenName, long cursor, int count) throws TwitterException {
return factory.createIDs(get(conf.getRestBaseURL() + "followers/ids.json?screen_name="
+ screenName + "&cursor=" + cursor + "&count=" + count));
}

@Override
public ResponseList<Friendship> lookupFriendships(long[] ids) throws TwitterException {
return factory.createFriendshipList(get(conf.getRestBaseURL() + "friendships/lookup.json?user_id=" + StringUtil.join(ids)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@ public interface FriendsFollowersResources {
*/
IDs getFriendsIDs(long userId, long cursor) throws TwitterException;

/**
* Returns an array of numeric IDs for every user the specified user is following.
* <br>This method calls http://api.twitter.com/1.1/friends/ids.json
*
* @param userId Specifies the ID of the user for whom to return the friends list.
* @param cursor Causes the list of connections to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 as suspended users are filterd out after connections are queried. <br/>
* To begin paging provide a value of -1 as the cursor. The response from the API will include a previous_cursor and next_cursor to allow paging back and forth.
* @param count Specifies the number of IDs attempt retrieval of, up to a maximum of 5,000 per distinct request. The value of count is best thought of as a limit to the number of results to return.<br/>
* When using the count parameter with this method, it is wise to use a consistent count value across all requests to the same user's collection.<br/>
* Usage of this parameter is encouraged in environments where all 5,000 IDs constitutes too large of a response.
* @return an array of numeric IDs for every user the specified user is following
* @throws TwitterException when Twitter service or network is unavailable
* @see <a href="https://dev.twitter.com/docs/api/1.1/get/friends/ids">GET friends/ids | Twitter Developers</a>
* @since Twitter4J 4.0.2
*/
IDs getFriendsIDs(long userId, long cursor,int count) throws TwitterException;

/**
* Returns an array of numeric IDs for every user the specified user is following.
* <br>This method calls https://api.twitter.com/1.1/friends/ids.json
Expand All @@ -65,6 +82,23 @@ public interface FriendsFollowersResources {
*/
IDs getFriendsIDs(String screenName, long cursor) throws TwitterException;

/**
* Returns an array of numeric IDs for every user the specified user is following.
* <br>This method calls http://api.twitter.com/1.1/friends/ids.json
*
* @param screenName Specifies the screen name of the user for whom to return the friends list.
* @param cursor Causes the list of connections to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 as suspended users are filterd out after connections are queried. <br/>
* To begin paging provide a value of -1 as the cursor. The response from the API will include a previous_cursor and next_cursor to allow paging back and forth.
* @param count Specifies the number of IDs attempt retrieval of, up to a maximum of 5,000 per distinct request. The value of count is best thought of as a limit to the number of results to return.<br/>
* When using the count parameter with this method, it is wise to use a consistent count value across all requests to the same user's collection.<br/>
* Usage of this parameter is encouraged in environments where all 5,000 IDs constitutes too large of a response.
* @return an array of numeric IDs for every user the specified user is following
* @throws TwitterException when Twitter service or network is unavailable
* @see <a href="https://dev.twitter.com/docs/api/1.1/get/friends/ids">GET friends/ids | Twitter Developers</a>
* @since Twitter4J 4.0.2
*/
IDs getFriendsIDs(String screenName, long cursor,int count) throws TwitterException;

/**
* Returns an array of numeric IDs for every user the specified user is followed by.
* <br>This method calls https://api.twitter.com/1.1/followers/ids.json
Expand Down Expand Up @@ -92,6 +126,23 @@ public interface FriendsFollowersResources {
*/
IDs getFollowersIDs(long userId, long cursor) throws TwitterException;

/**
* Returns an array of numeric IDs for every user the specified user is followed by.
* <br>This method calls http://api.twitter.com/1.1/followers/ids.json
*
* @param userId Specifies the ID of the user for whom to return the followers list.
* @param cursor Causes the list of connections to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 as suspended users are filterd out after connections are queried. <br/>
* To begin paging provide a value of -1 as the cursor. The response from the API will include a previous_cursor and next_cursor to allow paging back and forth.
* @param count Specifies the number of IDs attempt retrieval of, up to a maximum of 5,000 per distinct request. <br/>
* The value of count is best thought of as a limit to the number of results to return. <br/>
* When using the count parameter with this method, it is wise to use a consistent count value across all requests to the same user's collection. Usage of this parameter is encouraged in environments where all 5,000 IDs constitutes too large of a response.
* @return The ID or screen_name of the user to retrieve the friends ID list for.
* @throws TwitterException when Twitter service or network is unavailable
* @see <a href="https://dev.twitter.com/docs/api/1.1/get/followers/ids">GET followers/ids | Twitter Developers</a>
* @since Twitter4J 4.0.2
*/
IDs getFollowersIDs(long userId, long cursor, int count) throws TwitterException;

/**
* Returns an array of numeric IDs for every user the specified user is followed by.
* <br>This method calls https://api.twitter.com/1.1/followers/ids.json
Expand All @@ -106,6 +157,23 @@ public interface FriendsFollowersResources {
*/
IDs getFollowersIDs(String screenName, long cursor) throws TwitterException;

/**
* Returns an array of numeric IDs for every user the specified user is followed by.
* <br>This method calls http://api.twitter.com/1.1/followers/ids.json
*
* @param screenName Specifies the screen name of the user for whom to return the followers list.
* @param cursor Causes the list of connections to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 as suspended users are filterd out after connections are queried. <br/>
* To begin paging provide a value of -1 as the cursor. The response from the API will include a previous_cursor and next_cursor to allow paging back and forth.
* @param count Specifies the number of IDs attempt retrieval of, up to a maximum of 5,000 per distinct request. <br/>
* The value of count is best thought of as a limit to the number of results to return. <br/>
* When using the count parameter with this method, it is wise to use a consistent count value across all requests to the same user's collection. Usage of this parameter is encouraged in environments where all 5,000 IDs constitutes too large of a response.
* @return The ID or screen_name of the user to retrieve the friends ID list for.
* @throws TwitterException when Twitter service or network is unavailable
* @see <a href="https://dev.twitter.com/docs/api/1.1/get/followers/ids">GET followers/ids | Twitter Developers</a>
* @since Twitter4J 4.0.2
*/
IDs getFollowersIDs(String screenName, long cursor,int count) throws TwitterException;


/**
* Returns the relationship of the authenticating user to the specified users.
Expand Down

0 comments on commit 56dfd54

Please sign in to comment.