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

io.castle.client.internal.backend.RestApi Maven / Gradle / Ivy

Go to download

Castle adds real-time monitoring of your authentication stack, instantly notifying you and your users on potential account hijacks.

There is a newer version: 2.4.3
Show newest version
package io.castle.client.internal.backend;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.castle.client.model.AsyncCallbackHandler;
import io.castle.client.model.Review;
import io.castle.client.model.Verdict;

public interface RestApi {
    /**
     *
     * @param payloadJson          JSON object containing the event properties
     * @param asyncCallbackHandler callback to inform if request was correctly sent
     */
    void sendTrackRequest(JsonElement payloadJson, AsyncCallbackHandler asyncCallbackHandler);

    /**
     *
     * @param payloadJson JSON object containing the event properties
     * @return Verdict to be used in login logic
     */
    Verdict sendAuthenticateSync(JsonElement payloadJson);

    /**
     *
     * @param payloadJson          JSON object containing the event properties
     * @param asyncCallbackHandler callback to inform if request was correctly sent
     */
    void sendAuthenticateAsync(JsonElement payloadJson, AsyncCallbackHandler asyncCallbackHandler);

    /**
     * Async call to the identify endpoint, returning immediately.
     *
     * @param userId      unique userId
     * @param contextJson context json
     * @param active      is this call realized as part of a active session of the user
     * @param traitsJson  additional traits json
     */
    void sendIdentifyRequest(String userId, JsonObject contextJson, boolean active, JsonElement traitsJson);

    /**
     * Sync call to the review endpoint.
     *
     * @param reviewId string representing the id to be reviewed
     * @return a {@code review} with metadata contained in the body of the response
     */
    Review sendReviewRequestSync(String reviewId);

    /**
     * Async call to the review endpoint, returning immediately.
     *
     * @param reviewId        string representing the id to be reviewed
     * @param callbackHandler callback to handle the Review value returned by the API
     */
    void sendReviewRequestAsync(String reviewId, AsyncCallbackHandler callbackHandler);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy