recombee-api-client 4.1.5 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/index.js +1 -1
  2. package/lib/api-client.js +15 -12
  3. package/lib/errors/index.js +1 -1
  4. package/lib/index.d.ts +132 -179
  5. package/lib/requests/add-bookmark.js +1 -1
  6. package/lib/requests/add-cart-addition.js +1 -1
  7. package/lib/requests/add-detail-view.js +1 -1
  8. package/lib/requests/add-item-property.js +1 -1
  9. package/lib/requests/add-item.js +1 -1
  10. package/lib/requests/add-purchase.js +1 -1
  11. package/lib/requests/add-rating.js +1 -1
  12. package/lib/requests/add-series.js +12 -2
  13. package/lib/requests/add-user-property.js +1 -1
  14. package/lib/requests/add-user.js +1 -1
  15. package/lib/requests/delete-bookmark.js +1 -1
  16. package/lib/requests/delete-cart-addition.js +1 -1
  17. package/lib/requests/delete-detail-view.js +1 -1
  18. package/lib/requests/delete-item.js +1 -1
  19. package/lib/requests/delete-purchase.js +1 -1
  20. package/lib/requests/delete-rating.js +1 -1
  21. package/lib/requests/delete-series.js +12 -2
  22. package/lib/requests/delete-user.js +1 -1
  23. package/lib/requests/delete-view-portion.js +1 -1
  24. package/lib/requests/get-item-property-info.js +1 -1
  25. package/lib/requests/get-item-values.js +1 -1
  26. package/lib/requests/get-user-values.js +1 -1
  27. package/lib/requests/index.js +1 -6
  28. package/lib/requests/insert-to-series.js +2 -2
  29. package/lib/requests/list-items.js +2 -2
  30. package/lib/requests/list-users.js +2 -2
  31. package/lib/requests/recommend-item-segments-to-item-segment.js +2 -2
  32. package/lib/requests/recommend-item-segments-to-item.js +2 -2
  33. package/lib/requests/recommend-item-segments-to-user.js +2 -2
  34. package/lib/requests/recommend-items-to-item-segment.js +214 -0
  35. package/lib/requests/recommend-items-to-item.js +2 -2
  36. package/lib/requests/recommend-items-to-user.js +2 -2
  37. package/lib/requests/recommend-next-items.js +4 -3
  38. package/lib/requests/recommend-users-to-item.js +2 -2
  39. package/lib/requests/recommend-users-to-user.js +2 -2
  40. package/lib/requests/remove-from-series.js +4 -7
  41. package/lib/requests/request.js +1 -1
  42. package/lib/requests/search-items.js +2 -2
  43. package/lib/requests/set-view-portion.js +1 -1
  44. package/lib/requests/update-more-items.js +1 -1
  45. package/package.json +8 -5
  46. package/test/add-bookmark-batch_test.js +2 -4
  47. package/test/add-bookmark-callback_test.js +0 -15
  48. package/test/add-bookmark-test.js +0 -17
  49. package/test/add-cart-addition-batch_test.js +2 -4
  50. package/test/add-cart-addition-callback_test.js +0 -15
  51. package/test/add-cart-addition-test.js +0 -17
  52. package/test/add-detail-view-batch_test.js +2 -4
  53. package/test/add-detail-view-callback_test.js +0 -15
  54. package/test/add-detail-view-test.js +0 -17
  55. package/test/add-purchase-batch_test.js +2 -4
  56. package/test/add-purchase-callback_test.js +0 -15
  57. package/test/add-purchase-test.js +0 -17
  58. package/test/add-rating-batch_test.js +2 -4
  59. package/test/add-rating-callback_test.js +0 -15
  60. package/test/add-rating-test.js +0 -17
  61. package/test/list-items-batch_test.js +1 -1
  62. package/test/list-items-callback_test.js +1 -1
  63. package/test/list-items-test.js +1 -1
  64. package/test/list-users-batch_test.js +1 -1
  65. package/test/list-users-callback_test.js +1 -1
  66. package/test/list-users-test.js +1 -1
  67. package/test/{list-groups-batch_test.js → recommend-items-to-item-segment-batch_test.js} +4 -5
  68. package/test/{list-groups-callback_test.js → recommend-items-to-item-segment-callback_test.js} +8 -7
  69. package/test/{remove-from-group-test.js → recommend-items-to-item-segment-test.js} +5 -14
  70. package/test/remove-from-series-batch_test.js +4 -6
  71. package/test/remove-from-series-callback_test.js +2 -17
  72. package/test/remove-from-series-test.js +2 -19
  73. package/test/set-environment.js +89 -86
  74. package/test/set-view-portion-batch_test.js +0 -2
  75. package/test/set-view-portion-callback_test.js +0 -15
  76. package/test/set-view-portion-test.js +0 -17
  77. package/lib/requests/add-group.js +0 -42
  78. package/lib/requests/delete-group.js +0 -43
  79. package/lib/requests/insert-to-group.js +0 -58
  80. package/lib/requests/list-group-items.js +0 -42
  81. package/lib/requests/list-groups.js +0 -40
  82. package/lib/requests/remove-from-group.js +0 -48
  83. package/test/add-group-batch_test.js +0 -39
  84. package/test/add-group-callback_test.js +0 -72
  85. package/test/add-group-test.js +0 -68
  86. package/test/delete-group-batch_test.js +0 -39
  87. package/test/delete-group-callback_test.js +0 -74
  88. package/test/delete-group-test.js +0 -76
  89. package/test/insert-to-group-batch_test.js +0 -53
  90. package/test/insert-to-group-callback_test.js +0 -86
  91. package/test/insert-to-group-test.js +0 -68
  92. package/test/list-group-items-batch_test.js +0 -36
  93. package/test/list-group-items-callback_test.js +0 -38
  94. package/test/list-group-items-test.js +0 -34
  95. package/test/list-groups-test.js +0 -32
  96. package/test/remove-from-group-batch_test.js +0 -35
  97. package/test/remove-from-group-callback_test.js +0 -50
@@ -21,7 +21,7 @@ class DeleteCartAddition extends rqs.Request {
21
21
  * - Description: Unix timestamp of the cart addition. If the `timestamp` is omitted, then all the cart additions with the given `userId` and `itemId` are deleted.
22
22
  */
23
23
  constructor(userId, itemId, optional) {
24
- super('DELETE', '/cartadditions/', 1000, false);
24
+ super('DELETE', '/cartadditions/', 3000, false);
25
25
  this.userId = userId;
26
26
  this.itemId = itemId;
27
27
  optional = optional || {};
@@ -21,7 +21,7 @@ class DeleteDetailView extends rqs.Request {
21
21
  * - Description: Unix timestamp of the detail view. If the `timestamp` is omitted, then all the detail views with the given `userId` and `itemId` are deleted.
22
22
  */
23
23
  constructor(userId, itemId, optional) {
24
- super('DELETE', '/detailviews/', 1000, false);
24
+ super('DELETE', '/detailviews/', 3000, false);
25
25
  this.userId = userId;
26
26
  this.itemId = itemId;
27
27
  optional = optional || {};
@@ -17,7 +17,7 @@ class DeleteItem extends rqs.Request {
17
17
  * @param {string} itemId - ID of the item to be deleted.
18
18
  */
19
19
  constructor(itemId) {
20
- super('DELETE', `/items/${itemId}`, 1000, false);
20
+ super('DELETE', `/items/${itemId}`, 3000, false);
21
21
  this.itemId = itemId;
22
22
  }
23
23
 
@@ -21,7 +21,7 @@ class DeletePurchase extends rqs.Request {
21
21
  * - Description: Unix timestamp of the purchase. If the `timestamp` is omitted, then all the purchases with the given `userId` and `itemId` are deleted.
22
22
  */
23
23
  constructor(userId, itemId, optional) {
24
- super('DELETE', '/purchases/', 1000, false);
24
+ super('DELETE', '/purchases/', 3000, false);
25
25
  this.userId = userId;
26
26
  this.itemId = itemId;
27
27
  optional = optional || {};
@@ -21,7 +21,7 @@ class DeleteRating extends rqs.Request {
21
21
  * - Description: Unix timestamp of the rating. If the `timestamp` is omitted, then all the ratings with the given `userId` and `itemId` are deleted.
22
22
  */
23
23
  constructor(userId, itemId, optional) {
24
- super('DELETE', '/ratings/', 1000, false);
24
+ super('DELETE', '/ratings/', 3000, false);
25
25
  this.userId = userId;
26
26
  this.itemId = itemId;
27
27
  optional = optional || {};
@@ -14,10 +14,17 @@ class DeleteSeries extends rqs.Request {
14
14
  /**
15
15
  * Construct the request
16
16
  * @param {string} seriesId - ID of the series to be deleted.
17
+ * @param {Object} optional - Optional parameters given as an object with structure name of the parameter: value
18
+ * - Allowed parameters:
19
+ * - *cascadeDelete*
20
+ * - Type: boolean
21
+ * - Description: If set to `true`, item with the same ID as seriesId will be also deleted. Default is `false`.
17
22
  */
18
- constructor(seriesId) {
19
- super('DELETE', `/series/${seriesId}`, 1000, false);
23
+ constructor(seriesId, optional) {
24
+ super('DELETE', `/series/${seriesId}`, 3000, false);
20
25
  this.seriesId = seriesId;
26
+ optional = optional || {};
27
+ this.cascadeDelete = optional.cascadeDelete;
21
28
  }
22
29
 
23
30
  /**
@@ -27,6 +34,9 @@ class DeleteSeries extends rqs.Request {
27
34
  bodyParameters() {
28
35
  let params = {};
29
36
 
37
+ if(this.cascadeDelete !== undefined)
38
+ params.cascadeDelete = this.cascadeDelete;
39
+
30
40
  return params;
31
41
  }
32
42
 
@@ -16,7 +16,7 @@ class DeleteUser extends rqs.Request {
16
16
  * @param {string} userId - ID of the user to be deleted.
17
17
  */
18
18
  constructor(userId) {
19
- super('DELETE', `/users/${userId}`, 1000, false);
19
+ super('DELETE', `/users/${userId}`, 3000, false);
20
20
  this.userId = userId;
21
21
  }
22
22
 
@@ -21,7 +21,7 @@ class DeleteViewPortion extends rqs.Request {
21
21
  * - Description: Identifier of a session.
22
22
  */
23
23
  constructor(userId, itemId, optional) {
24
- super('DELETE', '/viewportions/', 1000, false);
24
+ super('DELETE', '/viewportions/', 3000, false);
25
25
  this.userId = userId;
26
26
  this.itemId = itemId;
27
27
  optional = optional || {};
@@ -15,7 +15,7 @@ class GetItemPropertyInfo extends rqs.Request {
15
15
  * @param {string} propertyName - Name of the property about which the information is to be retrieved.
16
16
  */
17
17
  constructor(propertyName) {
18
- super('GET', `/items/properties/${propertyName}`, 1000, false);
18
+ super('GET', `/items/properties/${propertyName}`, 3000, false);
19
19
  this.propertyName = propertyName;
20
20
  }
21
21
 
@@ -15,7 +15,7 @@ class GetItemValues extends rqs.Request {
15
15
  * @param {string} itemId - ID of the item whose properties are to be obtained.
16
16
  */
17
17
  constructor(itemId) {
18
- super('GET', `/items/${itemId}`, 1000, false);
18
+ super('GET', `/items/${itemId}`, 3000, false);
19
19
  this.itemId = itemId;
20
20
  }
21
21
 
@@ -15,7 +15,7 @@ class GetUserValues extends rqs.Request {
15
15
  * @param {string} userId - ID of the user whose properties are to be obtained.
16
16
  */
17
17
  constructor(userId) {
18
- super('GET', `/users/${userId}`, 1000, false);
18
+ super('GET', `/users/${userId}`, 3000, false);
19
19
  this.userId = userId;
20
20
  }
21
21
 
@@ -20,12 +20,6 @@ exports.ListSeries = require("./list-series").ListSeries;
20
20
  exports.ListSeriesItems = require("./list-series-items").ListSeriesItems;
21
21
  exports.InsertToSeries = require("./insert-to-series").InsertToSeries;
22
22
  exports.RemoveFromSeries = require("./remove-from-series").RemoveFromSeries;
23
- exports.AddGroup = require("./add-group").AddGroup;
24
- exports.DeleteGroup = require("./delete-group").DeleteGroup;
25
- exports.ListGroups = require("./list-groups").ListGroups;
26
- exports.ListGroupItems = require("./list-group-items").ListGroupItems;
27
- exports.InsertToGroup = require("./insert-to-group").InsertToGroup;
28
- exports.RemoveFromGroup = require("./remove-from-group").RemoveFromGroup;
29
23
  exports.AddUser = require("./add-user").AddUser;
30
24
  exports.DeleteUser = require("./delete-user").DeleteUser;
31
25
  exports.SetUserValues = require("./set-user-values").SetUserValues;
@@ -62,6 +56,7 @@ exports.ListItemViewPortions = require("./list-item-view-portions").ListItemView
62
56
  exports.ListUserViewPortions = require("./list-user-view-portions").ListUserViewPortions;
63
57
  exports.RecommendItemsToUser = require("./recommend-items-to-user").RecommendItemsToUser;
64
58
  exports.RecommendItemsToItem = require("./recommend-items-to-item").RecommendItemsToItem;
59
+ exports.RecommendItemsToItemSegment = require("./recommend-items-to-item-segment").RecommendItemsToItemSegment;
65
60
  exports.RecommendNextItems = require("./recommend-next-items").RecommendNextItems;
66
61
  exports.RecommendUsersToUser = require("./recommend-users-to-user").RecommendUsersToUser;
67
62
  exports.RecommendUsersToItem = require("./recommend-users-to-item").RecommendUsersToItem;
@@ -20,10 +20,10 @@ class InsertToSeries extends rqs.Request {
20
20
  * - Allowed parameters:
21
21
  * - *cascadeCreate*
22
22
  * - Type: boolean
23
- * - Description: Indicates that any non-existing entity specified within the request should be created (as if corresponding PUT requests were invoked). This concerns both the `seriesId` and the `itemId`. If `cascadeCreate` is set to true, the behavior also depends on the `itemType`. Either item or series may be created if not present in the database.
23
+ * - Description: Indicates that any non-existing entity specified within the request should be created (as if corresponding PUT requests were invoked). This concerns both the `seriesId` and the `itemId`. If `cascadeCreate` is set to true, the behavior also depends on the `itemType`. In case of `item`, an item is created, in case of `series` a series + corresponding item with the same ID is created.
24
24
  */
25
25
  constructor(seriesId, itemType, itemId, time, optional) {
26
- super('POST', `/series/${seriesId}/items/`, 1000, false);
26
+ super('POST', `/series/${seriesId}/items/`, 3000, false);
27
27
  this.seriesId = seriesId;
28
28
  this.itemType = itemType;
29
29
  this.itemId = itemId;
@@ -27,7 +27,7 @@ class ListItems extends rqs.Request {
27
27
  * - Type: boolean
28
28
  * - Description: With `returnProperties=true`, property values of the listed items are returned along with their IDs in a JSON dictionary.
29
29
  * Example response:
30
- * ```
30
+ * ```json
31
31
  * [
32
32
  * {
33
33
  * "itemId": "tv-178",
@@ -49,7 +49,7 @@ class ListItems extends rqs.Request {
49
49
  * - Type: string[]
50
50
  * - Description: Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
51
51
  * Example response for `includedProperties=description,price`:
52
- * ```
52
+ * ```json
53
53
  * [
54
54
  * {
55
55
  * "itemId": "tv-178",
@@ -27,7 +27,7 @@ class ListUsers extends rqs.Request {
27
27
  * - Type: boolean
28
28
  * - Description: With `returnProperties=true`, property values of the listed users are returned along with their IDs in a JSON dictionary.
29
29
  * Example response:
30
- * ```
30
+ * ```json
31
31
  * [
32
32
  * {
33
33
  * "userId": "user-81",
@@ -45,7 +45,7 @@ class ListUsers extends rqs.Request {
45
45
  * - Type: string[]
46
46
  * - Description: Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
47
47
  * Example response for `includedProperties=country`:
48
- * ```
48
+ * ```json
49
49
  * [
50
50
  * {
51
51
  * "userId": "user-81",
@@ -6,12 +6,12 @@
6
6
  const rqs = require("./request");
7
7
 
8
8
  /**
9
- * Recommends Segments from a result Segmentation that are the most relevant to a particular Segment from a context Segmentation.
9
+ * Recommends Segments from a result [Segmentation](https://docs.recombee.com/segmentations.html) that are the most relevant to a particular Segment from a context Segmentation.
10
10
  * Based on the used Segmentations, this endpoint can be used for example for:
11
11
  * - Recommending the related brands to particular brand
12
12
  * - Recommending the related brands to particular category
13
13
  * - Recommending the related artists to a particular genre (assuming songs are the Items)
14
- * You need to set the used context and result Segmentation the Admin UI in the Scenario settings prior to using this endpoint.
14
+ * You need to set the used context and result Segmentation the Admin UI in the [Scenario settings](https://docs.recombee.com/scenarios) prior to using this endpoint.
15
15
  * The returned segments are sorted by relevance (first segment being the most relevant).
16
16
  * It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
17
17
  */
@@ -6,13 +6,13 @@
6
6
  const rqs = require("./request");
7
7
 
8
8
  /**
9
- * Recommends Segments from a Segmentation that are the most relevant to a particular item.
9
+ * Recommends Segments from a [Segmentation](https://docs.recombee.com/segmentations.html) that are the most relevant to a particular item.
10
10
  * Based on the used Segmentation, this endpoint can be used for example for:
11
11
  * - Recommending the related categories
12
12
  * - Recommending the related genres
13
13
  * - Recommending the related brands
14
14
  * - Recommending the related artists
15
- * You need to set the used Segmentation the Admin UI in the Scenario settings prior to using this endpoint.
15
+ * You need to set the used Segmentation the Admin UI in the [Scenario settings](https://docs.recombee.com/scenarios) prior to using this endpoint.
16
16
  * The returned segments are sorted by relevance (first segment being the most relevant).
17
17
  * It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
18
18
  */
@@ -6,13 +6,13 @@
6
6
  const rqs = require("./request");
7
7
 
8
8
  /**
9
- * Recommends the top Segments from a Segmentation for a particular user, based on the user's past interactions.
9
+ * Recommends the top Segments from a [Segmentation](https://docs.recombee.com/segmentations.html) for a particular user, based on the user's past interactions.
10
10
  * Based on the used Segmentation, this endpoint can be used for example for:
11
11
  * - Recommending the top categories for the user
12
12
  * - Recommending the top genres for the user
13
13
  * - Recommending the top brands for the user
14
14
  * - Recommending the top artists for the user
15
- * You need to set the used Segmentation the Admin UI in the Scenario settings prior to using this endpoint.
15
+ * You need to set the used Segmentation the Admin UI in the [Scenario settings](https://docs.recombee.com/scenarios) prior to using this endpoint.
16
16
  * The returned segments are sorted by relevance (first segment being the most relevant).
17
17
  * It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
18
18
  */
@@ -0,0 +1,214 @@
1
+ /*
2
+ This file is auto-generated, do not edit
3
+ */
4
+
5
+ 'use strict';
6
+ const rqs = require("./request");
7
+
8
+ /**
9
+ * Recommends Items that are the most relevant to a particular Segment from a context [Segmentation](https://docs.recombee.com/segmentations.html).
10
+ * Based on the used Segmentation, this endpoint can be used for example for:
11
+ * - Recommending articles related to a particular topic
12
+ * - Recommending songs belonging to a particular genre
13
+ * - Recommending products produced by a particular brand
14
+ * You need to set the used context Segmentation in the Admin UI in the [Scenario settings](https://docs.recombee.com/scenarios) prior to using this endpoint.
15
+ * The returned items are sorted by relevance (the first item being the most relevant).
16
+ * It is also possible to use the POST HTTP method (for example, in the case of a very long ReQL filter) — query parameters then become body parameters.
17
+ */
18
+ class RecommendItemsToItemSegment extends rqs.Request {
19
+
20
+ /**
21
+ * Construct the request
22
+ * @param {string} contextSegmentId - ID of the segment from `contextSegmentationId` for which the recommendations are to be generated.
23
+ * @param {string} targetUserId - ID of the user who will see the recommendations.
24
+ * Specifying the *targetUserId* is beneficial because:
25
+ * * It makes the recommendations personalized
26
+ * * Allows the calculation of Actions and Conversions
27
+ * in the graphical user interface,
28
+ * as Recombee can pair the user who got recommendations
29
+ * and who afterward viewed/purchased an item.
30
+ * If you insist on not specifying the user, pass `null`
31
+ * (`None`, `nil`, `NULL` etc., depending on the language) to *targetUserId*.
32
+ * Do not create some special dummy user for getting recommendations,
33
+ * as it could mislead the recommendation models,
34
+ * and result in wrong recommendations.
35
+ * For anonymous/unregistered users, it is possible to use, for example, their session ID.
36
+ * @param {number} count - Number of items to be recommended (N for the top-N recommendation).
37
+ * @param {Object} optional - Optional parameters given as an object with structure name of the parameter: value
38
+ * - Allowed parameters:
39
+ * - *scenario*
40
+ * - Type: string
41
+ * - Description: Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".
42
+ * You can set various settings to the [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
43
+ * The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.
44
+ * - *cascadeCreate*
45
+ * - Type: boolean
46
+ * - Description: If an item of the given *itemId* or user of the given *targetUserId* doesn't exist in the database, it creates the missing entity/entities and returns some (non-personalized) recommendations. This allows, for example, rotations in the following recommendations for the user of the given *targetUserId*, as the user will be already known to the system.
47
+ * - *returnProperties*
48
+ * - Type: boolean
49
+ * - Description: With `returnProperties=true`, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended items to the user.
50
+ * Example response:
51
+ * ```json
52
+ * {
53
+ * "recommId": "0c6189e7-dc1a-429a-b613-192696309361",
54
+ * "recomms":
55
+ * [
56
+ * {
57
+ * "id": "tv-178",
58
+ * "values": {
59
+ * "description": "4K TV with 3D feature",
60
+ * "categories": ["Electronics", "Televisions"],
61
+ * "price": 342,
62
+ * "url": "myshop.com/tv-178"
63
+ * }
64
+ * },
65
+ * {
66
+ * "id": "mixer-42",
67
+ * "values": {
68
+ * "description": "Stainless Steel Mixer",
69
+ * "categories": ["Home & Kitchen"],
70
+ * "price": 39,
71
+ * "url": "myshop.com/mixer-42"
72
+ * }
73
+ * }
74
+ * ],
75
+ * "numberNextRecommsCalls": 0
76
+ * }
77
+ * ```
78
+ * - *includedProperties*
79
+ * - Type: string[]
80
+ * - Description: Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
81
+ * Example response for `includedProperties=description,price`:
82
+ * ```json
83
+ * {
84
+ * "recommId": "6842c725-a79f-4537-a02c-f34d668a3f80",
85
+ * "recomms":
86
+ * [
87
+ * {
88
+ * "id": "tv-178",
89
+ * "values": {
90
+ * "description": "4K TV with 3D feature",
91
+ * "price": 342
92
+ * }
93
+ * },
94
+ * {
95
+ * "id": "mixer-42",
96
+ * "values": {
97
+ * "description": "Stainless Steel Mixer",
98
+ * "price": 39
99
+ * }
100
+ * }
101
+ * ],
102
+ * "numberNextRecommsCalls": 0
103
+ * }
104
+ * ```
105
+ * - *filter*
106
+ * - Type: string
107
+ * - Description: Boolean-returning [ReQL](https://docs.recombee.com/reql.html) expression, which allows you to filter recommended items based on the values of their attributes.
108
+ * Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
109
+ * - *booster*
110
+ * - Type: string
111
+ * - Description: Number-returning [ReQL](https://docs.recombee.com/reql.html) expression, which allows you to boost the recommendation rate of some items based on the values of their attributes.
112
+ * Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
113
+ * - *logic*
114
+ * - Type: string | object
115
+ * - Description: Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
116
+ * See [this section](https://docs.recombee.com/recommendation_logics.html) for a list of available logics and other details.
117
+ * The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
118
+ * Logic can also be set to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
119
+ * - *minRelevance*
120
+ * - Type: string
121
+ * - Description: **Expert option** If the *targetUserId* is provided: Specifies the threshold of how relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend a number of items equal to *count* at any cost. If there is not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations being appended to reach the full *count*. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested relevance and may return less than *count* items when there is not enough data to fulfill it.
122
+ * - *rotationRate*
123
+ * - Type: number
124
+ * - Description: **Expert option** If the *targetUserId* is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per request in a backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example, `rotationRate=0.2` for only slight rotation of recommended items.
125
+ * - *rotationTime*
126
+ * - Type: number
127
+ * - Description: **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long it takes for an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized.
128
+ * - *expertSettings*
129
+ * - Type: object
130
+ * - Description: Dictionary of custom options.
131
+ * - *returnAbGroup*
132
+ * - Type: boolean
133
+ * - Description: If there is a custom AB-testing running, return the name of the group to which the request belongs.
134
+ */
135
+ constructor(contextSegmentId, targetUserId, count, optional) {
136
+ super('POST', '/recomms/item-segments/items/', 3000, false);
137
+ this.contextSegmentId = contextSegmentId;
138
+ this.targetUserId = targetUserId;
139
+ this.count = count;
140
+ optional = optional || {};
141
+ this.scenario = optional.scenario;
142
+ this.cascadeCreate = optional.cascadeCreate;
143
+ this.returnProperties = optional.returnProperties;
144
+ this.includedProperties = optional.includedProperties;
145
+ this.filter = optional.filter;
146
+ this.booster = optional.booster;
147
+ this.logic = optional.logic;
148
+ this.minRelevance = optional.minRelevance;
149
+ this.rotationRate = optional.rotationRate;
150
+ this.rotationTime = optional.rotationTime;
151
+ this.expertSettings = optional.expertSettings;
152
+ this.returnAbGroup = optional.returnAbGroup;
153
+ }
154
+
155
+ /**
156
+ * Get body parameters
157
+ * @return {Object} The values of body parameters (name of parameter: value of the parameter)
158
+ */
159
+ bodyParameters() {
160
+ let params = {};
161
+ params.contextSegmentId = this.contextSegmentId;
162
+ params.targetUserId = this.targetUserId;
163
+ params.count = this.count;
164
+
165
+ if(this.scenario !== undefined)
166
+ params.scenario = this.scenario;
167
+
168
+ if(this.cascadeCreate !== undefined)
169
+ params.cascadeCreate = this.cascadeCreate;
170
+
171
+ if(this.returnProperties !== undefined)
172
+ params.returnProperties = this.returnProperties;
173
+
174
+ if(this.includedProperties !== undefined)
175
+ params.includedProperties = this.includedProperties;
176
+
177
+ if(this.filter !== undefined)
178
+ params.filter = this.filter;
179
+
180
+ if(this.booster !== undefined)
181
+ params.booster = this.booster;
182
+
183
+ if(this.logic !== undefined)
184
+ params.logic = this.logic;
185
+
186
+ if(this.minRelevance !== undefined)
187
+ params.minRelevance = this.minRelevance;
188
+
189
+ if(this.rotationRate !== undefined)
190
+ params.rotationRate = this.rotationRate;
191
+
192
+ if(this.rotationTime !== undefined)
193
+ params.rotationTime = this.rotationTime;
194
+
195
+ if(this.expertSettings !== undefined)
196
+ params.expertSettings = this.expertSettings;
197
+
198
+ if(this.returnAbGroup !== undefined)
199
+ params.returnAbGroup = this.returnAbGroup;
200
+
201
+ return params;
202
+ }
203
+
204
+ /**
205
+ * Get query parameters
206
+ * @return {Object} The values of query parameters (name of parameter: value of the parameter)
207
+ */
208
+ queryParameters() {
209
+ let params = {};
210
+ return params;
211
+ }
212
+ }
213
+
214
+ exports.RecommendItemsToItemSegment = RecommendItemsToItemSegment
@@ -46,7 +46,7 @@ class RecommendItemsToItem extends rqs.Request {
46
46
  * - Type: boolean
47
47
  * - Description: With `returnProperties=true`, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended items to the user.
48
48
  * Example response:
49
- * ```
49
+ * ```json
50
50
  * {
51
51
  * "recommId": "0c6189e7-dc1a-429a-b613-192696309361",
52
52
  * "recomms":
@@ -77,7 +77,7 @@ class RecommendItemsToItem extends rqs.Request {
77
77
  * - Type: string[]
78
78
  * - Description: Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
79
79
  * Example response for `includedProperties=description,price`:
80
- * ```
80
+ * ```json
81
81
  * {
82
82
  * "recommId": "6842c725-a79f-4537-a02c-f34d668a3f80",
83
83
  * "recomms":
@@ -34,7 +34,7 @@ class RecommendItemsToUser extends rqs.Request {
34
34
  * - Type: boolean
35
35
  * - Description: With `returnProperties=true`, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended items to the user.
36
36
  * Example response:
37
- * ```
37
+ * ```json
38
38
  * {
39
39
  * "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
40
40
  * "recomms":
@@ -65,7 +65,7 @@ class RecommendItemsToUser extends rqs.Request {
65
65
  * - Type: string[]
66
66
  * - Description: Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
67
67
  * Example response for `includedProperties=description,price`:
68
- * ```
68
+ * ```json
69
69
  * {
70
70
  * "recommId": "a86ee8d5-cd8e-46d1-886c-8b3771d0520b",
71
71
  * "recomms":
@@ -9,9 +9,10 @@ const rqs = require("./request");
9
9
  * Returns items that shall be shown to a user as next recommendations when the user e.g. scrolls the page down (*infinite scroll*) or goes to the next page.
10
10
  * It accepts `recommId` of a base recommendation request (e.g., request from the first page) and the number of items that shall be returned (`count`).
11
11
  * The base request can be one of:
12
- * - [Recommend items to item](https://docs.recombee.com/api.html#recommend-items-to-item)
13
- * - [Recommend items to user](https://docs.recombee.com/api.html#recommend-items-to-user)
14
- * - [Search items](https://docs.recombee.com/api.html#search-items)
12
+ * - [Recommend Items to Item](https://docs.recombee.com/api.html#recommend-items-to-item)
13
+ * - [Recommend Items to User](https://docs.recombee.com/api.html#recommend-items-to-user)
14
+ * - [Recommend Items to Item Segment](https://docs.recombee.com/api.html#recommend-items-to-item-segment)
15
+ * - [Search Items](https://docs.recombee.com/api.html#search-items)
15
16
  * All the other parameters are inherited from the base request.
16
17
  * *Recommend next items* can be called many times for a single `recommId` and each call returns different (previously not recommended) items.
17
18
  * The number of *Recommend next items* calls performed so far is returned in the `numberNextRecommsCalls` field.
@@ -30,7 +30,7 @@ class RecommendUsersToItem extends rqs.Request {
30
30
  * - Type: boolean
31
31
  * - Description: With `returnProperties=true`, property values of the recommended users are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended users.
32
32
  * Example response:
33
- * ```
33
+ * ```json
34
34
  * {
35
35
  * "recommId": "039b71dc-b9cc-4645-a84f-62b841eecfce",
36
36
  * "recomms":
@@ -57,7 +57,7 @@ class RecommendUsersToItem extends rqs.Request {
57
57
  * - Type: string[]
58
58
  * - Description: Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
59
59
  * Example response for `includedProperties=country`:
60
- * ```
60
+ * ```json
61
61
  * {
62
62
  * "recommId": "b2b355dd-972a-4728-9c6b-2dc229db0678",
63
63
  * "recomms":
@@ -30,7 +30,7 @@ class RecommendUsersToUser extends rqs.Request {
30
30
  * - Type: boolean
31
31
  * - Description: With `returnProperties=true`, property values of the recommended users are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended users.
32
32
  * Example response:
33
- * ```
33
+ * ```json
34
34
  * {
35
35
  * "recommId": "9cb9c55d-50ba-4478-84fd-ab456136156e",
36
36
  * "recomms":
@@ -57,7 +57,7 @@ class RecommendUsersToUser extends rqs.Request {
57
57
  * - Type: string[]
58
58
  * - Description: Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
59
59
  * Example response for `includedProperties=country`:
60
- * ```
60
+ * ```json
61
61
  * {
62
62
  * "recommId": "b326d82d-5d57-4b45-b362-c9d6f0895855",
63
63
  * "recomms":
@@ -15,14 +15,12 @@ class RemoveFromSeries extends rqs.Request {
15
15
  * @param {string} seriesId - ID of the series from which a series item is to be removed.
16
16
  * @param {string} itemType - Type of the item to be removed.
17
17
  * @param {string} itemId - ID of the item iff `itemType` is `item`. ID of the series iff `itemType` is `series`.
18
- * @param {number} time - Time index of the item to be removed.
19
18
  */
20
- constructor(seriesId, itemType, itemId, time) {
21
- super('DELETE', `/series/${seriesId}/items/`, 1000, false);
19
+ constructor(seriesId, itemType, itemId) {
20
+ super('DELETE', `/series/${seriesId}/items/`, 3000, false);
22
21
  this.seriesId = seriesId;
23
22
  this.itemType = itemType;
24
23
  this.itemId = itemId;
25
- this.time = time;
26
24
  }
27
25
 
28
26
  /**
@@ -31,6 +29,8 @@ class RemoveFromSeries extends rqs.Request {
31
29
  */
32
30
  bodyParameters() {
33
31
  let params = {};
32
+ params.itemType = this.itemType;
33
+ params.itemId = this.itemId;
34
34
 
35
35
  return params;
36
36
  }
@@ -41,9 +41,6 @@ class RemoveFromSeries extends rqs.Request {
41
41
  */
42
42
  queryParameters() {
43
43
  let params = {};
44
- params.itemType = this.itemType;
45
- params.itemId = this.itemId;
46
- params.time = this.time;
47
44
  return params;
48
45
  }
49
46
  }
@@ -19,4 +19,4 @@ class Request {
19
19
  }
20
20
  }
21
21
 
22
- exports.Request = Request
22
+ exports.Request = Request
@@ -36,7 +36,7 @@ class SearchItems extends rqs.Request {
36
36
  * - Type: boolean
37
37
  * - Description: With `returnProperties=true`, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended items to the user.
38
38
  * Example response:
39
- * ```
39
+ * ```json
40
40
  * {
41
41
  * "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
42
42
  * "recomms":
@@ -67,7 +67,7 @@ class SearchItems extends rqs.Request {
67
67
  * - Type: string[]
68
68
  * - Description: Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
69
69
  * Example response for `includedProperties=description,price`:
70
- * ```
70
+ * ```json
71
71
  * {
72
72
  * "recommId": "a86ee8d5-cd8e-46d1-886c-8b3771d0520b",
73
73
  * "recomms":
@@ -35,7 +35,7 @@ class SetViewPortion extends rqs.Request {
35
35
  * - Description: A dictionary of additional data for the interaction.
36
36
  */
37
37
  constructor(userId, itemId, portion, optional) {
38
- super('POST', '/viewportions/', 1000, false);
38
+ super('POST', '/viewportions/', 3000, false);
39
39
  this.userId = userId;
40
40
  this.itemId = itemId;
41
41
  this.portion = portion;