User Tools

Site Tools


scripting:restcallback

This is an old revision of the document!


RestCallback

Class: RestCallback

Parent Class: (?none?)

Location: scripts/GameLib/online/RestApi.c

Description: RestCallback class.

Common usage

The restAPI allows interaction with external webresources in JSON format. The callbackContext contains the results or errors from the restAPI request

Typical usage : statistics/leaderboards/persistent world.

class TestCallback : RestCallback
{
    override void OnSuccess( string data, int dataSize )
    {
        Print(" !!! OnSuccess() size=" + dataSize );
        if( dataSize > 0 )
            Print(data); // !!! NOTE: Print() will not output string longer than 1024b, check your dataSize !!!
    };
}

Functions

OnError();

OnError( int errorCode );

Called in case request failed (ERestResult) - Note! May be called multiple times in case of (RetryCount > 1)

Return type: void

OnTimeout();

OnTimeout(  );

Called in case request timed out or handled improperly (no error, no success, no data)

Return type: void

OnSuccess();

OnSuccess( string data, int dataSize );

Called when data arrived and/ or response processed successfully

Return type: void

OnFileCreated();

OnFileCreated( string fileName, int dataSize );

Called when data arrived and/ or file created successfully

Return type: void

scripting/restcallback.1661436129.txt.gz · Last modified: 2022/08/25 15:02 by jerryhopper

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki