Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
RestCallback Class Reference
Inheritance diagram for RestCallback:

Detailed Description

Object used as callback structure in which you will receive results of scripted RestAPI calls.

For callback function you can use any function without arguments or with RestCallback as the only argument. If RestCallback was provided as the argument it will contain RestCallback used for the request that invoked it. Allowed arguments of the function can be found in typedef of RestCallbackFunc.

Warning
If callback is not stored as ref then it will be deleted after its execution finishes.

Examples of callback functions:

// you can use function without arguments
void MyOnSuccessFunction()
{
// This code will be executed on successful request
}
// or add RestCallback argument
void MyOnSuccessFunction(RestCallback cb)
{
// This code will be executed on successful request
// you can access data from the response
string data = cb.GetData();
// you can access HTTP result code as enum
HttpCode httpResultEnum = cb.GetHttpCode();
// or it can be stored as int for codes undefined in enum
int httpResultInt = cb.GetHttpCode();
}
// use different function for error event
void MyOnErrorFunction(RestCallback cb)
{
// This code will be executed if request failed
if (cb.GetRestResult() == ERestResult.EREST_ERROR_TIMEOUT)
{
// Handle error caused by request timeout
}
// you can access data if any were provided by the RestApi
string data = cb.GetData()
}
Get all prefabs that have the spawner data
ERestResult
States and result + error code produced by RestApi.
Definition ERestResult.c:14
HttpCode
Definition HttpCode.c:19

You have to set functions on the RestCallback instance for them to be invoked:

m_MyCallback = new RestCallback();
m_MyCallback.SetOnSuccess(MyOnSuccessFunction);
m_MyCallback.SetOnError(MyOnErrorFunction);

Definition at line 71 of file RestCallback.c.


The documentation for this class was generated from the following file: