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

org.whispersystems.signalservice.internal.websocket.ResponseMapper Maven / Gradle / Ivy

There is a newer version: 2.15.3_unofficial_107
Show newest version
package org.whispersystems.signalservice.internal.websocket;


import org.whispersystems.signalservice.internal.ServiceResponse;

import java.util.function.Function;

/**
 * Responsible for taking an API response and converting it to a {@link ServiceResponse}. This includes
 * parsing for a success as well as any application errors. All errors (application or parsing related)
 * are encapsulated in an error version of a {@link ServiceResponse}, hence why no method throws an
 * exception.
 * 

* Unless you need to do something really special, you should only be extending this to be provided to * {@link DefaultResponseMapper}. * * @param - The final type the API response will map into. */ public interface ResponseMapper { ServiceResponse map(int status, String body, Function getHeader, boolean unidentified); default ServiceResponse map(WebsocketResponse response) { return map(response.getStatus(), response.getBody(), response::getHeader, response.isUnidentified()); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy