oneuptime
Version:
OneUptime is a JS package that tracks error event and send logs from your applications to your oneuptime dashboard.
909 lines (240 loc) • 10.5 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Module: helpers</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">Module: helpers</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="description">HTTP wrapper functions module.</div>
<dl class="details">
<dt class="tag-author">Author:</dt>
<dd class="tag-author">
<ul>
<li>HackerBay, Inc.</li>
</ul>
</dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_helpers.js.html">lib/helpers.js</a>, <a href="lib_helpers.js.html#line1">line 1</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="module-config.html">module:config</a></li>
<li><a href="module-logger.html">module:logger</a></li>
</ul>
</dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="~headers"><span class="type-signature">(inner, constant) </span>headers<span class="type-signature"></span></h4>
<div class="description">
The request headers.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_helpers.js.html">lib/helpers.js</a>, <a href="lib_helpers.js.html#line16">line 16</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="~defaultErrorHandler"><span class="type-signature">(inner) </span>defaultErrorHandler<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Handle request error.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The error object of the request.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_helpers.js.html">lib/helpers.js</a>, <a href="lib_helpers.js.html#line24">line 24</a>
</li></ul></dd>
</dl>
<h4 class="name" id="~get"><span class="type-signature">(inner) </span>get<span class="signature">(apiUrl, url, key, success, error)</span><span class="type-signature"> → {Promise}</span></h4>
<div class="description">
Get request data with axios.
</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>apiUrl</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The url of the api.</td>
</tr>
<tr>
<td class="name"><code>url</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The endpoint of the request.</td>
</tr>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The api key of the endpoint.</td>
</tr>
<tr>
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The request success callback.</td>
</tr>
<tr>
<td class="name"><code>error</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The request error callback.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_helpers.js.html">lib/helpers.js</a>, <a href="lib_helpers.js.html#line50">line 50</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The request promise.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="~post"><span class="type-signature">(inner) </span>post<span class="signature">(apiUrl, url, data, key, success, error)</span><span class="type-signature"> → {Promise}</span></h4>
<div class="description">
Post request data with axios.
</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>apiUrl</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The url of the api.</td>
</tr>
<tr>
<td class="name"><code>url</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The endpoint of the request.</td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The data of endpoint.</td>
</tr>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The api key of the endpoint.</td>
</tr>
<tr>
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The request success callback.</td>
</tr>
<tr>
<td class="name"><code>error</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The request error callback.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_helpers.js.html">lib/helpers.js</a>, <a href="lib_helpers.js.html#line70">line 70</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The request promise.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-api.html">api</a></li><li><a href="module-config.html">config</a></li><li><a href="module-helpers.html">helpers</a></li><li><a href="module-logger.html">logger</a></li><li><a href="module-server-monitor.html">server-monitor</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Fri Jan 08 2021 00:53:57 GMT+0100 (West Africa Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>