UNPKG

fluro

Version:

Promise based HTTP Fluro client for the browser and node.js

3,261 lines (931 loc) 46.1 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>content - 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">content</h1> <section> <header> <h2> <span class="ancestors"><a href="fluro.html">fluro</a>.</span> content </h2> </header> <article> <div class="container-overview"> <h4 class="name" id="content"><span class="type-signature"></span>new content<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.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line19">line 19</a> </li></ul></dd> </dl> <div class="description"> Creates a new FluroContent instance. This module provides a number of helper functions for Creating, Reading, Updating and Deleting content via the Fluro API </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=".mention"><span class="type-signature">(static) </span>mention<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.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line217">line 217</a> </li></ul></dd> </dl> <div class="description"> Runs a search from the Fluro server for a specific mentionable user </div> <h5>Example</h5> <pre class="prettyprint"><code>fluro.content.mention('john.smith', {limit:5}, config).then(function(results) { //Will return a nested array with up to 5 personas })</code></pre> <h4 class="name" id=".search"><span class="type-signature">(static) </span>search<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.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line60">line 60</a> </li></ul></dd> </dl> <div class="description"> Runs a search from the Fluro server and returns the results </div> <h5>Example</h5> <pre class="prettyprint"><code>fluro.content.search('Wonder', {limit:5, types:['song', 'album', 'tag']}).then(function(results) { //Will return a nested array with up to 5 results for each type //[{_type:'Song', results:[{title:"Wonder"...}]}, {_type:'Album', results:[{title:"Wonder"...}]}] }) fluro.content.search('Wonder', {limit:5}).then(function(results) { //Will return an array of up to 5 items the user has access to view that match the search terms //[{title:"Wonder", _type:'article', definition:'song'...}, {title:"Wonder", _type:'article', definition:'album'...}] })</code></pre> <h4 class="name" id=".type"><span class="type-signature">(static) </span>type<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.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line139">line 139</a> </li></ul></dd> </dl> <div class="description"> Retrieves a specific definition or data type </div> <h5>Example</h5> <pre class="prettyprint"><code>fluro.content.type('song', options, config).then(function(definition) { //Will return the definition })</code></pre> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".duplicate"><span class="type-signature">(static) </span>duplicate<span class="signature">(item)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line969">line 969</a> </li></ul></dd> </dl> <div class="description"> This function creates a clean copy of a specified content item </div> <h5>Example</h5> <pre class="prettyprint"><code>fluro.content.duplicate({_id:'5be504eabf33991239599d63'}) .then(function(freshItem) { //Fresh item is a cleaned duplicate of the original item })</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>item</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">The ID or object representing the item you want to duplicate</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that will be resolved with a cleaned duplicate of the original item </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".external"><span class="type-signature">(static) </span>external<span class="signature">(externalID, params)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line409">line 409</a> </li></ul></dd> </dl> <div class="description"> This function returns a single populated item by providing its _external id </div> <h5>Example</h5> <pre class="prettyprint"><code>//Retrieve just the title for item with external id that matches '5be504-eabf33991-239599-d63' fluro.content.external('5be504-eabf33991-239599-d63', {select:'title'})</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>externalID</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The item's _external id property</td> </tr> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Extra query string parameters for the request</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that will be resolved with the item or an error </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".form"><span class="type-signature">(static) </span>form<span class="signature">(id, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line603">line 603</a> </li></ul></dd> </dl> <div class="description"> This function returns an interaction definition via the public 'form' API endpoint This will only result successfully if the definition requested has the definition of 'form' and has the status of 'active' </div> <h5>Example</h5> <pre class="prettyprint"><code>//Retrieve a form ('58dca23c21428d2d045a1cf7') in testing mode fluro.content.form('58dca23c21428d2d045a1cf7', {testing:true})</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>id</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The id of the form 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 <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>testing</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Whether to load the form in testing mode or not</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that will be resolved with the form or an error </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".get"><span class="type-signature">(static) </span>get<span class="signature">(id, params)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line352">line 352</a> </li></ul></dd> </dl> <div class="description"> This function returns a single populated item by providing its _id </div> <h5>Example</h5> <pre class="prettyprint"><code>//Retrieve just the title for item '5be504eabf33991239599d63' fluro.content.get('5be504eabf33991239599d63', {select:'title'})</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>id</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The item's _id</td> </tr> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Extra query string parameters for the request</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that will be resolved with the item or an error </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".keys"><span class="type-signature">(static) </span>keys<span class="signature">(ids, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line915">line 915</a> </li></ul></dd> </dl> <div class="description"> This function makes it easy to retrieve all distinct keys for a specified selection of ids </div> <h5>Example</h5> <pre class="prettyprint"><code>fluro.content.keys(['5be504eabf33991239599d63']).then(function(values) { //Would return ['firstName', 'lastName', 'title', 'tags', 'realms'] })</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>ids</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last">The ids you want to retrieve keys for</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 and query parameters for the http request</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that will be resolved with an array of possible keys </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".query"><span class="type-signature">(static) </span>query<span class="signature">(queryID, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line291">line 291</a> </li></ul></dd> </dl> <div class="description"> A helper function for retrieving the results of a specified query </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>queryID</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The id of the query you want to run</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">The options for the query <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">The query string parameters for the query that will be mapped ?one=value&two=value</td> </tr> <tr> <td class="name"><code>variables</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Any query variables you wish to inject each key will be mapped ?variables[key]=value</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that will be resolved with the results or an error </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".related"><span class="type-signature">(static) </span>related<span class="signature">(id, params)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line542">line 542</a> </li></ul></dd> </dl> <div class="description"> This function returns a list of related items That either reference the specified item or are referenced by the provided item </div> <h5>Example</h5> <pre class="prettyprint"><code>//Retrieve some related items for '5be504eabf33991239599d63' fluro.content.related('5be504eabf33991239599d63', {select:'title'})</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>id</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The item to find related content for</td> </tr> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Extra query string parameters for the request</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that will be resolved with an array of related items </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">(criteria, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line496">line 496</a> </li></ul></dd> </dl> <div class="description"> A helper function for retrieving the results of a dynamic query </div> <h5>Example</h5> <pre class="prettyprint"><code>//Find all events that have a status of active or archived where the endDate is greater than or equal to now and return the titles fluro.content.retrieve({_type:'event', status:{$in:['active', 'archived']}, endDate:{$gte:"date('now')"}}}, {select:'title'})</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>criteria</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">The query criteria</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 and parameters</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that will be resolved with the results or an error </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".slug"><span class="type-signature">(static) </span>slug<span class="signature">(slug, params)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line452">line 452</a> </li></ul></dd> </dl> <div class="description"> This function returns a single populated item by providing its slug </div> <h5>Example</h5> <pre class="prettyprint"><code>//Retrieve just the title for item with the slug 'my-article' fluro.content.slug('my-article', {select:'title'})</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>slug</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The item's slug value</td> </tr> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Extra query string parameters for the request</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that will be resolved with the item or an error </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".submitInteraction"><span class="type-signature">(static) </span>submitInteraction<span class="signature">(definitionName, data, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line661">line 661</a> </li></ul></dd> </dl> <div class="description"> This function makes it easy to submit form interactions via the Fluro API </div> <h5>Example</h5> <pre class="prettyprint"><code>//Retrieve some related items for '5be504eabf33991239599d63' fluro.content.submitInteraction('5be504eabf33991239599d63', 'comment', {data:{customField:'My message'}}, {reply:'5be504eabf33991239599d63'})</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>definitionName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the definition of the form you want to submit eg. 'supportRequest' or 'contactUs'...</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 interaction data to submit</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 <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>reply</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">The id of the post to reply to (If threaded conversation)</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that will be resolved with an array of related items </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".submitPost"><span class="type-signature">(static) </span>submitPost<span class="signature">(target, definitionName, data, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line704">line 704</a> </li></ul></dd> </dl> <div class="description"> This function makes it easy to create and attach a post to a specified piece of fluro content </div> <h5>Example</h5> <pre class="prettyprint"><code>//Retrieve some related items for '5be504eabf33991239599d63' fluro.content.submitPost('5be504eabf33991239599d63', 'comment', {data:{customField:'My message'}}, {reply:'5be504eabf33991239599d63'})</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>target</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The ID of the item to attach this post to</td> </tr> <tr> <td class="name"><code>definitionName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the definition type of the post you want to create eg. 'note' or 'comment'...</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 post content to create</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 <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>reply</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">The id of the post to reply to (If threaded conversation)</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that will be resolved with an array of related items </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".thread"><span class="type-signature">(static) </span>thread<span class="signature">(target, definitionName, data, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line751">line 751</a> </li></ul></dd> </dl> <div class="description"> This function makes it easy to retrieve the current thread of posts attached to a specific item </div> <h5>Example</h5> <pre class="prettyprint"><code>//Retrieve the current post thread of all 'comments' attached to a specific content fluro.content.thread('5be504eabf33991239599d63', 'comment', {data:{customField:'My message'}}, {reply:'5be504eabf33991239599d63'})</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>target</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The ID of the item to attach this post to</td> </tr> <tr> <td class="name"><code>definitionName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the definition type of the post you want to create eg. 'note' or 'comment'...</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 post content to create</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 <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>reply</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">The id of the post to reply to (If threaded conversation)</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that will be resolved with an array of related items </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".values"><span class="type-signature">(static) </span>values<span class="signature">(ids, key)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.content.js.html">fluro.content.js</a>, <a href="fluro.content.js.html#line799">line 799</a> </li></ul></dd> </dl> <div class="description"> This function makes it easy to retrieve all distinct values for a specified field key for a specified subset of items from the server, for instance if you wanted to retrieve all possible 'firstName' values from a selection of content ids </div> <h5>Example</h5> <pre class="prettyprint"><code>fluro.content.values(['5be504eabf33991239599d63'], 'firstName').then(function(values) { //Would return ['Frank', 'Lucy', 'Marissa'] })</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>ids</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last">The ids you want to retrieve values for</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 key of the field you want to retrieve the values for</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that will be resolved with an array of possible values </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</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>