All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.siftscience.EntityScoreResponse Maven / Gradle / Ivy

There is a newer version: 3.16.0
Show newest version
package com.siftscience;

import com.siftscience.model.AbuseScore;
import com.siftscience.model.EntityScoreResponseBody;
import okhttp3.Response;

import java.io.IOException;

public class EntityScoreResponse extends SiftResponse {
    EntityScoreResponse(Response okResponse, FieldSet requestBody) throws IOException {
        super(okResponse, requestBody);
    }

    @Override
    void populateBodyFromJson(String jsonBody) {
        body = EntityScoreResponseBody.fromJson(jsonBody);
    }

    public AbuseScore getScoreResponse(String abuseType) {
        if (this.getBody() != null && this.getBody().getScores() != null) {
            return this.getBody().getScores().get(abuseType);
        }
        return null;
    }

    public Double getScore(String abuseType) {
        AbuseScore abuseScore = getScoreResponse(abuseType);
        if (abuseScore != null) {
            return abuseScore.getScore();
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy