Skip to content

Commit f618ca2

Browse files
committed
Support image and imageList item property types
1 parent 82aef87 commit f618ca2

27 files changed

+61
-70
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,19 @@ var client = new recombee.ApiClient('--my-database-id--', '--my-secret-token--')
9393
const NUM = 100;
9494

9595
// We will use computers as items in this example
96-
// Computers have three properties
96+
// Computers have four properties
9797
// - price (floating point number)
9898
// - number of processor cores (integer number)
9999
// - description (string)
100+
// - image (url of computer's photo)
100101

101102
// Add properties of items
102-
client.send(new rqs.Batch([new rqs.ResetDatabase(), //TODO
103+
client.send(new rqs.Batch([
103104
new rqs.AddItemProperty('price', 'double'),
104105
new rqs.AddItemProperty('num-cores', 'int'),
105106
new rqs.AddItemProperty('description', 'string'),
106-
new rqs.AddItemProperty('time', 'timestamp')
107+
new rqs.AddItemProperty('time', 'timestamp'),
108+
new rqs.AddItemProperty('image', 'image')
107109
]))
108110
.then((responses) => {
109111
//Prepare requests for setting a catalog of computers
@@ -116,7 +118,8 @@ client.send(new rqs.Batch([new rqs.ResetDatabase(), //TODO
116118
'price': 600 + 400 * Math.random(),
117119
'num-cores': Math.floor(Math.random() * 8) + 1,
118120
'description': 'Great computer',
119-
'time': new Date().toISOString()
121+
'time': new Date().toISOString(),
122+
'image': `http://examplesite.com/products/computer-${i}.jpg`
120123
},
121124
//optional parameters:
122125
{

doc/AddItemProperty.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ <h5>Parameters:</h5>
128128

129129

130130

131-
<td class="description last">Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`</td>
131+
<td class="description last">Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`, `image` or `imageList`.</td>
132132
</tr>
133133

134134

@@ -455,7 +455,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AddBookma
455455
<br class="clear">
456456

457457
<footer>
458-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Feb 19 2018 17:28:03 GMT+0100 (CET)
458+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Apr 05 2018 17:17:21 GMT+0200 (CEST)
459459
</footer>
460460

461461
<script> prettyPrint(); </script>

doc/DeleteViewPortion.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ <h1 class="page-title">Class: DeleteViewPortion</h1>
3030

3131
<h2><span class="attribs"><span class="type-signature"></span></span>DeleteViewPortion<span class="signature">(userId, itemId, optional)</span><span class="type-signature"></span></h2>
3232

33-
<div class="class-description">The view portions feature is currently experimental.
34-
Deletes an existing view portion specified by (`userId`, `itemId`, `sessionId`) from the database.</div>
33+
<div class="class-description">Deletes an existing view portion specified by (`userId`, `itemId`, `sessionId`) from the database.</div>
3534

3635

3736
</header>
@@ -197,7 +196,7 @@ <h5>Parameters:</h5>
197196

198197
<dt class="tag-source">Source:</dt>
199198
<dd class="tag-source"><ul class="dummy"><li>
200-
<a href="requests_delete-view-portion.js.html">requests/delete-view-portion.js</a>, <a href="requests_delete-view-portion.js.html#line12">line 12</a>
199+
<a href="requests_delete-view-portion.js.html">requests/delete-view-portion.js</a>, <a href="requests_delete-view-portion.js.html#line11">line 11</a>
201200
</li></ul></dd>
202201

203202

@@ -303,7 +302,7 @@ <h4 class="name" id="bodyParameters"><span class="type-signature"></span>bodyPar
303302

304303
<dt class="tag-source">Source:</dt>
305304
<dd class="tag-source"><ul class="dummy"><li>
306-
<a href="requests_delete-view-portion.js.html">requests/delete-view-portion.js</a>, <a href="requests_delete-view-portion.js.html#line36">line 36</a>
305+
<a href="requests_delete-view-portion.js.html">requests/delete-view-portion.js</a>, <a href="requests_delete-view-portion.js.html#line35">line 35</a>
307306
</li></ul></dd>
308307

309308

@@ -411,7 +410,7 @@ <h4 class="name" id="queryParameters"><span class="type-signature"></span>queryP
411410

412411
<dt class="tag-source">Source:</dt>
413412
<dd class="tag-source"><ul class="dummy"><li>
414-
<a href="requests_delete-view-portion.js.html">requests/delete-view-portion.js</a>, <a href="requests_delete-view-portion.js.html#line46">line 46</a>
413+
<a href="requests_delete-view-portion.js.html">requests/delete-view-portion.js</a>, <a href="requests_delete-view-portion.js.html#line45">line 45</a>
415414
</li></ul></dd>
416415

417416

@@ -483,7 +482,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AddBookma
483482
<br class="clear">
484483

485484
<footer>
486-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Feb 19 2018 17:28:03 GMT+0100 (CET)
485+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Apr 05 2018 17:17:21 GMT+0200 (CEST)
487486
</footer>
488487

489488
<script> prettyPrint(); </script>

doc/ListItemViewPortions.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ <h1 class="page-title">Class: ListItemViewPortions</h1>
3030

3131
<h2><span class="attribs"><span class="type-signature"></span></span>ListItemViewPortions<span class="signature">(itemId)</span><span class="type-signature"></span></h2>
3232

33-
<div class="class-description">The view portions feature is currently experimental.
34-
List all the view portions of an item ever submitted by different users.</div>
33+
<div class="class-description">List all the view portions of an item ever submitted by different users.</div>
3534

3635

3736
</header>
@@ -147,7 +146,7 @@ <h5>Parameters:</h5>
147146

148147
<dt class="tag-source">Source:</dt>
149148
<dd class="tag-source"><ul class="dummy"><li>
150-
<a href="requests_list-item-view-portions.js.html">requests/list-item-view-portions.js</a>, <a href="requests_list-item-view-portions.js.html#line12">line 12</a>
149+
<a href="requests_list-item-view-portions.js.html">requests/list-item-view-portions.js</a>, <a href="requests_list-item-view-portions.js.html#line11">line 11</a>
151150
</li></ul></dd>
152151

153152

@@ -253,7 +252,7 @@ <h4 class="name" id="bodyParameters"><span class="type-signature"></span>bodyPar
253252

254253
<dt class="tag-source">Source:</dt>
255254
<dd class="tag-source"><ul class="dummy"><li>
256-
<a href="requests_list-item-view-portions.js.html">requests/list-item-view-portions.js</a>, <a href="requests_list-item-view-portions.js.html#line27">line 27</a>
255+
<a href="requests_list-item-view-portions.js.html">requests/list-item-view-portions.js</a>, <a href="requests_list-item-view-portions.js.html#line26">line 26</a>
257256
</li></ul></dd>
258257

259258

@@ -361,7 +360,7 @@ <h4 class="name" id="queryParameters"><span class="type-signature"></span>queryP
361360

362361
<dt class="tag-source">Source:</dt>
363362
<dd class="tag-source"><ul class="dummy"><li>
364-
<a href="requests_list-item-view-portions.js.html">requests/list-item-view-portions.js</a>, <a href="requests_list-item-view-portions.js.html#line37">line 37</a>
363+
<a href="requests_list-item-view-portions.js.html">requests/list-item-view-portions.js</a>, <a href="requests_list-item-view-portions.js.html#line36">line 36</a>
365364
</li></ul></dd>
366365

367366

@@ -433,7 +432,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AddBookma
433432
<br class="clear">
434433

435434
<footer>
436-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Feb 19 2018 17:28:04 GMT+0100 (CET)
435+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Apr 05 2018 17:17:21 GMT+0200 (CEST)
437436
</footer>
438437

439438
<script> prettyPrint(); </script>

doc/ListUserViewPortions.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ <h1 class="page-title">Class: ListUserViewPortions</h1>
3030

3131
<h2><span class="attribs"><span class="type-signature"></span></span>ListUserViewPortions<span class="signature">(userId)</span><span class="type-signature"></span></h2>
3232

33-
<div class="class-description">The view portions feature is currently experimental.
34-
List all the view portions ever submitted by a given user.</div>
33+
<div class="class-description">List all the view portions ever submitted by a given user.</div>
3534

3635

3736
</header>
@@ -147,7 +146,7 @@ <h5>Parameters:</h5>
147146

148147
<dt class="tag-source">Source:</dt>
149148
<dd class="tag-source"><ul class="dummy"><li>
150-
<a href="requests_list-user-view-portions.js.html">requests/list-user-view-portions.js</a>, <a href="requests_list-user-view-portions.js.html#line12">line 12</a>
149+
<a href="requests_list-user-view-portions.js.html">requests/list-user-view-portions.js</a>, <a href="requests_list-user-view-portions.js.html#line11">line 11</a>
151150
</li></ul></dd>
152151

153152

@@ -253,7 +252,7 @@ <h4 class="name" id="bodyParameters"><span class="type-signature"></span>bodyPar
253252

254253
<dt class="tag-source">Source:</dt>
255254
<dd class="tag-source"><ul class="dummy"><li>
256-
<a href="requests_list-user-view-portions.js.html">requests/list-user-view-portions.js</a>, <a href="requests_list-user-view-portions.js.html#line27">line 27</a>
255+
<a href="requests_list-user-view-portions.js.html">requests/list-user-view-portions.js</a>, <a href="requests_list-user-view-portions.js.html#line26">line 26</a>
257256
</li></ul></dd>
258257

259258

@@ -361,7 +360,7 @@ <h4 class="name" id="queryParameters"><span class="type-signature"></span>queryP
361360

362361
<dt class="tag-source">Source:</dt>
363362
<dd class="tag-source"><ul class="dummy"><li>
364-
<a href="requests_list-user-view-portions.js.html">requests/list-user-view-portions.js</a>, <a href="requests_list-user-view-portions.js.html#line37">line 37</a>
363+
<a href="requests_list-user-view-portions.js.html">requests/list-user-view-portions.js</a>, <a href="requests_list-user-view-portions.js.html#line36">line 36</a>
365364
</li></ul></dd>
366365

367366

@@ -433,7 +432,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AddBookma
433432
<br class="clear">
434433

435434
<footer>
436-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Feb 19 2018 17:28:04 GMT+0100 (CET)
435+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Apr 05 2018 17:17:22 GMT+0200 (CEST)
437436
</footer>
438437

439438
<script> prettyPrint(); </script>

doc/MergeUsers.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ <h5>Parameters:</h5>
106106

107107

108108

109-
<td class="description last">ID of the source user.</td>
109+
<td class="description last">ID of the targer user.</td>
110110
</tr>
111111

112112

@@ -129,7 +129,7 @@ <h5>Parameters:</h5>
129129

130130

131131

132-
<td class="description last">ID of the target user.</td>
132+
<td class="description last">ID of the source user.</td>
133133
</tr>
134134

135135

@@ -483,7 +483,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AddBookma
483483
<br class="clear">
484484

485485
<footer>
486-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Feb 19 2018 17:28:04 GMT+0100 (CET)
486+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Apr 05 2018 17:17:22 GMT+0200 (CEST)
487487
</footer>
488488

489489
<script> prettyPrint(); </script>

doc/SetItemValues.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AddBookma
268268
<br class="clear">
269269

270270
<footer>
271-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Feb 19 2018 17:28:04 GMT+0100 (CET)
271+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Apr 05 2018 17:17:22 GMT+0200 (CEST)
272272
</footer>
273273

274274
<script> prettyPrint(); </script>

doc/SetViewPortion.html

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ <h1 class="page-title">Class: SetViewPortion</h1>
3030

3131
<h2><span class="attribs"><span class="type-signature"></span></span>SetViewPortion<span class="signature">(userId, itemId, portion, optional)</span><span class="type-signature"></span></h2>
3232

33-
<div class="class-description">The view portions feature is currently experimental.
34-
Sets viewed portion of an item (for example a video or article) by a user (at a session).
33+
<div class="class-description">Sets viewed portion of an item (for example a video or article) by a user (at a session).
3534
If you send new request with the same (`userId`, `itemId`, `sessionId`), the portion gets updated.</div>
3635

3736

@@ -153,7 +152,7 @@ <h5>Parameters:</h5>
153152

154153

155154

156-
<td class="description last">Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ).</td>
155+
<td class="description last">Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ). It should be the really viewed part of the item, no matter seeking, so for example if the user seeked immediately to half of the item and then viewed 10% of the item, the `portion` should still be `0.1`.</td>
157156
</tr>
158157

159158

@@ -180,7 +179,7 @@ <h5>Parameters:</h5>
180179
- Allowed parameters:
181180
- *sessionId*
182181
- Type: string
183-
- Description: Id of session in which the user viewed the item
182+
- Description: ID of session in which the user viewed the item. Default is `null` (`None`, `nil`, `NULL` etc. depending on language).
184183
- *timestamp*
185184
- Type: string|number
186185
- Description: UTC timestamp of the rating as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
@@ -227,7 +226,7 @@ <h5>Parameters:</h5>
227226

228227
<dt class="tag-source">Source:</dt>
229228
<dd class="tag-source"><ul class="dummy"><li>
230-
<a href="requests_set-view-portion.js.html">requests/set-view-portion.js</a>, <a href="requests_set-view-portion.js.html#line13">line 13</a>
229+
<a href="requests_set-view-portion.js.html">requests/set-view-portion.js</a>, <a href="requests_set-view-portion.js.html#line12">line 12</a>
231230
</li></ul></dd>
232231

233232

@@ -333,7 +332,7 @@ <h4 class="name" id="bodyParameters"><span class="type-signature"></span>bodyPar
333332

334333
<dt class="tag-source">Source:</dt>
335334
<dd class="tag-source"><ul class="dummy"><li>
336-
<a href="requests_set-view-portion.js.html">requests/set-view-portion.js</a>, <a href="requests_set-view-portion.js.html#line47">line 47</a>
335+
<a href="requests_set-view-portion.js.html">requests/set-view-portion.js</a>, <a href="requests_set-view-portion.js.html#line46">line 46</a>
337336
</li></ul></dd>
338337

339338

@@ -441,7 +440,7 @@ <h4 class="name" id="queryParameters"><span class="type-signature"></span>queryP
441440

442441
<dt class="tag-source">Source:</dt>
443442
<dd class="tag-source"><ul class="dummy"><li>
444-
<a href="requests_set-view-portion.js.html">requests/set-view-portion.js</a>, <a href="requests_set-view-portion.js.html#line69">line 69</a>
443+
<a href="requests_set-view-portion.js.html">requests/set-view-portion.js</a>, <a href="requests_set-view-portion.js.html#line68">line 68</a>
445444
</li></ul></dd>
446445

447446

@@ -513,7 +512,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AddBookma
513512
<br class="clear">
514513

515514
<footer>
516-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Feb 19 2018 17:28:04 GMT+0100 (CET)
515+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Apr 05 2018 17:17:22 GMT+0200 (CEST)
517516
</footer>
518517

519518
<script> prettyPrint(); </script>

doc/requests_add-item-property.js.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ <h1 class="page-title">Source: requests/add-item-property.js</h1>
4141
/**
4242
* Construct the request
4343
* @param {string} propertyName - Name of the item property to be created. Currently, the following names are reserved:`id`, `itemid`, case insensitively. Also, the length of the property name must not exceed 63 characters.
44-
* @param {string} type - Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`
44+
* @param {string} type - Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`, `image` or `imageList`.
4545
*/
4646
constructor(propertyName, type) {
4747
super('PUT', `/items/properties/${propertyName}`, 100000, false);
@@ -87,7 +87,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AddBookma
8787
<br class="clear">
8888

8989
<footer>
90-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Feb 19 2018 17:28:03 GMT+0100 (CET)
90+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Apr 05 2018 17:17:21 GMT+0200 (CEST)
9191
</footer>
9292

9393
<script> prettyPrint(); </script>

doc/requests_delete-view-portion.js.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ <h1 class="page-title">Source: requests/delete-view-portion.js</h1>
3434
const rqs = require("./request");
3535

3636
/**
37-
* The view portions feature is currently experimental.
3837
* Deletes an existing view portion specified by (`userId`, `itemId`, `sessionId`) from the database.
3938
*/
4039
class DeleteViewPortion extends rqs.Request {
@@ -98,7 +97,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AddBookma
9897
<br class="clear">
9998

10099
<footer>
101-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Feb 19 2018 17:28:03 GMT+0100 (CET)
100+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Apr 05 2018 17:17:21 GMT+0200 (CEST)
102101
</footer>
103102

104103
<script> prettyPrint(); </script>

0 commit comments

Comments
 (0)