Package com.naver.ads.network
Interface Caller
-
- All Implemented Interfaces:
public interface Caller<TResponse extends Object>An invocation of a method that sends a request to a webserver and returns a response. Each caller yields its own HTTP request and response pair.
Callers may be executed synchronously with execute, or asynchronously with enqueue.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceCaller.Callbackthe callback type to notify the result of this caller.
-
Method Summary
Modifier and Type Method Description abstract BooleanisCancellationRequested()Gets whether cancellation has been requested. abstract BooleanisExecuted()Returns true if this caller has been either execute executed or enqueue enqueued. abstract CallerStategetState()Returns the caller state. abstract Response<TResponse>execute()Synchronously send the request and return its response abstract Unitenqueue(Caller.Callback<TResponse> callback)Asynchronously send the request and notify Callback of its response or if an error occurred talking to the server, creating the request, or processing the response abstract Deferred<HttpRequest>getRawRequest()the deferred raw request. -
-
Method Detail
-
isCancellationRequested
abstract Boolean isCancellationRequested()
Gets whether cancellation has been requested.
-
isExecuted
abstract Boolean isExecuted()
Returns true if this caller has been either execute executed or enqueue enqueued. It is an error to execute or enqueue a caller more than once.
-
getState
abstract CallerState getState()
Returns the caller state.
-
execute
abstract Response<TResponse> execute()
Synchronously send the request and return its response
- Returns:
the response
-
enqueue
abstract Unit enqueue(Caller.Callback<TResponse> callback)
Asynchronously send the request and notify Callback of its response or if an error occurred talking to the server, creating the request, or processing the response
- Parameters:
callback- the callback that notify of its successful response or error
-
getRawRequest
abstract Deferred<HttpRequest> getRawRequest()
the deferred raw request.
-
-
-
-