fluro
Version:
Promise based HTTP Fluro client for the browser and node.js
2,076 lines (542 loc) • 28 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>types - 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">
<script src="scripts/nav.js" defer></script>
<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="access.html">access</a></li><li><a href="api.html">api</a></li><li><a href="asset.html">asset</a></li><li><a href="auth.html">auth</a></li><li><a href="cache.html">cache</a></li><li><a href="components.html">components</a></li><li><a href="fluro.html">fluro</a></li><li><a href="fluro.content.html">content</a><ul class='methods'><li data-type='method'><a href="fluro.content.html#.duplicate">duplicate</a></li><li data-type='method'><a href="fluro.content.html#.external">external</a></li><li data-type='method'><a href="fluro.content.html#.form">form</a></li><li data-type='method'><a href="fluro.content.html#.get">get</a></li><li data-type='method'><a href="fluro.content.html#.keys">keys</a></li><li data-type='method'><a href="fluro.content.html#.query">query</a></li><li data-type='method'><a href="fluro.content.html#.related">related</a></li><li data-type='method'><a href="fluro.content.html#.retrieve">retrieve</a></li><li data-type='method'><a href="fluro.content.html#.slug">slug</a></li><li data-type='method'><a href="fluro.content.html#.submitInteraction">submitInteraction</a></li><li data-type='method'><a href="fluro.content.html#.submitPost">submitPost</a></li><li data-type='method'><a href="fluro.content.html#.thread">thread</a></li><li data-type='method'><a href="fluro.content.html#.values">values</a></li></ul></li><li><a href="fluro.date.html">date</a><ul class='methods'><li data-type='method'><a href="fluro.date.html#.countdown">countdown</a></li><li data-type='method'><a href="fluro.date.html#.dateFromID">dateFromID</a></li><li data-type='method'><a href="fluro.date.html#.formatDate">formatDate</a></li><li data-type='method'><a href="fluro.date.html#.getAge">getAge</a></li><li data-type='method'><a href="fluro.date.html#.groupEventByDate">groupEventByDate</a></li><li data-type='method'><a href="fluro.date.html#.isDifferentTimezoneThanUser">isDifferentTimezoneThanUser</a></li><li data-type='method'><a href="fluro.date.html#.isMultiDayEvent">isMultiDayEvent</a></li><li data-type='method'><a href="fluro.date.html#.localDate">localDate</a></li><li data-type='method'><a href="fluro.date.html#.readableEventDate">readableEventDate</a></li><li data-type='method'><a href="fluro.date.html#.readableEventTime">readableEventTime</a></li><li data-type='method'><a href="fluro.date.html#.timeago">timeago</a></li><li data-type='method'><a href="fluro.date.html#.timeline">timeline</a></li><li data-type='method'><a href="fluro.date.html#.timestampToAmPm">timestampToAmPm</a></li><li data-type='method'><a href="fluro.date.html#.timezones">timezones</a></li></ul></li><li><a href="fluro.types.html">types</a><ul class='methods'><li data-type='method'><a href="fluro.types.html#.all">all</a></li><li data-type='method'><a href="fluro.types.html#.basicTypes">basicTypes</a></li><li data-type='method'><a href="fluro.types.html#.get">get</a></li><li data-type='method'><a href="fluro.types.html#.mapDefinitionItems">mapDefinitionItems</a></li><li data-type='method'><a href="fluro.types.html#.parentType">parentType</a></li><li data-type='method'><a href="fluro.types.html#.postableTypes">postableTypes</a></li><li data-type='method'><a href="fluro.types.html#.readable">readable</a></li><li data-type='method'><a href="fluro.types.html#.reloadTerminology">reloadTerminology</a></li><li data-type='method'><a href="fluro.types.html#.retrieve">retrieve</a></li><li data-type='method'><a href="fluro.types.html#.subTypes">subTypes</a></li><li data-type='method'><a href="fluro.types.html#.term">term</a></li></ul></li><li><a href="fluro.utils.html">utils</a><ul class='methods'><li data-type='method'><a href="fluro.utils.html#.arrayIDs">arrayIDs</a></li><li data-type='method'><a href="fluro.utils.html#.comma">comma</a></li><li data-type='method'><a href="fluro.utils.html#.currencySymbol">currencySymbol</a></li><li data-type='method'><a href="fluro.utils.html#.errorMessage">errorMessage</a></li><li data-type='method'><a href="fluro.utils.html#.formatCurrency">formatCurrency</a></li><li data-type='method'><a href="fluro.utils.html#.getDefaultValueForField">getDefaultValueForField</a></li><li data-type='method'><a href="fluro.utils.html#.getFlattenedFields">getFlattenedFields</a></li><li data-type='method'><a href="fluro.utils.html#.getStringID">getStringID</a></li><li data-type='method'><a href="fluro.utils.html#.guid">guid</a></li><li data-type='method'><a href="fluro.utils.html#.hash">hash</a></li><li data-type='method'><a href="fluro.utils.html#.injectScript">injectScript</a></li><li data-type='method'><a href="fluro.utils.html#.machineName">machineName</a></li><li data-type='method'><a href="fluro.utils.html#.mapParameters">mapParameters</a></li><li data-type='method'><a href="fluro.utils.html#.matchInArray">matchInArray</a></li><li data-type='method'><a href="fluro.utils.html#.processCardPrioritySort">processCardPrioritySort</a></li></ul></li><li><a href="fluro.video.html">video</a><ul class='methods'><li data-type='method'><a href="fluro.video.html#.hhmmss">hhmmss</a></li><li data-type='method'><a href="fluro.video.html#.readableMilliseconds">readableMilliseconds</a></li><li data-type='method'><a href="fluro.video.html#.readableSeconds">readableSeconds</a></li></ul></li></ul>
</nav>
<div id="main">
<h1 class="page-title">types</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="fluro.html">fluro</a>.</span>
types
</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="types"><span class="type-signature"></span>new types<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.types.js.html">fluro.types.js</a>, <a href="fluro.types.js.html#line13">line 13</a>
</li></ul></dd>
</dl>
<div class="description">
Creates a new FluroTypes service
This module provides a number of helpful functions for retrieving, translating and understanding types, schemas and definitions
that are defined within Fluro
</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>fluro</code></td>
<td class="type">
<span class="param-type">FluroCore</span>
</td>
<td class="description last">A reference to the parent instance of the FluroCore module. This 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">Members</h3>
<h4 class="name" id=".terms"><span class="type-signature">(static) </span>terms<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.types.js.html">fluro.types.js</a>, <a href="fluro.types.js.html#line309">line 309</a>
</li></ul></dd>
</dl>
<div class="description">
Retrieves all definitions available in the current account. Useful for making one request and caching
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".all"><span class="type-signature">(static) </span>all<span class="signature">(options)</span><span class="type-signature"> → {promise}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="fluro.types.js.html">fluro.types.js</a>, <a href="fluro.types.js.html#line280">line 280</a>
</li></ul></dd>
</dl>
<div class="description">
Retrieves all definitions available in the current account. Useful for making one request and caching
</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">object</span>
</td>
<td class="description last">extra options for the request</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
An promise that will resolve to the array of definitions
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">promise</span>
</dd>
</dl>
<h4 class="name" id=".basicTypes"><span class="type-signature">(static) </span>basicTypes<span class="signature">()</span><span class="type-signature"> → {Array}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="fluro.types.js.html">fluro.types.js</a>, <a href="fluro.types.js.html#line530">line 530</a>
</li></ul></dd>
</dl>
<div class="description">
Retrieve an array of all basic types
</div>
<h5>Returns:</h5>
<div class="param-desc">
eg. 'service', 'concert', 'conference'
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id=".get"><span class="type-signature">(static) </span>get<span class="signature">(definedName, options)</span><span class="type-signature"> → {promise}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="fluro.types.js.html">fluro.types.js</a>, <a href="fluro.types.js.html#line198">line 198</a>
</li></ul></dd>
</dl>
<div class="description">
Retrieves a specified definition or primitive type object
</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>definedName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The definition or type name you want to retrieve</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">extra options for the request</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
An promise that will resolve to the type definition from Fluro
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">promise</span>
</dd>
</dl>
<h4 class="name" id=".mapDefinitionItems"><span class="type-signature">(static) </span>mapDefinitionItems<span class="signature">(array, baseType)</span><span class="type-signature"> → {Array}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="fluro.types.js.html">fluro.types.js</a>, <a href="fluro.types.js.html#line234">line 234</a>
</li></ul></dd>
</dl>
<div class="description">
A helpful function for mapping an array of items into a grouped array broken up by definition
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>//Returns {something:[{title:'Demographic', plural:'Demographics', key:'demographic', entries:[{...},{...}]}]}
fluro.types.mapDefinitionItems([{title:'test', definition:'demographic'}], 'tag');</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>array</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">An array of content items</td>
</tr>
<tr>
<td class="name"><code>baseType</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The default base type to map, eg. 'tag', 'contact', 'event'</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
A mapped array broken up by definition
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id=".parentType"><span class="type-signature">(static) </span>parentType<span class="signature">(definitionName)</span><span class="type-signature"> → {String}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="fluro.types.js.html">fluro.types.js</a>, <a href="fluro.types.js.html#line510">line 510</a>
</li></ul></dd>
</dl>
<div class="description">
Input a definition name or basic type and receive the most basic _type of that definition
</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>definitionName</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The definition or _type</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
Eg. 'photo', 'service', or 'song'...
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id=".postableTypes"><span class="type-signature">(static) </span>postableTypes<span class="signature">(definitionName, options)</span><span class="type-signature"> → {Array}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="fluro.types.js.html">fluro.types.js</a>, <a href="fluro.types.js.html#line663">line 663</a>
</li></ul></dd>
</dl>
<div class="description">
Input a definition name or basic type and receive the most basic _type of that definition
</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>definitionName</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The definition or _type</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Extra options</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
an array of definitions that can be posted
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id=".readable"><span class="type-signature">(static) </span>readable<span class="signature">(definitionName, plural)</span><span class="type-signature"> → {String}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="fluro.types.js.html">fluro.types.js</a>, <a href="fluro.types.js.html#line466">line 466</a>
</li></ul></dd>
</dl>
<div class="description">
Input a definition name or basic type and receive the human readable version of that type
</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>definitionName</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The definition or _type</td>
</tr>
<tr>
<td class="name"><code>plural</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="description last">Whether to return it's plural version</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
Eg. 'Audio', 'Detail Sheet', or 'Events'...
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id=".reloadTerminology"><span class="type-signature">(static) </span>reloadTerminology<span class="signature">()</span><span class="type-signature"> → {promise}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="fluro.types.js.html">fluro.types.js</a>, <a href="fluro.types.js.html#line381">line 381</a>
</li></ul></dd>
</dl>
<div class="description">
Retrieves a glossary of glossary for readable definition titles and plurals
</div>
<h5>Returns:</h5>
<div class="param-desc">
An promise that will resolve to the matching basic types or reject with the responding error
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">promise</span>
</dd>
</dl>
<h4 class="name" id=".retrieve"><span class="type-signature">(static) </span>retrieve<span class="signature">(types)</span><span class="type-signature"> → {promise}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="fluro.types.js.html">fluro.types.js</a>, <a href="fluro.types.js.html#line738">line 738</a>
</li></ul></dd>
</dl>
<div class="description">
Retrieves a list of specified types and their respective definitions
</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>types</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last">The names of the basic types you want to retrieve</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
An promise that will resolve to the matching basic types or reject with the responding error
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">promise</span>
</dd>
</dl>
<h4 class="name" id=".subTypes"><span class="type-signature">(static) </span>subTypes<span class="signature">(definitionName, includeBasicType)</span><span class="type-signature"> → {Array}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="fluro.types.js.html">fluro.types.js</a>, <a href="fluro.types.js.html#line547">line 547</a>
</li></ul></dd>
</dl>
<div class="description">
Input a definition name or basic type and receive the most basic _type of that definition
</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>definitionName</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The basic _type</td>
</tr>
<tr>
<td class="name"><code>includeBasicType</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="description last">Whether to include the basic type definition in the results</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
eg. 'service', 'concert', 'conference'
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id=".term"><span class="type-signature">(static) </span>term<span class="signature">(definitionName)</span><span class="type-signature"> → {Object}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="fluro.types.js.html">fluro.types.js</a>, <a href="fluro.types.js.html#line495">line 495</a>
</li></ul></dd>
</dl>
<div class="description">
Input a definition name or basic type and receive the basic details about that definition
</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>definitionName</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The definition or _type</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
The details about this definition as defined in the glossary
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Aug 06 2020 08:07:22 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>