Methods
(static) beginSession(options, successCallBack, errorCallBack)
This method allows the application a means of recording an application-defined Session.
Each session is a grouping in which all subsequent appStats operations will be logged with the
same "sessionKey", until the next endSession call.
Parameters:
Name |
Type |
Description |
options |
Object
|
Properties
Name |
Type |
Description |
sessionKey |
String
|
sessionKey is an application-defined string, which will be a meaningful identifier for this session.
This same sessionKey should also be passed to any server-side calls, such as RTTI,
so that stats collected on the server can reflect the same sessionKey. |
category |
String
|
category is an application-defined string, representing the type of session.
Examples of typical categories include BillPay, etc. |
|
successCallBack |
function
|
callback with state indicating API call is successful |
errorCallBack |
function
|
callback with error message to be invoked when something goes wrong |
Example
{
sessionKey: 'UniqueID',
category: 'BillPay'
}
(static) endSession(options, successCallBack, errorCallBack)
This method tells appStats to stop the session. Subsequent logging calls will not include a sessionKey in the AppStats data,
until the next time beginSession is called again.
Parameters:
Name |
Type |
Description |
options |
Object
|
Properties
Name |
Type |
Description |
success |
boolean
|
Used to represent success/failure of a session. |
message |
String
|
message is a response string if any. |
|
successCallBack |
function
|
callback with state indicating API call is successful |
errorCallBack |
function
|
callback with error message to be invoked when something goes wrong |
Example
{
success: true,
message: 'Billpay session is successful'
}
(static) exportAppStats(successCallBack, errorCallBack)
The content of the AppStats data in memory will be return to the caller in JSON Object format.
Parameters:
Name |
Type |
Description |
successCallBack |
function
|
callback with AppStats data in JSON Object format indicating API call is successful |
errorCallBack |
function
|
callback with error message to be invoked when something goes wrong |
(static) initAppStats(successCallBack, errorCallBack)
Initialize AppStats with capturing Environment details and stored in-memory as JSON Object.
Parameters:
Name |
Type |
Description |
successCallBack |
function
|
callback with state indicating API call is successful |
errorCallBack |
function
|
callback with error message to be invoked when something goes wrong |
(static) isRecording()
Returns the AppStatus recording status.
Returns:
Returns the recording status.
(static) logFieldChangeEvent(options, successCallBack, errorCallBack)
This method records the field change event in appStats data.
Parameters:
Name |
Type |
Description |
options |
Object
|
Properties
Name |
Type |
Attributes |
Description |
IsValid |
boolean
|
|
IsValid represents existance of an error. |
ErrorDescription |
String
|
|
ErrorDescription describes the error. |
FormattingFailed |
boolean
|
<optional>
|
FormattingFailed is a boolean of field formatting value. |
DocumentID |
String
|
|
DocumentID is a uniqe string returned from extraction server. |
FieldName |
String
|
|
FieldName is a name of the field. |
OriginalValue |
String
|
|
OriginalValue is an actual extracted value of field. |
Confidence |
number
|
|
Percentage confidence of the extracted field. |
ChangedValue |
String
|
|
ChangedValue is a new value updated for the field. |
|
successCallBack |
function
|
callback with state indicating API call is successful |
errorCallBack |
function
|
callback with error message to be invoked when something goes wrong |
Example
{
IsValid:true,
ErrorDescription:'field not extracted';
FormattingFailed:false;
DocumentID:'unique-ID';
FieldName:'Payee Name';
OriginalValue:'';
Confidence:0;
ChangedValue:'abc';
}
(static) logSessionEvent(options, successCallBack, errorCallBack)
Each Session event may represent a "sub-Session", or single operation which defines one step
in a sequence of steps which collectively define a complete session. The logSessionEvent
accepts as a parameter object.
Parameters:
Name |
Type |
Description |
options |
Object
|
Properties
Name |
Type |
Description |
sessionType |
String
|
SessionType represents custom sessions type. |
response |
String
|
Response is a reason for custom session. |
|
successCallBack |
function
|
callback with state indicating API call is successful |
errorCallBack |
function
|
callback with error message to be invoked when something goes wrong |
Example
{
sessionType: 'SUBMIT/RETAKE',
response: 'submitted with error'
}
(static) startRecord(successCallBack, errorCallBack)
Use this method to start recording statistics or continues recording during normal library operations. This will set the isRecordingAppStats property to true.
This method is only valid if you have initialized AppStats by calling initAppStats
Parameters:
Name |
Type |
Description |
successCallBack |
function
|
callback with state indicating API call is successful |
errorCallBack |
function
|
callback with error message to be invoked when something goes wrong |
(static) stopRecord(successCallBack, errorCallBack)
Use this method to stop recording. This will set the isRecordingAppStats property to false, This method is only valid if you previously started recording.
Parameters:
Name |
Type |
Description |
successCallBack |
function
|
callback with state indicating API call is successful |
errorCallBack |
function
|
callback with error message to be invoked when something goes wrong |