API Reference
Accessing the API
The API is available through the global object yarkon
. You should only use the API commands and events after the object is ready, similar to the DOM object. To do so, you have to put all code that requires the API in the onReady
method, like so:
<script>
yarkon.onReady = function(yarkon) {
// Remove the application name, we don't need it here. Update the link
// to go to the correct site
$('a.navbar-brand').html('').attr('href', 'http://looneytunes.wikia.com/wiki/Category:ACME');
// Wire the select folder event
yarkon.onSelectFolder(function(e, args) {
// Log what happened
console.log('Event: ' + e.type + '\nArgs: ' + JSON.stringify(args));
});
};
</script>
API Documentation
Version 4.2.1
Automatically generated from source on Sun Sep 22 2019 20:57:22 GMT-0400 (Eastern Daylight Time)
Types
The object types used by Yarkon.
Item
The Item class represents a row in the grid.
Type: Object
Properties
-
id
string : Path to this object in S3. -
title
string : The display name of this S3 object in the grid. -
bucket
string : The name of the bucket containing this item in S3. -
key
string : The key of the this item in S3. -
isFolder
boolean : Will be true if this S3 object is a folder. -
modified
date : Last modified date and time (documents only). -
size
number : Size of the S3 object in bytes (documents only). -
storageClass
string : The storage class of the this item in S3 (documents only).
Folder
The Folder class represents a node in the tree.
Type: Object
Properties
-
id
string : Path to this object in S3. -
title
string : The display name of this S3 object in the tree. -
bucket
string : The name of the bucket containing this folder in S3. -
key
string : The key of the this folder in S3. -
isBucket
boolean : Will be true if this S3 object is a bucket.
PaneState
Use the PaneState object represents the current state of a pane.
Type: object
Properties
-
pane
Pane : Identifies the pane. -
isOpen
boolean : Will be true if this pane is open. -
isShown
boolean : Will be true if this pane is shown.
Callback
The Callback function is called by some of the methods of Yarkon, to return
data to the caller asynchronously.
Type: function
Parameters
-
error
Error : An Error object if there was one. If no error, will benull
. -
data
Object : The data returned from the method.
EventHandler
Use the EventHandler function to handle callbacks from events.
Type: function
Parameters
Enums
The enumerated types used by Yarkon.
Feature
The feature being added or removed from the client interface.
This is used as a bit-mask, so for instance, if you want to allow the user to create and delete buckets, you should pass in (BucketCreate | BucketDelete).
Properties
-
BucketCreate
number (0x00001000): Allow the user to create buckets. -
BucketDelete
number (0x00002000) : Allow the user to delete buckets. -
BucketPermissions
number (0x00004000) : Allow the user to change bucket permissions. -
BucketWebsite
number (0x00008000) : Allow the user to change bucket website settings. -
BucketLogging
number (0x00010000) : Allow the user to change bucket logging settings. -
BucketVersioning
number (0x0002000) : Allow the user to change bucket versioning settings. -
BucketTags
number (0x00040000) : Allow the user to change bucket tags. -
BucketPayer
number (0x00080000) : Allow the user to change bucket payer settings. -
DocumentContent
number (0x00100000) : Allow the user to change document content settings. -
DocumentPermissions
number (0x00200000) : Allow the user to change document permissions. -
DocumentMetadata
number (0x00400000) : Allow the user to change document meta-data.
Menu
The type of menu being initialized in the onInitMenu event handler.
Properties
-
TreeMenu
string : Menu displayed when clicking a folder or bucket in the tree -
GridDocMenu
string : Menu displayed when clicking on a document in the main grid -
GridFolderMenu
string : Menu displayed when clicking on a folder in the main grid -
GridCanvasMenu
string : Menu displayed when clicking on an empty space in the main grid -
SearchGridDocMenu
string : Menu displayed when clicking on a document in the search grid -
SearchGridFolderMenu
string : Menu displayed when clicking on a folder in the search grid -
SearchGridCanvasMenu
string : Menu displayed when clicking on an empty space in the search grid
Pane
Identifies the layout pane for a specified action.
Properties
-
North
string : The north pane (the toolbar). -
West
string : The west pane (the tree view). -
East
string : The east pane (the preview). -
South
string : The south pane (the search grid).
Data Access
Use these methods to get data about the Yarkon control current state and the underlying data.
getActiveFolder
Get the current active folder in the tree.
Examples
var activeFolder = Yarkon.getActiveFolder();
console.log(activeFolder.id);
Returns Folder : The active folder
getActiveItem
Get the current active item in the grid.
Examples
var active = yarkon.getActiveItem();
console.log(active.id);
Returns Item : The active item
getActiveSearchItem
Get the current active item in the search grid.
Examples
var active = yarkon.getActiveSearchItem();
console.log(active.id);
Returns Item : The active item
getItems
Get the current items in the grid.
Examples
var items = yarkon.getSelectedItems();
var display = 'Selected:\n';
if (items && items.length) {
display += items.map(function(el, index) {
return index + '. ' +
(el.data.isFolder ? 'Folder' : 'Document') + ': ' +
el.data.title + '(' + el.id + ')';
}).join('\n');
} else {
display += 'No items';
}
console.log(display);
Returns Array<Item> : The items.
getSearchItems
Get the current items in the search grid.
Examples
var searchItems = yarkon.getSearchItems();
var display = 'Found:\n';
if (searchItems && searchItems.length) {
display += searchItems.map(function(el, index) {
return index + '. ' +
(el.data.isFolder ? 'Folder' : 'Document') + ': ' +
el.data.title + '(' + el.id + ')';
}).join('\n');
} else {
display += 'No search results';
}
console.log(display);
Returns Array<Item> : The items.
getSelectedItems
Get the current selection in the grid.
Examples
var selectedItems = yarkon.getSelectedItems();
var display = 'Selected:\n';
if (selectedItems && selectedItems.length) {
display += selectedItems.map(function(el, index) {
return index + '. ' +
(el.data.isFolder ? 'Folder' : 'Document') + ': ' +
el.data.title + '(' + el.id + ')';
}).join('\n');
} else {
display += 'No selection';
}
console.log(display);
Returns Array<Item> : The selected items.
getSelectedSearchItems
Get the current selection in the search grid.
Examples
var selectedItems = yarkon.getSelectedSearchItems();
var display = 'Selected:\n';
if (selectedItems && selectedItems.length) {
display += selectedItems.map(function(el, index) {
return index + '. ' +
(el.data.isFolder ? 'Folder' : 'Document') + ': ' +
el.data.title + '(' + el.id + ')';
}).join('\n');
} else {
display += 'No selection';
}
console.log(display);
Returns Array<Item> : The selected items.
getFolderData
Get the S3 data for the specified folder.
Parameters
-
folder
Folder : The folder to get data for. -
callback
Callback : The callback function to call with the data
Examples
var activeFolder = Yarkon.getActiveFolder();
Yarkon.getFolderData(activeFolder, function(err, data) {
if (!err) {
console.log(JSON.stringify(data));
} else {
console.error(err);
}
});
getItemData
Get the S3 data for the specified item.
Parameters
-
item
Item : The item to get data for. -
callback
Callback : The callback function to call with the data
Examples
var selectedItems = Yarkon.getSelectedItems();
if (selectedItems && selectedItems.length) {
Yarkon.getItemData(selectedItems[0], function(err, data) {
if (!err) {
console.log(JSON.stringify(data.Body));
} else {
console.error(err);
}
});
}
getItemAttributes
Get the S3 attributes associated with the specified item.
Parameters
-
item
Item : The item to get data for. -
callback
Callback : The callback function to call with the data.The attributes returned are the same as when calling S3.headObject:
Examples
var selectedItems = Yarkon.getSelectedItems();
if (selectedItems && selectedItems.length) {
Yarkon.getItemAttributes(selectedItems[0], function(err, data) {
if (!err) {
console.log(JSON.stringify(data.Metadata));
} else {
console.error(err);
}
});
}
Layout Management
The layout of the Yarkon control can be managed using these methods.
isPaneOpen
Get the current state of a pane
Parameters
pane
Pane : the location of the pane to check
Returns boolean true
if the pane is open, otherwise false
.
openPane
Set a pane state to open
Parameters
pane
Pane : the location of the pane to open
Examples
// Open the tree view
yarkon.openPane(yarkon.Pane.West);
closePane
Set a pane state to close
Parameters
pane
Pane : the location of the pane to close
Examples
// Close the tree view
yarkon.closePane(yarkon.Pane.West);
isPaneShown
Get the current visibility of a pane
Parameters
pane
Pane : the location of the pane to check
Returns boolean true
if the pane is shown, otherwise false
.
showPane
Set a pane state to shown
Parameters
pane
Pane : the location of the pane to show
Examples
// Show the tree view
yarkon.showPane(yarkon.Pane.West);
hidePane
Set a pane state to hidden
Parameters
pane
Pane : the location of the pane to hide
Examples
// Hide the tree view
yarkon.hidePane(yarkon.Pane.West);
Commands
Use these commands for automation.
setActiveFolder
Open the folder specified in the tree view and make it active.
Parameters
folderId
String
Examples
yarkon.setActiveFolder(folderId);
downloadItems
Download the specified items.
If the items array contains a single document, it will be downloaded as is. If it contains a single folder, the folder and its content will be zipped and download with the structure retained in the zip archive. If multiple items are passed in, a zip file will be created containing all of them, with folder structure retained.
If no items are passed in, will download the current selection. If there is no current selection, will download the active item in the grid, if there is one.
Parameters
Examples
yarkon.downloadItems(items);
downloadFolder
Download the specified folder.
The folder and its content will be zipped and download with the structure retained in the zip archive.
If no folder is passed in, will download the active folder if there is one.
Parameters
folderId
String : The S3 path of the folder to download.
Examples
yarkon.downloadFolder(folderId);
openItem
Open the specified item.
Parameters
item
Item : The item to open.
Examples
var active = yarkon.getActiveItem();
yarkon.openItem(item);
updateItemsAttributes
Update the S3 attributes associated with the specified item.
Parameters
-
params
Object : The attributes to update. -
callback
Callback : The callback function to call with the dataThe params are the same as those used in S3.copyObject: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#copyObject-propertyImportant: updating attributes in S3 required a copy. Therefore, this can be a costly operation, if there are many items or the files are large.
Examples
var selectedItems = Yarkon.getSelectedItems();
if (selectedItems && selectedItems.length) {
Yarkon.updateItemsAttributes(selectedItems, {
ServerSideEncryption: 'AES256',
StorageClass: 'REDUCED_REDUNDANCY',
Metadata: {
'updated-by': 'yarkon'
},
MetadataDirective: 'REPLACE'
}, function(err, data) {
if (!err) {
console.log('Updated items.');
} else {
console.error(err);
}
});
}
searchInFolder
Search for items inside a folder.
Parameters
-
folderId
String : The folder to search in. Pass in null for the current active folder. -
text
String : The text to search for. Pass in an empty string to clear the current search results. -
params
Object : User defined params to pass to the search event handlers.
Examples
var folder = yarkon.getActiveFolder();
var text = 'some text';
yarkon.searchInFolder(folder.id, text);
createFolder
Create a folder under the given parent.
Parameters
-
parentId
String : The id of the parent folder. -
name
String : The name for the new folder. -
callback
Callback : The callback function to call with the data. The data will include the Id of the newly created folder.
Examples
var activeFolder = Yarkon.getActiveFolder();
Yarkon.createFolder(activeFolder.id, 'My New Folder', function(err, data) {
if (!err) {
console.log(JSON.stringify(data));
} else {
console.error(err);
}
});
Events
Yarkon communicates changes following user actions using an event model.
onChangeLayout
This event is called when the layout of the Yarkon control changes.
A layout change happens when a pane is shown or hidden.
In the args
passed to the event handler is the PaneState data.
Parameters
handler
EventHandler
Examples
yarkon.onChangeLayout(function(e, args) {
console.log('Event: ' + e.pane + '\Args: ' + JSON.stringify(args));
});
onInitMenu
This event is called when a folder is selected.
In the args
passed to the event handler, you have the type of menu that is being initialized. The menu type is defined by the enum Menu.
To modify the menu, add the following to the args:
-
remove
- array of labels of the menu entries you want removed. -
add
- array of menu commands to add to the menu.
See the code examples for more.
Parameters
handler
EventHandler
Examples
// Remove the Cut, Copy and Paste commands from the Tree menu
yarkon.onInitMenu(function(e, args) {
if (args.menu === yarkon.Menu.TreeMenu) {
args.remove = ['Cut', 'Copy', 'Paste'];
}
});
// Add two custom commands to all grid menus
Yarkon.onInitMenu(function(e, args) {
if (args.menu === Yarkon.Menu.GridDocMenu ||
args.menu === Yarkon.Menu.GridFolderMenu ||
args.menu === Yarkon.Menu.SearchGridDocMenu ||
args.menu === Yarkon.Menu.SearchGridFolderMenu ) {
args.add = [{
menuEntry: {
id: 'my_bomb_command',
label: 'My Bomb',
icon: 'fa-bomb', // Any font-awesome icon
click: function(item) {
alert('Bomb item: ' + JSON.stringify(item));
},
enabler: function(item) {
return true;
}
},
insertBefore: 'Cut'
}, {
menuEntry: {
id: 'my_bolt_command',
label: 'My Bolt',
icon: 'fa-bolt', // Any font-awesome icon
click: function(item) {
alert('Bolt item: ' + JSON.stringify(item));
},
enabler: function(item) {
return true;
}
},
insertBefore: 'Cut'
}, {
menuEntry: {
id: 'my_separator',
label: '-'
},
insertBefore: 'Cut'
}]
}
});
onChangeActiveFolder
This event is called when a folder is selected in the tree.
In the args
passed to the event handler is the Folder data.
Parameters
handler
EventHandler
Examples
yarkon.onChangeActiveFolder(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onChangeActiveItem
This event is called when the active item in the grid has changed.
In the args
passed to the event handler is the Item data.
Parameters
handler
EventHandler
Examples
yarkon.onChangeActiveItem(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onChangeSelectedItems
This event is called when the selected items in the grid have changed.
In the args
passed to the event handler is an array of the Item data.
Parameters
handler
EventHandler
Examples
yarkon.onChangeSelectedItems(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onChangeActiveSearchItem
This event is called when the active item in the search grid has changed.
In the args
passed to the event handler is the Item data.
Parameters
handler
EventHandler
Examples
yarkon.onChangeActiveSearchItem(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onChangeSelectedSearchItems
This event is called when the selected items in the search grid have changed.
In the args
passed to the event handler is an array of the Item data.
Parameters
handler
EventHandler
Examples
yarkon.onChangeSelectedSearchItems(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onBeginDownload
This event is called when a download operation is about to start.
Downloads work as following:
-
If there is only one item to download, it will be downloaded as is.
-
If there are multiple items to download, they will be archived in a single zip file, with the hierarchy retained in the zip file. This zip file will be downloaded.
-
If there was a single folder downloaded, the name of the zip file will be the name of the folder. Otherwise, it will be a generic name.
In the args
passed to the event handler is the information for this upload operation:
-
bucket
: S3 path of the bucket. -
items
Item | Item[]: The downloaded item or items when more than one. -
zipFileName
: The name of the zip file downloaded, if there is any.
Parameters
handler
EventHandler
Examples
yarkon.onBeginDownload(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onEndDownload
This event is called when a download operation is done.
Use it to get the details on what happened using the args:
-
bucket
- S3 path of the bucket. -
items
Item | Item[]: The downloaded item or items when more than one. -
zipFileName
: The name of the zip file downloaded, if there is any. -
error
- Error if there was an error uploading the file.
Parameters
handler
EventHandler
Examples
yarkon.onEndDownload(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onBeginUpload
This event is called when an upload operation is about to start.
In the args
passed to the event handler is the information for this upload operation:
-
bucket
- S3 path of the bucket. -
folder
- S3 path of the folder (prefix). -
files
- File[] : array of the files to be uploaded. -
params
- Extra parameters of the upload. Use it to update themetadata
,storageClass
,serverSideEncryption
,ACL
for all files.
Parameters
handler
EventHandler
Examples
yarkon.onBeginUpload(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
// Add the upload timestamp to the files
if (!args.params.metadata) {
args.params.metadata = {};
}
args.params.metadata['uploaded-by'] = 'Yarkon demo';
args.params.metadata['uploaded-on'] = (new Date()).toUTCString();
});
onBeginUploadFile
This event is called when a file is about to be uploaded.
In the args
passed to the event handler is the information for this upload operation:
-
bucket
- S3 path of the bucket. -
path
- S3 path of the uploaded file. -
content
- File : the file being uploaded. -
contentType
- MIME type of the file being uploaded. -
params
- Extra parameters of the upload. Use it to update themetadata
,storageClass
,serverSideEncryption
,ACL
for this file.
In case you want to skip this file, add a field skip
to the params
and set its value to true
.
Additional overrides (see example below):
-
You can override the file path by adding a field
newPath
to theparams
and setting it to your desired new path. -
To override the content type, add a field
newContentType
to theparams
and set its value.
Parameters
handler
EventHandler
Examples
yarkon.onBeginUploadFile(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
// Do not upload files that have a "json" extension
var ext = args.path.substr(args.path.lastIndexOf('.') + 1).toLowerCase();
if (ext === 'json') {
args.params.skip = true;
return;
}
// Update the path for all "jpg" files and make sure the content
// type is what we need
if (ext === 'jpg' || ext === 'jpeg') {
var fileName = args.path.substring(0, args.path.lastIndexOf('.'));
args.params.newPath = fileName + '-yarkon-demo.jpg';
args.params.newContentType = 'image/jpg';
}
});
onEndUploadFile
This event is called when a file upload operation is done.
Use it to get the details on what happened using the args:
-
bucket
- S3 path of the bucket. -
path
- S3 path of the uploaded file. -
data
- S3 data of the uploaded file. -
error
- Error if there was an error uploading the file.
If you used the skip
option in the onBeginUploadFile event, this event will not be sent.
Parameters
handler
EventHandler
Examples
yarkon.onEndUploadFile(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onEndUpload
This event is called when an upload operation is done.
Use it to get the details on what happened using the args:
-
bucket
- S3 path of the bucket. -
folder
- S3 path of the folder (prefix). -
error
- Error if there was an error uploading the file.
Parameters
handler
EventHandler
Examples
yarkon.onEndUpload(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onBeginAction
This event is called when an S3 action is about to start.
An action may be any of the following:
-
Copy object or objects - result of a copy-paste operation or drag and drop with control pressed.
-
Delete object or objects - delete using context menu or the delete key.
-
Rename object - name change from UI.
-
Move object or objects - result of cut-paste operation or drag and drop.
In the args
passed to the event handler is the information for this action:
-
action
- the action. One of "copy", "delete", "move", "rename". -
bucket
- S3 path of the bucket. -
targetBucket
: S3 path of the target bucket. -
actionKeys
- array of the keys to be processed. -
error
- Error if there was a processing error.
Parameters
handler
EventHandler
Examples
yarkon.onBeginAction(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onBeginActionItem
This event is called when an S3 action is about to be start on an object.
In the args
passed to the event handler is the information for this delete operation:
-
action
- the action. One of "copy", "delete", "move", "rename". -
bucket
- S3 path of the bucket. -
key
: S3 key of the object. -
targetBucket
: target bucket (copy, move and rename only). -
targetKey
: target key (copy, move and rename only). -
keysToDelete
: array of keys that will be deleted (delete only). -
error
- Error if there was a processing error.
Note: a delete operation acts in batches of 1,000. An event will be sent
once for a batch.
Parameters
handler
EventHandler
Examples
yarkon.onBeginActionItem(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onEndActionItem
This event is called when an S3 action on an object is done.
In the args
passed to the event handler is the information for this delete operation:
-
action
- the action. One of "copy", "delete", "move", "rename". -
bucket
- S3 path of the bucket. -
key
: S3 key of the object. -
targetBucket
: target bucket (copy, move and rename only). -
targetKey
: target key (copy, move and rename only). -
deletedKeys
: array of the keys deleted (delete only). -
error
- Error if there was a processing error.
Note: a delete operation acts in batches of 1,000. An event will be sent once for a batch.
Parameters
handler
EventHandler
Examples
yarkon.onEndActionItem(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onEndAction
This event is called when an S3 action is done.
Use it to get the details on what happened using the args:
-
action
- the action. One of "copy", "delete", "move", "rename". -
bucket
- S3 path of the bucket. -
targetBucket
: S3 path of the target bucket. -
actionKeys
- array of the keys to be processed. -
copiedKeys
- array of the keys copied (copy, rename and move only). -
deletedKeys
: array of the keys deleted (delete, rename and move only). -
error
- Error if there was a processing error.
Note: move and rename actions report the changes made using both the copiedKeys
and the deletedKeys
fields. For instance, for a move action, the copiedKeys
will list the items after the action, and the deletedKeys
the items before.
Parameters
handler
EventHandler
Examples
yarkon.onEndAction(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onBeginSearch
This event is called when a search operation is about to start.
In the args
passed to the event handler is the information for this search operation:
-
folder
- Folder the active folder, limiting the search scope. -
searchFor
- The text entered by the user in the search box. -
param
- Object the User defined params passed to the search function. -
onSearch
- In case you want to override the default search function, provide your search function here.
The params
are passed in when using the searchInFolder method.
The onSearch
function should have the signature function(args, callback)
.
-
args
- would be the same as theargs
passed into the event handler. -
callback
- when your search operation is done, you must call thiscallback
.
The callback
function has the signature function(err, data)
.
-
err
- Error in case there was an error during your custom search operation. -
data
- an Item array representing the search results.
Parameters
handler
EventHandler
Examples
var myCustomSearch = function(args, callback) {
var folder = args.folder;
var searchFor = args.searchFor;
console.log('Searching for "' + searchFor + '" in folder "' + folder.title + '".');
// Simulate a search for the purpose of this example
var selectedItems = yarkon.getSelectedItems();
callback(null, selectedItems);
}
yarkon.onBeginSearch(function(e, args) {
// Replace with a custom function
args.onSearch = myCustomSearch;
});
onEndSearch
This event is called when a search operation is done.
Use it to do any action post search.
The args:
-
folder
- Folder the active folder, limiting the search scope. -
searchFor
- The text entered by the user in the search box. -
param
- Object the User defined params passed to the search function. -
items
- an Item array returned from the search. -
error
- Error if there was a processing error.
The params
are passed in when using the searchInFolder method.
You can change the items
returned if you need - for instance, add another filter.
Parameters
handler
EventHandler
Examples
yarkon.onEndSearch(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
onShowPreview
This event is called when an image preview is about to be displayed.
You can use it to replace the original image with an alternative such as a thumbnail.
In the args
passed to the event handler is the information for this preview operation:
-
bucket
- S3 path of the bucket. -
key
- S3 key of the image object. -
params
- Extra parameters of the image preview. Use it to tell the viewer what to show.
The args:
-
bucket
- S3 path of the bucket containing the thumbnail. -
key
- S3 key of the thumbnail image object. -
imageWidth
- width of the original image. -
imageHeight
- height of the original image.
Parameters
handler
EventHandler
Examples
yarkon.onShowPreview(function(e, args) {
console.log('Event: ' + e.type + '\Args: ' + JSON.stringify(args));
});
Modals
You can show modal dialogs using the below commands. You can use these to prompt user actions.
showAbout
Show the About modal.
Examples
yarkon.showAbout();
shareItems
Show the Share Items modal.
Parameters
Examples
yarkon.shareItems(items);
uploadIntoFolder
Show the Upload modal for the given folder.
Parameters
folder
Folder : The folder to upload documents. If not provided, will use the current active folder.
Examples
var activeFolder = Yarkon.getActiveFolder();
yarkon.uploadIntoFolder(activeFolder);
showProperties
Show the Item or Folder Properties modal.
Parameters
Examples
yarkon.shareItems(item);
showSettings
Show the Settings modal.
Parameters
tab
string The name of the tab selected when the form opens.
Examples
yarkon.showSettings('tab-performance');
Service
Generic service layer methods.
getVersion
Get the current API version number.
Examples
var versionNumber = yarkon.getVersion();
console.log(versionNumber);
Returns String : The current version number
getS3
Get access to the underlying S3 object.
Important: this object is here in case you need to interface directly with S3. Yarkon has a sophisticated caching layer on top of S3 so it is highly preferred to access S3 functions through Yarkon whenever possible.
Examples
yarkon.getS3().listObjectsV2({
Bucket: 'yarkon-qa-shared',
MaxKeys: 2
}, function(err, data) {
console.log(JSON.stringify(err ? err : data));
}).send();