Skip to main content

Plugin Instances

buildfire.pluginInstance#

This is an object within the buildfire singleton that is for retrieving other plugins instances that are added to the current app context.

What is a plugin instance?#

a plugin instance is a new occurrence of a plugin type. For example you can have installed one Text Plugin but have two instances of it.

Typically this is used in launcher or folder type plugins. These types of plugins help the user navigate to other plugins.

  • Gotchya: Be careful when saving the plugin instances data to your local datastore. The instance may be deleted or modified after your save. Use Dynamic Data Injection to get latest data

Methods#

showDialog()
#

buildfire.pluginInstance.showDialog(options, callback)

Used on the control side. This method will display a dialog that allows the user to search and select one or many plugins

buildfire.pluginInstance.showDialog({
skipPluginInstances: true
}, function(error, instances){
if (err) {
console.error(err);
} else if (instances.length > 0) {
console.log(instances[0].title);
}
});

options#

NameTypeRequiredDescriptionDefault
skipPluginInstancesbooleannoShows the create plugin instance dialog directly, without showing the select plugin instances dialogfalse

callback(error, instances)#

NameTypeDescription
errorstringError string, null when operation is successful
instancesarrayArray of selected plugin instances
instances[]#
NameTypeDescription
folderNamestringFolder Name
iconUrlstringString url of plugin instance icon
instanceIdstringUnique identifier for the plugin instance
pluginTypeIdstringUnique identifier for the plugin type
pluginTypeNamestringName of the plugin type
titlestringTitle of the plugin

get()
#

buildfire.pluginInstance.get(instanceId, callback)

Will fetch a plugin based on the provided instanceId

buildfire.pluginInstance.get('123', function(error, instance){
if (err) {
console.error(err);
} else if (instance) {
console.log(instance.title);
}
});

instanceId#

NameTypeRequiredDescriptionDefault
instanceIdstringyesUnique identifier of the plugin to retrieveN/A

callback(error, instance)#

NameTypeDescription
errorstringError string, null when operation is successful
instanceobjectObject representing the plugin instance
instance#
NameTypeDescription
iconUrlstringString url of plugin instance icon
instanceIdstringUnique identifier for the plugin instance
pluginTypeIdstringUnique identifier for the plugin type
titlestringTitle of the plugin

search()
#

buildfire.pluginInstance.search(options, callback)

Will search all the plugins and return results paginated

buildfire.pluginInstance.search({ title: 'myPlugin' }, function(error, instances){
if (err) {
console.error(err);
} else if (instances.length > 0) {
console.log(instances[0].title);
}
});

options#

NameTypeRequiredDescriptionDefault
titlestringnoTitle of the plugin to search forundefined
pageIndexintegernoPage number to return0
pageSizeintegernoEntries per page, max 2020

callback(error, instances)#

NameTypeDescription
errorstringError string, null when operation is successful
instancesarrayArray of plugin instances
totalRecordintegerNumber of results found
instances[]#
NameTypeDescription
dataobjectObject containing plugin instance data
idstringUnique identifier used by the database
pluginTypeIdstringUnique identifier for the plugin type
instances[].data#
NameTypeDescription
iconUrlstringString url of plugin instance icon
instanceIdstringUnique identifier for the plugin instance
pluginTypeIdstringUnique identifier for the plugin type
titlestringTitle of the plugin

showCreatePluginInstancesDialog()
#

buildfire.pluginInstance.showCreatePluginInstancesDialog(options, callback)

Used on the control side. This method will display a dialog that allows the user to add a new plugin instance of a specific type, and return that plugin instance to the caller

buildfire.pluginInstance.showCreatePluginInstancesDialog(function(error, instances){
if (error) {
console.error(error);
} else if (instances.length > 0) {
console.log(instances[0].title);
}
});

callback(error, instances)#

NameTypeDescription
errorstringError string, null when operation is successful
instancesarrayArray of selected plugin instances
instances[]#
NameTypeDescription
folderNamestringFolder Name
iconUrlstringString url of plugin instance icon
instanceIdstringUnique identifier for the plugin instance
pluginTypeIdstringUnique identifier for the plugin type
pluginTypeNamestringName of the plugin type
titlestringTitle of the plugin

create()
#

buildfire.pluginInstance.create(options, callback)

This method allows the user to directly install a plugin from the marketplace without interaction with marketplace

buildfire.pluginInstance.create({
pluginTypeName: "Folder",
newPluginTitle: "My Folder"
}, function (error, instance){
if (error) {
console.error(error);
} else {
console.log(instance.title);
}
});

options#

NameTypeRequiredDescriptionDefault
pluginTypeNamestringyesmarketplace plugin type name - must be the exact plugin type name, but not case sensitiveN/A
newPluginTitlestringyesNew plugin instance nameN/A

callback(error, instance)#

NameTypeDescription
errorstringError string, null when operation is successful
instanceobjectObject containing new plugin instance data
instance#
NameTypeDescription
instanceIdstringUnique identifier for the new plugin instance
pluginTypeIdstringUnique identifier for the plugin type
pluginTypeNamestringName of the plugin type
titlestringTitle of the new plugin
tokenstringToken for the original plugin
folderNamestringFolder name of the new plugin
refIdstringReference id of the new plugin
iconClassNamestringIcon class name of the new plugin
iconUrlstringIcon URL of the new plugin

clone()
#

buildfire.pluginInstance.clone(options, callback)

This method allows the user to clone an existing plugin within the app, it searches the installed plugins on the app and clones the closest plugin it finds to the provided pluginTitle.

const options = ;
buildfire.pluginInstance.clone({
pluginTitle: "My Folders",
newPluginTitle: "Shared Folders"
}, function (err, instance) {
if (err) {
console.error(err);
} else {
console.log(instance);
};
});

options#

NameTypeRequiredDescriptionDefault
pluginTitlestringyesExisting plugin title installed on the appN/A
newPluginTitlestringyesNew plugin instance nameN/A

callback(error, instance)#

NameTypeDescription
errorstringError string, null when operation is successful
instanceobjectObject containing new plugin instance data
instance#
NameTypeDescription
instanceIdstringUnique identifier for the new plugin instance
pluginTypeIdstringUnique identifier for the plugin type
pluginTypeNamestringName of the plugin type
titlestringTitle of the new plugin
tokenstringToken for the original plugin
folderNamestringFolder name of the new plugin
refIdstringReference id of the new plugin
iconClassNamestringIcon class name of the new plugin
iconUrlstringIcon URL of the new plugin