thunder-client
Version:
A JavaScript client for the Thunder API
1,600 lines (421 loc) • 20.1 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>ThunderClient - 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="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</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>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ThunderClient.html">ThunderClient</a><ul class='methods'><li data-type='method'><a href="ThunderClient.html#createUser">createUser</a></li><li data-type='method'><a href="ThunderClient.html#deleteUser">deleteUser</a></li><li data-type='method'><a href="ThunderClient.html#getUser">getUser</a></li><li data-type='method'><a href="ThunderClient.html#resetVerificationStatus">resetVerificationStatus</a></li><li data-type='method'><a href="ThunderClient.html#sendEmail">sendEmail</a></li><li data-type='method'><a href="ThunderClient.html#updateUser">updateUser</a></li><li data-type='method'><a href="ThunderClient.html#verifyUser">verifyUser</a></li></ul></li></ul>
</nav>
<div id="main">
<h1 class="page-title">ThunderClient</h1>
<section>
<header>
<h2>
ThunderClient
</h2>
<div class="class-description">The ThunderClient class provides methods to communicate to Thunder.</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="ThunderClient"><span class="type-signature"></span>new ThunderClient<span class="signature">(endpoint, application, secret)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="thunder-client.js.html">thunder-client.js</a>, <a href="thunder-client.js.html#line16">line 16</a>
</li></ul></dd>
</dl>
<div class="description">
Constructs a new ThunderClient.
</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>endpoint</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The base endpoint to connect to Thunder with.</td>
</tr>
<tr>
<td class="name"><code>application</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The name of the application key used for basic auth.</td>
</tr>
<tr>
<td class="name"><code>secret</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The value of the application secret used for basic auth.</td>
</tr>
</tbody>
</table>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="createUser"><span class="type-signature"></span>createUser<span class="signature">(user, callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="thunder-client.js.html">thunder-client.js</a>, <a href="thunder-client.js.html#line39">line 39</a>
</li></ul></dd>
</dl>
<div class="description">
POST /users
Creates a new Thunder user.
</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>user</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">The data of the user object to create.</td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The function to call when the method completes.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="deleteUser"><span class="type-signature"></span>deleteUser<span class="signature">(email, password, callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="thunder-client.js.html">thunder-client.js</a>, <a href="thunder-client.js.html#line102">line 102</a>
</li></ul></dd>
</dl>
<div class="description">
DELETE /users
Deletes a Thunder user.
</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>email</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The email address of the user to delete.</td>
</tr>
<tr>
<td class="name"><code>password</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The password of the user to delete.</td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The function to call when the method completes.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="getUser"><span class="type-signature"></span>getUser<span class="signature">(email, password, callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="thunder-client.js.html">thunder-client.js</a>, <a href="thunder-client.js.html#line59">line 59</a>
</li></ul></dd>
</dl>
<div class="description">
GET /users
Gets a Thunder user.
</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>email</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The email address of the user to get.</td>
</tr>
<tr>
<td class="name"><code>password</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The password of the user to get.</td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The function to call when the method completes.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="resetVerificationStatus"><span class="type-signature"></span>resetVerificationStatus<span class="signature">(email, password, callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="thunder-client.js.html">thunder-client.js</a>, <a href="thunder-client.js.html#line169">line 169</a>
</li></ul></dd>
</dl>
<div class="description">
POST /verify/reset
Resets a user's email verification status.
</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>email</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The user's email address.</td>
</tr>
<tr>
<td class="name"><code>password</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The user's password.</td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The function to call when the method completes.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="sendEmail"><span class="type-signature"></span>sendEmail<span class="signature">(email, password, callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="thunder-client.js.html">thunder-client.js</a>, <a href="thunder-client.js.html#line122">line 122</a>
</li></ul></dd>
</dl>
<div class="description">
POST /verify
Creates and sends a new verification email.
</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>email</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The email address of the user to send the email to.</td>
</tr>
<tr>
<td class="name"><code>password</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The password of the user to send the email to.</td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The function to call when the method completes.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="updateUser"><span class="type-signature"></span>updateUser<span class="signature">(email, password, user, callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="thunder-client.js.html">thunder-client.js</a>, <a href="thunder-client.js.html#line80">line 80</a>
</li></ul></dd>
</dl>
<div class="description">
PUT /users
Updates a Thunder user.
</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>email</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The existing email address of the user to update.</td>
</tr>
<tr>
<td class="name"><code>password</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The password of the user to update.</td>
</tr>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">The user object to PUT as an update.</td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The function to call when the method completes.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="verifyUser"><span class="type-signature"></span>verifyUser<span class="signature">(email, token, callback, responseType)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="thunder-client.js.html">thunder-client.js</a>, <a href="thunder-client.js.html#line145">line 145</a>
</li></ul></dd>
</dl>
<div class="description">
GET /verify
Verifies a user. Simulates the user clicking the URL in the email.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>email</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="default">
</td>
<td class="description last">The email address of the user to verify.</td>
</tr>
<tr>
<td class="name"><code>token</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="default">
</td>
<td class="description last">The verification token that should match the generated token.</td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="default">
</td>
<td class="description last">The function to call when the method completes.</td>
</tr>
<tr>
<td class="name"><code>responseType</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="default">
<code>json</code>
</td>
<td class="description last">The type of response to recieve.
Must be either 'html' or 'json'. Defaults to 'json'.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
Upon error or after successfully sending the GET request.
</div>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Oct 05 2018 21:34:55 GMT+0000 (UTC) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>