scripting:restcallback
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
scripting:restcallback [2022/08/25 14:56] – [Common usage] jerryhopper | scripting:restcallback [2022/08/25 15:05] (current) – [Common usage] jerryhopper | ||
---|---|---|---|
Line 13: | Line 13: | ||
===== Common usage ===== | ===== Common usage ===== | ||
+ | |||
+ | The restAPI allows interaction with external webresources in JSON format. the RestCallback class contains functions in which you process the restAPI request results. | ||
+ | |||
+ | Typical usage : statistics/ | ||
+ | |||
- | Typical usage : Do something with the data from the restAPI | ||
class TestCallback : RestCallback | class TestCallback : RestCallback | ||
Line 27: | Line 31: | ||
} | } | ||
- | |||
- | **FULL EXAMPLE** | ||
- | |||
- | < | ||
- | class TestCallback : RestCallback | ||
- | { | ||
- | |||
- | void OnError( int errorCode ) | ||
- | { | ||
- | // override this with your implementation | ||
- | Print(" | ||
- | }; | ||
- | |||
- | void OnTimeout() | ||
- | { | ||
- | // override this with your implementation | ||
- | Print(" | ||
- | }; | ||
- | |||
- | void OnSuccess( string data, int dataSize ) | ||
- | { | ||
- | // override this with your implementation | ||
- | Print(" | ||
- | if( dataSize > 0 ) | ||
- | Print(data); | ||
- | }; | ||
- | |||
- | |||
- | void OnFileCreated( string fileName, int dataSize ) | ||
- | { | ||
- | // override this with your implementation | ||
- | Print(" | ||
- | }; | ||
- | } | ||
- | </ | ||
Line 107: | Line 76: | ||
+ | |||
+ | ===== FULL EXAMPLE ===== | ||
+ | |||
+ | < | ||
+ | class TestCallback : RestCallback | ||
+ | { | ||
+ | |||
+ | void OnError( int errorCode ) | ||
+ | { | ||
+ | // override this with your implementation | ||
+ | Print(" | ||
+ | }; | ||
+ | |||
+ | void OnTimeout() | ||
+ | { | ||
+ | // override this with your implementation | ||
+ | Print(" | ||
+ | }; | ||
+ | |||
+ | void OnSuccess( string data, int dataSize ) | ||
+ | { | ||
+ | // override this with your implementation | ||
+ | Print(" | ||
+ | if( dataSize > 0 ) | ||
+ | Print(data); | ||
+ | }; | ||
+ | |||
+ | |||
+ | void OnFileCreated( string fileName, int dataSize ) | ||
+ | { | ||
+ | // override this with your implementation | ||
+ | Print(" | ||
+ | }; | ||
+ | } | ||
+ | </ | ||
scripting/restcallback.1661435765.txt.gz · Last modified: 2022/08/25 14:56 by jerryhopper