diff options
Diffstat (limited to 'documentation/jsapi/LuCI.Request.html')
-rw-r--r-- | documentation/jsapi/LuCI.Request.html | 1900 |
1 files changed, 1900 insertions, 0 deletions
diff --git a/documentation/jsapi/LuCI.Request.html b/documentation/jsapi/LuCI.Request.html new file mode 100644 index 0000000000..2028b406fc --- /dev/null +++ b/documentation/jsapi/LuCI.Request.html @@ -0,0 +1,1900 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>JSDoc: Class: Request</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: Request</h1> + + + + + + +<section> + +<header> + + <h2><span class="attribs"><span class="type-signature"></span></span> + <span class="ancestors"><a href="LuCI.html">LuCI</a>.</span>Request</h2> + + <div class="class-description"><p>The <code>Request</code> class allows initiating HTTP requests and provides utilities +for dealing with responses.</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="luci.js.html">luci.js</a>, <a href="luci.js.html#line569">line 569</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + <h3 class="subsection-title">Classes</h3> + + <dl> + <dt><a href="LuCI.Request.poll.html">poll</a></dt> + <dd></dd> + </dl> + + + + + + + + + + + + <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"> → {<a href="LuCI.Request.html#.interceptorFn">LuCI.Request.interceptorFn</a>}</span></h4> + + + + + + +<div class="description"> + <p>Register an HTTP response interceptor function. Interceptor +functions are useful to perform default actions on incoming HTTP +responses, such as checking for expired authentication or for +implementing request retries before returning a failure.</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.Request.html#.interceptorFn">LuCI.Request.interceptorFn</a></span> + + + + </td> + + + + + + <td class="description last"><p>The interceptor 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="luci.js.html">luci.js</a>, <a href="luci.js.html#line844">line 844</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>The registered function.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type"><a href="LuCI.Request.html#.interceptorFn">LuCI.Request.interceptorFn</a></span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="expandURL"><span class="type-signature"></span>expandURL<span class="signature">(url)</span><span class="type-signature"> → {string}</span></h4> + + + + + + +<div class="description"> + <p>Turn the given relative URL into an absolute URL if necessary.</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>url</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The URL to convert.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line586">line 586</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>The absolute URL derived from the given one, or the original URL +if it already was absolute.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">string</span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(target, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<<a href="LuCI.Response.html">LuCI.Response</a>>}</span></h4> + + + + + + +<div class="description"> + <p>Initiate an HTTP GET request to the given target.</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>target</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The URL to request.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>options</code></td> + + + <td class="type"> + + +<span class="param-type"><a href="LuCI.Request.html#.RequestOptions">LuCI.Request.RequestOptions</a></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + + <td class="description last"><p>Additional options to configure the request.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line797">line 797</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>The resulting HTTP response.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise.<<a href="LuCI.Response.html">LuCI.Response</a>></span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="post"><span class="type-signature"></span>post<span class="signature">(target, data<span class="signature-attributes">opt</span>, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<<a href="LuCI.Response.html">LuCI.Response</a>>}</span></h4> + + + + + + +<div class="description"> + <p>Initiate an HTTP POST request to the given target.</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>target</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The URL to request.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>data</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + + <td class="description last"><p>The request data to send, see <a href="LuCI.Request.html#.RequestOptions"><code>LuCI.Request.RequestOptions</code></a> for details.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>options</code></td> + + + <td class="type"> + + +<span class="param-type"><a href="LuCI.Request.html#.RequestOptions">LuCI.Request.RequestOptions</a></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + + <td class="description last"><p>Additional options to configure the request.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line818">line 818</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>The resulting HTTP response.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise.<<a href="LuCI.Response.html">LuCI.Response</a>></span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="removeInterceptor"><span class="type-signature"></span>removeInterceptor<span class="signature">(interceptorFn)</span><span class="type-signature"> → {boolean}</span></h4> + + + + + + +<div class="description"> + <p>Remove an HTTP response interceptor function. The passed function +value must be the very same value that was used to register the +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.Request.html#.interceptorFn">LuCI.Request.interceptorFn</a></span> + + + + </td> + + + + + + <td class="description last"><p>The interceptor 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="luci.js.html">luci.js</a>, <a href="luci.js.html#line863">line 863</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>Returns <code>true</code> if any function has been removed, else <code>false</code>.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">boolean</span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="request"><span class="type-signature"></span>request<span class="signature">(target, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<<a href="LuCI.Response.html">LuCI.Response</a>>}</span></h4> + + + + + + +<div class="description"> + <p>Initiate an HTTP request to the given target.</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>target</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The URL to request.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>options</code></td> + + + <td class="type"> + + +<span class="param-type"><a href="LuCI.Request.html#.RequestOptions">LuCI.Request.RequestOptions</a></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + + <td class="description last"><p>Additional options to configure the request.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line648">line 648</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>The resulting HTTP response.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise.<<a href="LuCI.Response.html">LuCI.Response</a>></span> + + + </dd> +</dl> + + + + + + + + + + + + <h3 class="subsection-title">Type Definitions</h3> + + + + + + + + <h4 class="name" id=".interceptorFn"><span class="type-signature"></span>interceptorFn<span class="signature">(res)</span><span class="type-signature"></span></h4> + + + + + + +<div class="description"> + <p>Interceptor functions are invoked whenever an HTTP reply is received, in the order +these functions have been registered.</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>res</code></td> + + + <td class="type"> + + +<span class="param-type"><a href="LuCI.Response.html">LuCI.Response</a></span> + + + + </td> + + + + + + <td class="description last"><p>The HTTP response 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="luci.js.html">luci.js</a>, <a href="luci.js.html#line822">line 822</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + +<h4 class="name" id=".RequestOptions">RequestOptions</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>Default</th> + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>method</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + <td class="default"> + + GET + + </td> + + + <td class="description last"><p>The HTTP method to use, e.g. <code>GET</code> or <code>POST</code>.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>query</code></td> + + + <td class="type"> + + +<span class="param-type">Object.<string, (Object|string)></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"><p>Query string data to append to the URL. Non-string values of the +given object will be converted to JSON.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>cache</code></td> + + + <td class="type"> + + +<span class="param-type">boolean</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + <td class="default"> + + false + + </td> + + + <td class="description last"><p>Specifies whether the HTTP response may be retrieved from cache.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>username</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"><p>Provides a username for HTTP basic authentication.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>password</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"><p>Provides a password for HTTP basic authentication.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>timeout</code></td> + + + <td class="type"> + + +<span class="param-type">number</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"><p>Specifies the request timeout in seconds.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>credentials</code></td> + + + <td class="type"> + + +<span class="param-type">boolean</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + <td class="default"> + + false + + </td> + + + <td class="description last"><p>Whether to include credentials such as cookies in the request.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>content</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"><p>Specifies the HTTP message body to send along with the request. +If the value is a function, it is invoked and the return value +used as content, if it is a FormData instance, it is used as-is, +if it is an object, it will be converted to JSON, in all other +cases it is converted to a string.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>header</code></td> + + + <td class="type"> + + +<span class="param-type">Object.<string, string></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"><p>Specifies HTTP headers to set for the request.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>progress</code></td> + + + <td class="type"> + + +<span class="param-type">function</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"><p>An optional request callback function which receives ProgressEvent +instances as sole argument during the HTTP request transfer.</p></td> + </tr> + + + </tbody> +</table> + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line593">line 593</a> + </li></ul></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 |