summaryrefslogtreecommitdiffhomepage
path: root/documentation/jsapi/LuCI.rpc.html
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/jsapi/LuCI.rpc.html')
-rw-r--r--documentation/jsapi/LuCI.rpc.html2414
1 files changed, 2414 insertions, 0 deletions
diff --git a/documentation/jsapi/LuCI.rpc.html b/documentation/jsapi/LuCI.rpc.html
new file mode 100644
index 0000000000..9d548f3ad3
--- /dev/null
+++ b/documentation/jsapi/LuCI.rpc.html
@@ -0,0 +1,2414 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>JSDoc: Class: rpc</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="styles/prettify-tomorrow.css">
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
+</head>
+
+<body>
+
+<div id="main">
+
+ <h1 class="page-title">Class: rpc</h1>
+
+
+
+
+
+
+<section>
+
+<header>
+
+ <h2><span class="attribs"><span class="type-signature"></span></span>
+ <span class="ancestors"><a href="LuCI.html">LuCI</a>.</span>rpc</h2>
+
+ <div class="class-description"><p>The <code>LuCI.rpc</code> class provides high level ubus JSON-RPC abstractions
+and means for listing and invoking remove RPC methods.</p></div>
+
+
+</header>
+
+<article>
+ <div class="container-overview">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line8">line 8</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ </div>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h3 class="subsection-title">Methods</h3>
+
+
+
+
+
+
+
+ <h4 class="name" id="addInterceptor"><span class="type-signature"></span>addInterceptor<span class="signature">(interceptorFn)</span><span class="type-signature"> &rarr; {<a href="LuCI.rpc.html#~interceptorFn">LuCI.rpc~interceptorFn</a>}</span></h4>
+
+
+
+
+
+
+<div class="description">
+ <p>Registers a new interceptor function.</p>
+</div>
+
+
+
+
+
+
+
+
+
+ <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>interceptorFn</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type"><a href="LuCI.rpc.html#~interceptorFn">LuCI.rpc~interceptorFn</a></span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last"><p>The inteceptor function to register.</p></td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line454">line 454</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+<div class="param-desc">
+ <p>Returns the given function value.</p>
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type"><a href="LuCI.rpc.html#~interceptorFn">LuCI.rpc~interceptorFn</a></span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="declare"><span class="type-signature"></span>declare<span class="signature">(options)</span><span class="type-signature"> &rarr; {<a href="LuCI.rpc.html#~invokeFn">LuCI.rpc~invokeFn</a>}</span></h4>
+
+
+
+
+
+
+<div class="description">
+ <p>Describes a remote RPC call procedure and returns a function
+implementing it.</p>
+</div>
+
+
+
+
+
+
+
+
+
+ <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"><a href="LuCI.rpc.html#.DeclareOptions">LuCI.rpc.DeclareOptions</a></span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last"><p>If any object names are given, this function will return the method
+signatures of each given object.</p></td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line292">line 292</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+<div class="param-desc">
+ <p>Returns a new function implementing the method call described in
+<code>options</code>.</p>
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type"><a href="LuCI.rpc.html#~invokeFn">LuCI.rpc~invokeFn</a></span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="getBaseURL"><span class="type-signature"></span>getBaseURL<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
+
+
+
+
+
+
+<div class="description">
+ <p>Returns the current RPC base URL.</p>
+</div>
+
+
+
+
+
+
+
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line367">line 367</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+<div class="param-desc">
+ <p>Returns the RPC URL endpoint to issue requests against.</p>
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">string</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="getSessionID"><span class="type-signature"></span>getSessionID<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
+
+
+
+
+
+
+<div class="description">
+ <p>Returns the current RPC session id.</p>
+</div>
+
+
+
+
+
+
+
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line346">line 346</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+<div class="param-desc">
+ <p>Returns the 32 byte session ID string used for authenticating remote
+requests.</p>
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">string</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="getStatusText"><span class="type-signature"></span>getStatusText<span class="signature">(statusCode)</span><span class="type-signature"> &rarr; {string}</span></h4>
+
+
+
+
+
+
+<div class="description">
+ <p>Translates a numeric <code>ubus</code> error code into a human readable
+description.</p>
+</div>
+
+
+
+
+
+
+
+
+
+ <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>statusCode</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">number</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last"><p>The numeric status code.</p></td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line391">line 391</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+<div class="param-desc">
+ <p>Returns the textual description of the code.</p>
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">string</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="list"><span class="type-signature"></span>list<span class="signature">(&hellip;objectNames<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;(Array.&lt;string>|Object.&lt;string, Object.&lt;string, Object.&lt;string, string>>>)>}</span></h4>
+
+
+
+
+
+
+<div class="description">
+ <p>Lists available remote ubus objects or the method signatures of
+specific objects.</p>
+<p>This function has two signatures and is sensitive to the number of
+arguments passed to it:</p>
+<ul>
+<li><code>list()</code> -
+Returns an array containing the names of all remote <code>ubus</code> objects</li>
+<li><code>list(&quot;objname&quot;, ...)</code>
+Returns method signatures for each given <code>ubus</code> object name.</li>
+</ul>
+</div>
+
+
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+ <th>Attributes</th>
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>objectNames</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">string</span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+ &lt;optional><br>
+
+
+
+
+
+ &lt;repeatable><br>
+
+ </td>
+
+
+
+
+ <td class="description last"><p>If any object names are given, this function will return the method
+signatures of each given object.</p></td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line140">line 140</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+<div class="param-desc">
+ <p>When invoked without arguments, this function will return a promise
+resolving to an array of <code>ubus</code> object names. When invoked with one or
+more arguments, a promise resolving to an object describing the method
+signatures of each requested <code>ubus</code> object name will be returned.</p>
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">Promise.&lt;(Array.&lt;string>|Object.&lt;string, Object.&lt;string, Object.&lt;string, string>>>)></span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="removeInterceptor"><span class="type-signature"></span>removeInterceptor<span class="signature">(interceptorFn)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
+
+
+
+
+
+
+<div class="description">
+ <p>Removes a registered interceptor function.</p>
+</div>
+
+
+
+
+
+
+
+
+
+ <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>interceptorFn</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type"><a href="LuCI.rpc.html#~interceptorFn">LuCI.rpc~interceptorFn</a></span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last"><p>The inteceptor function to remove.</p></td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line470">line 470</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+<div class="param-desc">
+ <p>Returns <code>true</code> if the given function has been removed or <code>false</code>
+if it has not been found.</p>
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">boolean</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="setBaseURL"><span class="type-signature"></span>setBaseURL<span class="signature">(sid)</span><span class="type-signature"></span></h4>
+
+
+
+
+
+
+<div class="description">
+ <p>Set the RPC base URL to use.</p>
+</div>
+
+
+
+
+
+
+
+
+
+ <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>sid</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">string</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last"><p>Sets the RPC URL endpoint to issue requests against.</p></td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line377">line 377</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="setSessionID"><span class="type-signature"></span>setSessionID<span class="signature">(sid)</span><span class="type-signature"></span></h4>
+
+
+
+
+
+
+<div class="description">
+ <p>Set the RPC session id to use.</p>
+</div>
+
+
+
+
+
+
+
+
+
+ <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>sid</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">string</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last"><p>Sets the 32 byte session ID string used for authenticating remote
+requests.</p></td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line357">line 357</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h3 class="subsection-title">Type Definitions</h3>
+
+
+
+<h4 class="name" id=".DeclareOptions">DeclareOptions</h4>
+
+
+
+
+
+
+ <h5>Type:</h5>
+ <ul>
+ <li>
+
+<span class="param-type">Object</span>
+
+
+ </li>
+ </ul>
+
+
+
+
+
+ <h5 class="subsection-title">Properties:</h5>
+
+
+
+<table class="props">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+ <th>Attributes</th>
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>object</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">string</span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+
+
+ </td>
+
+
+
+
+ <td class="description last"><p>The name of the remote <code>ubus</code> object to invoke.</p></td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>method</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">string</span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+
+
+ </td>
+
+
+
+
+ <td class="description last"><p>The name of the remote <code>ubus</code> method to invoke.</p></td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>params</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">Array.&lt;string></span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+ &lt;optional><br>
+
+
+
+ </td>
+
+
+
+
+ <td class="description last"><p>Lists the named parameters expected by the remote <code>ubus</code> RPC method.
+The arguments passed to the resulting generated method call function
+will be mapped to named parameters in the order they appear in this
+array.</p>
+<p>Extraneous parameters passed to the generated function will not be
+sent to the remote procedure but are passed to the
+<a href="LuCI.rpc.html#~filterFn"><code>filter function</code></a> if one is specified.</p>
+<p>Examples:</p>
+<ul>
+<li><code>params: [ &quot;foo&quot;, &quot;bar&quot; ]</code> -
+When the resulting call function is invoked with <code>fn(true, false)</code>,
+the corresponding args object sent to the remote procedure will be
+<code>{ foo: true, bar: false }</code>.</li>
+<li><code>params: [ &quot;test&quot; ], filter: function(reply, args, extra) { ... }</code> -
+When the resultung generated function is invoked with
+<code>fn(&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;)</code> then <code>{ &quot;test&quot;: &quot;foo&quot; }</code> will be sent as
+argument to the remote procedure and the filter function will be
+invoked with <code>filterFn(reply, [ &quot;foo&quot; ], &quot;bar&quot;, &quot;baz&quot;)</code></li>
+</ul></td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>expect</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">Object.&lt;string, *></span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+ &lt;optional><br>
+
+
+
+ </td>
+
+
+
+
+ <td class="description last"><p>Describes the expected return data structure. The given object is
+supposed to contain a single key selecting the value to use from
+the returned <code>ubus</code> reply object. The value of the sole key within
+the <code>expect</code> object is used to infer the expected type of the received
+<code>ubus</code> reply data.</p>
+<p>If the received data does not contain <code>expect</code>'s key, or if the
+type of the data differs from the type of the value in the expect
+object, the expect object's value is returned as default instead.</p>
+<p>The key in the <code>expect</code> object may be an empty string (<code>''</code>) in which
+case the entire reply object is selected instead of one of its subkeys.</p>
+<p>If the <code>expect</code> option is omitted, the received reply will be returned
+as-is, regardless of its format or type.</p>
+<p>Examples:</p>
+<ul>
+<li><code>expect: { '': { error: 'Invalid response' } }</code> -
+This requires the entire <code>ubus</code> reply to be a plain JavaScript
+object. If the reply isn't an object but e.g. an array or a numeric
+error code instead, it will get replaced with
+<code>{ error: 'Invalid response' }</code> instead.</li>
+<li><code>expect: { results: [] }</code> -
+This requires the received <code>ubus</code> reply to be an object containing
+a key <code>results</code> with an array as value. If the received reply does
+not contain such a key, or if <code>reply.results</code> points to a non-array
+value, the empty array (<code>[]</code>) will be used instead.</li>
+<li><code>expect: { success: false }</code> -
+This requires the received <code>ubus</code> reply to be an object containing
+a key <code>success</code> with a boolean value. If the reply does not contain
+<code>success</code> or if <code>reply.success</code> is not a boolean value, <code>false</code> will
+be returned as default instead.</li>
+</ul></td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>filter</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type"><a href="LuCI.rpc.html#~filterFn">LuCI.rpc~filterFn</a></span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+ &lt;optional><br>
+
+
+
+ </td>
+
+
+
+
+ <td class="description last"><p>Specfies an optional filter function which is invoked to transform the
+received reply data before it is returned to the caller.</p></td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line160">line 160</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="~filterFn"><span class="type-signature"></span>filterFn<span class="signature">(data, args, &hellip;extraArgs)</span><span class="type-signature"> &rarr; {*}</span></h4>
+
+
+
+
+
+
+<div class="description">
+ <p>The filter function is invoked to transform a received <code>ubus</code> RPC call
+reply before returning it to the caller.</p>
+</div>
+
+
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+ <th>Attributes</th>
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>data</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">*</span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+
+
+
+
+ </td>
+
+
+
+
+ <td class="description last"><p>The received <code>ubus</code> reply data or a subset of it as described in the
+<code>expect</code> option of the RPC call declaration. In case of remote call
+errors, <code>data</code> is numeric <code>ubus</code> error code instead.</p></td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>args</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">Array.&lt;*></span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+
+
+
+
+ </td>
+
+
+
+
+ <td class="description last"><p>The arguments the RPC method has been invoked with.</p></td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>extraArgs</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">*</span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+
+
+
+
+ &lt;repeatable><br>
+
+ </td>
+
+
+
+
+ <td class="description last"><p>All extraneous arguments passed to the RPC method exceeding the number
+of arguments describes in the RPC call declaration.</p></td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line231">line 231</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+<div class="param-desc">
+ <p>The return value of the filter function will be returned to the caller
+of the RPC method as-is.</p>
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">*</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="~interceptorFn"><span class="type-signature"></span>interceptorFn<span class="signature">(msg, req)</span><span class="type-signature"> &rarr; {Promise.&lt;*>|*}</span></h4>
+
+
+
+
+
+
+<div class="description">
+ <p>Registered interceptor functions are invoked before the standard reply
+parsing and handling logic.</p>
+<p>By returning rejected promises, interceptor functions can cause the
+invocation function to fail, regardless of the received reply.</p>
+<p>Interceptors may also modify their message argument in-place to
+rewrite received replies before they're processed by the standard
+response handling code.</p>
+<p>A common use case for such functions is to detect failing RPC replies
+due to expired authentication in order to trigger a new login.</p>
+</div>
+
+
+
+
+
+
+
+
+
+ <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>msg</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">*</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last"><p>The unprocessed, JSON decoded remote RPC method call reply.</p>
+<p>Since interceptors run before the standard parsing logic, the reply
+data is not verified for correctness or filtered according to
+<code>expect</code> and <code>filter</code> specifications in the declarations.</p></td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>req</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">Object</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last"><p>The related request object which is an extended variant of the
+declaration object, allowing access to internals of the invocation
+function such as <code>filter</code>, <code>expect</code> or <code>params</code> values.</p></td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line408">line 408</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+<div class="param-desc">
+ <p>Interceptor functions may return a promise to defer response
+processing until some delayed work completed. Any values the returned
+promise resolves to are ignored.</p>
+<p>When the returned promise rejects with an error, the invocation
+function will fail too, forwarding the error to the caller.</p>
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">Promise.&lt;*></span>
+|
+
+<span class="param-type">*</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h4 class="name" id="~invokeFn"><span class="type-signature"></span>invokeFn<span class="signature">(&hellip;params)</span><span class="type-signature"> &rarr; {Promise.&lt;*>}</span></h4>
+
+
+
+
+
+
+<div class="description">
+ <p>The generated invocation function is returned by
+<a href="LuCI.rpc.html#declare"><code>rpc.declare()</code></a> and encapsulates a single
+RPC method call.</p>
+<p>Calling this function will execute a remote <code>ubus</code> HTTP call request
+using the arguments passed to it as arguments and return a promise
+resolving to the received reply values.</p>
+</div>
+
+
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+ <th>Attributes</th>
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>params</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">*</span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+
+
+
+
+ &lt;repeatable><br>
+
+ </td>
+
+
+
+
+ <td class="description last"><p>The parameters to pass to the remote procedure call. The given
+positional arguments will be named to named RPC parameters according
+to the names specified in the <code>params</code> array of the method declaration.</p>
+<p>Any additional parameters exceeding the amount of arguments in the
+<code>params</code> declaration are passed as private extra arguments to the
+declared filter function.</p></td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="rpc.js.html">rpc.js</a>, <a href="rpc.js.html#line254">line 254</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<h5>Returns:</h5>
+
+
+<div class="param-desc">
+ <p>Returns a promise resolving to the result data of the remote <code>ubus</code>
+RPC method invocation, optionally substituted and filtered according
+to the <code>expect</code> and <code>filter</code> declarations.</p>
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">Promise.&lt;*></span>
+
+
+ </dd>
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+</article>
+
+</section>
+
+
+
+
+</div>
+
+<nav>
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="LuCI.html">LuCI</a></li><li><a href="LuCI.Class.html">Class</a></li><li><a href="LuCI.dom.html">dom</a></li><li><a href="LuCI.fs.html">fs</a></li><li><a href="LuCI.Headers.html">Headers</a></li><li><a href="LuCI.Network.html">Network</a></li><li><a href="LuCI.Network.Device.html">Device</a></li><li><a href="LuCI.Network.Hosts.html">Hosts</a></li><li><a href="LuCI.Network.Protocol.html">Protocol</a></li><li><a href="LuCI.Network.WifiDevice.html">WifiDevice</a></li><li><a href="LuCI.Network.WifiNetwork.html">WifiNetwork</a></li><li><a href="LuCI.Poll.html">Poll</a></li><li><a href="LuCI.Request.html">Request</a></li><li><a href="LuCI.Request.poll.html">poll</a></li><li><a href="LuCI.Response.html">Response</a></li><li><a href="LuCI.rpc.html">rpc</a></li><li><a href="LuCI.uci.html">uci</a></li><li><a href="LuCI.view.html">view</a></li><li><a href="LuCI.XHR.html">XHR</a></li></ul>
+</nav>
+
+<br class="clear">
+
+<footer>
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Nov 05 2019 09:33:05 GMT+0100 (Central European Standard Time)
+</footer>
+
+<script> prettyPrint(); </script>
+<script src="scripts/linenumber.js"> </script>
+</body>
+</html> \ No newline at end of file