Package org.apache.fineract.client.util
Class Calls
java.lang.Object
org.apache.fineract.client.util.Calls
Extension methods for
Call. This class is recommended to be statically imported.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> retrofit2.Response<T> executeU(retrofit2.Call<T> call) static <T> Tok(retrofit2.Call<T> call) Execute a Call, expecting success, returning strongly typed body.static <T> retrofit2.Response<T> okR(retrofit2.Call<T> call) Execute a Call, expecting success, returning Response.
-
Method Details
-
ok
Execute a Call, expecting success, returning strongly typed body. This covers the most typical use and is thus most used.- Parameters:
call- the Call to execute- Returns:
- the body of the successful call (never null)
- Throws:
CallFailedRuntimeException- thrown either if a problem occurred talking to the server, or the HTTP response code was not [200..300) successful
-
okR
public static <T> retrofit2.Response<T> okR(retrofit2.Call<T> call) throws CallFailedRuntimeException Execute a Call, expecting success, returning Response. This is rarely used, and only useful if you need access to e.g. the headers of the response.- Parameters:
call- the Call to execute- Returns:
- the Response of the successful call (never null)
- Throws:
CallFailedRuntimeException- thrown either if a problem occurred talking to the server, or the HTTP response code was not [200..300) successful
-
executeU
public static <T> retrofit2.Response<T> executeU(retrofit2.Call<T> call) throws CallFailedRuntimeException Call.execute()mappingIOExceptiontoCallFailedRuntimeException. This can be useful for code which would like to handle non-success HTTP responses, notably tests asserting non-200 results.- Parameters:
call- the Call to execute- Returns:
- the Response, which may or may not have been successful.
- Throws:
CallFailedRuntimeException- thrown if a problem occurred talking to the server
-