Methods Overview
Calling a native method
The vablet interface is primarily used calling the VabletNativeInterface.callNativeMethod(...) function.
This function expects the vablet function name as the first parameter, followed by an object containing the named arguments. The third argument is the returned callback function provided there is one.
Function
VabletNativeInterface.callNativeMethod(name, options, callback)
| Argument | Type | Description |
|---|---|---|
name |
string | vablet API function name. |
options |
object | Named object containing function options. |
callback |
function | callback returns a response object. |
Returns
Most vablet functions will return the results in the form of a callback function as the third argument, with the expected data attached to the response object.
Functions returning a callback will always contain a response object with success and error in the case of a failure.
Usage
Example
Below is a simple example on retrieving the file manifest data for a provided file id.
VabletNativeInterface.callNativeMethod(
"getFileWithId", // the vablet method name
{ fileId: 54321 }, // options for the vablet method
(response) => { // the callback provides a response object
if (response.success) {
// On success let's alert the file name!
alert(response.file.name)
} else {
// Uh oh, We have an error! Let's see what it is.
alert(response.error);
}
}
);
You can learn more about the getFileWithId(...) method here.
Conditions
The interface layer must be fully loaded before using any of the vablet native methods. To prevent any errors it's best to bind any events or functions calling the API in the VabletLibraryLoaded event.
Get more information about VabletLibaryLoaded here.
Method List
Click on a function name to see it's arguments and a code snippet.
CSV / XML Data
| Function Name | Description |
|---|---|
| getCSVForFileId | Gets the CSV for the file with the given ID. |
| getCSVForFileName | Gets the CSV for the first file with the supplied name in the system. |
| getXMLForFileId | Gets the XML for the file with the given ID. |
| getXMLForFileName | Gets the XML for the first file with the supplied name in the system. |
| Function Name | Description |
|---|---|
| ConvertHTMLAttachmentToPdfAndSend | Converts HTML data to PDF and emails it. |
| SendEmail | Converts HTML data to PDF and emails it. |
| sendEmailForFiles | Sends Vablet files to the specified emails. |
| useVabletGUIToSendEmailForFiles | Presents the Vablet email gui, using the prefilled values specified. Returns success if the email is queued or sent. |
Files and Folders
| Function Name | Description |
|---|---|
| getFileWithId | Fetches the meta for a Vablet file via fileId. |
| getFolderFullDataById | Gets the meta data for folder with the folderId supplied. |
| getFolderFullDataByPath | Gets the meta data for folder with the folderPath supplied. |
| getThumbnailForFileId | Gets the thumbnail data for the file with the given ID. |
| searchForTerm | Searches for a term within the file manifest. Returns an array of file objects. |
| setCompletedToTrue | Sets the completed flag in the specified fileId's Media Report to true. |
| toggleFavoriteStatusForFileWithId | Toggles the favorite flag for the file, then adds or removes the file from the favorites folder. |
| toggleTagStatusForFileWithId | Toggles the tag flag for the file, then adds or removes the file from the Tagged folder. |
Presentation Folders
| Function Name | Description |
|---|---|
| addFileIdsToUserFolder | Adds files with ids to the end of the folder list. If the file exists it will be readded in the order given. |
| addFileNamesToUserFolder | Adds files with names to the end of the folder list. If the file exists it will be readded in the order given. |
| createUserFolder | Creates a new user folder. |
SalesForce
| Function Name | Description |
|---|---|
| endSession | Ends the current SalesForce session, and pops up the event editing screen. |
| GetSalesForceContact | Presents a SalesForce selection screen. Returns selected contact information. |
| getSalesforceContactIfEnabledElseNative | If a salesforce session is active, it obtains a salesforce contact. If a native session is enabled it obtains a native contacts. |
| GetSelectedContactsIndependentOfSessionType | If a salesforce session is active, it obtains salesforce session contacts that were selected. If a native session is enabled it obtains native session contacts that were selected. |
| presentSalesforceCalendar | Presents the Salesforce event selection calendar. |
| presentSalesforceMenuFromButtonWithId | Presents Vablet's popover from the button specified. |
| startSessionWithSalesforceContactId | Starts a Salesforce session with the specified contactId. |
| startSessionWithoutContact | Starts a session without a contact. |
Other
| Function Name | Description |
|---|---|
| changeActiveFolderTo | Changes the active folder, which if using the openfile feature will affect slide behavior. |
| CloseFile | Closes the current file. |
| enableNativeDisplayOfHtmlSelectionForHTMLPaths | A thumbnail bar to select HTML files to go to. This version has automatic handling of swipe gestures. Once enabled swiping up and down will display the menu. |
| getLatestManifest | Starts a manifest update and calls back after the update has finished. |
| HideCloseButton | Hides the Vablet close button. |
| hideHtmlSelection | Hides any visible HTML selection bar. |
| reportPageChange | Reports a page change for logging purposes. |
| showHtmlSelectionForHTMLPaths | A thumbnail bar to select HTML files to go to. |
| snapshotCurrentPage | Takes a snapshot of the current page, and presents the user with an email form to send it. |
| SupressFileToolbar | Hides the Vablet bottom toolbar. |