Class: Operation

Operation(opts)

The Operation class allows to execute an operation on a Nuxeo Platform instance.

Cannot directly be instantiated

Constructor

new Operation(opts)

Creates an Operation.

Parameters:
Name Type Description
opts string

The configuration options.

Properties
Name Type Description
nuxeo string

The Nuxeo object linked to this Operation object.

id string

The ID of the operation.

url string

The automation URL.

Source:
Example
var Nuxeo = require('nuxeo')
var nuxeo = new Nuxeo({
 baseURL: 'http://localhost:8080/nuxeo',
 auth: {
   method: 'basic',
   username: 'Administrator',
   password: 'Administrator'
 }
});
nuxeo.operation('Document.GetChild')
  .input('/default-domain')
  .params({
    name: 'workspaces',
  })
  .execute()
  .then(function(res) {
    // res.uid !== null
    // res.title === 'Workspaces'
  })
  .catch(function(error) {
    throw new Error(error);
  });

Methods

context(context) → {Operation}

Sets this operation context.

Parameters:
Name Type Description
context object

The operation context.

Source:
Returns:

The operation itself.

Type
Operation

execute(optsopt) → {Promise}

Executes this operation.

Parameters:
Name Type Attributes Description
opts object <optional>

Options overriding the ones from this object.

Source:
Returns:

A Promise object resolved with the result of the Operation.

Type
Promise

input(input) → {Operation}

Sets this operation input.

Parameters:
Name Type Description
input string | Array | Blob | BatchBlob | BatchUpload

The operation input.

Source:
Returns:

The operation itself.

Type
Operation

param(name, value) → {Operation}

Adds an operation param.

Parameters:
Name Type Description
name string

The param name.

value string

The param value.

Source:
Returns:

The operation itself.

Type
Operation

params(params) → {Operation}

Adds operation params. The given params are merged with the existing ones if any.

Parameters:
Name Type Description
params object

The params to be merge with the existing ones.

Source:
Returns:

The operation itself.

Type
Operation