fluro
Version:
Promise based HTTP Fluro client for the browser and node.js
948 lines (274 loc) • 18.2 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>FluroAPI - 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="FluroAccess.html">FluroAccess</a><ul class='methods'><li data-type='method'><a href="FluroAccess.html#.addEventListener">addEventListener</a></li><li data-type='method'><a href="FluroAccess.html#.can">can</a></li><li data-type='method'><a href="FluroAccess.html#.canDeleteItem">canDeleteItem</a></li><li data-type='method'><a href="FluroAccess.html#.canEditItem">canEditItem</a></li><li data-type='method'><a href="FluroAccess.html#.canViewItem">canViewItem</a></li><li data-type='method'><a href="FluroAccess.html#.has">has</a></li><li data-type='method'><a href="FluroAccess.html#.isAuthor">isAuthor</a></li><li data-type='method'><a href="FluroAccess.html#.removeAllListeners">removeAllListeners</a></li><li data-type='method'><a href="FluroAccess.html#.removeEventListener">removeEventListener</a></li><li data-type='method'><a href="FluroAccess.html#.retrieveActionableRealms">retrieveActionableRealms</a></li><li data-type='method'><a href="FluroAccess.html#.retrieveCurrentSession">retrieveCurrentSession</a></li><li data-type='method'><a href="FluroAccess.html#.setDefaultApplication">setDefaultApplication</a></li></ul></li><li><a href="FluroAPI.html">FluroAPI</a><ul class='methods'><li data-type='method'><a href="FluroAPI.html#.delete">delete</a></li><li data-type='method'><a href="FluroAPI.html#.get">get</a></li><li data-type='method'><a href="FluroAPI.html#.post">post</a></li><li data-type='method'><a href="FluroAPI.html#.put">put</a></li></ul></li><li><a href="FluroAsset.html">FluroAsset</a><ul class='methods'><li data-type='method'><a href="FluroAsset.html#.avatarUrl">avatarUrl</a></li><li data-type='method'><a href="FluroAsset.html#.downloadUrl">downloadUrl</a></li><li data-type='method'><a href="FluroAsset.html#.filesize">filesize</a></li><li data-type='method'><a href="FluroAsset.html#.getUrl">getUrl</a></li><li data-type='method'><a href="FluroAsset.html#.imageUrl">imageUrl</a></li><li data-type='method'><a href="FluroAsset.html#.playerUrl">playerUrl</a></li><li data-type='method'><a href="FluroAsset.html#.posterUrl">posterUrl</a></li></ul></li><li><a href="FluroAuth.html">FluroAuth</a><ul class='methods'><li data-type='method'><a href="FluroAuth.html#.addEventListener">addEventListener</a></li><li data-type='method'><a href="FluroAuth.html#.changeAccount">changeAccount</a></li><li data-type='method'><a href="FluroAuth.html#.getCurrentToken">getCurrentToken</a></li><li data-type='method'><a href="FluroAuth.html#.getCurrentUser">getCurrentUser</a></li><li data-type='method'><a href="FluroAuth.html#.login">login</a></li><li data-type='method'><a href="FluroAuth.html#.logout">logout</a></li><li data-type='method'><a href="FluroAuth.html#.refreshAccessToken">refreshAccessToken</a></li><li data-type='method'><a href="FluroAuth.html#.removeAllListeners">removeAllListeners</a></li><li data-type='method'><a href="FluroAuth.html#.removeEventListener">removeEventListener</a></li><li data-type='method'><a href="FluroAuth.html#.retrieveUserFromResetToken">retrieveUserFromResetToken</a></li><li data-type='method'><a href="FluroAuth.html#.sendResetPasswordRequest">sendResetPasswordRequest</a></li><li data-type='method'><a href="FluroAuth.html#.set">set</a></li><li data-type='method'><a href="FluroAuth.html#.signup">signup</a></li><li data-type='method'><a href="FluroAuth.html#.sync">sync</a></li><li data-type='method'><a href="FluroAuth.html#.updateUserWithToken">updateUserWithToken</a></li></ul></li><li><a href="FluroCache.html">FluroCache</a><ul class='methods'><li data-type='method'><a href="FluroCache.html#.get">get</a></li><li data-type='method'><a href="FluroCache.html#.reset">reset</a></li></ul></li><li><a href="FluroContent.html">FluroContent</a><ul class='methods'><li data-type='method'><a href="FluroContent.html#.external">external</a></li><li data-type='method'><a href="FluroContent.html#.form">form</a></li><li data-type='method'><a href="FluroContent.html#.get">get</a></li><li data-type='method'><a href="FluroContent.html#.keys">keys</a></li><li data-type='method'><a href="FluroContent.html#.query">query</a></li><li data-type='method'><a href="FluroContent.html#.related">related</a></li><li data-type='method'><a href="FluroContent.html#.retrieve">retrieve</a></li><li data-type='method'><a href="FluroContent.html#.slug">slug</a></li><li data-type='method'><a href="FluroContent.html#.submitInteraction">submitInteraction</a></li><li data-type='method'><a href="FluroContent.html#.submitPost">submitPost</a></li><li data-type='method'><a href="FluroContent.html#.thread">thread</a></li><li data-type='method'><a href="FluroContent.html#.values">values</a></li></ul></li><li><a href="FluroCore.html">FluroCore</a></li><li><a href="FluroDate.html">FluroDate</a><ul class='methods'><li data-type='method'><a href="FluroDate.html#.dateFromID">dateFromID</a></li><li data-type='method'><a href="FluroDate.html#.formatDate">formatDate</a></li><li data-type='method'><a href="FluroDate.html#.isMultiDayEvent">isMultiDayEvent</a></li><li data-type='method'><a href="FluroDate.html#.localDate">localDate</a></li><li data-type='method'><a href="FluroDate.html#.readableEventDate">readableEventDate</a></li><li data-type='method'><a href="FluroDate.html#.readableEventTime">readableEventTime</a></li><li data-type='method'><a href="FluroDate.html#.timeago">timeago</a></li><li data-type='method'><a href="FluroDate.html#.timezones">timezones</a></li></ul></li><li><a href="FluroTypes.html">FluroTypes</a><ul class='methods'><li data-type='method'><a href="FluroTypes.html#.all">all</a></li><li data-type='method'><a href="FluroTypes.html#.get">get</a></li><li data-type='method'><a href="FluroTypes.html#.readable">readable</a></li><li data-type='method'><a href="FluroTypes.html#.reloadTerminology">reloadTerminology</a></li><li data-type='method'><a href="FluroTypes.html#.retrieve">retrieve</a></li></ul></li><li><a href="FluroUtils.html">FluroUtils</a><ul class='methods'><li data-type='method'><a href="FluroUtils.html#.arrayIDs">arrayIDs</a></li><li data-type='method'><a href="FluroUtils.html#.comma">comma</a></li><li data-type='method'><a href="FluroUtils.html#.errorMessage">errorMessage</a></li><li data-type='method'><a href="FluroUtils.html#.getDefaultValueForField">getDefaultValueForField</a></li><li data-type='method'><a href="FluroUtils.html#.getStringID">getStringID</a></li><li data-type='method'><a href="FluroUtils.html#.guid">guid</a></li><li data-type='method'><a href="FluroUtils.html#.hash">hash</a></li><li data-type='method'><a href="FluroUtils.html#.mapParameters">mapParameters</a></li><li data-type='method'><a href="FluroUtils.html#.matchInArray">matchInArray</a></li></ul></li></ul>
</nav>
<div id="main">
<h1 class="page-title">FluroAPI</h1>
<section>
<header>
<h2>
FluroAPI
</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="FluroAPI"><span class="type-signature"></span>new FluroAPI<span class="signature">(fluro)</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="fluro.api.js.html">fluro.api.js</a>, <a href="fluro.api.js.html#line33">line 33</a>
</li></ul></dd>
</dl>
<div class="description">
Creates a new FluroAPI instance.
This module is a wrapper around the <a href="https://www.npmjs.com/package/axios">axios</a> package. It aims to make it easier for you to connect with and consume endpoints from the
Fluro REST API for more information about the available endpoints see <a href="https://developer.fluro.io">Fluro REST API Documentation</a>
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>//Make a request to get the current user session
fluro.api.get('/session')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});</code></pre>
<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>fluro</code></td>
<td class="type">
<span class="param-type"><a href="FluroCore.html">FluroCore</a></span>
</td>
<td class="description last">A reference to the parent instance of the FluroCore module. The FluroAPI module is usually created by a FluroCore instance that passes itself in as the first argument.</td>
</tr>
</tbody>
</table>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".delete"><span class="type-signature">(static) </span>delete<span class="signature">(path, config)</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="fluro.api.js.html">fluro.api.js</a>, <a href="fluro.api.js.html#line166">line 166</a>
</li></ul></dd>
</dl>
<div class="description">
Makes a delete http request to the Fluro REST API
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>fluro.api.delete('/content/article/5ca3d64dd2bb085eb9d450db')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});</code></pre>
<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>path</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The Fluro API endpoint to request</td>
</tr>
<tr>
<td class="name"><code>config</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Optional parameters for the request</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".get"><span class="type-signature">(static) </span>get<span class="signature">(path, config)</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="fluro.api.js.html">fluro.api.js</a>, <a href="fluro.api.js.html#line104">line 104</a>
</li></ul></dd>
</dl>
<div class="description">
Makes a get http request to the Fluro REST API
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>//Make a request to get the current user session
fluro.api.get('/content/article', {
params:{
select:'title created',
limit:10,
simple:true,
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});</code></pre>
<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>path</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The Fluro API endpoint to request</td>
</tr>
<tr>
<td class="name"><code>config</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Optional parameters for the request</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".post"><span class="type-signature">(static) </span>post<span class="signature">(path, config)</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="fluro.api.js.html">fluro.api.js</a>, <a href="fluro.api.js.html#line128">line 128</a>
</li></ul></dd>
</dl>
<div class="description">
Makes a post http request to the Fluro REST API
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>fluro.api.post('/content/article', {title:'my new article', ...}, {
//headers and other things
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});</code></pre>
<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>path</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The Fluro API endpoint to request</td>
</tr>
<tr>
<td class="name"><code>config</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Optional parameters for the request</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".put"><span class="type-signature">(static) </span>put<span class="signature">(path, config)</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="fluro.api.js.html">fluro.api.js</a>, <a href="fluro.api.js.html#line147">line 147</a>
</li></ul></dd>
</dl>
<div class="description">
Makes a put http request to the Fluro REST API
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>fluro.api.put('/content/article/5ca3d64dd2bb085eb9d450db', {title:'my new article', ...}, {
//headers and other things
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});</code></pre>
<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>path</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The Fluro API endpoint to request</td>
</tr>
<tr>
<td class="name"><code>config</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Optional parameters for the request</td>
</tr>
</tbody>
</table>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Sep 05 2019 21:42:53 GMT+1000 (Australian Eastern Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>
</body>
</html>