public abstract class AbstractClientBaseService extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
protected static com.fasterxml.jackson.databind.ObjectMapper |
mapper |
| Constructor and Description |
|---|
AbstractClientBaseService() |
| Modifier and Type | Method and Description |
|---|---|
abstract <Data,F,Param,TReq extends ClientRequest<Param>,TResp extends BiFlowableClientResponse<Data,F>> |
biStreamRequest(TReq request,
FlowableRequestSupplier<Param,retrofit2.Call<okhttp3.ResponseBody>> requestSupplier,
Class<TResp> tRespClass,
Class<F> tStreamClass)
Executes a streaming API request and returns a Flowable-based response.
|
static <T> T |
execute(io.reactivex.rxjava3.core.Single<T> apiCall)
Executes a Single API call synchronously and handles errors.
|
abstract <Data,Param,TReq extends ClientRequest<Param>,TResp extends ClientResponse<Data>> |
executeRequest(TReq request,
RequestSupplier<Param,Data> requestSupplier,
Class<TResp> tRespClass)
Executes a synchronous API request.
|
static io.reactivex.rxjava3.core.Flowable<SSE> |
stream(retrofit2.Call<okhttp3.ResponseBody> apiCall)
Creates a streaming Flowable of SSE events without emitting done events.
|
static io.reactivex.rxjava3.core.Flowable<SSE> |
stream(retrofit2.Call<okhttp3.ResponseBody> apiCall,
boolean emitDone)
Creates a streaming Flowable of SSE events with optional done event emission.
|
<T> io.reactivex.rxjava3.core.Flowable<T> |
stream(retrofit2.Call<okhttp3.ResponseBody> apiCall,
Class<T> cl)
Creates a streaming Flowable that maps SSE data to the specified class type.
|
<T,Param,TReq extends ClientRequest<Param>,TResp extends FlowableClientResponse<T>> |
streamRequest(TReq request,
FlowableRequestSupplier<Param,retrofit2.Call<okhttp3.ResponseBody>> requestSupplier,
Class<TResp> tRespClass,
Class<T> tClass)
Executes a streaming API request with the same type for response body and stream
element.
|
protected static final org.slf4j.Logger logger
protected static final com.fasterxml.jackson.databind.ObjectMapper mapper
public abstract <Data,Param,TReq extends ClientRequest<Param>,TResp extends ClientResponse<Data>> TResp executeRequest(TReq request, RequestSupplier<Param,Data> requestSupplier, Class<TResp> tRespClass)
Data - the type of data returned by the APIParam - the type of parameters sent to the APITReq - the type of the request objectTResp - the type of the response objectrequest - the request object containing parametersrequestSupplier - the supplier that creates the API calltRespClass - the class of the response typepublic abstract <Data,F,Param,TReq extends ClientRequest<Param>,TResp extends BiFlowableClientResponse<Data,F>> TResp biStreamRequest(TReq request, FlowableRequestSupplier<Param,retrofit2.Call<okhttp3.ResponseBody>> requestSupplier, Class<TResp> tRespClass, Class<F> tStreamClass)
Data - type of response bodyF - type of each element in the stream (can be same as Data)Param - request param typeTReq - request typeTResp - response type (must extend BiFlowableClientResponse)request - the request to sendrequestSupplier - factory that creates the Retrofit calltRespClass - the response class typetStreamClass - the class of the stream elementpublic <T,Param,TReq extends ClientRequest<Param>,TResp extends FlowableClientResponse<T>> TResp streamRequest(TReq request, FlowableRequestSupplier<Param,retrofit2.Call<okhttp3.ResponseBody>> requestSupplier, Class<TResp> tRespClass, Class<T> tClass)
T - data type for both response and streamParam - request param typeTReq - request typeTResp - response type (must extend FlowableClientResponsepublic static <T> T execute(io.reactivex.rxjava3.core.Single<T> apiCall)
T - the type of the responseapiCall - the Single API call to executeZAiHttpException - if an HTTP error occurs with a parseable error bodyretrofit2.HttpException - if an HTTP error occurs that cannot be parsedpublic <T> io.reactivex.rxjava3.core.Flowable<T> stream(retrofit2.Call<okhttp3.ResponseBody> apiCall,
Class<T> cl)
T - the type to map the SSE data toapiCall - the API call that returns streaming datacl - the class to map the SSE data topublic static io.reactivex.rxjava3.core.Flowable<SSE> stream(retrofit2.Call<okhttp3.ResponseBody> apiCall)
apiCall - the API call that returns streaming datapublic static io.reactivex.rxjava3.core.Flowable<SSE> stream(retrofit2.Call<okhttp3.ResponseBody> apiCall, boolean emitDone)
apiCall - the API call that returns streaming dataemitDone - whether to emit done eventsCopyright © 2025. All rights reserved.