|
19 | 19 | package ml.duncte123.skybot.utils; |
20 | 20 |
|
21 | 21 | import com.fasterxml.jackson.core.JsonProcessingException; |
22 | | -import com.fasterxml.jackson.databind.ObjectMapper; |
23 | 22 | import com.fasterxml.jackson.databind.json.JsonMapper; |
24 | 23 | import com.fasterxml.jackson.databind.node.ObjectNode; |
25 | 24 | import com.github.natanbc.reliqua.limiter.RateLimiter; |
@@ -370,52 +369,4 @@ public static PendingRequest<String> shortenUrl(String url, Variables variables, |
370 | 369 | return new FakePendingRequest<>("JSON PARSING FAILED: " + e.getMessage()); |
371 | 370 | } |
372 | 371 | } |
373 | | - |
374 | | - // TODO: find replacement for firebase |
375 | | - @Deprecated |
376 | | - public static PendingRequest<String> shortenUrl(String url, String googleKey, ObjectMapper mapper) { |
377 | | - return shortenUrl(url, googleKey, mapper, "duncte.bot"); |
378 | | - } |
379 | | - |
380 | | - @Deprecated |
381 | | - @Nonnull |
382 | | - public static PendingRequest<String> shortenUrl(String url, String googleKey, ObjectMapper mapper, String prefix) { |
383 | | - final ObjectNode json = mapper.createObjectNode(); |
384 | | - |
385 | | - json.set("dynamicLinkInfo", |
386 | | - mapper.createObjectNode() |
387 | | - .put("domainUriPrefix", prefix) |
388 | | - .put("link", url) |
389 | | - ); |
390 | | - json.set("suffix", |
391 | | - mapper.createObjectNode() |
392 | | - .put("option", "SHORT") // SHORT or UNGUESSABLE |
393 | | - ); |
394 | | - |
395 | | - try { |
396 | | - return WebUtils.ins.postRequest( |
397 | | - "https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=" + googleKey, |
398 | | - JSONRequestBody.fromJackson(json) |
399 | | - ) |
400 | | - .setRateLimiter(RateLimiter.directLimiter()) |
401 | | - .build( |
402 | | - (r) -> { |
403 | | - final ObjectNode response = toJSONObject(r, mapper); |
404 | | - |
405 | | - if (response == null) { |
406 | | - return "Google did a fucky wucky and send invalid json"; |
407 | | - } |
408 | | - |
409 | | - return response.get("shortLink").asText(); |
410 | | - }, |
411 | | - WebParserUtils::handleError |
412 | | - ); |
413 | | - } |
414 | | - catch (JsonProcessingException e) { |
415 | | - e.printStackTrace(); |
416 | | - |
417 | | - // Return a fake pending request to make sure that things don't break |
418 | | - return new FakePendingRequest<>("JSON PARSING FAILED: " + e.getMessage()); |
419 | | - } |
420 | | - } |
421 | 372 | } |
0 commit comments