From c6971390891823706f6aa6f5d29e3c682917d224 Mon Sep 17 00:00:00 2001 From: Srinidhi Date: Fri, 12 Jul 2019 15:10:19 +0530 Subject: [PATCH] doc(unvired-cordova-sdk): doc update (#3090) * feat(unvired-cordova-sdk): add plugin * style(unvired-cordova-sdk): fix style * doc(unvired-cordova-sdk): add doc * doc(unvired-cordova-sdk): update doc * style(unvired-cordova-sdk): fix style * doc(unvired-cordova-sdk): fix readme errors * doc(unvired-cordova-sdk): update doc --- .../plugins/unvired-cordova-sdk/index.ts | 686 +++++++++++++++++- 1 file changed, 655 insertions(+), 31 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index d7f668695..a1dfd7f4b 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -16,6 +16,8 @@ * // Login * let loginParameters = new LoginParameters() * loginParameters.appName = 'UNVIRED_DIGITAL_FORMS' + * loginParameters.metadataPath = '../assets/metadata.json' + * loginParameters.loginType = LoginType.unvired * let loginResult: LoginResult = await this.unviredCordovaSDK.login(loginParameters) * * // Make a Sync call. @@ -31,48 +33,179 @@ import { Injectable } from '@angular/core'; import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Observable } from 'rxjs'; +export enum AuthenticateAndActivateResultType { + /** + * This value indicates that UMP was able to validate users credentials & activation of the user is complete. + * In mobile apps, this also means database is created & apps can proceed with their custom logic. + */ + auth_activation_success = 2, + /** + * This value indicates that UMP was unable to validate users credentials. + */ + auth_activation_error = 3 +} + +export enum AuthenticateLocalResultType { + /** + * This value indicates that UnviredCordovaSDK was able to validate users credentials and apps can proceed with their custom logic. + */ + login_success = 4, + /** + * This value indicates that UnviredCordovaSDK was unable to validate users credentials. You can retrieve the error information from AuthenticateLocalResult. + */ + login_error = 5 +} + export enum LoginListenerType { + /** + * This value indicates that there is no user account exists and user needs to authenticate & activate. Call authenticateAndActivate() api to activate the user. + */ auth_activation_required = 0, - app_requires_login, - auth_activation_success, - auth_activation_error, - login_success, - login_error, - app_requires_current_account + /** + * Applicable for iOS, Android & Windows. + * This value indicates user needs to login before using the app. This depends on the setting LOCAL_PASSWORD which is set in UMP Admin Cockpit. + * If LOCAL_PASSWORD is set to true, this type is set everytime user opens the app. + */ + app_requires_login = 1, + /** + * This value indicates app can proceed with its custom logic. + */ + login_success = 4, + /** + * TODO + */ + app_requires_current_account = 6 } export enum LoginType { + /** + * This value represents authentication using Unvired ID. + * Example: + * If you plan to authenticate using Unvired ID, you need to send the following parameters: + * ``` + * loginParameters.username = 'USER_NAME' + * loginParameters.password = 'password' + * loginParameters.company = 'unvired' + * loginParameters.loginType = LoginType.unvired + * ``` + */ unvired = 'UNVIRED_ID', + /** + * This value represents authentication using Active Directory Service (ADS). + * Example: + * If you plan to authenticate using Unvired ID, you need to send the following parameters: + * ``` + * loginParameters.username = 'USER_NAME' + * loginParameters.password = 'password' + * loginParameters.company = 'unvired' + * loginParameters.domain = 'ADS_DOMAIN' + * loginParameters.loginType = LoginType.ads + * ``` + */ ads = 'ADS', + /** + * This value represents authentication using SAP ID. + * Example: + * If you plan to authenticate using Unvired ID, you need to send the following parameters: + * ``` + * loginParameters.username = 'USER_NAME' + * loginParameters.password = 'password' + * loginParameters.company = 'unvired' + * loginParameters.port = 'SAP_PORT_NAME' + * loginParameters.domain = 'SAP_DOMAIN' + * loginParameters.loginType = LoginType.sap + * ``` + */ sap = 'SAP', + /** + * TODO: + */ custom = 'CUSTOM' } export enum ResultType { + /** + * This value indicates a succesful operation. + */ success = 0, + /** + * This value indicates an error. + */ error } export enum RequestType { + /** + * Set this type if the data exchange with UMP is 1:1. The header datastructure needs to be sent which also should be present in database prior to the call. + * You can use UnviredCordovaSDK's db methods to insert data into database. + */ RQST = 0, + /** + * Set this type if the data exchange with UMP is 1:N pr 0:N. Sending a datastructure is optional and is dependent on the process agent function. + * If the process agent function is marked with metadata delete flag, then server data replaces the data in database. + * If the process agent function is NOT marked with metadata delete flag, then this request type behaves the same as QUERY + */ PULL, + /** + * This request type is for those message which are initiated by the server. You typically do not set this request type in sync.. methods. + */ PUSH, + /** + * Set this type if the data exchange with UMP is 1:N pr 0:N. Sending a datastructure is optional and is dependent on the process agent function. + * Unlike PULL, this request type updates the data in database without deleting existing entries. + */ QUERY, + /** + * Set this type if the data exchange with UMP is 1:0. This handles the case where no server response is expected. + */ REQ } export enum NotificationListenerType { - dataSend = 0, // Notify successful asynchronous send of data to the server. - dataChanged = 1, // Notify data changes for each BusinessEntity when received data from server. - dataReceived = 2, // Notify data receive completion on receive of all BusinessEntity - appReset = 3, // Notify application data reset. - attachmentDownloadSuccess = 4, // Notify application with error message and attchment item on attachment download error - attachmentDownloadError = 5, // Notify application with error message and attchment item on attachment download success - incomingDataProcessingFinished = 6, // Notify application when incoming data handling finished - attachmentDownloadWaiting = 7, // Notify application when attachment download is waiting on the server - infoMessage = 8, // Notify application with any InfoMessages - serverError = 9, // Notify application with Server errors - attachmentDownloadCompleted = 10 // Notify attachment downloads completed + /** + * Notify successful asynchronous send of data to the server. This type indicates that data has moved from outbox to sent items. + */ + dataSend = 0, + /** + * Notify data changes for each BusinessEntity when received data from server. This type indicates when data is removed from sent items table. + */ + dataChanged = 1, + /** + * Notify data receive completion on receiving of all BusinessEntities from server. Data would get processed after this step. + */ + dataReceived = 2, + /** + * Notify application data reset. + */ + appReset = 3, + /** + * Notify application with error message and attchment item on attachment download success + */ + attachmentDownloadSuccess = 4, + /** + * Notify application with error message and attchment item on attachment download error + */ + attachmentDownloadError = 5, + /** + * Notify application when incoming data handling finished + */ + incomingDataProcessingFinished = 6, + /** + * Notify application when incoming data handling finished + */ + attachmentDownloadWaiting = 7, + /** + * Notify application with any InfoMessages + */ + infoMessage = 8, + /** + * Notify application with Server errors + */ + serverError = 9, + /** + * Notify attachment downloads completed + */ + attachmentDownloadCompleted = 10 } export enum AttachmentItemStatus { @@ -100,10 +233,25 @@ export class Settings { } export class UnviredResult { + /** + * The data returned in response to the api call. + */ data: any; + /** + * The informational message returned in lieu of data. + */ message: string; + /** + * Refer to the overrided property in subclasses. + */ type: number; + /** + * Contains the error information which the apps can convey to the users. + */ error: string; + /** + * Contains the detailed error information which the apps can convey to the users. + */ errorDetail: string; } @@ -125,23 +273,86 @@ export class DbResult extends UnviredResult { } export class LoginParameters { + /** + * Set the application name as configured in UMP. + */ appName: string; + + /** + * Company name as configured in UMP. + */ company: string; + + /** + * Username of the user trying to login. + */ username: string; + + /** + * Password of the user trying to login. + */ password: string; + + /** + * UMP URL. For example: http://192.168.98.160:8080/UMP + */ url: string; + + /** + * Domain name. Required only if the login type is ADS or SAP. + */ domain: string; + + /** + * Set this value to one of the allowed login types for your app as configured in UMP. + */ loginType: LoginType; + + /** + * FrontEndUserId: This id uniquely identifies the user across devices of same type. If the Unvired user has multiple front end ids for a device type, you need to set this value. + * If the Unvired user has only one front end id, leave this field blank. + */ feUserId: string; + + /** + * Required only if the loginType is 'sap'. This sets the SAP Port Name. + */ port: string; + + /** + * Required for Browser Platform. + * For iOS Platform include the metadata.xml file as part of App Bundle + * For Android Platform include the metadata.xml file in src > res > raw + */ metadataPath: string; + + /** + * This is required for Android only. Setting this value would save the attachments as Base64 string for easy access. + */ isRequiredAttachmentBase64: boolean; + + /** + * TODO: + */ autoSendTime: string; + + /** + * TODO: + */ autoSyncTime: string; } export class LoginResult extends UnviredResult { type: LoginListenerType; } + +export class AuthenticateActivateResult extends UnviredResult { + type: AuthenticateAndActivateResultType; +} + +export class AuthenticateLocalResult extends UnviredResult { + type: AuthenticateLocalResultType; +} + @Plugin({ pluginName: 'UnviredCordovaSDK', plugin: 'cordova-plugin-unvired-sdk', // npm package name, example: cordova-plugin-camera @@ -149,246 +360,616 @@ export class LoginResult extends UnviredResult { repo: 'https://github.com/unvired/cordova-plugin-unvired-sdk/', // the github repository URL for the plugin install: 'ionic cordova plugin add @ionic-native/unvired-cordova-sdk', // OPTIONAL install command, in case the plugin requires variables installVariables: [], // OPTIONAL the plugin requires variables - platforms: ['iOS'] // Array of platforms supported, example: ['Android', 'iOS'] + platforms: ['iOS', 'Android', 'Windows', 'Browser'] // Array of platforms supported, example: ['Android', 'iOS'] }) @Injectable() export class UnviredCordovaSDK extends IonicNativePlugin { loginParameters: LoginParameters; + /** + * Write debug logs. + * @param sourceClass Name of the class + * @param method Name of the method + * @param message The actual message + * Example: + * ``` + * this.unviredSDK.logDebug("Class Name", "Method Name", "Log Message") + * ``` + * would produce the log message like this + * 01-07-2019 15:52 | DEBUG | Class Name | Method Name | Log Message + */ @Cordova() logDebug(sourceClass: string, method: string, message: string): Promise { return; } + /** + * Write error logs. + * @param sourceClass Name of the class + * @param method Name of the method + * @param message The actual message + * Example: + * ``` + * this.unviredSDK.logError("Class Name", "Method Name", "Log Message") + * ``` + * would produce the log message like this + * 01-07-2019 15:52 | ERROR | Class Name | Method Name | Log Message + */ @Cordova() logError(sourceClass: string, method: string, message: string): Promise { return; } + /** + * Write Info logs. + * @param sourceClass Name of the class + * @param method Name of the method + * @param message The actual message + * Example: + * ``` + * this.unviredSDK.logInfo("Class Name", "Method Name", "Log Message") + * ``` + * would produce the log message like this + * 01-07-2019 15:52 | IMPORTANT | Class Name | Method Name | Log Message + */ @Cordova() logInfo(sourceClass: string, method: string, message: string): Promise { return; } + /** + * TODO: + */ @Cordova() logRead(): Promise { return; } + /** + * TODO: + */ @Cordova() logDelete(): Promise { return; } + /** + * TODO: + */ @Cordova() sendLogToServer(): Promise { return; } + /** + * TODO: + */ @Cordova() sendLogViaEmail(): Promise { return; } /** - * This api initiatilizes the Unvired Application. - * @param loginParameters + * This api initializes the Unvired Application. + * @param loginParameters Set of parameters to be passed the login() + * For Example: + * ``` + * let loginParameters = new LoginParameters() + * loginParameters.appName = 'UNVIRED_DIGITAL_FORMS' + * loginParameters.metadataPath = '../assets/metadata.json' + * loginParameters.loginType = LoginType.unvired + * ``` */ @Cordova() login(loginParameters: LoginParameters): Promise { return; } + /** + * TODO: + */ @Cordova() logout(): Promise { return; } /** - * Authenticates & activates the app against UMP - * @param loginParameters Send username & Password through loginParameters + * Authenticates ( With the Unvired Server ) & activates ( Receives Framework Settings ) the app against UMP + * Example: + * ``` + * let loginParameters = new LoginParameters() + * loginParameters.username = 'MY_USERNAME' + * loginParameters.password = 'MY_PASSWORD' + * await this.unviredSDK.authenticateAndActivate(loginParameters) + * ``` + * @param loginParameters LoginParamerter instance used to send username / password. */ @Cordova() - authenticateAndActivate(loginParameters: LoginParameters): Promise { + authenticateAndActivate(loginParameters: LoginParameters): Promise { return; } /** - * Authenticates the user against the locally saved username & password. + * Authenticates the user against the previously saved username & password. * For ADS Login, authentication is performed with the ADS Server. - * @param loginParameters Send username & Password through loginParameters + * @param loginParameters Send username & Password through LoginParameters + * Example: + * ``` + * let loginParameters = new LoginParameters() + * loginParameters.username = 'MY_USERNAME' + * loginParameters.password = 'MY_PASSWORD' + * await this.unviredSDK.authenticateLocal(loginParameters) */ @Cordova() - authenticateLocal(loginParameters: LoginParameters): Promise { + authenticateLocal(loginParameters: LoginParameters): Promise { return; } + /** + * Get all the accounts configured on the device. + */ @Cordova() getAllAccounts(): Promise { return; } + /** + * Switch account + * @param account The account to switch to + */ @Cordova() switchAccount(account: any): Promise { return; } + /** + * Delete account + * @param account The account to delete + */ @Cordova() deleteAccount(account: any): Promise { return; } + /** + * Get all InfoMessages linked to the header. + * @param headerName Name of the header. Example: CUSTOMER_HEADER + * @param lid LID of the header. + */ @Cordova() getInfoMessages(headerName: string, lid: string): Promise { return; } + /** + * Supported for iOS, Android & Windows Platforms. + * Display framework settings. + */ @Cordova() showSettings(): Promise { return; } + /** + * Get User settings. + */ @Cordova() userSettings(): Promise { return; } + /** + * Update System Credential + * @param credentials The credential to update to + */ @Cordova() updateSystemCredentials(credentials: any): Promise { return; } + /** + * Get all system credentials. + */ @Cordova() getSystemCredentials(): Promise { return; } + /** + * Get version number of unvired-cordova-sdk. + */ @Cordova() getVersionNumbers(): Promise { return; } + /** + * Delete all data from the device. + */ @Cordova() clearData(): Promise { return; } + /** + * Check whether the device has internet. + */ @Cordova() hasInternet(): Promise { return; } + /** + * Get a random id to use as guid. + */ @Cordova() guid() { return; } + /** + * For Debugging Only. pull database file to "temp" folder for development purpose only. + */ @Cordova() - dbSelect(tableName: string, whereClause: string): Promise { + pullDb(): Promise { return; } + /** + * For Debugging Only. ush updated database file from "temp" folder to application directory for development purpose only + */ + @Cordova() + pushDb(): Promise { + return; + } + + /** + * Select records from Database + * @param tableName table name. Example: CUSTOMER_HEADER + * @param whereClause {Object} JSON object containing name-value pairs. + * Example: + * ``` + * # Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 + * this.unviredSDK.dbSelect('FORM_HEADER', {"FORM_ID": "5caed815892215034dacad56"}) + * ``` + */ + @Cordova() + dbSelect(tableName: string, whereClause: any): Promise { + return; + } + + /** + * Insert record into database. + * In browser platform this function always inserts or updates based on GID. + * @param tableName Name of the table. + * @param structureObject - JSON object containing name-value pairs. + * @param isHeader {boolean} - is DataStructure a header or item? + * Example: + * ``` + * # Insert CUSTOMER_HEADER Datastructure into DB. + * this.unviredsdk.dbInsert("CUSTOMER_HEADER", {"NAME":"TARAK","NO":"0039"}, true); + * ``` + */ @Cordova() dbInsert(tableName: string, structureObject: any, isHeader: boolean): Promise { return; } + /** + * insert or update the record ( if record exists ) into database. + * In browser insert always inserts or updates based on gid + * @param tableName Name of the table + * @param structureObject - JSON object containing name-value pairs. + * @param isHeader {boolean} - is DataStructure a header or item? + * Example: + * ``` + * # Insert or update a CUSTOMER_HEADER with NAME as TARAK and NO as '0039' + * this.unviredsdk.dbInsertOrUpdate("CUSTOMER_HEADER",{"NAME":"TARAK","NO":"0039"},true); + * ``` + */ @Cordova() dbInsertOrUpdate(tableName: string, structureObject: any, isHeader: boolean): Promise { return; } + /** + * Delete records from the database. + * @param tableName Name of the table + * @param whereClause {Object} JSON object containing name-value pairs. + * Example: + * ``` + * # Delete CUSTOMER_HEADER where F_NAME equals TARAK + * this.unviredSDK.dbDelete('CUSTOMER_HEADER', {'F_NAME':'TARAK'}) + * ``` + */ @Cordova() - dbDelete(tableName: string, whereClause: string): Promise { + dbDelete(tableName: string, whereClause: any): Promise { return; } + /** + * Update records in database. + * @param tableName Name of the table + * @param updatedObject JSON object containing name-value pairs. + * @param whereClause {Object} JSON object containing name-value pairs. + * Example: + * ``` + * # Update TEAM_NAME of TEAMS_HEADER for team matching TEAM_ID = 8B75B4DB7F134DE08CF446889433B9CC + * this.unviredSDK.dbUpdate('TEAMS_HEADER', {'TEAM_NAME': 'SUPPORT'}, {'TEAM_ID': '8B75B4DB7F134DE08CF446889433B9CC' }) + * ``` + */ @Cordova() - dbUpdate(tableName: string, updatedObject: any, whereClause: string): Promise { + dbUpdate(tableName: string, updatedObject: any, whereClause: any): Promise { return; } + /** + * Supported in iOS, Android & Windows only. + * Execute SQL Statement + * @param query {string} SQL Statement. + * Example: + * ``` + * this.unviredSDK.dbExecuteStatement('SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = 39') + * ``` + */ @Cordova() dbExecuteStatement(query: string): Promise { return; } + /** + * Supported in iOS, Android & Windows only. + * Create Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html ) + * @param savePoint {string} Name of savepoint + * Example: + * ``` + * this.unviredSDK.dbCreateSavePoint('MySavePointName') + * ``` + */ @Cordova() dbCreateSavePoint(savePoint: string): Promise { return; } + /** + * Supported in iOS, Android & Windows only. + * Release Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html ) + * @param savePoint {string} Name of savepoint + * ``` + * this.unviredSDK.dbReleaseSavePoint('MySavePointName') + * ``` + */ @Cordova() dbReleaseSavePoint(savePoint: string): Promise { return; } + /** + * Supported in iOS, Android & Windows only. + * Rollback Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html ) + * @param savePoint {string} Name of the savepoint + * Example: + * ``` + * this.unviredSDK.dbRollbackToSavePoint('MySavePointName') + * ``` + */ @Cordova() dbRollbackToSavePoint(savePoint: string): Promise { return; } + /** + * Supported in iOS, Android & Windows only. + * Begin database transaction. + * For more info, consult SQLite documentation ( https://www.sqlite.org/lang_transaction.html ) + * Example: + * ``` + * this.unviredSDK.dbBeginTransaction() + * ``` + */ @Cordova() dbBeginTransaction(): Promise { return; } + /** + * Supported in iOS, Android & Windows only. + * End database transaction. + * For more info, consult SQLite documentation ( https://www.sqlite.org/lang_transaction.html ) + * Example: + * ``` + * this.unviredSDK.dbEndTransaction() + * ``` + */ @Cordova() dbEndTransaction(): Promise { return; } + /** + * Supported in Android & Windows only. + * Launch a file from a file path + * @param filePath file path + */ @Cordova() launchFile(filePath: string): Promise { return; } + /** + * Supported in Android & Windows only. + * Write Base64 string to a file and launch. + */ @Cordova() launchBase64(base64string: string, fileName: string, extension: string): Promise { return; } + /** + * Supported in Windows Only + * Unzip file. + */ @Cordova() unzip(srcPath: string, destPath: string) { return; } + /** + * Get the path for the folder where attachments are stored. + * Apps can combine this with the attachment filename to construct absolute path to an attachment file. + */ @Cordova() getAttachmentFolderPath(): Promise { return; } + /** + * Copy attachment file to application folder and insert attachment item to database with updated local path. + * @param tableName Table name of attachment item. + * @param structureObject {Object} JSON object containing name-value pairs. + * Example: + * ``` + * {'F_NAME':'TARAK','EMP_NO':'0039'} + * ``` + */ @Cordova() createAttachmentItem(tableName: string, structureObject: any): Promise { return; } + /** + * Upload attachment item to server. + * @param tableName Table name of attachment item. + * @param structureObject JSON object containing name-value pairs. + * @param isAsync Flag which indicates whether the upload should happen in async. + */ @Cordova() uploadAttachment(tableName: string, structureObject: any, isAsync: boolean): Promise { return; } + /** + * Download attachment from server. + * @param tableName Table name of attachment item. + * @param structureObject JSON object containing name-value pairs. + */ @Cordova() downloadAttachment(tableName: string, structureObject: any): Promise { return; } + /** + * Sends data to UMP in SYNC mode. This means user has to wait until the duration of SYNC call. Only one SYNC call can be active at any point of time. Once the call completes, the result data would be available in the Promise. + * Apps typically block UI during a SYNC call so that there are user-actions when the SYNC call is active. + * @param reqype RequestType for the message. Please check RequestType to select the right request type. + * @param header {Object} Header datastructure to be sent to UMP. Header datastructure is mandatory of the request type is RQST. + * For PA functions which do not accept any input, set an empty string for this parameter. + * Example: If Header datastructure needs to be sent, make sure the header datastructure is in the following format: + * ``` + * {"CUSTOMER_HEADER": {field_name : field_value,...}} + * ``` + * @param customData {Object} This depends on the PA function. This is useful if you want to send custom data to a PA function. + * Example: You can also use this parameter to send header datastrucrture provided the data structure is formatted like this. + * ``` + * { + * "CATEGORY_BE": [{ + * "CATEGORY_HEADER": {field_name : field_value,...} + * }] + * } + * ``` + * @param paFunction Name of the Process Agent function to be executed. Example: PA_MOBILE_EXECUTE_SALES_ORDER. + * @param autoSave This defines whether to save the response to database. + */ @Cordova() - syncForeground(reqype: any, header: any, customData: any, paFunction: string, autoSave: boolean): Promise { + syncForeground(reqype: RequestType, header: any, customData: any, paFunction: string, autoSave: boolean): Promise { return; } + /** + * Sends data to UMP in ASYNC mode. This means user can make this call and continue with other program execution. + * The result of the call would be notified through the observable returned for the function registerNotifListener(). + * @param reqype RequestType for the message. Please check RequestType to select the right request type. + * @param header {Object} Header datastructure to be sent to UMP. Header datastructure is mandatory of the request type is RQST. + * For PA functions which do not accept any input, set an empty string for this parameter. + * Example: If Header datastructure needs to be sent, make sure the header datastructure is in the following format: + * ``` + * {"CUSTOMER_HEADER": {field_name : field_value,...}} + * ``` + * @param customData {Object} This depends on the PA function. This is useful if you want to send custom data to a PA function. + * Example: You can also use this parameter to send header datastrucrture provided the data structure is formatted like this. + * ``` + * { + * "CATEGORY_BE": [{ + * "CATEGORY_HEADER": {field_name : field_value,...} + * }] + * } + * ``` + * @param paFunction Name of the Process Agent function to be executed. Example: PA_MOBILE_EXECUTE_SALES_ORDER. + * @param beName Name of the Business Entity + * @param belid LID of the Header datastructure + * @param bypassAttachment Set this flag to false if you want to upload attachments first and then make the server call. + */ @Cordova() - syncBackground(reqype: any, header: any, customData: any, paFunction: string, beName: string, belid: string, bypassAttachment: boolean): Promise { + syncBackground(reqype: RequestType, header: any, customData: any, paFunction: string, beName: string, belid: string, bypassAttachment: boolean): Promise { return; } + /** + * For Browser platform only. + * Reinitialize web db. Use this api to initialize db from persisted local storage db + */ + @Cordova() + dbReload() { + return; + } + + /** + * For Browser platform only. + * Generate Unvired BusinessEntity json from header and items + * @param headerName Header Table Name + * @param header Header Datastructure object + * @param itemName Item Table Name + * @param items Array of Item Structures. + */ + @Cordova() + generateUBJson(headerName: string, header: any, itemName: string, items: any) { + return; + } + + /** + * For Browser platform only. + * parseRawUBJson - Parse response json returned from syncForeground api. + * @param json JSON string + */ + @Cordova() + parseRawUBJson(json: string) { + return; + } + + /** + * For Browser platform only. + * Returns a collection of all entities which belong to |tableName| + * @param tableName Name of the table Exanple: CUSTOMER_HEADER + */ + @Cordova() + dbGetCollection(tableName: string) { + return; + } + + /** + * Places a request to download all pending messages for the logged in user in UMP. + * To keep track of returned data, you would need to register a notification listener (registerNotifListener()) & subscribe to the observable. + */ @Cordova() getMessages() { return; } + /** + * Subscribe to this observable to listen for life-cyle events in the case of an async message. + * Only one class can subscribe to notifications are any point of time. + */ @Cordova({ observable: true, clearFunction: 'unRegisterNotifListener' @@ -397,43 +978,86 @@ export class UnviredCordovaSDK extends IonicNativePlugin { return; } + /** + * Unregister the notification listener previously registered. + */ @Cordova() unRegisterNotifListener(): Promise { return; } + /** + * Supported in iOS, Android & Windows only + * Check whether a Header datastructure is in outbox. + * @param beLid LID of the Header datastructure. + */ @Cordova() isInOutBox(beLid: string): Promise { return; } + /** + * Supported in iOS, Android & Windows only + * Returns the count of outbox items. + */ @Cordova() outBoxItemCount(): Promise { return; } + /** + * Supported in iOS, Android & Windows only + * Checks whether a Header datastructure is in sent and is waiting for response. + * Typically you would use before allowing the user to update the Header datastructure. + * @param beLid LID of the Business Entity + */ @Cordova() isInSentItem(beLid: string): Promise { return; } + /** + * Supported in iOS, Android & Windows only + * Returns the count of sent items. + */ @Cordova() sentItemCount(): Promise { return; } + /** + * Supported in iOS, Android & Windows only + * Returns the count of Inbox items. + */ @Cordova() inBoxItemCount(): Promise { return; } + /** + * Supported in iOS, Android & Windows only + * Delete outbox entry for a Header datastructure. + * @param beLid LID of the Business Entity + */ @Cordova() deleteOutBoxEntry(beLid: string): Promise { return; } + /** + * Resets sync data with the application such as outbox, inbox & sent item entries. + * You may want to call this function before switching account. + */ @Cordova() resetApplicationSyncData(): Promise { return; } + + /** + * For Browser platform only + * Helps in updating application database without reauthenticating with server which requires to drop both app and framework database. + */ + reCreateAppDB(): Promise { + return; + } }