|
19 | 19 | public class HttpClient extends AsyncHttpClient {
|
20 | 20 |
|
21 | 21 | private final String apiUrl;
|
22 |
| - // NOTE: do we even need these since we now have the PartnerAuthRequestFilter? |
23 | 22 | private final int apiKey;
|
24 |
| - private final String apiSecret; |
25 | 23 |
|
26 | 24 | private HttpClient(Builder builder) {
|
27 | 25 | super(builder.config);
|
28 | 26 | this.apiKey = builder.apiKey;
|
29 |
| - this.apiSecret = builder.apiSecret; |
30 | 27 | this.apiUrl = builder.apiUrl;
|
31 | 28 | }
|
32 | 29 |
|
@@ -238,76 +235,6 @@ public String deleteArchive(String archiveId) {
|
238 | 235 | return responseString;
|
239 | 236 | }
|
240 | 237 |
|
241 |
| -// protected static String makeDeleteRequest(String resource) throws OpenTokException { |
242 |
| -// BoundRequestBuilder get = client.prepareDelete(apiUrl + resource); |
243 |
| -// addCommonHeaders(get); |
244 |
| -// |
245 |
| -// try { |
246 |
| -// Response result = get.execute().get(); |
247 |
| -// if (result.getStatusCode() < 200 || result.getStatusCode() > 299) { |
248 |
| -// throw new RequestException(result.getStatusCode(), "Error response: message: " |
249 |
| -// + result.getStatusText()); |
250 |
| -// } |
251 |
| -// return result.getResponseBody(); |
252 |
| -// } catch (Exception e) { |
253 |
| -// throw new RequestException(500, e.getMessage()); |
254 |
| -// } |
255 |
| -// } |
256 |
| -// |
257 |
| -// protected static String makeGetRequest(String resource) throws OpenTokException { |
258 |
| -// BoundRequestBuilder get = client.prepareGet(apiUrl + resource); |
259 |
| -// addCommonHeaders(get); |
260 |
| -// |
261 |
| -// try { |
262 |
| -// Response result = get.execute().get(); |
263 |
| -// if (result.getStatusCode() < 200 || result.getStatusCode() > 299) { |
264 |
| -// throw new RequestException(result.getStatusCode(), "Error response: message: " |
265 |
| -// + result.getStatusText()); |
266 |
| -// } |
267 |
| -// return result.getResponseBody(); |
268 |
| -// } catch (Exception e) { |
269 |
| -// throw new RequestException(500, e.getMessage()); |
270 |
| -// } |
271 |
| -// } |
272 |
| -// |
273 |
| -// protected static String makePostRequest(String resource, Map<String, String> headers, Map<String, String> params, |
274 |
| -// String postData) throws OpenTokException { |
275 |
| -// BoundRequestBuilder post = client.preparePost(apiUrl + resource); |
276 |
| -// if (params != null) { |
277 |
| -// for (Entry<String, String> pair : params.entrySet()) { |
278 |
| -// post.addParameter(pair.getKey(), pair.getValue()); |
279 |
| -// } |
280 |
| -// } |
281 |
| -// |
282 |
| -// if (headers != null) { |
283 |
| -// for (Entry<String, String> pair : headers.entrySet()) { |
284 |
| -// post.addHeader(pair.getKey(), pair.getValue()); |
285 |
| -// } |
286 |
| -// } |
287 |
| -// |
288 |
| -// addCommonHeaders(post); |
289 |
| -// |
290 |
| -// if (postData != null) { |
291 |
| -// post.setBody(postData); |
292 |
| -// } |
293 |
| -// |
294 |
| -// try { |
295 |
| -// Response result = post.execute().get(); |
296 |
| -// |
297 |
| -// if (result.getStatusCode() < 200 || result.getStatusCode() > 299) { |
298 |
| -// throw new RequestException(result.getStatusCode(), "Error response: message: " + result.getStatusText()); |
299 |
| -// } |
300 |
| -// |
301 |
| -// return result.getResponseBody(); |
302 |
| -// } catch (Exception e) { |
303 |
| -// throw new RequestException(500, e.getMessage()); |
304 |
| -// } |
305 |
| -// } |
306 |
| -// |
307 |
| -// private static void addCommonHeaders(BoundRequestBuilder get) { |
308 |
| -// get.addHeader("X-TB-PARTNER-AUTH", String.format("%s:%s", apiKey, apiSecret)); |
309 |
| -// } |
310 |
| - |
311 | 238 | public static class Builder {
|
312 | 239 | private final int apiKey;
|
313 | 240 | private final String apiSecret;
|
|
0 commit comments