API reference
API reference
Select your platform
No SDKs available
No versions available

Request Class

This class is used to represent a request to a server or a system service. Each request will have a unique request Id that is used to map it to the Message that is returned.

Constructors

Request ( requestId )
Signature
com.meta.horizon.platform.ovr.requests.Request< T >.Request(long requestId)
Parameters
requestId: long

Methods

getRequestId ()
Signature
long com.meta.horizon.platform.ovr.requests.Request< T >.getRequestId()
Returns
long
onError ( handler )
Set the error callback for this request. The callback should only be set once, or a RuntimeException will be thrown.
Signature
Request<T> com.meta.horizon.platform.ovr.requests.Request< T >.onError(Handler< Error > handler)
Parameters
handler: Handler< Error >  The handler to call when the request fails.
Returns
Request< T >  the request.
onSuccess ( handler )
Set the success callback for this request. The callback should only be set once, or a RuntimeException will be thrown.
Signature
Request<T> com.meta.horizon.platform.ovr.requests.Request< T >.onSuccess(Handler< T > handler)
Parameters
handler: Handler< T >  The handler to call when the request succeeds.
Returns
Request< T >  the request.

Static Methods

handleMessage ( message )
Handle an incoming message by calling the appropriate callback for the request associated with it. Callbacks registered to the exact requestId will be delivered. If there's no exact match with a specific request, then we will attempt to deliver to the registered notification callback for the message type.
To handle messages yourself, you should call runCallbacks() instead.
Signature
static synchronized void com.meta.horizon.platform.ovr.requests.Request< T >.handleMessage(final Message message)
Parameters
message: final Message  The message to handle.
Returns
synchronized void
runCallbacks ( limit )
This will run callbacks on all messages that are returned from the server, up to the provided limit. This will limit the number of messages to run callbacks on at a time.
Signature
static void com.meta.horizon.platform.ovr.requests.Request< T >.runCallbacks(int limit)
Parameters
limit: int  the maximum number of messages to process
Returns
void
runCallbacks ()
Pops all available messages from the queue and handles them by calling the appropriate request callbacks.
This will run callbacks on all messages that are returned from the server. This will not return until all messages in the queue have been handled/delivered.
Signature
static void com.meta.horizon.platform.ovr.requests.Request< T >.runCallbacks()
Returns
void

Static Methods

setNotificationCallback ( type , onSuccess , onError )
Signature
static void com.meta.horizon.platform.ovr.requests.Request< T >.setNotificationCallback(Message.MessageType type, Handler onSuccess, Handler< Error > onError)
Parameters
type: Message.MessageType
onSuccess: Handler
onError: Handler< Error >
Returns
void

Inner Class

Handler Interface

The message handler interface for callbacks that are called when a request succeeds or fails.

Methods

handle ( payload )
This will be called when the message is handled.
Signature
void com.meta.horizon.platform.ovr.requests.Request< T >.Handler< T >.handle(T payload)
Parameters
payload: T  The payload of the message.
Returns
void