DataHubSDK

DataHubSDK

DataHub Node.js SDK.

Constructor

new DataHubSDK(portopt, hostnameopt, protocolopt)

const client = new SDK({
  port: 5678,
  hostname: '127.0.0.1',
});
Source:
Parameters:
Name Type Attributes Default Description
port string <optional>
5678

DataHub port.

hostname string <optional>
'127.0.0.1'

DataHub hostname.

protocol string <optional>
'http'

DataHub protocol.

Methods

(async) getSceneData(options)

await client.getSceneData({
  hub: 'app',
  pathname: 'api',
  scene: 'success',
  method: 'POST',
})
Source:
Parameters:
Name Type Description
options Object

scene options

Name Type Attributes Default Description
hub string

hubname.

pathname string

pathname.

scene string

scene name.

method string <optional>
'ALL'

api method, default is 'ALL'.

(async) switchAllScenes(options)

await client.switchAllScenes({
  hub: 'app',
  scene: 'success',
})
Source:
Parameters:
Name Type Description
options Object

switch scene options

Name Type Description
hub string

hubname.

scene string

scene name.

(async) switchMultiScenes(options)

await client.switchMultiScenes([{
  hub: 'app',
  pathname: 'api',
  scene: 'success',
  method: 'POST',
}, {
  hub: 'app',
  pathname: 'api2',
  scene: 'success',
  method: 'POST',
}])
Source:
Parameters:
Name Type Description
options Array.<Object>

switch scene options

Name Type Attributes Default Description
hub string

hubname.

pathname string

pathname.

scene string

scene name.

method string <optional>
'ALL'

api method, default is 'ALL'.

(async) switchScene(options)

await client.switchScene({
  hub: 'app',
  pathname: 'api',
  scene: 'success',
  method: 'POST',
})
await client.switchScene({
  hub: 'app',
  pathname: 'api',
  scene: 'success',
  method: 'POST',
})
Source:
Parameters:
Name Type Description
options Object

switch scene options

Name Type Attributes Default Description
hub string

hubname.

pathname string

pathname.

scene string

scene name.

method string <optional>
'ALL'

api method, default is 'ALL'.