Class: Directory

Directory(opts)

The Directory class allows to work with directories on a Nuxeo Platform instance.

Cannot directly be instantiated

Constructor

new Directory(opts)

Creates a Directory.

Parameters:
Name Type Description
opts object

The configuration options.

Properties
Name Type Description
nuxeo string

The Nuxeo object linked to this directory.

directoryName string

The name of this directory.

Source:
Example
var Nuxeo = require('nuxeo')
var nuxeo = new Nuxeo({
 baseURL: 'http://localhost:8080/nuxeo',
 auth: {
   method: 'basic',
   username: 'Administrator',
   password: 'Administrator'
 }
});
nuxeo.directory('nature')
  .fetch('article')
  .then(function(res) {
    // res.properties.id === 'article'
    // res.properties.label === 'article label.directories.nature.article'
  })
  .catch(function(error) {
    throw new Error(error));
  });

Methods

create(entry, optsopt) → {Promise}

Creates an entry.

Parameters:
Name Type Attributes Description
entry object

The entry to be created.

opts object <optional>

Options overriding the ones from this object.

Source:
Returns:

A Promise object resolved with the created DirectoryEntry.

Type
Promise

delete(id, optsopt) → {Promise}

Deletes an entry given its id.

Parameters:
Name Type Attributes Description
id string

The entry id.

opts object <optional>

Options overriding the ones from this object.

Source:
Returns:

A Promise object resolved with the result of the DELETE request.

Type
Promise

fetch(id, optsopt) → {Promise}

Fetches a directory entry given its id.

Parameters:
Name Type Attributes Description
id string

The entry id.

opts object <optional>

Options overriding the ones from this object.

Source:
Returns:

A Promise object resolved with the DirectoryEntry.

Type
Promise

fetchAll(optsopt) → {Promise}

Fetches all directory entries.

Parameters:
Name Type Attributes Description
opts object <optional>

Options overriding the ones from this object.

Source:
Returns:

A Promise object resolved with the entries.

Type
Promise

update(entry, optsopt) → {Promise}

Updates an entry. Assumes that the entry object has an id property.

Parameters:
Name Type Attributes Description
entry object

The entry to be updated.

Properties
Name Type Description
id object

The string id of the entry to be updated.

opts object <optional>

Options overriding the ones from this object.

Source:
Returns:

A Promise object resolved with the updated DirectoryEntry.

Type
Promise