|
Enfusion Script API
|
Object used as callback structure in which you will receive results of Backend requests exposed via ScriptAPIs. More...
Public Member Functions | |
| proto external void | SetOnSuccess (BackendCallbackFunc onSuccess) |
| Sets function which will be invoked if request was successful. | |
| proto external void | SetOnError (BackendCallbackFunc onError) |
| Sets function which will be invoked if request failed due to some error. | |
| proto external ERestResult | GetRestResult () |
| Returns result code from RestApi. | |
| proto external EBackendRequest | GetBackendRequest () |
| Returns type of request that invoked callback. | |
| proto external EBackendError | GetBackendError () |
| Returns backend error of failed request. | |
| proto external EApiCode | GetApiCode () |
| Returns API code of the request which can represent specific reason why the request failed. | |
| proto external HttpCode | GetHttpCode () |
| Returns HTTP code result of the request. | |
| proto external string | GetErrorMessage () |
| Returns additional message provided by the backend to the request error. | |
| proto external string | GetErrorUID () |
| Returns UID of the request error. | |
| proto external Managed | GetResultData () |
| Returns weak reference to possible result data from request response if supported. | |
| void | OnSuccess (int code) |
| OBSOLETE - WILL BE REMOVED! Use SetOnSuccess() to set callback function instead! | |
| void | OnError (int code, int restCode, int apiCode) |
| OBSOLETE - WILL BE REMOVED! Use SetOnError() to set callback function instead! | |
| void | OnTimeout () |
| OBSOLETE - WILL BE REMOVED! Use SetOnError() to set callback function instead and check GetRestResult() == ERestResult.EREST_ERROR_TIMEOUT! | |
Public Member Functions inherited from Managed | |
| proto external ref Managed | Clone () |
| Return shallow copy of object, or null if it is not allowed (not public constructor) | |
Object used as callback structure in which you will receive results of Backend requests exposed via ScriptAPIs.
For callback function you can use any function without arguments or with BackendCallback as the only argument. If BackendCallback was provided as the argument it will contain BackendCallback used for the request that invoked it. Allowed arguments of the function can be found in typedef of BackendCallbackFunc.
Examples of callback functions:
You have to set functions on the BackendCallback instance for them to be invoked:
| proto external EApiCode BackendCallback.GetApiCode | ( | ) |
Returns API code of the request which can represent specific reason why the request failed.
Some API codes when provided in OnSuccess can also direct what action should be taken next which means that not all API Codes represents errors.
| proto external EBackendError BackendCallback.GetBackendError | ( | ) |
Returns backend error of failed request.
| proto external EBackendRequest BackendCallback.GetBackendRequest | ( | ) |
Returns type of request that invoked callback.
| proto external string BackendCallback.GetErrorMessage | ( | ) |
Returns additional message provided by the backend to the request error.
| proto external string BackendCallback.GetErrorUID | ( | ) |
Returns UID of the request error.
| proto external HttpCode BackendCallback.GetHttpCode | ( | ) |
Returns HTTP code result of the request.
| proto external ERestResult BackendCallback.GetRestResult | ( | ) |
Returns result code from RestApi.
| proto external Managed BackendCallback.GetResultData | ( | ) |
Returns weak reference to possible result data from request response if supported.
Otherwise returns null.
OBSOLETE - WILL BE REMOVED! Use SetOnError() to set callback function instead!
| void BackendCallback.OnSuccess | ( | int | code | ) |
OBSOLETE - WILL BE REMOVED! Use SetOnSuccess() to set callback function instead!
| void BackendCallback.OnTimeout | ( | ) |
OBSOLETE - WILL BE REMOVED! Use SetOnError() to set callback function instead and check GetRestResult() == ERestResult.EREST_ERROR_TIMEOUT!
| proto external void BackendCallback.SetOnError | ( | BackendCallbackFunc | onError | ) |
Sets function which will be invoked if request failed due to some error.
| proto external void BackendCallback.SetOnSuccess | ( | BackendCallbackFunc | onSuccess | ) |
Sets function which will be invoked if request was successful.