datahub-nodejs-sdk
Version:
DataHub Node.js SDK
1,541 lines (513 loc) • 22.4 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>DataHubSDK - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="DataHubSDK.html">DataHubSDK</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="DataHubSDK.html#getSceneData">getSceneData</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="DataHubSDK.html#switchAllScenes">switchAllScenes</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="DataHubSDK.html#switchMultiScenes">switchMultiScenes</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="DataHubSDK.html#switchScene">switchScene</a></span></li>
</nav>
<div id="main">
<h1 class="page-title">DataHubSDK</h1>
<section>
<header>
<h2>
DataHubSDK
</h2>
<div class="class-description"><p>DataHub Node.js SDK.</p></div>
</header>
<article>
<div class="container-overview">
<div class="section-method">
<h2>Constructor</h2>
<h4 class="name" id="DataHubSDK"><span class="type-signature"></span>new DataHubSDK<span class="signature">(port<span class="signature-attributes">opt</span>, hostname<span class="signature-attributes">opt</span>, protocol<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
<pre class="prettyprint source lang-javascript"><code>const client = new SDK({
port: 5678,
hostname: '127.0.0.1',
});</code></pre>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="datahub-nodejs-sdk.js.html">datahub-nodejs-sdk.js</a>, <a href="datahub-nodejs-sdk.js.html#line24">line 24</a>
</li></ul></dd>
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
5678
</td>
<td class="description last">
<p>DataHub port.</p>
</td>
</tr>
<tr>
<td class="name"><code>hostname</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
'127.0.0.1'
</td>
<td class="description last">
<p>DataHub hostname.</p>
</td>
</tr>
<tr>
<td class="name"><code>protocol</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
'http'
</td>
<td class="description last">
<p>DataHub protocol.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3 class="subsection-title">Methods</h3>
<div class="section-method">
<h4 class="name" id="getSceneData"><span class="type-signature">(async) </span>getSceneData<span class="signature">(options)</span><span class="type-signature"></span></h4>
<div class="description">
<pre class="prettyprint source lang-javascript"><code>await client.getSceneData({
hub: 'app',
pathname: 'api',
scene: 'success',
method: 'POST',
})</code></pre>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="datahub-nodejs-sdk.js.html">datahub-nodejs-sdk.js</a>, <a href="datahub-nodejs-sdk.js.html#line127">line 127</a>
</li></ul></dd>
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="description last">
<p>scene options</p>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>hub</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">
<p>hubname.</p>
</td>
</tr>
<tr>
<td class="name"><code>pathname</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">
<p>pathname.</p>
</td>
</tr>
<tr>
<td class="name"><code>scene</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">
<p>scene name.</p>
</td>
</tr>
<tr>
<td class="name"><code>method</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
'ALL'
</td>
<td class="description last">
<p>api method, default is 'ALL'.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section-method">
<h4 class="name" id="switchAllScenes"><span class="type-signature">(async) </span>switchAllScenes<span class="signature">(options)</span><span class="type-signature"></span></h4>
<div class="description">
<pre class="prettyprint source lang-javascript"><code>await client.switchAllScenes({
hub: 'app',
scene: 'success',
})</code></pre>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="datahub-nodejs-sdk.js.html">datahub-nodejs-sdk.js</a>, <a href="datahub-nodejs-sdk.js.html#line203">line 203</a>
</li></ul></dd>
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="description last">
<p>switch scene options</p>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>hub</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
<p>hubname.</p>
</td>
</tr>
<tr>
<td class="name"><code>scene</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
<p>scene name.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section-method">
<h4 class="name" id="switchMultiScenes"><span class="type-signature">(async) </span>switchMultiScenes<span class="signature">(options)</span><span class="type-signature"></span></h4>
<div class="description">
<pre class="prettyprint source lang-javascript"><code>await client.switchMultiScenes([{
hub: 'app',
pathname: 'api',
scene: 'success',
method: 'POST',
}, {
hub: 'app',
pathname: 'api2',
scene: 'success',
method: 'POST',
}])</code></pre>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="datahub-nodejs-sdk.js.html">datahub-nodejs-sdk.js</a>, <a href="datahub-nodejs-sdk.js.html#line185">line 185</a>
</li></ul></dd>
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type"><code>Array.<Object></code></span>
</td>
<td class="description last">
<p>switch scene options</p>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>hub</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">
<p>hubname.</p>
</td>
</tr>
<tr>
<td class="name"><code>pathname</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">
<p>pathname.</p>
</td>
</tr>
<tr>
<td class="name"><code>scene</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">
<p>scene name.</p>
</td>
</tr>
<tr>
<td class="name"><code>method</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
'ALL'
</td>
<td class="description last">
<p>api method, default is 'ALL'.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section-method">
<h4 class="name" id="switchScene"><span class="type-signature">(async) </span>switchScene<span class="signature">(options)</span><span class="type-signature"></span></h4>
<div class="description">
<pre class="prettyprint source lang-javascript"><code>await client.switchScene({
hub: 'app',
pathname: 'api',
scene: 'success',
method: 'POST',
})</code></pre><pre class="prettyprint source lang-javascript"><code>await client.switchScene({
hub: 'app',
pathname: 'api',
scene: 'success',
method: 'POST',
})</code></pre>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="datahub-nodejs-sdk.js.html">datahub-nodejs-sdk.js</a>, <a href="datahub-nodejs-sdk.js.html#line158">line 158</a>
</li></ul></dd>
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="description last">
<p>switch scene options</p>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>hub</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">
<p>hubname.</p>
</td>
</tr>
<tr>
<td class="name"><code>pathname</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">
<p>pathname.</p>
</td>
</tr>
<tr>
<td class="name"><code>scene</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">
<p>scene name.</p>
</td>
</tr>
<tr>
<td class="name"><code>method</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
'ALL'
</td>
<td class="description last">
<p>api method, default is 'ALL'.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</article>
</section>
</div>
<br class="clear">
<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Feb 22 2019 16:32:31 GMT+0800 (CST) using the Minami theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>