Constructor
new Request(opts)
Creates a Request.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
object | The configuration options. Properties
|
- Source:
Example
var Nuxeo = require('nuxeo')
var nuxeo = new Nuxeo({
baseURL: 'http://localhost:8080/nuxeo',
auth: {
method: 'basic',
username: 'Administrator',
password: 'Administrator'
}
});
nuxeo.request('/path/default-domain')
.get()
.then(function(res) {
// res.uid !== null
// res.type === 'Domain'
})
.catch(function(error) {
throw new Error(error);
});
Methods
delete(optsopt) → {Promise}
Performs a DELETE request.
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 request.
- Type
- Promise
execute(opts) → {Promise}
Performs a Request.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
opts |
object | Options overriding the ones from this object. Properties
|
- Source:
Returns:
A Promise object resolved with the result of the request.
- Type
- Promise
get(opts) → {Promise}
Performs a GET request.
Parameters:
Name | Type | Description |
---|---|---|
opts |
object | Options overriding the ones from the Request object. |
- Source:
Returns:
A Promise object resolved with the result of the request.
- Type
- Promise
path(path) → {Request}
Adds path segment.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The path segment. |
- Source:
Returns:
The request itself.
- Type
- Request
post(optsopt) → {Promise}
Performs a POST request.
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 request.
- Type
- Promise
put(optsopt) → {Promise}
Performs a PUT request.
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 request.
- Type
- Promise
queryParams(queryParams) → {Request}
Adds query params. The given query params are merged with the existing ones if any.
Parameters:
Name | Type | Description |
---|---|---|
queryParams |
object | The query params to be merged with the existing ones. |
- Source:
Returns:
The request itself.
- Type
- Request