Class: Operation

Operation

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
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: {
   username: 'Administrator',
   password: 'Administrator',
 }
});
nuxeo.operation('Document.GetChild')
  .input('/default-domain')
  .params({
    name: 'workspaces',
  })
  .execute().then((res) => {
       // res.uid !== null
    // res.title === 'Workspaces'
  }).catch(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(opts) → {Promise}

Executes this operation.

Parameters:
Name Type Description
opts object

Options overriding the ones from the Operation 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