monster.util.getCapability()
Syntax
monster.util.getCapability(path);
Parameters
Key | Description | Type | Default | Required |
---|---|---|---|---|
path | Path to a resource/feature to access. | `String | String[]` |
Return value
- An
Object
literal describing the capability of a feature
Key | Description | Type |
---|---|---|
isEnabled | Whether the feature at path is available. | Boolean |
defaultValue | Default value for capability at path . | Boolean |
- An
Array
listing features whenpath
only contains a resource undefined
whenpath
cannot be resolved into a valid feature
Description
The monster.util.getCapability
method returns data informing on the capability of a feature for a resource.
The data returned is cluster specific, meaning the user/account logged in does not impact the state of capabilities returned.
That said, when no user is logged-in, valid resource/feature will return undefined
as the capabilities information is only shared by Kazoo on successful authentication.
Examples
Access a resource/feature
console.log(monster.util.getCapability('voicemail.transcription'));
// -> { "isEnabled": true, "defaultValue": false }
List features for a resource
console.log(monster.util.getCapability('voicemail'));
// -> ["transcription"]
Access an invalid resource/feature path
console.log(monster.util.getCapability('voicemail.transcription.default'));
// -> undefined
console.log(monster.util.getCapability('voicemail.superman'));
// -> undefined
console.log(monster.util.getCapability('user'));
// -> undefined
console.log(monster.util.getCapability('user.superman'));
// -> undefined