Constructor
new RulesManager(options)
Parameters:
Name |
Type |
Description |
options |
Object
|
The client options.
Properties
Name |
Type |
Attributes |
Description |
baseUrl |
String
|
|
The URL of the API. |
headers |
Object
|
<optional>
|
Headers to be included in all requests. |
|
- Source:
Members
Type:
- Source:
(inner) apiOptions :Object
Options object for the Rest Client instance.
Type:
- Source:
Methods
create(data, cbopt) → {Promise|undefined}
Create a new rule.
Parameters:
Name |
Type |
Attributes |
Description |
data |
Object
|
|
Rule data object. |
cb |
function
|
<optional>
|
Callback function. |
- Source:
Returns:
-
Type
-
Promise
|
undefined
Example
management.rules.create(data, function (err) {
if (err) {
// Handle error.
}
// Rule created.
});
delete(params, cbopt) → {Promise|undefined}
Delete an existing rule.
Parameters:
Name |
Type |
Attributes |
Description |
params |
Object
|
|
Rule parameters.
Properties
Name |
Type |
Description |
id |
String
|
Rule ID. |
|
cb |
function
|
<optional>
|
Callback function. |
- Source:
Returns:
-
Type
-
Promise
|
undefined
Example
management.rules.delete({ id: RULE_ID }, function (err) {
if (err) {
// Handle error.
}
// Rule deleted.
});
get(params, cbopt) → {Promise|undefined}
Get an Auth0 rule.
Parameters:
Name |
Type |
Attributes |
Description |
params |
Object
|
|
Rule parameters.
Properties
Name |
Type |
Description |
id |
String
|
Rule ID. |
|
cb |
function
|
<optional>
|
Callback function. |
- Source:
Returns:
-
Type
-
Promise
|
undefined
Example
management.rules.get({ id: RULE_ID }, function (err, rule) {
if (err) {
// Handle error.
}
console.log(rule);
});
getAll(cbopt) → {Promise|undefined}
Get all rules.
Parameters:
Name |
Type |
Attributes |
Description |
cb |
function
|
<optional>
|
Callback function. |
- Source:
Returns:
-
Type
-
Promise
|
undefined
Example
management.rules.getAll(function (err, rules) {
console.log(rules.length);
});
update(params, data, cbopt) → {Promise|undefined}
Update an existing rule.
Parameters:
Name |
Type |
Attributes |
Description |
params |
Object
|
|
Rule parameters.
Properties
Name |
Type |
Description |
id |
String
|
Rule ID. |
|
data |
Object
|
|
Updated rule data. |
cb |
function
|
<optional>
|
Callback function. |
- Source:
Returns:
-
Type
-
Promise
|
undefined
Example
var data = { name: 'New name' };
var params = { id: RULE_ID };
// Using auth0 instance.
management.updateRule(params, data, function (err, rule) {
if (err) {
// Handle error.
}
console.log(rule.name); // 'New name'
});
// Using the rules manager directly.
management.rules.update(params, data, function (err, rule) {
if (err) {
// Handle error.
}
console.log(rule.name); // 'New name'
});