io.castle.client.model.CastleResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of castle-java Show documentation
Show all versions of castle-java Show documentation
Castle adds real-time monitoring of your authentication stack, instantly notifying you and your users
on potential account hijacks.
package io.castle.client.model;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import io.castle.client.internal.utils.OkHttpExceptionUtil;
import okhttp3.Response;
import java.io.IOException;
public class CastleResponse {
private final int code;
private final JsonElement json;
public CastleResponse(Response response) throws IOException {
code = response.code();
String body = response.body().string();
JsonParser gson = new JsonParser();
json = gson.parse(body);
OkHttpExceptionUtil.handle(response);
}
public boolean isSuccessful() {
return this.code >= 200 && this.code < 300;
}
public JsonElement json() {
return json;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy