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

com.siftscience.EventResponse Maven / Gradle / Ivy

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

import com.siftscience.model.*;
import okhttp3.Response;

import java.io.IOException;
import java.util.List;
import java.util.Map;

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

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

    public Double getScore(String abuseType) {
        AbuseScore scoreResponse = getAbuseScore(abuseType);
        return scoreResponse != null ? scoreResponse.getScore() : null;
    }

    public List getReasons(String abuseType) {
        AbuseScore scoreResponse = getAbuseScore(abuseType);
        return scoreResponse != null ? scoreResponse.getReasons() : null;
    }

    public Map getAbuseScores() {
        com.siftscience.model.ScoreResponse scoreResponse = getBody().getScoreResponse();
        return scoreResponse != null ? scoreResponse.getScores() : null;
    }

    public AbuseScore getAbuseScore(String abuseType) {
        com.siftscience.model.ScoreResponse scoreResponse = getBody().getScoreResponse();
        return scoreResponse != null && scoreResponse.getScores() != null ?
                scoreResponse.getScores().get(abuseType) : null;
    }

    public List getWorkflowStatuses() {
        com.siftscience.model.ScoreResponse scoreResponse = getBody().getScoreResponse();
        return scoreResponse != null ? scoreResponse.getWorkflowStatuses() : null;
    }

    public WorkflowStatus getWorkflowStatus(int i) {
        List workflowStatuses = getWorkflowStatuses();
        return workflowStatuses != null ? workflowStatuses.get(i) : null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy