playbasis
Version:
Playbasis Javascript SDK
2,473 lines (818 loc) • 33.3 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Documentation Namespace: contentApi</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top ">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">Documentation</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="topNavigation">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="Playbasis.html">Playbasis</a></li><li><a href="Playbasis.authApi.html">Playbasis.authApi</a></li><li><a href="Playbasis.badgeApi.html">Playbasis.badgeApi</a></li><li><a href="Playbasis.barCode.html">Playbasis.barCode</a></li><li><a href="Playbasis.builder.html">Playbasis.builder</a></li><li><a href="Playbasis.communicationApi.html">Playbasis.communicationApi</a></li><li><a href="Playbasis.const.html">Playbasis.const</a></li><li><a href="Playbasis.contentApi.html">Playbasis.contentApi</a></li><li><a href="Playbasis.engineApi.html">Playbasis.engineApi</a></li><li><a href="Playbasis.goodsApi.html">Playbasis.goodsApi</a></li><li><a href="Playbasis.helpers.html">Playbasis.helpers</a></li><li><a href="Playbasis.http.html">Playbasis.http</a></li><li><a href="Playbasis.livefeedApi.html">Playbasis.livefeedApi</a></li><li><a href="Playbasis.merchantApi.html">Playbasis.merchantApi</a></li><li><a href="Playbasis.playerApi.html">Playbasis.playerApi</a></li><li><a href="Playbasis.pointApi.html">Playbasis.pointApi</a></li><li><a href="Playbasis.qrCode.html">Playbasis.qrCode</a></li><li><a href="Playbasis.questApi.html">Playbasis.questApi</a></li><li><a href="Playbasis.quizApi.html">Playbasis.quizApi</a></li><li><a href="Playbasis.redeemApi.html">Playbasis.redeemApi</a></li><li><a href="Playbasis.serviceApi.html">Playbasis.serviceApi</a></li><li><a href="Playbasis.storeOrganizeApi.html">Playbasis.storeOrganizeApi</a></li><li><a href="Playbasis.util.html">Playbasis.util</a></li>
</ul>
</li>
</ul>
<div class="col-sm-3 col-md-3">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
<div class="input-group-btn">
<button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container" id="toc-content">
<div class="row">
<div class="col-md-8">
<div id="main">
<h1 class="page-title">Namespace: contentApi</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="Playbasis.html">Playbasis</a>.</span>
contentApi
</h2>
</header>
<article>
<div class="container-overview">
<div class="description"><p>Playbasis Content Organize API</p></div>
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<dl>
<hr>
<dt>
<h4 class="name" id=".countContent"><span class="type-signature"><static> </span>countContent(options)</h4>
</dt>
<dd>
<div class="description">
<p>Count content(s) by specified filter fields.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<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"><p>(<strong>optional</strong>) options as object.<br>
It can include<br>
{<br>
<code>title</code>: <em>String</em> = filter title of content<br>
<code>category</code>: <em>String</em> = filter by category of content<br>
<code>date_check</code>: *String = "true" | "false" whether or not to return content that is available in this range<br>
<code>pin</code>: <em>String</em> = secret PIN given to content<br>
<code>tags: *String* = tags to filter content</code>status<code>: *String* = filter by status of content to find. Possible values are "true" | "false" | "all". Default value is "true".</code>player_id<code>: *String* = filter by player id associated with content</code>only_new_content<code>: *String* = "true" to display content which player does not provide any action (like/dislike) yet | "false" to display content which player has already provided an action (like/dislike)</code>only_new_feedback`: <em>String</em> = "true" to display content which player does not give feedback yet | "false" to display content which player has given the feedback<br>
}</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise object</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".createCategory"><span class="type-signature"><static> </span>createCategory(name)</h4>
</dt>
<dd>
<div class="description">
<p>Create content category.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>name of category</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise object</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".createContent"><span class="type-signature"><static> </span>createContent(title, summary, detail, options)</h4>
</dt>
<dd>
<div class="description">
<p>Create content.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>title</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>title of content</p></td>
</tr>
<tr>
<td class="name"><code>summary</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>summary of content</p></td>
</tr>
<tr>
<td class="name"><code>detail</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>detail of content</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>(<strong>optional</strong>) options as object.<br>
It can include<br>
{<br>
<code>node_id</code>: <em>String</em> = node id of content<br>
<code>category</code>: <em>String</em> = category of content to be in<br>
<code>image</code>: <em>String</em> = url to the content profile image<br>
<code>status</code>: <em>String</em> = content available status which can be "true" | "false"<br>
<code>date_start</code>: <em>String</em> = date start in format YYYY-MM-DD (ex.1982-09-29)<br>
<code>date_end</code>: <em>String</em> = date end in format YYYY-MM-DD (ex.1982-09-29)
<code>player_id</code>: <em>String</em> = player id who generated this content<br>
<code>pin</code>: <em>String</em> = secret PIN given to content<br>
<code>tags: *String* = tag(s) to add to this content</code>key<code>: *String* = custom keys separated by comma</code>value`: <em>String</em> = custom values separated by comma<br>
}</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise object</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".deleteCategory"><span class="type-signature"><static> </span>deleteCategory(id)</h4>
</dt>
<dd>
<div class="description">
<p>Delete content category.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<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"><p>category id</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise object</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".deleteContent"><span class="type-signature"><static> </span>deleteContent(nodeId)</h4>
</dt>
<dd>
<div class="description">
<p>Delete existing content</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>nodeId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>node id of content</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise object</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".dislikeContent"><span class="type-signature"><static> </span>dislikeContent(nodeId, playerId, options)</h4>
</dt>
<dd>
<div class="description">
<p>Send action dislike for player to content.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>nodeId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>node id of content</p></td>
</tr>
<tr>
<td class="name"><code>playerId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>player id to like content</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>(<strong>optional</strong>) options as object.<br>
It can include<br>
{<br>
<code>key</code>: <em>String</em> = custom keys separated by comma<br>
<code>value</code>: <em>String</em> = custom values separated by comma<br>
}</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise object</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".giveFeedbackContent"><span class="type-signature"><static> </span>giveFeedbackContent(nodeId, playerId, feedback, options)</h4>
</dt>
<dd>
<div class="description">
<p>Give feedback to content for player.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>nodeId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>node id of content</p></td>
</tr>
<tr>
<td class="name"><code>playerId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>player id to like content</p></td>
</tr>
<tr>
<td class="name"><code>feedback</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>feedback to give to content</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>(<strong>optional</strong>) options as object.<br>
It can include<br>
{<br>
<code>key</code>: <em>String</em> = custom keys separated by comma<br>
<code>value</code>: <em>String</em> = custom values separated by comma<br>
}</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise object</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".likeContent"><span class="type-signature"><static> </span>likeContent(nodeId, playerId, options)</h4>
</dt>
<dd>
<div class="description">
<p>Send action like for player to content.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>nodeId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>node id of content</p></td>
</tr>
<tr>
<td class="name"><code>playerId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>player id to like content</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>(<strong>optional</strong>) options as object.<br>
It can include<br>
{<br>
<code>key</code>: <em>String</em> = custom keys separated by comma<br>
<code>value</code>: <em>String</em> = custom values separated by comma<br>
}</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise object</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".retrieveCategory"><span class="type-signature"><static> </span>retrieveCategory(options)</h4>
</dt>
<dd>
<div class="description">
<p>Retrieve category by specified filter fields.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<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"><p>(<strong>optional</strong>) options as object.<br>
It can include<br>
{<br>
<code>id</code>: <em>String</em> = specific id of category<br>
<code>name</code>: <em>String</em> = specific name of category<br>
<code>sort</code>: <em>String</em> = specific field to sort "_id" | "name" | "date_added" | "date_modified"
<code>order</code>: <em>String</em> = direction of order "asc" | "desc"<br>
<code>offset</code>: <em>Number</em> = number of starting records
<code>limit</code>: <em>Number</em> = number of results to return<br>
}</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise object</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".retrieveContent"><span class="type-signature"><static> </span>retrieveContent(options)</h4>
</dt>
<dd>
<div class="description">
<p>Retrieve content(s) by specified filter fields</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<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"><p>(<strong>optional</strong>) options as object.<br>
It can include<br>
{<br>
<code>node_id</code>: <em>String</em> = filter by node id of content<br>
<code>title</code>: <em>String</em> = filter title of content<br>
<code>category</code>: <em>String</em> = filter by category of content<br>
<code>date_check</code>: *String = "true" | "false" whether or not to return content that is available in this range<br>
<code>sort</code>: <em>String</em> = field to sort. It can be "title" | "date_start" | "date_end" | "date_added" | "date_modified" | "random" | "followup" | "action"<br>
<code>order</code>: <em>String</em> = direction of order results which can be "asc" | "desc". If sort is "random", then this field will be seed number.<br>
<code>offset</code>: <em>Number</em> = offset of starting returned records. Default is 0.<br>
<code>limit</code>: <em>Number</em> = Number of results to return. Default is 20.<br>
<code>full_html</code>: <em>String</em> = "true" | "false" whether or not to return full html<br>
<code>pin</code>: <em>String</em> = secret PIN given to content<br>
<code>tags: *String* = tags to filter content</code>status<code>: *String* = filter by status of content to find. Possible values are "true" | "false" | "all". Default value is "true".</code>player_id<code>: *String* = filter by player id associated with content</code>only_new_content<code>: *String* = "true" to display content which player does not provide any action (like/dislike) yet | "false" to display content which player has already provided an action (like/dislike)</code>only_new_feedback`: <em>String</em> = "true" to display content which player does not give feedback yet | "false" to display content which player has given the feedback<br>
}</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise object</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".updateCategory"><span class="type-signature"><static> </span>updateCategory(id, name)</h4>
</dt>
<dd>
<div class="description">
<p>Update content category.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<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"><p>category id</p></td>
</tr>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>category name to update</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise object</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".updateContent"><span class="type-signature"><static> </span>updateContent(nodeId, updates)</h4>
</dt>
<dd>
<div class="description">
<p>Update content by content id</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>nodeId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>node id of content</p></td>
</tr>
<tr>
<td class="name"><code>updates</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>updates as object.<br>
It can include<br>
{<br>
<code>title</code>: <em>String</em> = title of content<br>
<code>summary</code>: <em>String</em> = summary of content<br>
<code>detail</code>: <em>String</em> = detail of content<br>
<code>category</code>: <em>String</em> = category of content to be in<br>
<code>image</code>: <em>String</em> = url to the content profile image<br>
<code>status</code>: <em>String</em> = content available status which can be "true" | "false"<br>
<code>date_start</code>: <em>String</em> = date start in format YYYY-MM-DD (ex.1982-09-29)<br>
<code>date_end</code>: <em>String</em> = date end in format YYYY-MM-DD (ex.1982-09-29)
<code>pin</code>: <em>String</em> = secret PIN given to content<br>
<code>tags: *String* = tag(s) to add to this content</code>key<code>: *String* = custom keys separated by comma</code>value`: <em>String</em> = custom values separated by comma<br>
}</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise object</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-3">
<div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div>
</div>
</div>
</div>
<div class="modal fade" id="searchResults">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Search results</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<footer>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.2</a>
on August 23rd 2019, 1:59:06 pm
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
</footer>
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/toc.js"></script>
<script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
<script>
$( function () {
$( "[id*='$']" ).each( function () {
var $this = $( this );
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
} );
$( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
var $this = $( this );
var example = $this.find( "code" );
exampleText = example.html();
var lang = /{@lang (.*?)}/.exec( exampleText );
if ( lang && lang[1] ) {
exampleText = exampleText.replace( lang[0], "" );
example.html( exampleText );
lang = lang[1];
} else {
var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
lang = langClassMatch ? langClassMatch[1] : "javascript";
}
if ( lang ) {
$this
.addClass( "sunlight-highlight-" + lang )
.addClass( "linenums" )
.html( example.html() );
}
} );
Sunlight.highlightAll( {
lineNumbers : true,
showMenu : true,
enableDoclinks : true
} );
$.catchAnchorLinks( {
navbarOffset: 10
} );
$( "#toc" ).toc( {
anchorName : function ( i, heading, prefix ) {
return $( heading ).attr( "id" ) || ( prefix + i );
},
selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
showAndHide : false,
smoothScrolling: true
} );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
$( '.dropdown-toggle' ).dropdown();
$( "table" ).each( function () {
var $this = $( this );
$this.addClass('table');
} );
} );
</script>
<!--Navigation and Symbol Display-->
<!--Google Analytics-->
<script type="text/javascript">
$(document).ready(function() {
SearcherDisplay.init();
});
</script>
</body>
</html>