@Override public Boolean subscribe(WChannel ch, WUser u) throws IllegalArgumentException { JsonSubscribeRequest request = new JsonSubscribeRequest(u.getToken(), ch.getName(), serverUrl); JsonSubscribeResponse response = new JsonSubscribeResponse(); response.parseJson(request.doRequest()); if (response.getErrno() == Errno.SUCCESS) { return true; } else { return false; } }
@Override public List<WMark> getTags(WUser u, WChannel ch, int amount) throws IllegalArgumentException { JsonFilterChannelRequest request = new JsonFilterChannelRequest(u.getToken(), ch.getName(), amount, serverUrl); JsonFilterChannelResponse response = new JsonFilterChannelResponse(); response.parseJson(request.doRequest()); List<WMark> marks = new ArrayList<WMark>(); for (int i = 0; i < response.getChannels().size(); i++) { for (int j = 0; j < response.getChannels().get(i).getMarks().size(); j++) { WMark mark = JGeoConnector.toWTag(response.getChannels().get(i).getMarks().get(j)); marks.add(mark); } } return marks; }