public String getFriends(String streamId, long userId) throws IOException, ControlStreamException { return getFriends(streamId, userId, 0); }
/** * @deprecated info.json does not take a user_id param (@see https://dev.twitter.com/docs/streaming-apis/streams/site/control#info) */ @Deprecated public String getInfo(String streamId, long userId) throws IOException, ControlStreamException { return getInfo(streamId); }
public void removeUsers(String streamId, Collection<Long> userIds) throws IOException, ControlStreamException { Preconditions.checkArgument(userIds.size() >= 1 && userIds.size() <= 100, "The userId parameter can be supplied with up to 100 user IDs."); Endpoint endpoint = SitestreamEndpoint.removeUserEndpoint(streamId); endpoint.addPostParameter(Constants.USER_ID_PARAM, Joiner.on(',').join(userIds)); HttpUriRequest request = HttpConstants.constructRequest(hosts.nextHost(), endpoint, auth); consumeHttpEntityContent(makeControlStreamRequest(request)); }
SitestreamController controller = new SitestreamController(auth); controller.getFriends(t4jClient.getStreamId(), 12345L); controller.addUser(t4jClient.getStreamId(), 987765L);
public void addUsers(String streamId, Collection<Long> userIds) throws IOException, ControlStreamException { Preconditions.checkArgument(userIds.size() >= 1 && userIds.size() <= 100, "The userId parameter can be supplied with up to 100 user IDs."); Endpoint endpoint = SitestreamEndpoint.addUserEndpoint(streamId); endpoint.addPostParameter(Constants.USER_ID_PARAM, Joiner.on(',').join(userIds)); HttpUriRequest request = HttpConstants.constructRequest(hosts.nextHost(), endpoint, auth); consumeHttpEntityContent(makeControlStreamRequest(request)); }
public String getInfo(String streamId) throws IOException, ControlStreamException { Endpoint endpoint = SitestreamEndpoint.streamInfoEndpoint(streamId); HttpUriRequest request = HttpConstants.constructRequest(hosts.nextHost(), endpoint, auth); HttpResponse response = makeControlStreamRequest(request); return consumeHttpEntityContent(response); }
/** * TODO: This must be limited to 25 adds per seconds */ public void addUser(String streamId, long userId) throws IOException, ControlStreamException { Endpoint endpoint = SitestreamEndpoint.addUserEndpoint(streamId); endpoint.addPostParameter(Constants.USER_ID_PARAM, Long.toString(userId)); HttpUriRequest request = HttpConstants.constructRequest(hosts.nextHost(), endpoint, auth); consumeHttpEntityContent(makeControlStreamRequest(request)); }
public void removeUser(String streamId, long userId) throws IOException, ControlStreamException { Endpoint endpoint = SitestreamEndpoint.removeUserEndpoint(streamId); endpoint.addPostParameter(Constants.USER_ID_PARAM, Long.toString(userId)); HttpUriRequest request = HttpConstants.constructRequest(hosts.nextHost(), endpoint, auth); consumeHttpEntityContent(makeControlStreamRequest(request)); }
public String getFriends(String streamId, long userId, int cursor) throws IOException, ControlStreamException { Endpoint endpoint = SitestreamEndpoint.friendsEndpoint(streamId); endpoint.addPostParameter(Constants.USER_ID_PARAM, Long.toString(userId)); endpoint.addPostParameter(Constants.CURSOR_PARAM, Integer.toString(cursor)); HttpUriRequest request = HttpConstants.constructRequest(hosts.nextHost(), endpoint, auth); HttpResponse response = makeControlStreamRequest(request); return consumeHttpEntityContent(response); }