DataHub Node.js SDK
$ npm i datahub-nodejs-sdk --save-dev
import DataHubSDK from 'datahub-nodejs-sdk';
const sdkClient = new DataHubSDK();
// switch currentScene for 'POST api/create' to 'sucess'
await sdkClient.switchScene({
hub: 'app',
pathname: 'api/create',
scene: 'success',
method: 'POST', // method is optional, default method is 'ALL'
})
// switch currentScene for 'GET api/read' to 'success'
// switch currentScene for 'DELETE api/delete' to 'success'
await sdkClient.switchMultiScenes([{
hub: 'app',
pathname: 'api/read',
scene: 'success',
method: 'GET', // method is optional, default method is 'ALL'
}, {
hub: 'app',
pathname: 'api/delete',
scene: 'success',
method: 'DELETE', // method is optional, default method is 'ALL'
}])
// switch all scenes for all pathnames under app to 'success'
await sdkClient.switchAllScenes({
hub: 'app',
scene: 'success',
})
xudafeng |
zhangyuheng |
---|
This project follows the git-contributor spec, auto upated at Mon Mar 26 2018 12:31:12 GMT+0800
.
The MIT License (MIT)