Skip to content

Commit

Permalink
Use v2/feeback, remove v2 api switch
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyborger1 committed Feb 2, 2024
1 parent c16893e commit ce1af6f
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/main/java/com/botdetector/http/BotDetectorClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,21 @@ public class BotDetectorClient
private static final String API_VERSION_FALLBACK_WORD = "latest";
private static final HttpUrl BASE_HTTP_URL = HttpUrl.parse(
System.getProperty("BotDetectorAPIPath", "https://api.prd.osrsbotdetector.com"));
private static final HttpUrl BASE_HTTP_URL_V2 = HttpUrl.parse(
System.getProperty("BotDetectorAPIPathV2", "https://api-v2.prd.osrsbotdetector.com"));
private static final Supplier<String> CURRENT_EPOCH_SUPPLIER = () -> String.valueOf(Instant.now().getEpochSecond());

@Getter
@AllArgsConstructor
private enum ApiPath
{
DETECTION("v2/report", true),
PLAYER_STATS_REPORTS("v2/player/report/score", true),
PLAYER_STATS_FEEDBACK("v2/player/feedback/score", true),
PREDICTION("v2/player/prediction", true),
FEEDBACK("v1/feedback/", false),
VERIFY_DISCORD("site/discord_user/", false)
DETECTION("v2/report"),
PLAYER_STATS_REPORTS("v2/player/report/score"),
PLAYER_STATS_FEEDBACK("v2/player/feedback/score"),
PREDICTION("v2/player/prediction"),
FEEDBACK("v2/feedback"),
VERIFY_DISCORD("site/discord_user")
;

final String path;
final boolean v2;
}

public OkHttpClient okHttpClient;
Expand All @@ -125,7 +122,7 @@ private enum ApiPath
*/
private HttpUrl getUrl(ApiPath path, boolean addVersion)
{
HttpUrl.Builder builder = (path.isV2() ? BASE_HTTP_URL_V2 : BASE_HTTP_URL).newBuilder();
HttpUrl.Builder builder = BASE_HTTP_URL.newBuilder();

if (addVersion)
{
Expand Down

0 comments on commit ce1af6f

Please sign in to comment.