Skip to content

Commit

Permalink
TFJ-871 Support for extra ListsResources parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
igorbrigadir committed Jun 15, 2015
1 parent 45f7de9 commit 55d97f1
Show file tree
Hide file tree
Showing 3 changed files with 544 additions and 26 deletions.
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Hiroaki Takeuchi <takke30 at gmail.com> @takke
Hiroki Takemoto <pompopo at gmail.com> @pompopo
Hiroshi Sugimori <mamamadata at gmail.com> @ham1975
Hitoshi Kunimatsu <hkhumanoid at gmail.com>
Igor Brigadir <igor.brigadir at insight-centre.org> @igorbrigadir
JJ Kelley <jjthemachine at gmail.com> @jjthemachine
Jacob Elder <[email protected]> @jelder
Jacob S. Hoffman-Andrews <jsha at twitter.com> @j4cob
Expand Down
198 changes: 175 additions & 23 deletions twitter4j-core/src/main/java/twitter4j/TwitterImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -944,13 +944,26 @@ public Status createFavorite(long id) throws TwitterException {

@Override
public ResponseList<UserList> getUserLists(String listOwnerScreenName) throws TwitterException {
return getUserLists(listOwnerScreenName, false);
}

@Override
public ResponseList<UserList> getUserLists(String listOwnerScreenName, boolean reverse) throws TwitterException {
return factory.createUserListList(get(conf.getRestBaseURL() + "lists/list.json",
new HttpParameter("screen_name", listOwnerScreenName)));
new HttpParameter("screen_name", listOwnerScreenName),
new HttpParameter("reverse", reverse)));
}

@Override
public ResponseList<UserList> getUserLists(long listOwnerUserId) throws TwitterException {
return factory.createUserListList(get(conf.getRestBaseURL() + "lists/list.json?user_id=" + listOwnerUserId));
return getUserLists(listOwnerUserId, false);
}

@Override
public ResponseList<UserList> getUserLists(long listOwnerUserId, boolean reverse) throws TwitterException {
return factory.createUserListList(get(conf.getRestBaseURL() + "lists/list.json",
new HttpParameter("user_id", listOwnerUserId),
new HttpParameter("reverse", reverse)));
}

@Override
Expand Down Expand Up @@ -1031,55 +1044,125 @@ public UserList destroyUserListMembers(String ownerScreenName, String slug, Stri

@Override
public PagableResponseList<UserList> getUserListMemberships(long cursor) throws TwitterException {
return factory.createPagableUserListList(get(conf.getRestBaseURL() + "lists/memberships.json?cursor=" + cursor));

return getUserListMemberships(20, cursor);
}

@Override
public PagableResponseList<UserList> getUserListMemberships(int count, long cursor) throws TwitterException {
return factory.createPagableUserListList(get(conf.getRestBaseURL() + "lists/memberships.json",
new HttpParameter("cursor", cursor),
new HttpParameter("count", count)));
}

@Override
public PagableResponseList<UserList> getUserListMemberships(String listMemberScreenName, long cursor) throws TwitterException {
return getUserListMemberships(listMemberScreenName, cursor, false);
}

@Override
public PagableResponseList<UserList> getUserListMemberships(String listMemberScreenName, int count, long cursor) throws TwitterException {
return getUserListMemberships(listMemberScreenName, count, cursor, false);
}

@Override
public PagableResponseList<UserList> getUserListMemberships(String listMemberScreenName, long cursor, boolean filterToOwnedLists) throws TwitterException {
return getUserListMemberships(listMemberScreenName, 20, cursor, filterToOwnedLists);
}

@Override
public PagableResponseList<UserList> getUserListMemberships(String listMemberScreenName, int count, long cursor, boolean filterToOwnedLists) throws TwitterException {
return factory.createPagableUserListList(get(conf.getRestBaseURL()
+ "lists/memberships.json",
new HttpParameter("screen_name", listMemberScreenName),
new HttpParameter("count", count),
new HttpParameter("cursor", cursor),
new HttpParameter("filter_to_owned_lists", filterToOwnedLists)));
}

@Override
public PagableResponseList<UserList> getUserListMemberships(long listMemberId, long cursor) throws TwitterException {
return getUserListMemberships(listMemberId, cursor, false);
}

@Override
public PagableResponseList<UserList> getUserListMemberships(long listMemberId, int count, long cursor) throws TwitterException {
return getUserListMemberships(listMemberId, count, cursor, false);
}

@Override
public PagableResponseList<UserList> getUserListMemberships(long listMemberId, long cursor, boolean filterToOwnedLists) throws TwitterException {
return factory.createPagableUserListList(get(conf.getRestBaseURL()
+ "lists/memberships.json?user_id=" + listMemberId + "&cursor=" + cursor + "&filter_to_owned_lists="
+ filterToOwnedLists));
return getUserListMemberships(listMemberId, 20, cursor, filterToOwnedLists);
}

@Override
public PagableResponseList<UserList> getUserListMemberships(String listMemberScreenName, long cursor, boolean filterToOwnedLists) throws TwitterException {
return factory.createPagableUserListList(get(conf.getRestBaseURL()
public PagableResponseList<UserList> getUserListMemberships(long listMemberId, int count, long cursor, boolean filterToOwnedLists) throws TwitterException {
return factory.createPagableUserListList(get(conf.getRestBaseURL()
+ "lists/memberships.json",
new HttpParameter("screen_name", listMemberScreenName),
new HttpParameter("user_id", listMemberId),
new HttpParameter("count", count),
new HttpParameter("cursor", cursor),
new HttpParameter("filter_to_owned_lists", filterToOwnedLists)));
}

@Override
public PagableResponseList<User> getUserListSubscribers(long listId, long cursor) throws TwitterException {
return factory.createPagableUserList(get(conf.getRestBaseURL() + "lists/subscribers.json?list_id=" + listId + "&cursor=" + cursor));
return getUserListSubscribers(listId, 20, cursor, false);
}

@Override
public PagableResponseList<User> getUserListSubscribers(long listId, int count, long cursor) throws TwitterException {
return getUserListSubscribers(listId, count, cursor, false);
}

@Override
public PagableResponseList<User> getUserListSubscribers(long listId, int count, long cursor, boolean skipStatus) throws TwitterException {
return factory.createPagableUserList(get(conf.getRestBaseURL() + "lists/subscribers.json",
new HttpParameter("list_id", listId),
new HttpParameter("count", count),
new HttpParameter("cursor", cursor),
new HttpParameter("skip_status", skipStatus)));
}

@Override
public PagableResponseList<User> getUserListSubscribers(long ownerId, String slug, long cursor) throws TwitterException {
return factory.createPagableUserList(get(conf.getRestBaseURL() + "lists/subscribers.json?owner_id=" + ownerId
+ "&slug=" + slug + "&cursor=" + cursor));
return getUserListSubscribers(ownerId, slug, 20, cursor, false);
}

@Override
public PagableResponseList<User> getUserListSubscribers(long ownerId, String slug, int count, long cursor) throws TwitterException {
return getUserListSubscribers(ownerId, slug, count, cursor, false);
}

@Override
public PagableResponseList<User> getUserListSubscribers(long ownerId, String slug, int count, long cursor, boolean skipStatus) throws TwitterException {
return factory.createPagableUserList(get(conf.getRestBaseURL() + "lists/subscribers.json",
new HttpParameter("owner_id", ownerId),
new HttpParameter("slug", slug),
new HttpParameter("count", count),
new HttpParameter("cursor", cursor),
new HttpParameter("skip_status", skipStatus)));
}

@Override
public PagableResponseList<User> getUserListSubscribers(String ownerScreenName, String slug, long cursor) throws TwitterException {
return getUserListSubscribers(ownerScreenName, slug, 20, cursor, false);
}

@Override
public PagableResponseList<User> getUserListSubscribers(String ownerScreenName, String slug, int count, long cursor) throws TwitterException {
return getUserListSubscribers(ownerScreenName, slug, count, cursor, false);
}

@Override
public PagableResponseList<User> getUserListSubscribers(
String ownerScreenName, String slug, long cursor)
String ownerScreenName, String slug, int count, long cursor, boolean skipStatus)
throws TwitterException {
return factory.createPagableUserList(get(conf.getRestBaseURL() + "lists/subscribers.json",
new HttpParameter("owner_screen_name", ownerScreenName),
new HttpParameter("slug", slug),
new HttpParameter("cursor", cursor)));
new HttpParameter("count", count),
new HttpParameter("cursor", cursor),
new HttpParameter("skip_status", skipStatus)));
}

@Override
Expand Down Expand Up @@ -1230,24 +1313,64 @@ public User showUserListMembership(String ownerScreenName, String slug,
@Override
public PagableResponseList<User> getUserListMembers(long listId
, long cursor) throws TwitterException {
return factory.createPagableUserList(get(conf.getRestBaseURL() +
"lists/members.json?list_id=" + listId + "&cursor=" + cursor));
return getUserListMembers(listId, 20, cursor, false);
}

@Override
public PagableResponseList<User> getUserListMembers(long listId, int count, long cursor) throws TwitterException {
return getUserListMembers(listId, count, cursor, false);
}

@Override
public PagableResponseList<User> getUserListMembers(long listId, int count, long cursor, boolean skipStatus) throws TwitterException {
return factory.createPagableUserList(get(conf.getRestBaseURL() + "lists/members.json",
new HttpParameter("list_id", listId),
new HttpParameter("count", count),
new HttpParameter("cursor", cursor),
new HttpParameter("skip_status", skipStatus)));
}

@Override
public PagableResponseList<User> getUserListMembers(long ownerId, String slug, long cursor) throws TwitterException {
return getUserListMembers(ownerId, slug, 20, cursor, false);
}

@Override
public PagableResponseList<User> getUserListMembers(long ownerId, String slug, int count, long cursor) throws TwitterException {
return getUserListMembers(ownerId, slug, count, cursor, false);
}

@Override
public PagableResponseList<User> getUserListMembers(long ownerId, String slug, int count, long cursor, boolean skipStatus) throws TwitterException {
return factory.createPagableUserList(get(conf.getRestBaseURL() +
"lists/members.json?owner_id=" + ownerId + "&slug=" + slug + "&cursor=" + cursor));
"lists/members.json",
new HttpParameter("owner_id", ownerId),
new HttpParameter("slug", slug),
new HttpParameter("count", count),
new HttpParameter("cursor", cursor),
new HttpParameter("skip_status", skipStatus)));
}

@Override
public PagableResponseList<User> getUserListMembers(String ownerScreenName, String slug, long cursor) throws TwitterException {
return getUserListMembers(ownerScreenName, slug, 20, cursor, false);
}

@Override
public PagableResponseList<User> getUserListMembers(String ownerScreenName, String slug, int count, long cursor) throws TwitterException {
return getUserListMembers(ownerScreenName, slug, count, cursor, false);
}

@Override
public PagableResponseList<User> getUserListMembers(String ownerScreenName,
String slug, long cursor) throws TwitterException {
String slug, int count, long cursor, boolean skipStatus) throws TwitterException {
return factory.createPagableUserList(get(conf.getRestBaseURL() +
"lists/members.json",
new HttpParameter("owner_screen_name", ownerScreenName),
new HttpParameter("slug", slug),
new HttpParameter("cursor", cursor)));
new HttpParameter("count", count),
new HttpParameter("cursor", cursor),
new HttpParameter("skip_status", skipStatus)));
}

@Override
Expand Down Expand Up @@ -1362,9 +1485,33 @@ public UserList showUserList(String ownerScreenName, String slug)
}

@Override
public PagableResponseList<UserList> getUserListSubscriptions(String listOwnerScreenName, long cursor) throws TwitterException {
return factory.createPagableUserListList(get(conf.getRestBaseURL() + "lists/subscriptions.json?screen_name="
+ listOwnerScreenName + "&cursor=" + cursor));
public PagableResponseList<UserList> getUserListSubscriptions(String listSubscriberScreenName, long cursor) throws TwitterException {
return getUserListSubscriptions(listSubscriberScreenName, 20, cursor);
}

@Override
public PagableResponseList<UserList> getUserListSubscriptions(String listSubscriberScreenName, int count, long cursor) throws TwitterException {
return factory.createPagableUserListList(get(conf.getRestBaseURL() + "lists/subscriptions.json",
new HttpParameter("screen_name", listSubscriberScreenName)
, new HttpParameter("count", count)
, new HttpParameter("cursor", cursor)));
}

@Override
public PagableResponseList<UserList> getUserListSubscriptions(long listSubscriberId, long cursor) throws TwitterException {
return getUserListSubscriptions(listSubscriberId, 20, cursor);
}

@Override
public PagableResponseList<UserList> getUserListSubscriptions(long listSubscriberId, int count, long cursor) throws TwitterException {
return factory.createPagableUserListList(get(conf.getRestBaseURL() + "lists/subscriptions.json",
new HttpParameter("user_id", listSubscriberId),
new HttpParameter("count", count),
new HttpParameter("cursor", cursor)));
}

public PagableResponseList<UserList> getUserListsOwnerships(String listOwnerScreenName, long cursor) throws TwitterException {
return getUserListsOwnerships(listOwnerScreenName, 20, cursor);
}

@Override
Expand All @@ -1375,6 +1522,11 @@ public PagableResponseList<UserList> getUserListsOwnerships(String listOwnerScre
, new HttpParameter("cursor", cursor)));
}

@Override
public PagableResponseList<UserList> getUserListsOwnerships(long listOwnerId, long cursor) throws TwitterException {
return getUserListsOwnerships(listOwnerId, 20, cursor);
}

@Override
public PagableResponseList<UserList> getUserListsOwnerships(long listOwnerId, int count, long cursor) throws TwitterException {
return factory.createPagableUserListList(get(conf.getRestBaseURL() + "lists/ownerships.json",
Expand Down
Loading

0 comments on commit 55d97f1

Please sign in to comment.