/** * Makes a request and just obtains the HTTP status code. */ public int asHttpStatusCode(String tailApiUrl) throws IOException { while (true) {// loop while API rate limit is hit HttpURLConnection uc = setupConnection(root.getApiURL(tailApiUrl)); buildRequest(uc); try { return uc.getResponseCode(); } catch (IOException e) { handleApiError(e,uc); } } }
private <T> T _to(String tailApiUrl, Class<T> type, T instance) throws IOException { while (true) {// loop while API rate limit is hit HttpURLConnection uc = setupConnection(root.getApiURL(tailApiUrl)); buildRequest(uc); try { return parse(uc,type,instance); } catch (IOException e) { handleApiError(e,uc); } } }