0.0.3 • Published 5 years ago
is-hierarchy-client v0.0.3
Hierarchy Client
How to use
Install the module:
npm install is-hierarchy-client --registry https://insightsquared.jfrog.io/insightsquared/api/npm/npm/
In your JS code:
import HierarchyClient from 'is-hierarchy-client';
/*
External ID of the user who should be returned with the subordinates.
If rootId is not passed, the topmnost user is returned with the subordinates.
*/
const rootId = "...";
/*
depth = 0 means that only the rootId user is returned
depth = N means that up to N levels deep are returned
Not passing the depth will return the full hierarchy under the specified rootId
*/
const depth = 1;
/*
Base URL under which hierarchy API is deployed.
Currently in production it is https://clients.insightsquared.com
*/
const hierarchyClient = new HierarchyClient();
async () => {
const hierarchy = await hierarchyClient.getHierarchy({rootId, depth});
}
A sample hierarchy:
"subroles": [
{
"subroles": [
{
"subroles": [],
"employees": [
{
"is_active": true,
"id": 1,
"name": "...",
"ext_id": "SFDC_..."
}
],
"id": 2,
"name": "Sales Engineer",
"ext_id": "SFDC_..."
}
],
"employees": [],
"id": 3,
"name": "Sr Director, Business Operations",
"ext_id": "SFDC_..."
}
]
0.0.3
5 years ago