OpenVeo server API for plugins

API Docs for: 7.0.0
Show:

PluginApi

Module: plugin

Summary

Defines a base plugin API for all plugins' which need to expose an API.

// Implement a PluginApi : "MyPluginApi"
// for a plugin named "my-plugin"

var util = require('util');
var openVeoApi = require('@openveo/api');

function MyPluginApi() {
  MyPluginApi.super_.call(this);
}

util.inherits(MyPluginApi, openVeoApi.plugin.PluginApi);

// Associate the API to the plugin when creating it
function MyPlugin() {
  MyPlugin.super_.call(this);

  // Exposes MyPlugin's APIs
  this.api = new MyPluginApi();

}

util.inherits(MyPlugin, openVeoApi.plugin.Plugin);

Constructor

PluginApi

Syntax

PluginApi

()

Summary

Methods

executeHook

Syntax

executeHook

(
  • hook
  • data
  • callback
)
async

Summary

Executes all actions registered for a hook.

All actions are executed in the registration order.

Parameters:

  • hook String

    The hook associated to actions

  • data Mixed

    The data to transmit to the actions

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise

getHooks

Syntax

getHooks

() Object async

Summary

Gets available hooks of the plugin.

This should be overrided by plugins.

Returns:

Object:

The list of hooks

registerAction

Syntax

registerAction

(
  • hook
  • action
)
async

Summary

Registers an action to be executed when a hook occurs.

Parameters:

  • hook String

    The hook to register action on

  • action Function

    The function to execute when hook is executed

unregisterAction

Syntax

unregisterAction

(
  • hook
  • action
)
async

Summary

Unregisters an action registered on a hook.

Parameters:

  • hook String

    The hook to unregister action from

  • action Function

    The function action

Properties

actions

Syntax

actions

Object final

Summary

The list of registered actions.

Property names are the action names and values are functions.