From 24339a30d2956a51a99c41507cbf5ec010c45778 Mon Sep 17 00:00:00 2001 From: Ondrej Fiedler Date: Thu, 14 Jan 2021 17:32:38 +0100 Subject: [PATCH] Support RecommendNextItems endpoint --- README.md | 30 +- doc/AddBookmark.html | 10 +- doc/AddCartAddition.html | 10 +- doc/AddDetailView.html | 10 +- doc/AddGroup.html | 10 +- doc/AddItem.html | 10 +- doc/AddItemProperty.html | 10 +- doc/AddPurchase.html | 10 +- doc/AddRating.html | 10 +- doc/AddSeries.html | 10 +- doc/AddUser.html | 10 +- doc/AddUserProperty.html | 10 +- doc/ApiClient.html | 8 +- doc/ApiError.html | 6 +- doc/Batch.html | 10 +- doc/DeleteBookmark.html | 10 +- doc/DeleteCartAddition.html | 10 +- doc/DeleteDetailView.html | 10 +- doc/DeleteGroup.html | 10 +- doc/DeleteItem.html | 10 +- doc/DeleteItemProperty.html | 10 +- doc/DeletePurchase.html | 10 +- doc/DeleteRating.html | 10 +- doc/DeleteSeries.html | 10 +- doc/DeleteUser.html | 10 +- doc/DeleteUserProperty.html | 10 +- doc/DeleteViewPortion.html | 10 +- doc/GetItemPropertyInfo.html | 10 +- doc/GetItemValues.html | 10 +- doc/GetUserPropertyInfo.html | 10 +- doc/GetUserValues.html | 10 +- doc/InsertToGroup.html | 10 +- doc/InsertToSeries.html | 10 +- doc/ItemBasedRecommendation.html | 10 +- doc/ListGroupItems.html | 10 +- doc/ListGroups.html | 10 +- doc/ListItemBookmarks.html | 10 +- doc/ListItemCartAdditions.html | 10 +- doc/ListItemDetailViews.html | 10 +- doc/ListItemProperties.html | 10 +- doc/ListItemPurchases.html | 10 +- doc/ListItemRatings.html | 10 +- doc/ListItemViewPortions.html | 10 +- doc/ListItems.html | 10 +- doc/ListSeries.html | 10 +- doc/ListSeriesItems.html | 10 +- doc/ListUserBookmarks.html | 10 +- doc/ListUserCartAdditions.html | 10 +- doc/ListUserDetailViews.html | 10 +- doc/ListUserProperties.html | 10 +- doc/ListUserPurchases.html | 10 +- doc/ListUserRatings.html | 10 +- doc/ListUserViewPortions.html | 10 +- doc/ListUsers.html | 10 +- doc/MergeUsers.html | 10 +- doc/RecommendItemsToItem.html | 31 +- doc/RecommendItemsToUser.html | 31 +- doc/RecommendNextItems.html | 480 ++++++++++++++++++ doc/RecommendUsersToItem.html | 20 +- doc/RecommendUsersToUser.html | 22 +- doc/RemoveFromGroup.html | 10 +- doc/RemoveFromSeries.html | 10 +- doc/Request.html | 6 +- doc/ResetDatabase.html | 10 +- doc/ResponseError.html | 10 +- doc/SearchItems.html | 29 +- doc/SetItemValues.html | 6 +- doc/SetUserValues.html | 6 +- doc/SetValues.html | 10 +- doc/SetViewPortion.html | 10 +- doc/TimeoutError.html | 6 +- doc/UserBasedRecommendation.html | 10 +- doc/api-client.js.html | 6 +- doc/errors_api-error.js.html | 4 +- doc/errors_response-error.js.html | 8 +- doc/errors_timeout-error.js.html | 4 +- doc/index.html | 4 +- doc/requests_add-bookmark.js.html | 4 +- doc/requests_add-cart-addition.js.html | 4 +- doc/requests_add-detail-view.js.html | 4 +- doc/requests_add-group.js.html | 4 +- doc/requests_add-item-property.js.html | 4 +- doc/requests_add-item.js.html | 4 +- doc/requests_add-purchase.js.html | 4 +- doc/requests_add-rating.js.html | 4 +- doc/requests_add-series.js.html | 4 +- doc/requests_add-user-property.js.html | 4 +- doc/requests_add-user.js.html | 4 +- doc/requests_batch.js.html | 4 +- doc/requests_delete-bookmark.js.html | 4 +- doc/requests_delete-cart-addition.js.html | 4 +- doc/requests_delete-detail-view.js.html | 4 +- doc/requests_delete-group.js.html | 4 +- doc/requests_delete-item-property.js.html | 4 +- doc/requests_delete-item.js.html | 4 +- doc/requests_delete-purchase.js.html | 4 +- doc/requests_delete-rating.js.html | 4 +- doc/requests_delete-series.js.html | 4 +- doc/requests_delete-user-property.js.html | 4 +- doc/requests_delete-user.js.html | 4 +- doc/requests_delete-view-portion.js.html | 4 +- doc/requests_get-item-property-info.js.html | 4 +- doc/requests_get-item-values.js.html | 4 +- doc/requests_get-user-property-info.js.html | 4 +- doc/requests_get-user-values.js.html | 4 +- doc/requests_insert-to-group.js.html | 4 +- doc/requests_insert-to-series.js.html | 4 +- ...requests_item-based-recommendation.js.html | 4 +- doc/requests_list-group-items.js.html | 4 +- doc/requests_list-groups.js.html | 4 +- doc/requests_list-item-bookmarks.js.html | 4 +- doc/requests_list-item-cart-additions.js.html | 4 +- doc/requests_list-item-detail-views.js.html | 4 +- doc/requests_list-item-properties.js.html | 4 +- doc/requests_list-item-purchases.js.html | 4 +- doc/requests_list-item-ratings.js.html | 4 +- doc/requests_list-item-view-portions.js.html | 4 +- doc/requests_list-items.js.html | 4 +- doc/requests_list-series-items.js.html | 4 +- doc/requests_list-series.js.html | 4 +- doc/requests_list-user-bookmarks.js.html | 4 +- doc/requests_list-user-cart-additions.js.html | 4 +- doc/requests_list-user-detail-views.js.html | 4 +- doc/requests_list-user-properties.js.html | 4 +- doc/requests_list-user-purchases.js.html | 4 +- doc/requests_list-user-ratings.js.html | 4 +- doc/requests_list-user-view-portions.js.html | 4 +- doc/requests_list-users.js.html | 4 +- doc/requests_merge-users.js.html | 4 +- doc/requests_recommend-items-to-item.js.html | 17 +- doc/requests_recommend-items-to-user.js.html | 17 +- doc/requests_recommend-next-items.js.html | 106 ++++ doc/requests_recommend-users-to-item.js.html | 10 +- doc/requests_recommend-users-to-user.js.html | 12 +- doc/requests_remove-from-group.js.html | 4 +- doc/requests_remove-from-series.js.html | 4 +- doc/requests_request.js.html | 4 +- doc/requests_reset-database.js.html | 4 +- doc/requests_search-items.js.html | 15 +- doc/requests_set-item-values.js.html | 4 +- doc/requests_set-user-values.js.html | 4 +- doc/requests_set-values.js.html | 4 +- doc/requests_set-view-portion.js.html | 4 +- ...requests_user-based-recommendation.js.html | 4 +- doc/scripts/linenumber.js | 18 +- doc/styles/jsdoc-default.css | 4 +- lib/api-client.js | 2 +- lib/requests/index.js | 3 +- lib/requests/recommend-items-to-item.js | 13 +- lib/requests/recommend-items-to-user.js | 13 +- lib/requests/recommend-next-items.js | 55 ++ lib/requests/recommend-users-to-item.js | 6 +- lib/requests/recommend-users-to-user.js | 8 +- lib/requests/search-items.js | 11 +- package.json | 2 +- test/add-bookmark-batch_test.js | 22 +- test/add-cart-addition-batch_test.js | 22 +- test/add-detail-view-batch_test.js | 22 +- test/add-group-batch_test.js | 16 +- test/add-group-callback_test.js | 2 +- test/add-group-test.js | 2 +- test/add-item-batch_test.js | 16 +- test/add-item-callback_test.js | 2 +- test/add-item-property-batch_test.js | 16 +- test/add-item-test.js | 2 +- test/add-purchase-batch_test.js | 22 +- test/add-rating-batch_test.js | 22 +- test/add-series-batch_test.js | 16 +- test/add-series-callback_test.js | 2 +- test/add-series-test.js | 2 +- test/add-user-batch_test.js | 16 +- test/add-user-callback_test.js | 2 +- test/add-user-property-batch_test.js | 16 +- test/add-user-test.js | 2 +- test/delete-bookmark-batch_test.js | 10 +- test/delete-cart-addition-batch_test.js | 10 +- test/delete-detail-view-batch_test.js | 10 +- test/delete-group-batch_test.js | 16 +- test/delete-group-callback_test.js | 2 +- test/delete-group-test.js | 2 +- test/delete-item-batch_test.js | 16 +- test/delete-item-callback_test.js | 2 +- test/delete-item-property-batch_test.js | 16 +- test/delete-item-property-callback_test.js | 2 +- test/delete-item-property-test.js | 2 +- test/delete-item-test.js | 2 +- test/delete-purchase-batch_test.js | 10 +- test/delete-rating-batch_test.js | 10 +- test/delete-series-batch_test.js | 16 +- test/delete-series-callback_test.js | 2 +- test/delete-series-test.js | 2 +- test/delete-user-batch_test.js | 16 +- test/delete-user-callback_test.js | 2 +- test/delete-user-property-batch_test.js | 16 +- test/delete-user-property-callback_test.js | 2 +- test/delete-user-property-test.js | 2 +- test/delete-user-test.js | 2 +- test/delete-view-portion-batch_test.js | 10 +- test/get-item-property-info-batch_test.js | 14 +- test/get-item-values-batch_test.js | 12 +- test/get-user-property-info-batch_test.js | 14 +- test/get-user-values-batch_test.js | 12 +- test/insert-to-group-batch_test.js | 50 +- test/insert-to-series-batch_test.js | 50 +- test/item-based-recommendation-batch_test.js | 18 +- test/list-group-items-batch_test.js | 14 +- test/list-groups-batch_test.js | 10 +- test/list-item-bookmarks-batch_test.js | 14 +- test/list-item-cart-additions-batch_test.js | 14 +- test/list-item-detail-views-batch_test.js | 14 +- test/list-item-properties-batch_test.js | 10 +- test/list-item-purchases-batch_test.js | 14 +- test/list-item-ratings-batch_test.js | 14 +- test/list-item-view-portions-batch_test.js | 14 +- test/list-items-batch_test.js | 14 +- test/list-series-batch_test.js | 10 +- test/list-series-items-batch_test.js | 14 +- test/list-user-bookmarks-batch_test.js | 14 +- test/list-user-cart-additions-batch_test.js | 14 +- test/list-user-detail-views-batch_test.js | 14 +- test/list-user-properties-batch_test.js | 10 +- test/list-user-purchases-batch_test.js | 14 +- test/list-user-ratings-batch_test.js | 14 +- test/list-user-view-portions-batch_test.js | 14 +- test/list-users-batch_test.js | 14 +- test/merge-users-batch_test.js | 33 +- test/recommend-items-to-item-batch_test.js | 12 +- test/recommend-items-to-user-batch_test.js | 12 +- test/recommend-next-items-batch_test.js | 45 ++ test/recommend-next-items-callback_test.js | 54 ++ test/recommend-next-items-test.js | 42 ++ test/recommend-users-to-item-batch_test.js | 12 +- test/recommend-users-to-user-batch_test.js | 12 +- test/remove-from-group-batch_test.js | 10 +- test/remove-from-series-batch_test.js | 12 +- test/search-items-batch_test.js | 18 +- test/set-item-values-batch_test.js | 18 +- test/set-user-values-batch_test.js | 18 +- test/set-view-portion-batch_test.js | 20 +- test/user-based-recommendation-batch_test.js | 18 +- 240 files changed, 2145 insertions(+), 880 deletions(-) create mode 100644 doc/RecommendNextItems.html create mode 100644 doc/requests_recommend-next-items.js.html create mode 100644 lib/requests/recommend-next-items.js create mode 100644 test/recommend-next-items-batch_test.js create mode 100644 test/recommend-next-items-callback_test.js create mode 100644 test/recommend-next-items-test.js diff --git a/README.md b/README.md index c04951b..68fc0e7 100644 --- a/README.md +++ b/README.md @@ -71,17 +71,23 @@ userIds.forEach((userId) => { // Send the data to Recombee, use Batch for faster processing of larger data client.send(new rqs.Batch(purchases)) - .then(() => { - //Get 5 recommended items for user 'user-25' - client.send(new rqs.RecommendItemsToUser('user-25', 5)) - .then((recommended) => { - console.log("Recommended items for user-25: %j", recommended); - }); - }) - .catch((error) => { - console.error(error); - // Use fallback - }); +.then(() => { + //Get 5 recommended items for user 'user-25' + return client.send(new rqs.RecommendItemsToUser('user-25', 5)); +}) +.then((response) => { + console.log("Recommended items for user-25: %j", response.recomms); + + // User scrolled down - get next 3 recommended items + return client.send(new rqs.RecommendNextItems(response.recommId, 3)); +}) +.then((response) => { + console.log("Next recommended items for user-25: %j", response.recomms); +}) +.catch((error) => { + console.error(error); + // Use fallback +}); ``` ### Using property values @@ -180,7 +186,7 @@ client.send(new rqs.Batch([ }) .then((recommended) => { // Perform personalized full-text search with a user's search query (e.g. "computers") - return client.send(new rqs.SearchItems('user-42', 'computers', 5)); + return client.send(new rqs.SearchItems('user-42', 'computers', 5, {'scenario': "search_top"})); }) .then((matched) => { console.log("Matched items: %j", matched) diff --git a/doc/AddBookmark.html b/doc/AddBookmark.html index fdedb82..178c793 100644 --- a/doc/AddBookmark.html +++ b/doc/AddBookmark.html @@ -233,6 +233,8 @@
Parameters:
+ + @@ -334,6 +336,8 @@

bodyPar + +

Returns:
@@ -442,6 +446,8 @@

queryP + +

Returns:
@@ -485,13 +491,13 @@
Returns:

diff --git a/doc/AddCartAddition.html b/doc/AddCartAddition.html index 1ea8cfe..5c3c374 100644 --- a/doc/AddCartAddition.html +++ b/doc/AddCartAddition.html @@ -239,6 +239,8 @@
Parameters:
+ + @@ -340,6 +342,8 @@

bodyPar + +

Returns:
@@ -448,6 +452,8 @@

queryP + +

Returns:
@@ -491,13 +497,13 @@
Returns:

diff --git a/doc/AddDetailView.html b/doc/AddDetailView.html index 71ac05e..663be07 100644 --- a/doc/AddDetailView.html +++ b/doc/AddDetailView.html @@ -236,6 +236,8 @@
Parameters:
+ + @@ -337,6 +339,8 @@

bodyPar + +

Returns:
@@ -445,6 +449,8 @@

queryP + +

Returns:
@@ -488,13 +494,13 @@
Returns:

diff --git a/doc/AddGroup.html b/doc/AddGroup.html index 0eb1946..7118c8e 100644 --- a/doc/AddGroup.html +++ b/doc/AddGroup.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/AddItem.html b/doc/AddItem.html index c3bcc9b..3ffc166 100644 --- a/doc/AddItem.html +++ b/doc/AddItem.html @@ -175,6 +175,8 @@
Parameters:
+ + @@ -276,6 +278,8 @@

bodyPar + +

Returns:
@@ -384,6 +388,8 @@

queryP + +

Returns:
@@ -427,13 +433,13 @@
Returns:

diff --git a/doc/AddItemProperty.html b/doc/AddItemProperty.html index a56536c..304b65a 100644 --- a/doc/AddItemProperty.html +++ b/doc/AddItemProperty.html @@ -205,6 +205,8 @@
Parameters:
+ + @@ -306,6 +308,8 @@

bodyPar + +

Returns:
@@ -414,6 +418,8 @@

queryP + +

Returns:
@@ -457,13 +463,13 @@
Returns:

diff --git a/doc/AddPurchase.html b/doc/AddPurchase.html index 82deb22..303a680 100644 --- a/doc/AddPurchase.html +++ b/doc/AddPurchase.html @@ -242,6 +242,8 @@
Parameters:
+ + @@ -343,6 +345,8 @@

bodyPar + +

Returns:
@@ -451,6 +455,8 @@

queryP + +

Returns:
@@ -494,13 +500,13 @@
Returns:

diff --git a/doc/AddRating.html b/doc/AddRating.html index fae6707..21931f7 100644 --- a/doc/AddRating.html +++ b/doc/AddRating.html @@ -256,6 +256,8 @@
Parameters:
+ + @@ -357,6 +359,8 @@

bodyPar + +

Returns:
@@ -465,6 +469,8 @@

queryP + +

Returns:
@@ -508,13 +514,13 @@
Returns:

diff --git a/doc/AddSeries.html b/doc/AddSeries.html index 5f2708d..8fb6866 100644 --- a/doc/AddSeries.html +++ b/doc/AddSeries.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/AddUser.html b/doc/AddUser.html index 82cf5ac..edf75b9 100644 --- a/doc/AddUser.html +++ b/doc/AddUser.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/AddUserProperty.html b/doc/AddUserProperty.html index d95b813..706b8e8 100644 --- a/doc/AddUserProperty.html +++ b/doc/AddUserProperty.html @@ -203,6 +203,8 @@
Parameters:
+ + @@ -304,6 +306,8 @@

bodyPar + +

Returns:
@@ -412,6 +416,8 @@

queryP + +

Returns:
@@ -455,13 +461,13 @@
Returns:

diff --git a/doc/ApiClient.html b/doc/ApiClient.html index 03f2de7..f89197e 100644 --- a/doc/ApiClient.html +++ b/doc/ApiClient.html @@ -243,6 +243,8 @@
Parameters:
+ + @@ -421,6 +423,8 @@
Parameters:
+ + @@ -437,13 +441,13 @@
Parameters:

diff --git a/doc/ApiError.html b/doc/ApiError.html index 08efdb5..ea85893 100644 --- a/doc/ApiError.html +++ b/doc/ApiError.html @@ -121,6 +121,8 @@

new ApiError< + + @@ -153,13 +155,13 @@

new ApiError<
- Documentation generated by JSDoc 3.5.5 on Wed Jan 29 2020 13:19:45 GMT+0100 (Central European Standard Time) + Documentation generated by JSDoc 3.6.6 on Thu Jan 14 2021 17:29:06 GMT+0100 (Central European Standard Time)
diff --git a/doc/Batch.html b/doc/Batch.html index c7da3a7..1888749 100644 --- a/doc/Batch.html +++ b/doc/Batch.html @@ -203,6 +203,8 @@

Parameters:
+ + @@ -304,6 +306,8 @@

bodyPar + +

Returns:
@@ -412,6 +416,8 @@

queryP + +

Returns:
@@ -455,13 +461,13 @@
Returns:

diff --git a/doc/DeleteBookmark.html b/doc/DeleteBookmark.html index c1258b3..34771ac 100644 --- a/doc/DeleteBookmark.html +++ b/doc/DeleteBookmark.html @@ -224,6 +224,8 @@
Parameters:
+ + @@ -325,6 +327,8 @@

bodyPar + +

Returns:
@@ -433,6 +437,8 @@

queryP + +

Returns:
@@ -476,13 +482,13 @@
Returns:

diff --git a/doc/DeleteCartAddition.html b/doc/DeleteCartAddition.html index d3695da..1a1f4b5 100644 --- a/doc/DeleteCartAddition.html +++ b/doc/DeleteCartAddition.html @@ -224,6 +224,8 @@
Parameters:
+ + @@ -325,6 +327,8 @@

bodyPar + +

Returns:
@@ -433,6 +437,8 @@

queryP + +

Returns:
@@ -476,13 +482,13 @@
Returns:

diff --git a/doc/DeleteDetailView.html b/doc/DeleteDetailView.html index aa7ea81..2525893 100644 --- a/doc/DeleteDetailView.html +++ b/doc/DeleteDetailView.html @@ -224,6 +224,8 @@
Parameters:
+ + @@ -325,6 +327,8 @@

bodyPar + +

Returns:
@@ -433,6 +437,8 @@

queryP + +

Returns:
@@ -476,13 +482,13 @@
Returns:

diff --git a/doc/DeleteGroup.html b/doc/DeleteGroup.html index 0fa3103..b144817 100644 --- a/doc/DeleteGroup.html +++ b/doc/DeleteGroup.html @@ -175,6 +175,8 @@
Parameters:
+ + @@ -276,6 +278,8 @@

bodyPar + +

Returns:
@@ -384,6 +388,8 @@

queryP + +

Returns:
@@ -427,13 +433,13 @@
Returns:

diff --git a/doc/DeleteItem.html b/doc/DeleteItem.html index daf016e..ce6e77f 100644 --- a/doc/DeleteItem.html +++ b/doc/DeleteItem.html @@ -176,6 +176,8 @@
Parameters:
+ + @@ -277,6 +279,8 @@

bodyPar + +

Returns:
@@ -385,6 +389,8 @@

queryP + +

Returns:
@@ -428,13 +434,13 @@
Returns:

diff --git a/doc/DeleteItemProperty.html b/doc/DeleteItemProperty.html index ec68628..07e4bb0 100644 --- a/doc/DeleteItemProperty.html +++ b/doc/DeleteItemProperty.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/DeletePurchase.html b/doc/DeletePurchase.html index dd9533d..84fcfbd 100644 --- a/doc/DeletePurchase.html +++ b/doc/DeletePurchase.html @@ -224,6 +224,8 @@
Parameters:
+ + @@ -325,6 +327,8 @@

bodyPar + +

Returns:
@@ -433,6 +437,8 @@

queryP + +

Returns:
@@ -476,13 +482,13 @@
Returns:

diff --git a/doc/DeleteRating.html b/doc/DeleteRating.html index 698379b..9a856a1 100644 --- a/doc/DeleteRating.html +++ b/doc/DeleteRating.html @@ -224,6 +224,8 @@
Parameters:
+ + @@ -325,6 +327,8 @@

bodyPar + +

Returns:
@@ -433,6 +437,8 @@

queryP + +

Returns:
@@ -476,13 +482,13 @@
Returns:

diff --git a/doc/DeleteSeries.html b/doc/DeleteSeries.html index 52c38d1..4bedd87 100644 --- a/doc/DeleteSeries.html +++ b/doc/DeleteSeries.html @@ -175,6 +175,8 @@
Parameters:
+ + @@ -276,6 +278,8 @@

bodyPar + +

Returns:
@@ -384,6 +388,8 @@

queryP + +

Returns:
@@ -427,13 +433,13 @@
Returns:

diff --git a/doc/DeleteUser.html b/doc/DeleteUser.html index 867cda7..b9054a6 100644 --- a/doc/DeleteUser.html +++ b/doc/DeleteUser.html @@ -175,6 +175,8 @@
Parameters:
+ + @@ -276,6 +278,8 @@

bodyPar + +

Returns:
@@ -384,6 +388,8 @@

queryP + +

Returns:
@@ -427,13 +433,13 @@
Returns:

diff --git a/doc/DeleteUserProperty.html b/doc/DeleteUserProperty.html index 8eaac55..a9f7a60 100644 --- a/doc/DeleteUserProperty.html +++ b/doc/DeleteUserProperty.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/DeleteViewPortion.html b/doc/DeleteViewPortion.html index 578c70e..810672f 100644 --- a/doc/DeleteViewPortion.html +++ b/doc/DeleteViewPortion.html @@ -224,6 +224,8 @@
Parameters:
+ + @@ -325,6 +327,8 @@

bodyPar + +

Returns:
@@ -433,6 +437,8 @@

queryP + +

Returns:
@@ -476,13 +482,13 @@
Returns:

diff --git a/doc/GetItemPropertyInfo.html b/doc/GetItemPropertyInfo.html index 424c797..3b77c00 100644 --- a/doc/GetItemPropertyInfo.html +++ b/doc/GetItemPropertyInfo.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/GetItemValues.html b/doc/GetItemValues.html index 1159aec..b2446ad 100644 --- a/doc/GetItemValues.html +++ b/doc/GetItemValues.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/GetUserPropertyInfo.html b/doc/GetUserPropertyInfo.html index 433f61c..c295e4a 100644 --- a/doc/GetUserPropertyInfo.html +++ b/doc/GetUserPropertyInfo.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/GetUserValues.html b/doc/GetUserValues.html index 0b6b17e..e759c49 100644 --- a/doc/GetUserValues.html +++ b/doc/GetUserValues.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/InsertToGroup.html b/doc/InsertToGroup.html index 76cf1c9..4445404 100644 --- a/doc/InsertToGroup.html +++ b/doc/InsertToGroup.html @@ -247,6 +247,8 @@
Parameters:
+ + @@ -348,6 +350,8 @@

bodyPar + +

Returns:
@@ -456,6 +460,8 @@

queryP + +

Returns:
@@ -499,13 +505,13 @@
Returns:

diff --git a/doc/InsertToSeries.html b/doc/InsertToSeries.html index 539f974..d63509a 100644 --- a/doc/InsertToSeries.html +++ b/doc/InsertToSeries.html @@ -270,6 +270,8 @@
Parameters:
+ + @@ -371,6 +373,8 @@

bodyPar + +

Returns:
@@ -479,6 +483,8 @@

queryP + +

Returns:
@@ -522,13 +528,13 @@
Returns:

diff --git a/doc/ItemBasedRecommendation.html b/doc/ItemBasedRecommendation.html index 72f89ed..4b10dcc 100644 --- a/doc/ItemBasedRecommendation.html +++ b/doc/ItemBasedRecommendation.html @@ -305,6 +305,8 @@
Parameters:
+ + @@ -406,6 +408,8 @@

bodyPar + +

Returns:
@@ -514,6 +518,8 @@

queryP + +

Returns:
@@ -557,13 +563,13 @@
Returns:

diff --git a/doc/ListGroupItems.html b/doc/ListGroupItems.html index 8d70751..0d0dfa1 100644 --- a/doc/ListGroupItems.html +++ b/doc/ListGroupItems.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListGroups.html b/doc/ListGroups.html index 0b8cd80..8a651de 100644 --- a/doc/ListGroups.html +++ b/doc/ListGroups.html @@ -125,6 +125,8 @@

new ListGro + + @@ -226,6 +228,8 @@

bodyPar + +

Returns:
@@ -334,6 +338,8 @@

queryP + +

Returns:
@@ -377,13 +383,13 @@
Returns:

diff --git a/doc/ListItemBookmarks.html b/doc/ListItemBookmarks.html index 0099345..a76bfcd 100644 --- a/doc/ListItemBookmarks.html +++ b/doc/ListItemBookmarks.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListItemCartAdditions.html b/doc/ListItemCartAdditions.html index 1893e70..17425c3 100644 --- a/doc/ListItemCartAdditions.html +++ b/doc/ListItemCartAdditions.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListItemDetailViews.html b/doc/ListItemDetailViews.html index 8886057..c07e5d5 100644 --- a/doc/ListItemDetailViews.html +++ b/doc/ListItemDetailViews.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListItemProperties.html b/doc/ListItemProperties.html index cb89b57..c2d2689 100644 --- a/doc/ListItemProperties.html +++ b/doc/ListItemProperties.html @@ -125,6 +125,8 @@

new + + @@ -226,6 +228,8 @@

bodyPar + +

Returns:
@@ -334,6 +338,8 @@

queryP + +

Returns:
@@ -377,13 +383,13 @@
Returns:

diff --git a/doc/ListItemPurchases.html b/doc/ListItemPurchases.html index 4bba3b0..1c7f608 100644 --- a/doc/ListItemPurchases.html +++ b/doc/ListItemPurchases.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListItemRatings.html b/doc/ListItemRatings.html index 2b7c29e..fb7b0d4 100644 --- a/doc/ListItemRatings.html +++ b/doc/ListItemRatings.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListItemViewPortions.html b/doc/ListItemViewPortions.html index db49c27..eb83fcd 100644 --- a/doc/ListItemViewPortions.html +++ b/doc/ListItemViewPortions.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListItems.html b/doc/ListItems.html index f15842e..c60f59c 100644 --- a/doc/ListItems.html +++ b/doc/ListItems.html @@ -224,6 +224,8 @@
Parameters:
+ + @@ -325,6 +327,8 @@

bodyPar + +

Returns:
@@ -433,6 +437,8 @@

queryP + +

Returns:
@@ -476,13 +482,13 @@
Returns:

diff --git a/doc/ListSeries.html b/doc/ListSeries.html index 7b7ccd5..ef234e3 100644 --- a/doc/ListSeries.html +++ b/doc/ListSeries.html @@ -125,6 +125,8 @@

new ListSer + + @@ -226,6 +228,8 @@

bodyPar + +

Returns:
@@ -334,6 +338,8 @@

queryP + +

Returns:
@@ -377,13 +383,13 @@
Returns:

diff --git a/doc/ListSeriesItems.html b/doc/ListSeriesItems.html index b8c3be2..c101129 100644 --- a/doc/ListSeriesItems.html +++ b/doc/ListSeriesItems.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListUserBookmarks.html b/doc/ListUserBookmarks.html index 1deceaa..e395193 100644 --- a/doc/ListUserBookmarks.html +++ b/doc/ListUserBookmarks.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListUserCartAdditions.html b/doc/ListUserCartAdditions.html index 141282d..8992562 100644 --- a/doc/ListUserCartAdditions.html +++ b/doc/ListUserCartAdditions.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListUserDetailViews.html b/doc/ListUserDetailViews.html index 59875a5..93c4e31 100644 --- a/doc/ListUserDetailViews.html +++ b/doc/ListUserDetailViews.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListUserProperties.html b/doc/ListUserProperties.html index 8ca84e5..52ae78c 100644 --- a/doc/ListUserProperties.html +++ b/doc/ListUserProperties.html @@ -125,6 +125,8 @@

new + + @@ -226,6 +228,8 @@

bodyPar + +

Returns:
@@ -334,6 +338,8 @@

queryP + +

Returns:
@@ -377,13 +383,13 @@
Returns:

diff --git a/doc/ListUserPurchases.html b/doc/ListUserPurchases.html index e58b4c7..107fd84 100644 --- a/doc/ListUserPurchases.html +++ b/doc/ListUserPurchases.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListUserRatings.html b/doc/ListUserRatings.html index f60376f..421db21 100644 --- a/doc/ListUserRatings.html +++ b/doc/ListUserRatings.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListUserViewPortions.html b/doc/ListUserViewPortions.html index cb0c383..0c45ca8 100644 --- a/doc/ListUserViewPortions.html +++ b/doc/ListUserViewPortions.html @@ -174,6 +174,8 @@
Parameters:
+ + @@ -275,6 +277,8 @@

bodyPar + +

Returns:
@@ -383,6 +387,8 @@

queryP + +

Returns:
@@ -426,13 +432,13 @@
Returns:

diff --git a/doc/ListUsers.html b/doc/ListUsers.html index fc7eba6..5619952 100644 --- a/doc/ListUsers.html +++ b/doc/ListUsers.html @@ -218,6 +218,8 @@
Parameters:
+ + @@ -319,6 +321,8 @@

bodyPar + +

Returns:
@@ -427,6 +431,8 @@

queryP + +

Returns:
@@ -470,13 +476,13 @@
Returns:

diff --git a/doc/MergeUsers.html b/doc/MergeUsers.html index babad1d..077b88a 100644 --- a/doc/MergeUsers.html +++ b/doc/MergeUsers.html @@ -225,6 +225,8 @@
Parameters:
+ + @@ -326,6 +328,8 @@

bodyPar + +

Returns:
@@ -434,6 +438,8 @@

queryP + +

Returns:
@@ -477,13 +483,13 @@
Returns:

diff --git a/doc/RecommendItemsToItem.html b/doc/RecommendItemsToItem.html index b784618..7cf9a7d 100644 --- a/doc/RecommendItemsToItem.html +++ b/doc/RecommendItemsToItem.html @@ -31,8 +31,11 @@

Class: RecommendItemsToItem

RecommendItemsToItem(itemId, targetUserId, count, optional)

Recommends set of items that are somehow related to one given item, *X*. Typical scenario is when user *A* is viewing *X*. Then you may display items to the user that he might be also interested in. Recommend items to item request gives you Top-N such items, optionally taking the target user *A* into account. -It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters. -The returned items are sorted by relevancy (first item being the most relevant).
+The returned items are sorted by relevance (first item being the most relevant). +Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to: +- Let Recombee know that this recommendation was successful (e.g. user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics). +- Get subsequent recommended items when the user scrolls down (*infinite scroll*) or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items). +It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters. @@ -225,7 +228,8 @@
Parameters:
"url": "myshop.com/mixer-42" } } - ] + ], + "numberNextRecommsCalls": 0 } ``` - *includedProperties* @@ -251,7 +255,8 @@
Parameters:
"price": 39 } } - ] + ], + "numberNextRecommsCalls": 0 } ``` - *filter* @@ -276,7 +281,7 @@
Parameters:
- Description: **Expert option** Real number from [0.0, 1.0] which determines how much mutually dissimilar should the recommended items be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification. - *minRelevance* - Type: string - - Description: **Expert option** If the *targetUserId* is provided: Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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 relevancy, and may return less than *count* items when there is not enough data to fulfill it. + - Description: **Expert option** If the *targetUserId* is provided: Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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. - *rotationRate* - Type: number - 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 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. @@ -329,7 +334,7 @@
Parameters:
Source:
@@ -357,6 +362,8 @@
Parameters:
+ + @@ -435,7 +442,7 @@

bodyPar
Source:
@@ -458,6 +465,8 @@

bodyPar + +

Returns:
@@ -543,7 +552,7 @@

queryP
Source:
@@ -566,6 +575,8 @@

queryP + +

Returns:
@@ -609,13 +620,13 @@
Returns:

diff --git a/doc/RecommendItemsToUser.html b/doc/RecommendItemsToUser.html index 02c142a..1124ec5 100644 --- a/doc/RecommendItemsToUser.html +++ b/doc/RecommendItemsToUser.html @@ -32,8 +32,11 @@

RecommendIt
Based on user's past interactions (purchases, ratings, etc.) with the items, recommends top-N items that are most likely to be of high value for a given user. The most typical use cases are recommendations at homepage, in some "Picked just for you" section or in email. -It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters. -The returned items are sorted by relevancy (first item being the most relevant).
+The returned items are sorted by relevance (first item being the most relevant). +Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to: +- Let Recombee know that this recommendation was successful (e.g. user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics). +- Get subsequent recommended items when the user scrolls down (*infinite scroll*) or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items). +It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters. @@ -191,7 +194,8 @@

Parameters:
"url": "myshop.com/mixer-42" } } - ] + ], + "numberNextRecommsCalls": 0 } ``` - *includedProperties* @@ -217,7 +221,8 @@
Parameters:
"price": 39 } } - ] + ], + "numberNextRecommsCalls": 0 } ``` - *filter* @@ -239,7 +244,7 @@
Parameters:
- Description: **Expert option** Real number from [0.0, 1.0] which determines how much mutually dissimilar should the recommended items be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification. - *minRelevance* - Type: string - - Description: **Expert option** Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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 relevancy, and may return less than *count* items when there is not enough data to fulfill it. + - Description: **Expert option** Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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. - *rotationRate* - Type: number - Description: **Expert option** 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 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. Default: `0.1`. @@ -292,7 +297,7 @@
Parameters:
Source:
@@ -320,6 +325,8 @@
Parameters:
+ + @@ -398,7 +405,7 @@

bodyPar
Source:
@@ -421,6 +428,8 @@

bodyPar + +

Returns:
@@ -506,7 +515,7 @@

queryP
Source:
@@ -529,6 +538,8 @@

queryP + +

Returns:
@@ -572,13 +583,13 @@
Returns:

diff --git a/doc/RecommendNextItems.html b/doc/RecommendNextItems.html new file mode 100644 index 0000000..3a02a6c --- /dev/null +++ b/doc/RecommendNextItems.html @@ -0,0 +1,480 @@ + + + + + JSDoc: Class: RecommendNextItems + + + + + + + + + + +
+ +

Class: RecommendNextItems

+ + + + + + +
+ +
+ +

RecommendNextItems(recommId, count)

+ +
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 a next page. +It accepts `recommId` of a base recommendation request (e.g. request from the first page) and number of items that shall be returned (`count`). +The base request can be one of: + - [Recommend items to item](https://docs.recombee.com/api.html#recommend-items-to-item) + - [Recommend items to user](https://docs.recombee.com/api.html#recommend-items-to-user) + - [Search items](https://docs.recombee.com/api.html#search-items) +All the other parameters are inherited from the base request. +*Recommend next items* can be called many times for a single `recommId` and each call returns different (previously not recommended) items. +The number of *Recommend next items* calls performed so far is returned in the `numberNextRecommsCalls` field. +*Recommend next items* can be requested up to 30 minutes after the base request or a previous *Recommend next items* call. +For billing purposes, each call to *Recommend next items* is counted as a separate recommendation request.
+ + +
+ +
+
+ + + + +

Constructor

+ + + +

new RecommendNextItems(recommId, count)

+ + + + + + +
+ Construct the request +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
recommId + + +string + + + + ID of the base recommendation request for which next recommendations should be returned
count + + +number + + + + Number of items to be recommended
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +

Methods

+ + + + + + + +

bodyParameters() → {Object}

+ + + + + + +
+ Get body parameters +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ The values of body parameters (name of parameter: value of the parameter) +
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + + + + +

queryParameters() → {Object}

+ + + + + + +
+ Get query parameters +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ The values of query parameters (name of parameter: value of the parameter) +
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/doc/RecommendUsersToItem.html b/doc/RecommendUsersToItem.html index 5868324..c5b47df 100644 --- a/doc/RecommendUsersToItem.html +++ b/doc/RecommendUsersToItem.html @@ -186,7 +186,8 @@
Parameters:
"sex": "M" } } - ] + ], + "numberNextRecommsCalls": 0 } ``` - *includedProperties* @@ -210,7 +211,8 @@
Parameters:
"country": "CAN" } } - ] + ], + "numberNextRecommsCalls": 0 } ``` - *filter* @@ -304,6 +306,8 @@
Parameters:
+ + @@ -382,7 +386,7 @@

bodyPar
Source:
@@ -405,6 +409,8 @@

bodyPar + +

Returns:
@@ -490,7 +496,7 @@

queryP
Source:
@@ -513,6 +519,8 @@

queryP + +

Returns:
@@ -556,13 +564,13 @@
Returns:

diff --git a/doc/RecommendUsersToUser.html b/doc/RecommendUsersToUser.html index 56d6286..b2f518e 100644 --- a/doc/RecommendUsersToUser.html +++ b/doc/RecommendUsersToUser.html @@ -186,8 +186,9 @@
Parameters:
"sex": "M" } } - ] - } + ], + "numberNextRecommsCalls": 0 + } ``` - *includedProperties* - Type: string[] @@ -210,7 +211,8 @@
Parameters:
"country": "CAN" } } - ] + ], + "numberNextRecommsCalls": 0 } ``` - *filter* @@ -313,6 +315,8 @@
Parameters:
+ + @@ -391,7 +395,7 @@

bodyPar
Source:
@@ -414,6 +418,8 @@

bodyPar + +

Returns:
@@ -499,7 +505,7 @@

queryP
Source:
@@ -522,6 +528,8 @@

queryP + +

Returns:
@@ -565,13 +573,13 @@
Returns:

diff --git a/doc/RemoveFromGroup.html b/doc/RemoveFromGroup.html index c43d697..4f7c58c 100644 --- a/doc/RemoveFromGroup.html +++ b/doc/RemoveFromGroup.html @@ -220,6 +220,8 @@
Parameters:
+ + @@ -321,6 +323,8 @@

bodyPar + +

Returns:
@@ -429,6 +433,8 @@

queryP + +

Returns:
@@ -472,13 +478,13 @@
Returns:

diff --git a/doc/RemoveFromSeries.html b/doc/RemoveFromSeries.html index f06dd20..078ec45 100644 --- a/doc/RemoveFromSeries.html +++ b/doc/RemoveFromSeries.html @@ -243,6 +243,8 @@
Parameters:
+ + @@ -344,6 +346,8 @@

bodyPar + +

Returns:
@@ -452,6 +456,8 @@

queryP + +

Returns:
@@ -495,13 +501,13 @@
Returns:

diff --git a/doc/Request.html b/doc/Request.html index 7aea221..2651a6f 100644 --- a/doc/Request.html +++ b/doc/Request.html @@ -243,6 +243,8 @@
Parameters:
+ + @@ -275,13 +277,13 @@
Parameters:

diff --git a/doc/ResetDatabase.html b/doc/ResetDatabase.html index e2ba8a3..859736e 100644 --- a/doc/ResetDatabase.html +++ b/doc/ResetDatabase.html @@ -125,6 +125,8 @@

new Rese + + @@ -226,6 +228,8 @@

bodyPar + +

Returns:
@@ -334,6 +338,8 @@

queryP + +

Returns:
@@ -377,13 +383,13 @@
Returns:

diff --git a/doc/ResponseError.html b/doc/ResponseError.html index f29be7b..1caa05c 100644 --- a/doc/ResponseError.html +++ b/doc/ResponseError.html @@ -105,7 +105,7 @@
Parameters:
- ID of the item which will be modified + Request which caused the exception @@ -128,7 +128,7 @@
Parameters:
- The values for the individual properties + The returned status code @@ -220,6 +220,8 @@
Parameters:
+ + @@ -252,13 +254,13 @@
Parameters:

diff --git a/doc/SearchItems.html b/doc/SearchItems.html index 944733e..de4d4eb 100644 --- a/doc/SearchItems.html +++ b/doc/SearchItems.html @@ -33,8 +33,11 @@

SearchItems
Full-text personalized search. The results are based on the provided `searchQuery` and also on the user's past interactions (purchases, ratings, etc.) with the items (items more suitable for the user are preferred in the results). All the string and set item properties are indexed by the search engine. This endpoint should be used in a search box at your website/app. It can be called multiple times as the user is typing the query in order to get the most viable suggestions based on current state of the query, or once after submitting the whole query. -It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters. -The returned items are sorted by relevancy (first item being the most relevant).
+The returned items are sorted by relevance (first item being the most relevant). +Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to: +- Let Recombee know that this search was successful (e.g. user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics). +- Get subsequent search results when the user scrolls down or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items). +It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters. @@ -215,7 +218,8 @@

Parameters:
"url": "myshop.com/mixer-42" } } - ] + ], + "numberNextRecommsCalls": 0 } ``` - *includedProperties* @@ -241,7 +245,8 @@
Parameters:
"price": 39 } } - ] + ], + "numberNextRecommsCalls": 0 } ``` - *filter* @@ -304,7 +309,7 @@
Parameters:
Source:
@@ -332,6 +337,8 @@
Parameters:
+ + @@ -410,7 +417,7 @@

bodyPar
Source:
@@ -433,6 +440,8 @@

bodyPar + +

Returns:
@@ -518,7 +527,7 @@

queryP
Source:
@@ -541,6 +550,8 @@

queryP + +

Returns:
@@ -584,13 +595,13 @@
Returns:

diff --git a/doc/SetItemValues.html b/doc/SetItemValues.html index 37ab4e1..176993a 100644 --- a/doc/SetItemValues.html +++ b/doc/SetItemValues.html @@ -230,6 +230,8 @@
Parameters:
+ + @@ -262,13 +264,13 @@
Parameters:

diff --git a/doc/SetUserValues.html b/doc/SetUserValues.html index 75338d9..52b40da 100644 --- a/doc/SetUserValues.html +++ b/doc/SetUserValues.html @@ -228,6 +228,8 @@
Parameters:
+ + @@ -260,13 +262,13 @@
Parameters:

diff --git a/doc/SetValues.html b/doc/SetValues.html index 4ede3a3..8b94cdb 100644 --- a/doc/SetValues.html +++ b/doc/SetValues.html @@ -207,6 +207,8 @@
Parameters:
+ + @@ -308,6 +310,8 @@

bodyPar + +

Returns:
@@ -416,6 +420,8 @@

queryP + +

Returns:
@@ -459,13 +465,13 @@
Returns:

diff --git a/doc/SetViewPortion.html b/doc/SetViewPortion.html index b35b070..ea83032 100644 --- a/doc/SetViewPortion.html +++ b/doc/SetViewPortion.html @@ -260,6 +260,8 @@
Parameters:
+ + @@ -361,6 +363,8 @@

bodyPar + +

Returns:
@@ -469,6 +473,8 @@

queryP + +

Returns:
@@ -512,13 +518,13 @@
Returns:

diff --git a/doc/TimeoutError.html b/doc/TimeoutError.html index bc609e5..2707678 100644 --- a/doc/TimeoutError.html +++ b/doc/TimeoutError.html @@ -197,6 +197,8 @@
Parameters:
+ + @@ -229,13 +231,13 @@
Parameters:

diff --git a/doc/UserBasedRecommendation.html b/doc/UserBasedRecommendation.html index 27f4a91..5ab7fb7 100644 --- a/doc/UserBasedRecommendation.html +++ b/doc/UserBasedRecommendation.html @@ -294,6 +294,8 @@
Parameters:
+ + @@ -395,6 +397,8 @@

bodyPar + +

Returns:
@@ -503,6 +507,8 @@

queryP + +

Returns:
@@ -546,13 +552,13 @@
Returns:

diff --git a/doc/api-client.js.html b/doc/api-client.js.html index 0614e36..07eb342 100644 --- a/doc/api-client.js.html +++ b/doc/api-client.js.html @@ -72,7 +72,7 @@

Source: api-client.js

uri: url, headers: {'Accept': 'application/json', 'Content-Type': 'application/json', - 'User-Agent': 'recombee-node-api-client/3.0.0'}, + 'User-Agent': 'recombee-node-api-client/3.1.0'}, timeout: request.timeout, resolveWithFullResponse: true, json: true @@ -221,13 +221,13 @@

Source: api-client.js


diff --git a/doc/errors_api-error.js.html b/doc/errors_api-error.js.html index 295f7e8..89558f7 100644 --- a/doc/errors_api-error.js.html +++ b/doc/errors_api-error.js.html @@ -56,13 +56,13 @@

Source: errors/api-error.js


diff --git a/doc/errors_response-error.js.html b/doc/errors_response-error.js.html index 881fa5c..22244c4 100644 --- a/doc/errors_response-error.js.html +++ b/doc/errors_response-error.js.html @@ -35,8 +35,8 @@

Source: errors/response-error.js

class ResponseError extends ae.ApiError { /** * Create the exception - * @param {Request} request - ID of the item which will be modified - * @param {number} statusCode - The values for the individual properties + * @param {Request} request - Request which caused the exception + * @param {number} statusCode - The returned status code * @param {string} message - Error message from the API */ constructor(request, statusCode, message) { @@ -57,13 +57,13 @@

Source: errors/response-error.js


diff --git a/doc/errors_timeout-error.js.html b/doc/errors_timeout-error.js.html index 823e1e4..819b086 100644 --- a/doc/errors_timeout-error.js.html +++ b/doc/errors_timeout-error.js.html @@ -56,13 +56,13 @@

Source: errors/timeout-error.js


diff --git a/doc/index.html b/doc/index.html index 056c49e..571be9b 100644 --- a/doc/index.html +++ b/doc/index.html @@ -50,13 +50,13 @@


diff --git a/doc/requests_add-bookmark.js.html b/doc/requests_add-bookmark.js.html index 895ec42..74eed51 100644 --- a/doc/requests_add-bookmark.js.html +++ b/doc/requests_add-bookmark.js.html @@ -113,13 +113,13 @@

Source: requests/add-bookmark.js


diff --git a/doc/requests_add-cart-addition.js.html b/doc/requests_add-cart-addition.js.html index 84c6cb5..2ac0f65 100644 --- a/doc/requests_add-cart-addition.js.html +++ b/doc/requests_add-cart-addition.js.html @@ -127,13 +127,13 @@

Source: requests/add-cart-addition.js


diff --git a/doc/requests_add-detail-view.js.html b/doc/requests_add-detail-view.js.html index eb8559a..275d305 100644 --- a/doc/requests_add-detail-view.js.html +++ b/doc/requests_add-detail-view.js.html @@ -120,13 +120,13 @@

Source: requests/add-detail-view.js


diff --git a/doc/requests_add-group.js.html b/doc/requests_add-group.js.html index 4b751a7..bcbda40 100644 --- a/doc/requests_add-group.js.html +++ b/doc/requests_add-group.js.html @@ -78,13 +78,13 @@

Source: requests/add-group.js


diff --git a/doc/requests_add-item-property.js.html b/doc/requests_add-item-property.js.html index 2d0ac37..a3e3ae4 100644 --- a/doc/requests_add-item-property.js.html +++ b/doc/requests_add-item-property.js.html @@ -89,13 +89,13 @@

Source: requests/add-item-property.js


diff --git a/doc/requests_add-item.js.html b/doc/requests_add-item.js.html index 9c7ef46..053a2e8 100644 --- a/doc/requests_add-item.js.html +++ b/doc/requests_add-item.js.html @@ -79,13 +79,13 @@

Source: requests/add-item.js


diff --git a/doc/requests_add-purchase.js.html b/doc/requests_add-purchase.js.html index 3866ebc..e268986 100644 --- a/doc/requests_add-purchase.js.html +++ b/doc/requests_add-purchase.js.html @@ -134,13 +134,13 @@

Source: requests/add-purchase.js


diff --git a/doc/requests_add-rating.js.html b/doc/requests_add-rating.js.html index 4b2478b..f3bd34a 100644 --- a/doc/requests_add-rating.js.html +++ b/doc/requests_add-rating.js.html @@ -116,13 +116,13 @@

Source: requests/add-rating.js


diff --git a/doc/requests_add-series.js.html b/doc/requests_add-series.js.html index d8dc8b8..6463833 100644 --- a/doc/requests_add-series.js.html +++ b/doc/requests_add-series.js.html @@ -78,13 +78,13 @@

Source: requests/add-series.js


diff --git a/doc/requests_add-user-property.js.html b/doc/requests_add-user-property.js.html index fd2dce8..6c08c06 100644 --- a/doc/requests_add-user-property.js.html +++ b/doc/requests_add-user-property.js.html @@ -87,13 +87,13 @@

Source: requests/add-user-property.js


diff --git a/doc/requests_add-user.js.html b/doc/requests_add-user.js.html index 2758828..e510da1 100644 --- a/doc/requests_add-user.js.html +++ b/doc/requests_add-user.js.html @@ -78,13 +78,13 @@

Source: requests/add-user.js


diff --git a/doc/requests_batch.js.html b/doc/requests_batch.js.html index e8ea4f4..2451995 100644 --- a/doc/requests_batch.js.html +++ b/doc/requests_batch.js.html @@ -106,13 +106,13 @@

Source: requests/batch.js


diff --git a/doc/requests_delete-bookmark.js.html b/doc/requests_delete-bookmark.js.html index f6e81a6..1d42591 100644 --- a/doc/requests_delete-bookmark.js.html +++ b/doc/requests_delete-bookmark.js.html @@ -91,13 +91,13 @@

Source: requests/delete-bookmark.js


diff --git a/doc/requests_delete-cart-addition.js.html b/doc/requests_delete-cart-addition.js.html index d2c6eee..bafcb38 100644 --- a/doc/requests_delete-cart-addition.js.html +++ b/doc/requests_delete-cart-addition.js.html @@ -91,13 +91,13 @@

Source: requests/delete-cart-addition.js


diff --git a/doc/requests_delete-detail-view.js.html b/doc/requests_delete-detail-view.js.html index 5f762af..5097456 100644 --- a/doc/requests_delete-detail-view.js.html +++ b/doc/requests_delete-detail-view.js.html @@ -91,13 +91,13 @@

Source: requests/delete-detail-view.js


diff --git a/doc/requests_delete-group.js.html b/doc/requests_delete-group.js.html index 7845536..14b6fe8 100644 --- a/doc/requests_delete-group.js.html +++ b/doc/requests_delete-group.js.html @@ -79,13 +79,13 @@

Source: requests/delete-group.js


diff --git a/doc/requests_delete-item-property.js.html b/doc/requests_delete-item-property.js.html index 83ffced..4ee8cd0 100644 --- a/doc/requests_delete-item-property.js.html +++ b/doc/requests_delete-item-property.js.html @@ -78,13 +78,13 @@

Source: requests/delete-item-property.js


diff --git a/doc/requests_delete-item.js.html b/doc/requests_delete-item.js.html index 3b273b8..a9307fb 100644 --- a/doc/requests_delete-item.js.html +++ b/doc/requests_delete-item.js.html @@ -80,13 +80,13 @@

Source: requests/delete-item.js


diff --git a/doc/requests_delete-purchase.js.html b/doc/requests_delete-purchase.js.html index ba13819..13dd849 100644 --- a/doc/requests_delete-purchase.js.html +++ b/doc/requests_delete-purchase.js.html @@ -91,13 +91,13 @@

Source: requests/delete-purchase.js


diff --git a/doc/requests_delete-rating.js.html b/doc/requests_delete-rating.js.html index 1debbe5..5b09d60 100644 --- a/doc/requests_delete-rating.js.html +++ b/doc/requests_delete-rating.js.html @@ -91,13 +91,13 @@

Source: requests/delete-rating.js


diff --git a/doc/requests_delete-series.js.html b/doc/requests_delete-series.js.html index da64a52..1511fd6 100644 --- a/doc/requests_delete-series.js.html +++ b/doc/requests_delete-series.js.html @@ -79,13 +79,13 @@

Source: requests/delete-series.js


diff --git a/doc/requests_delete-user-property.js.html b/doc/requests_delete-user-property.js.html index ea4a8cd..c0596f4 100644 --- a/doc/requests_delete-user-property.js.html +++ b/doc/requests_delete-user-property.js.html @@ -78,13 +78,13 @@

Source: requests/delete-user-property.js


diff --git a/doc/requests_delete-user.js.html b/doc/requests_delete-user.js.html index fa8d10e..1f0e482 100644 --- a/doc/requests_delete-user.js.html +++ b/doc/requests_delete-user.js.html @@ -79,13 +79,13 @@

Source: requests/delete-user.js


diff --git a/doc/requests_delete-view-portion.js.html b/doc/requests_delete-view-portion.js.html index b154af5..fd8f013 100644 --- a/doc/requests_delete-view-portion.js.html +++ b/doc/requests_delete-view-portion.js.html @@ -91,13 +91,13 @@

Source: requests/delete-view-portion.js


diff --git a/doc/requests_get-item-property-info.js.html b/doc/requests_get-item-property-info.js.html index ba99ac5..bd152aa 100644 --- a/doc/requests_get-item-property-info.js.html +++ b/doc/requests_get-item-property-info.js.html @@ -78,13 +78,13 @@

Source: requests/get-item-property-info.js


diff --git a/doc/requests_get-item-values.js.html b/doc/requests_get-item-values.js.html index c8913c8..fbecc9b 100644 --- a/doc/requests_get-item-values.js.html +++ b/doc/requests_get-item-values.js.html @@ -78,13 +78,13 @@

Source: requests/get-item-values.js


diff --git a/doc/requests_get-user-property-info.js.html b/doc/requests_get-user-property-info.js.html index 5cc81d3..c02cd1f 100644 --- a/doc/requests_get-user-property-info.js.html +++ b/doc/requests_get-user-property-info.js.html @@ -78,13 +78,13 @@

Source: requests/get-user-property-info.js


diff --git a/doc/requests_get-user-values.js.html b/doc/requests_get-user-values.js.html index e065dd9..9157d1b 100644 --- a/doc/requests_get-user-values.js.html +++ b/doc/requests_get-user-values.js.html @@ -78,13 +78,13 @@

Source: requests/get-user-values.js


diff --git a/doc/requests_insert-to-group.js.html b/doc/requests_insert-to-group.js.html index a341385..9dd00cf 100644 --- a/doc/requests_insert-to-group.js.html +++ b/doc/requests_insert-to-group.js.html @@ -94,13 +94,13 @@

Source: requests/insert-to-group.js


diff --git a/doc/requests_insert-to-series.js.html b/doc/requests_insert-to-series.js.html index 6516e8d..3386a63 100644 --- a/doc/requests_insert-to-series.js.html +++ b/doc/requests_insert-to-series.js.html @@ -97,13 +97,13 @@

Source: requests/insert-to-series.js


diff --git a/doc/requests_item-based-recommendation.js.html b/doc/requests_item-based-recommendation.js.html index d68632d..725500d 100644 --- a/doc/requests_item-based-recommendation.js.html +++ b/doc/requests_item-based-recommendation.js.html @@ -223,13 +223,13 @@

Source: requests/item-based-recommendation.js


diff --git a/doc/requests_list-group-items.js.html b/doc/requests_list-group-items.js.html index d6b4b4f..86e2903 100644 --- a/doc/requests_list-group-items.js.html +++ b/doc/requests_list-group-items.js.html @@ -78,13 +78,13 @@

Source: requests/list-group-items.js


diff --git a/doc/requests_list-groups.js.html b/doc/requests_list-groups.js.html index 9a784d3..a882b89 100644 --- a/doc/requests_list-groups.js.html +++ b/doc/requests_list-groups.js.html @@ -76,13 +76,13 @@

Source: requests/list-groups.js


diff --git a/doc/requests_list-item-bookmarks.js.html b/doc/requests_list-item-bookmarks.js.html index 9915306..b373138 100644 --- a/doc/requests_list-item-bookmarks.js.html +++ b/doc/requests_list-item-bookmarks.js.html @@ -78,13 +78,13 @@

Source: requests/list-item-bookmarks.js


diff --git a/doc/requests_list-item-cart-additions.js.html b/doc/requests_list-item-cart-additions.js.html index c6dff81..bf8c661 100644 --- a/doc/requests_list-item-cart-additions.js.html +++ b/doc/requests_list-item-cart-additions.js.html @@ -78,13 +78,13 @@

Source: requests/list-item-cart-additions.js


diff --git a/doc/requests_list-item-detail-views.js.html b/doc/requests_list-item-detail-views.js.html index 10e1591..76d0aa8 100644 --- a/doc/requests_list-item-detail-views.js.html +++ b/doc/requests_list-item-detail-views.js.html @@ -78,13 +78,13 @@

Source: requests/list-item-detail-views.js


diff --git a/doc/requests_list-item-properties.js.html b/doc/requests_list-item-properties.js.html index f8cd7ca..a62665f 100644 --- a/doc/requests_list-item-properties.js.html +++ b/doc/requests_list-item-properties.js.html @@ -76,13 +76,13 @@

Source: requests/list-item-properties.js


diff --git a/doc/requests_list-item-purchases.js.html b/doc/requests_list-item-purchases.js.html index 44b7547..1c8c860 100644 --- a/doc/requests_list-item-purchases.js.html +++ b/doc/requests_list-item-purchases.js.html @@ -78,13 +78,13 @@

Source: requests/list-item-purchases.js


diff --git a/doc/requests_list-item-ratings.js.html b/doc/requests_list-item-ratings.js.html index 2ae2d37..d61d45f 100644 --- a/doc/requests_list-item-ratings.js.html +++ b/doc/requests_list-item-ratings.js.html @@ -78,13 +78,13 @@

Source: requests/list-item-ratings.js


diff --git a/doc/requests_list-item-view-portions.js.html b/doc/requests_list-item-view-portions.js.html index 8e097fa..abd6dc0 100644 --- a/doc/requests_list-item-view-portions.js.html +++ b/doc/requests_list-item-view-portions.js.html @@ -78,13 +78,13 @@

Source: requests/list-item-view-portions.js


diff --git a/doc/requests_list-items.js.html b/doc/requests_list-items.js.html index 8655860..fb735b6 100644 --- a/doc/requests_list-items.js.html +++ b/doc/requests_list-items.js.html @@ -143,13 +143,13 @@

Source: requests/list-items.js


diff --git a/doc/requests_list-series-items.js.html b/doc/requests_list-series-items.js.html index a76298a..45e15ae 100644 --- a/doc/requests_list-series-items.js.html +++ b/doc/requests_list-series-items.js.html @@ -78,13 +78,13 @@

Source: requests/list-series-items.js


diff --git a/doc/requests_list-series.js.html b/doc/requests_list-series.js.html index 14f419f..069194f 100644 --- a/doc/requests_list-series.js.html +++ b/doc/requests_list-series.js.html @@ -76,13 +76,13 @@

Source: requests/list-series.js


diff --git a/doc/requests_list-user-bookmarks.js.html b/doc/requests_list-user-bookmarks.js.html index ec4964a..59f69af 100644 --- a/doc/requests_list-user-bookmarks.js.html +++ b/doc/requests_list-user-bookmarks.js.html @@ -78,13 +78,13 @@

Source: requests/list-user-bookmarks.js


diff --git a/doc/requests_list-user-cart-additions.js.html b/doc/requests_list-user-cart-additions.js.html index 588501c..1e1614d 100644 --- a/doc/requests_list-user-cart-additions.js.html +++ b/doc/requests_list-user-cart-additions.js.html @@ -78,13 +78,13 @@

Source: requests/list-user-cart-additions.js


diff --git a/doc/requests_list-user-detail-views.js.html b/doc/requests_list-user-detail-views.js.html index 5fae1d9..af6729d 100644 --- a/doc/requests_list-user-detail-views.js.html +++ b/doc/requests_list-user-detail-views.js.html @@ -78,13 +78,13 @@

Source: requests/list-user-detail-views.js


diff --git a/doc/requests_list-user-properties.js.html b/doc/requests_list-user-properties.js.html index a3d4846..9b590c9 100644 --- a/doc/requests_list-user-properties.js.html +++ b/doc/requests_list-user-properties.js.html @@ -76,13 +76,13 @@

Source: requests/list-user-properties.js


diff --git a/doc/requests_list-user-purchases.js.html b/doc/requests_list-user-purchases.js.html index a590958..0c9ea24 100644 --- a/doc/requests_list-user-purchases.js.html +++ b/doc/requests_list-user-purchases.js.html @@ -78,13 +78,13 @@

Source: requests/list-user-purchases.js


diff --git a/doc/requests_list-user-ratings.js.html b/doc/requests_list-user-ratings.js.html index 8aec976..0b44555 100644 --- a/doc/requests_list-user-ratings.js.html +++ b/doc/requests_list-user-ratings.js.html @@ -78,13 +78,13 @@

Source: requests/list-user-ratings.js


diff --git a/doc/requests_list-user-view-portions.js.html b/doc/requests_list-user-view-portions.js.html index 9521ed2..221a1f0 100644 --- a/doc/requests_list-user-view-portions.js.html +++ b/doc/requests_list-user-view-portions.js.html @@ -78,13 +78,13 @@

Source: requests/list-user-view-portions.js


diff --git a/doc/requests_list-users.js.html b/doc/requests_list-users.js.html index 5f2d5a3..46eaab0 100644 --- a/doc/requests_list-users.js.html +++ b/doc/requests_list-users.js.html @@ -137,13 +137,13 @@

Source: requests/list-users.js


diff --git a/doc/requests_merge-users.js.html b/doc/requests_merge-users.js.html index 7c165a6..c50dcb3 100644 --- a/doc/requests_merge-users.js.html +++ b/doc/requests_merge-users.js.html @@ -90,13 +90,13 @@

Source: requests/merge-users.js


diff --git a/doc/requests_recommend-items-to-item.js.html b/doc/requests_recommend-items-to-item.js.html index 5daa03f..deba1d1 100644 --- a/doc/requests_recommend-items-to-item.js.html +++ b/doc/requests_recommend-items-to-item.js.html @@ -35,8 +35,11 @@

Source: requests/recommend-items-to-item.js

/** * Recommends set of items that are somehow related to one given item, *X*. Typical scenario is when user *A* is viewing *X*. Then you may display items to the user that he might be also interested in. Recommend items to item request gives you Top-N such items, optionally taking the target user *A* into account. + * The returned items are sorted by relevance (first item being the most relevant). + * Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to: + * - Let Recombee know that this recommendation was successful (e.g. user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics). + * - Get subsequent recommended items when the user scrolls down (*infinite scroll*) or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items). * It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters. - * The returned items are sorted by relevancy (first item being the most relevant). */ class RecommendItemsToItem extends rqs.Request { @@ -94,7 +97,8 @@

Source: requests/recommend-items-to-item.js

* "url": "myshop.com/mixer-42" * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *includedProperties* @@ -120,7 +124,8 @@

Source: requests/recommend-items-to-item.js

* "price": 39 * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *filter* @@ -145,7 +150,7 @@

Source: requests/recommend-items-to-item.js

* - Description: **Expert option** Real number from [0.0, 1.0] which determines how much mutually dissimilar should the recommended items be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification. * - *minRelevance* * - Type: string - * - Description: **Expert option** If the *targetUserId* is provided: Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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 relevancy, and may return less than *count* items when there is not enough data to fulfill it. + * - Description: **Expert option** If the *targetUserId* is provided: Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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. * - *rotationRate* * - Type: number * - 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 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. @@ -256,13 +261,13 @@

Source: requests/recommend-items-to-item.js


diff --git a/doc/requests_recommend-items-to-user.js.html b/doc/requests_recommend-items-to-user.js.html index fbee024..fad0ec9 100644 --- a/doc/requests_recommend-items-to-user.js.html +++ b/doc/requests_recommend-items-to-user.js.html @@ -36,8 +36,11 @@

Source: requests/recommend-items-to-user.js

/** * Based on user's past interactions (purchases, ratings, etc.) with the items, recommends top-N items that are most likely to be of high value for a given user. * The most typical use cases are recommendations at homepage, in some "Picked just for you" section or in email. + * The returned items are sorted by relevance (first item being the most relevant). + * Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to: + * - Let Recombee know that this recommendation was successful (e.g. user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics). + * - Get subsequent recommended items when the user scrolls down (*infinite scroll*) or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items). * It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters. - * The returned items are sorted by relevancy (first item being the most relevant). */ class RecommendItemsToUser extends rqs.Request { @@ -82,7 +85,8 @@

Source: requests/recommend-items-to-user.js

* "url": "myshop.com/mixer-42" * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *includedProperties* @@ -108,7 +112,8 @@

Source: requests/recommend-items-to-user.js

* "price": 39 * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *filter* @@ -130,7 +135,7 @@

Source: requests/recommend-items-to-user.js

* - Description: **Expert option** Real number from [0.0, 1.0] which determines how much mutually dissimilar should the recommended items be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification. * - *minRelevance* * - Type: string - * - Description: **Expert option** Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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 relevancy, and may return less than *count* items when there is not enough data to fulfill it. + * - Description: **Expert option** Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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. * - *rotationRate* * - Type: number * - Description: **Expert option** 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 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. Default: `0.1`. @@ -235,13 +240,13 @@

Source: requests/recommend-items-to-user.js


diff --git a/doc/requests_recommend-next-items.js.html b/doc/requests_recommend-next-items.js.html new file mode 100644 index 0000000..2a51987 --- /dev/null +++ b/doc/requests_recommend-next-items.js.html @@ -0,0 +1,106 @@ + + + + + JSDoc: Source: requests/recommend-next-items.js + + + + + + + + + + +
+ +

Source: requests/recommend-next-items.js

+ + + + + + +
+
+
/*
+ This file is auto-generated, do not edit
+*/
+
+'use strict';
+const rqs = require("./request");
+
+/**
+ * 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 a next page.
+ * It accepts `recommId` of a base recommendation request (e.g. request from the first page) and number of items that shall be returned (`count`).
+ * The base request can be one of:
+ *   - [Recommend items to item](https://docs.recombee.com/api.html#recommend-items-to-item)
+ *   - [Recommend items to user](https://docs.recombee.com/api.html#recommend-items-to-user)
+ *   - [Search items](https://docs.recombee.com/api.html#search-items)
+ * All the other parameters are inherited from the base request.
+ * *Recommend next items* can be called many times for a single `recommId` and each call returns different (previously not recommended) items.
+ * The number of *Recommend next items* calls performed so far is returned in the `numberNextRecommsCalls` field.
+ * *Recommend next items* can be requested up to 30 minutes after the base request or a previous *Recommend next items* call.
+ * For billing purposes, each call to *Recommend next items* is counted as a separate recommendation request.
+ */
+class RecommendNextItems extends rqs.Request {
+
+  /**
+   * Construct the request
+   * @param {string} recommId - ID of the base recommendation request for which next recommendations should be returned
+   * @param {number} count - Number of items to be recommended
+   */
+  constructor(recommId, count) {
+    super('POST', `/recomms/next/items/${recommId}`, 3000, false);
+    this.recommId = recommId;
+    this.count = count;
+  }
+
+  /**
+   * Get body parameters
+   * @return {Object} The values of body parameters (name of parameter: value of the parameter)
+   */
+  bodyParameters() {
+    let params = {};
+    params.count = this.count;
+
+    return params;
+  }
+
+  /**
+   * Get query parameters
+   * @return {Object} The values of query parameters (name of parameter: value of the parameter)
+   */
+  queryParameters() {
+    let params = {};
+    return params;
+  }
+}
+
+exports.RecommendNextItems = RecommendNextItems
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/doc/requests_recommend-users-to-item.js.html b/doc/requests_recommend-users-to-item.js.html index fb6539b..82ecc2d 100644 --- a/doc/requests_recommend-users-to-item.js.html +++ b/doc/requests_recommend-users-to-item.js.html @@ -77,7 +77,8 @@

Source: requests/recommend-users-to-item.js

* "sex": "M" * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *includedProperties* @@ -101,7 +102,8 @@

Source: requests/recommend-users-to-item.js

* "country": "CAN" * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *filter* @@ -207,13 +209,13 @@

Source: requests/recommend-users-to-item.js


diff --git a/doc/requests_recommend-users-to-user.js.html b/doc/requests_recommend-users-to-user.js.html index 282ffb0..dcceed8 100644 --- a/doc/requests_recommend-users-to-user.js.html +++ b/doc/requests_recommend-users-to-user.js.html @@ -77,8 +77,9 @@

Source: requests/recommend-users-to-user.js

* "sex": "M" * } * } - * ] - * } + * ], + * "numberNextRecommsCalls": 0 + * } * ``` * - *includedProperties* * - Type: string[] @@ -101,7 +102,8 @@

Source: requests/recommend-users-to-user.js

* "country": "CAN" * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *filter* @@ -228,13 +230,13 @@

Source: requests/recommend-users-to-user.js


diff --git a/doc/requests_remove-from-group.js.html b/doc/requests_remove-from-group.js.html index 6224725..c9fdc19 100644 --- a/doc/requests_remove-from-group.js.html +++ b/doc/requests_remove-from-group.js.html @@ -84,13 +84,13 @@

Source: requests/remove-from-group.js


diff --git a/doc/requests_remove-from-series.js.html b/doc/requests_remove-from-series.js.html index d6ced03..926ca51 100644 --- a/doc/requests_remove-from-series.js.html +++ b/doc/requests_remove-from-series.js.html @@ -87,13 +87,13 @@

Source: requests/remove-from-series.js


diff --git a/doc/requests_request.js.html b/doc/requests_request.js.html index c8f7760..3bda78b 100644 --- a/doc/requests_request.js.html +++ b/doc/requests_request.js.html @@ -58,13 +58,13 @@

Source: requests/request.js


diff --git a/doc/requests_reset-database.js.html b/doc/requests_reset-database.js.html index 65a6f34..114af51 100644 --- a/doc/requests_reset-database.js.html +++ b/doc/requests_reset-database.js.html @@ -76,13 +76,13 @@

Source: requests/reset-database.js


diff --git a/doc/requests_search-items.js.html b/doc/requests_search-items.js.html index 12dce19..fe672c2 100644 --- a/doc/requests_search-items.js.html +++ b/doc/requests_search-items.js.html @@ -37,8 +37,11 @@

Source: requests/search-items.js

* Full-text personalized search. The results are based on the provided `searchQuery` and also on the user's past interactions (purchases, ratings, etc.) with the items (items more suitable for the user are preferred in the results). * All the string and set item properties are indexed by the search engine. * This endpoint should be used in a search box at your website/app. It can be called multiple times as the user is typing the query in order to get the most viable suggestions based on current state of the query, or once after submitting the whole query. + * The returned items are sorted by relevance (first item being the most relevant). + * Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to: + * - Let Recombee know that this search was successful (e.g. user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics). + * - Get subsequent search results when the user scrolls down or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items). * It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters. - * The returned items are sorted by relevancy (first item being the most relevant). */ class SearchItems extends rqs.Request { @@ -84,7 +87,8 @@

Source: requests/search-items.js

* "url": "myshop.com/mixer-42" * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *includedProperties* @@ -110,7 +114,8 @@

Source: requests/search-items.js

* "price": 39 * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *filter* @@ -211,13 +216,13 @@

Source: requests/search-items.js


diff --git a/doc/requests_set-item-values.js.html b/doc/requests_set-item-values.js.html index 62aa9d4..21b2a75 100644 --- a/doc/requests_set-item-values.js.html +++ b/doc/requests_set-item-values.js.html @@ -65,13 +65,13 @@

Source: requests/set-item-values.js


diff --git a/doc/requests_set-user-values.js.html b/doc/requests_set-user-values.js.html index 4eb5cba..eda1ed2 100644 --- a/doc/requests_set-user-values.js.html +++ b/doc/requests_set-user-values.js.html @@ -64,13 +64,13 @@

Source: requests/set-user-values.js


diff --git a/doc/requests_set-values.js.html b/doc/requests_set-values.js.html index 8e6d58a..6a28fe9 100644 --- a/doc/requests_set-values.js.html +++ b/doc/requests_set-values.js.html @@ -87,13 +87,13 @@

Source: requests/set-values.js


diff --git a/doc/requests_set-view-portion.js.html b/doc/requests_set-view-portion.js.html index 7471323..22c9df4 100644 --- a/doc/requests_set-view-portion.js.html +++ b/doc/requests_set-view-portion.js.html @@ -124,13 +124,13 @@

Source: requests/set-view-portion.js


diff --git a/doc/requests_user-based-recommendation.js.html b/doc/requests_user-based-recommendation.js.html index 8bd7f5b..5e97bca 100644 --- a/doc/requests_user-based-recommendation.js.html +++ b/doc/requests_user-based-recommendation.js.html @@ -204,13 +204,13 @@

Source: requests/user-based-recommendation.js


diff --git a/doc/scripts/linenumber.js b/doc/scripts/linenumber.js index 8d52f7e..4354785 100644 --- a/doc/scripts/linenumber.js +++ b/doc/scripts/linenumber.js @@ -1,12 +1,12 @@ /*global document */ -(function() { - var source = document.getElementsByClassName('prettyprint source linenums'); - var i = 0; - var lineNumber = 0; - var lineId; - var lines; - var totalLines; - var anchorHash; +(() => { + const source = document.getElementsByClassName('prettyprint source linenums'); + let i = 0; + let lineNumber = 0; + let lineId; + let lines; + let totalLines; + let anchorHash; if (source && source[0]) { anchorHash = document.location.hash.substring(1); @@ -15,7 +15,7 @@ for (; i < totalLines; i++) { lineNumber++; - lineId = 'line' + lineNumber; + lineId = `line${lineNumber}`; lines[i].id = lineId; if (lineId === anchorHash) { lines[i].className += ' selected'; diff --git a/doc/styles/jsdoc-default.css b/doc/styles/jsdoc-default.css index 9207bc8..7d1729d 100644 --- a/doc/styles/jsdoc-default.css +++ b/doc/styles/jsdoc-default.css @@ -273,7 +273,7 @@ tr > th:last-child { border-right: 1px solid #ddd; } margin: 0; } -.prettyprint +.source { border: 1px solid #ddd; width: 80%; @@ -284,7 +284,7 @@ tr > th:last-child { border-right: 1px solid #ddd; } width: inherit; } -.prettyprint code +.source code { font-size: 100%; line-height: 18px; diff --git a/lib/api-client.js b/lib/api-client.js index 66403f6..1142f2e 100644 --- a/lib/api-client.js +++ b/lib/api-client.js @@ -44,7 +44,7 @@ class ApiClient { uri: url, headers: {'Accept': 'application/json', 'Content-Type': 'application/json', - 'User-Agent': 'recombee-node-api-client/3.0.0'}, + 'User-Agent': 'recombee-node-api-client/3.1.0'}, timeout: request.timeout, resolveWithFullResponse: true, json: true diff --git a/lib/requests/index.js b/lib/requests/index.js index 308d629..2b1120c 100644 --- a/lib/requests/index.js +++ b/lib/requests/index.js @@ -59,8 +59,9 @@ exports.DeleteViewPortion = require("./delete-view-portion").DeleteViewPortion; exports.ListItemViewPortions = require("./list-item-view-portions").ListItemViewPortions; exports.ListUserViewPortions = require("./list-user-view-portions").ListUserViewPortions; exports.RecommendItemsToUser = require("./recommend-items-to-user").RecommendItemsToUser; -exports.RecommendUsersToUser = require("./recommend-users-to-user").RecommendUsersToUser; exports.RecommendItemsToItem = require("./recommend-items-to-item").RecommendItemsToItem; +exports.RecommendNextItems = require("./recommend-next-items").RecommendNextItems; +exports.RecommendUsersToUser = require("./recommend-users-to-user").RecommendUsersToUser; exports.RecommendUsersToItem = require("./recommend-users-to-item").RecommendUsersToItem; exports.SearchItems = require("./search-items").SearchItems; exports.UserBasedRecommendation = require("./user-based-recommendation").UserBasedRecommendation; diff --git a/lib/requests/recommend-items-to-item.js b/lib/requests/recommend-items-to-item.js index 2e69fc4..a87d836 100644 --- a/lib/requests/recommend-items-to-item.js +++ b/lib/requests/recommend-items-to-item.js @@ -7,8 +7,11 @@ const rqs = require("./request"); /** * Recommends set of items that are somehow related to one given item, *X*. Typical scenario is when user *A* is viewing *X*. Then you may display items to the user that he might be also interested in. Recommend items to item request gives you Top-N such items, optionally taking the target user *A* into account. + * The returned items are sorted by relevance (first item being the most relevant). + * Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to: + * - Let Recombee know that this recommendation was successful (e.g. user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics). + * - Get subsequent recommended items when the user scrolls down (*infinite scroll*) or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items). * It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters. - * The returned items are sorted by relevancy (first item being the most relevant). */ class RecommendItemsToItem extends rqs.Request { @@ -66,7 +69,8 @@ class RecommendItemsToItem extends rqs.Request { * "url": "myshop.com/mixer-42" * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *includedProperties* @@ -92,7 +96,8 @@ class RecommendItemsToItem extends rqs.Request { * "price": 39 * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *filter* @@ -117,7 +122,7 @@ class RecommendItemsToItem extends rqs.Request { * - Description: **Expert option** Real number from [0.0, 1.0] which determines how much mutually dissimilar should the recommended items be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification. * - *minRelevance* * - Type: string - * - Description: **Expert option** If the *targetUserId* is provided: Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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 relevancy, and may return less than *count* items when there is not enough data to fulfill it. + * - Description: **Expert option** If the *targetUserId* is provided: Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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. * - *rotationRate* * - Type: number * - 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 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. diff --git a/lib/requests/recommend-items-to-user.js b/lib/requests/recommend-items-to-user.js index fd138eb..35aa926 100644 --- a/lib/requests/recommend-items-to-user.js +++ b/lib/requests/recommend-items-to-user.js @@ -8,8 +8,11 @@ const rqs = require("./request"); /** * Based on user's past interactions (purchases, ratings, etc.) with the items, recommends top-N items that are most likely to be of high value for a given user. * The most typical use cases are recommendations at homepage, in some "Picked just for you" section or in email. + * The returned items are sorted by relevance (first item being the most relevant). + * Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to: + * - Let Recombee know that this recommendation was successful (e.g. user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics). + * - Get subsequent recommended items when the user scrolls down (*infinite scroll*) or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items). * It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters. - * The returned items are sorted by relevancy (first item being the most relevant). */ class RecommendItemsToUser extends rqs.Request { @@ -54,7 +57,8 @@ class RecommendItemsToUser extends rqs.Request { * "url": "myshop.com/mixer-42" * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *includedProperties* @@ -80,7 +84,8 @@ class RecommendItemsToUser extends rqs.Request { * "price": 39 * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *filter* @@ -102,7 +107,7 @@ class RecommendItemsToUser extends rqs.Request { * - Description: **Expert option** Real number from [0.0, 1.0] which determines how much mutually dissimilar should the recommended items be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification. * - *minRelevance* * - Type: string - * - Description: **Expert option** Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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 relevancy, and may return less than *count* items when there is not enough data to fulfill it. + * - Description: **Expert option** Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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. * - *rotationRate* * - Type: number * - Description: **Expert option** 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 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. Default: `0.1`. diff --git a/lib/requests/recommend-next-items.js b/lib/requests/recommend-next-items.js new file mode 100644 index 0000000..29f1c1e --- /dev/null +++ b/lib/requests/recommend-next-items.js @@ -0,0 +1,55 @@ +/* + This file is auto-generated, do not edit +*/ + +'use strict'; +const rqs = require("./request"); + +/** + * 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 a next page. + * It accepts `recommId` of a base recommendation request (e.g. request from the first page) and number of items that shall be returned (`count`). + * The base request can be one of: + * - [Recommend items to item](https://docs.recombee.com/api.html#recommend-items-to-item) + * - [Recommend items to user](https://docs.recombee.com/api.html#recommend-items-to-user) + * - [Search items](https://docs.recombee.com/api.html#search-items) + * All the other parameters are inherited from the base request. + * *Recommend next items* can be called many times for a single `recommId` and each call returns different (previously not recommended) items. + * The number of *Recommend next items* calls performed so far is returned in the `numberNextRecommsCalls` field. + * *Recommend next items* can be requested up to 30 minutes after the base request or a previous *Recommend next items* call. + * For billing purposes, each call to *Recommend next items* is counted as a separate recommendation request. + */ +class RecommendNextItems extends rqs.Request { + + /** + * Construct the request + * @param {string} recommId - ID of the base recommendation request for which next recommendations should be returned + * @param {number} count - Number of items to be recommended + */ + constructor(recommId, count) { + super('POST', `/recomms/next/items/${recommId}`, 3000, false); + this.recommId = recommId; + this.count = count; + } + + /** + * Get body parameters + * @return {Object} The values of body parameters (name of parameter: value of the parameter) + */ + bodyParameters() { + let params = {}; + params.count = this.count; + + return params; + } + + /** + * Get query parameters + * @return {Object} The values of query parameters (name of parameter: value of the parameter) + */ + queryParameters() { + let params = {}; + return params; + } +} + +exports.RecommendNextItems = RecommendNextItems diff --git a/lib/requests/recommend-users-to-item.js b/lib/requests/recommend-users-to-item.js index 70fe543..5e77fbe 100644 --- a/lib/requests/recommend-users-to-item.js +++ b/lib/requests/recommend-users-to-item.js @@ -49,7 +49,8 @@ class RecommendUsersToItem extends rqs.Request { * "sex": "M" * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *includedProperties* @@ -73,7 +74,8 @@ class RecommendUsersToItem extends rqs.Request { * "country": "CAN" * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *filter* diff --git a/lib/requests/recommend-users-to-user.js b/lib/requests/recommend-users-to-user.js index 9f65153..4b4e716 100644 --- a/lib/requests/recommend-users-to-user.js +++ b/lib/requests/recommend-users-to-user.js @@ -49,8 +49,9 @@ class RecommendUsersToUser extends rqs.Request { * "sex": "M" * } * } - * ] - * } + * ], + * "numberNextRecommsCalls": 0 + * } * ``` * - *includedProperties* * - Type: string[] @@ -73,7 +74,8 @@ class RecommendUsersToUser extends rqs.Request { * "country": "CAN" * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *filter* diff --git a/lib/requests/search-items.js b/lib/requests/search-items.js index b412542..8f7fffe 100644 --- a/lib/requests/search-items.js +++ b/lib/requests/search-items.js @@ -9,8 +9,11 @@ const rqs = require("./request"); * Full-text personalized search. The results are based on the provided `searchQuery` and also on the user's past interactions (purchases, ratings, etc.) with the items (items more suitable for the user are preferred in the results). * All the string and set item properties are indexed by the search engine. * This endpoint should be used in a search box at your website/app. It can be called multiple times as the user is typing the query in order to get the most viable suggestions based on current state of the query, or once after submitting the whole query. + * The returned items are sorted by relevance (first item being the most relevant). + * Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to: + * - Let Recombee know that this search was successful (e.g. user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics). + * - Get subsequent search results when the user scrolls down or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items). * It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters. - * The returned items are sorted by relevancy (first item being the most relevant). */ class SearchItems extends rqs.Request { @@ -56,7 +59,8 @@ class SearchItems extends rqs.Request { * "url": "myshop.com/mixer-42" * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *includedProperties* @@ -82,7 +86,8 @@ class SearchItems extends rqs.Request { * "price": 39 * } * } - * ] + * ], + * "numberNextRecommsCalls": 0 * } * ``` * - *filter* diff --git a/package.json b/package.json index 1d3a9f5..4260944 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "recombee-api-client", - "version": "3.0.0", + "version": "3.1.0", "description": "Node.js client (SDK) for easy use of the Recombee recommendation API", "main": "index.js", "scripts": { diff --git a/test/add-bookmark-batch_test.js b/test/add-bookmark-batch_test.js index 204dcbe..66285a0 100644 --- a/test/add-bookmark-batch_test.js +++ b/test/add-bookmark-batch_test.js @@ -29,19 +29,19 @@ describe('AddBookmark', function(){ new rqs.AddBookmark('entity_id','entity_id',{'timestamp': -15}), new rqs.AddBookmark('u_id2','i_id2',{'cascadeCreate': true,'timestamp': 5}), new rqs.AddBookmark('u_id2','i_id2',{'cascadeCreate': true,'timestamp': 5}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 200); - chai.equal(responses[3].code, 404); - chai.equal(responses[4].code, 404); - chai.equal(responses[5].code, 400); - chai.equal(responses[6].code, 200); - chai.equal(responses[7].code, 409); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 200); + chai.equal(responses[3].code, 404); + chai.equal(responses[4].code, 404); + chai.equal(responses[5].code, 400); + chai.equal(responses[6].code, 200); + chai.equal(responses[7].code, 409); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/add-cart-addition-batch_test.js b/test/add-cart-addition-batch_test.js index 213d7c9..c1138d3 100644 --- a/test/add-cart-addition-batch_test.js +++ b/test/add-cart-addition-batch_test.js @@ -29,19 +29,19 @@ describe('AddCartAddition', function(){ new rqs.AddCartAddition('entity_id','entity_id',{'timestamp': -15}), new rqs.AddCartAddition('u_id2','i_id2',{'cascadeCreate': true,'timestamp': 5}), new rqs.AddCartAddition('u_id2','i_id2',{'cascadeCreate': true,'timestamp': 5}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 200); - chai.equal(responses[3].code, 404); - chai.equal(responses[4].code, 404); - chai.equal(responses[5].code, 400); - chai.equal(responses[6].code, 200); - chai.equal(responses[7].code, 409); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 200); + chai.equal(responses[3].code, 404); + chai.equal(responses[4].code, 404); + chai.equal(responses[5].code, 400); + chai.equal(responses[6].code, 200); + chai.equal(responses[7].code, 409); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/add-detail-view-batch_test.js b/test/add-detail-view-batch_test.js index 0f261f7..c295f67 100644 --- a/test/add-detail-view-batch_test.js +++ b/test/add-detail-view-batch_test.js @@ -29,19 +29,19 @@ describe('AddDetailView', function(){ new rqs.AddDetailView('entity_id','entity_id',{'timestamp': -15}), new rqs.AddDetailView('u_id2','i_id2',{'cascadeCreate': true,'timestamp': 5}), new rqs.AddDetailView('u_id2','i_id2',{'cascadeCreate': true,'timestamp': 5}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 200); - chai.equal(responses[3].code, 404); - chai.equal(responses[4].code, 404); - chai.equal(responses[5].code, 400); - chai.equal(responses[6].code, 200); - chai.equal(responses[7].code, 409); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 200); + chai.equal(responses[3].code, 404); + chai.equal(responses[4].code, 404); + chai.equal(responses[5].code, 400); + chai.equal(responses[6].code, 200); + chai.equal(responses[7].code, 409); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/add-group-batch_test.js b/test/add-group-batch_test.js index e953b8f..4347483 100644 --- a/test/add-group-batch_test.js +++ b/test/add-group-batch_test.js @@ -22,18 +22,18 @@ describe('AddGroup', function(){ it ('works in batch', (done) => { let requests = [ new rqs.AddGroup('valid_id'), - new rqs.AddGroup('$$$not_valid$$$'), + new rqs.AddGroup('***not_valid$$$'), new rqs.AddGroup('valid_id2'), new rqs.AddGroup('valid_id2') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 201); - chai.equal(responses[1].code, 400); - chai.equal(responses[2].code, 201); - chai.equal(responses[3].code, 409); + chai.equal(responses[0].code, 201); + chai.equal(responses[1].code, 400); + chai.equal(responses[2].code, 201); + chai.equal(responses[3].code, 409); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/add-group-callback_test.js b/test/add-group-callback_test.js index 232c792..c9bcc13 100644 --- a/test/add-group-callback_test.js +++ b/test/add-group-callback_test.js @@ -35,7 +35,7 @@ describe('AddGroup', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.AddGroup('$$$not_valid$$$'); + req = new rqs.AddGroup('***not_valid$$$'); env.client.send(req,((err,res) => { if(err) { chai.equal(err.name, 'ResponseError'); diff --git a/test/add-group-test.js b/test/add-group-test.js index c967f37..50939b2 100644 --- a/test/add-group-test.js +++ b/test/add-group-test.js @@ -31,7 +31,7 @@ describe('AddGroup', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.AddGroup('$$$not_valid$$$'); + req = new rqs.AddGroup('***not_valid$$$'); env.client.send(req) .then((res) => { chai.fail(); diff --git a/test/add-item-batch_test.js b/test/add-item-batch_test.js index 1ce874e..81c8c5b 100644 --- a/test/add-item-batch_test.js +++ b/test/add-item-batch_test.js @@ -22,18 +22,18 @@ describe('AddItem', function(){ it ('works in batch', (done) => { let requests = [ new rqs.AddItem('valid_id'), - new rqs.AddItem('$$$not_valid$$$'), + new rqs.AddItem('***not_valid$$$'), new rqs.AddItem('valid_id2'), new rqs.AddItem('valid_id2') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 201); - chai.equal(responses[1].code, 400); - chai.equal(responses[2].code, 201); - chai.equal(responses[3].code, 409); + chai.equal(responses[0].code, 201); + chai.equal(responses[1].code, 400); + chai.equal(responses[2].code, 201); + chai.equal(responses[3].code, 409); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/add-item-callback_test.js b/test/add-item-callback_test.js index 5dbd97a..3eb16b6 100644 --- a/test/add-item-callback_test.js +++ b/test/add-item-callback_test.js @@ -35,7 +35,7 @@ describe('AddItem', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.AddItem('$$$not_valid$$$'); + req = new rqs.AddItem('***not_valid$$$'); env.client.send(req,((err,res) => { if(err) { chai.equal(err.name, 'ResponseError'); diff --git a/test/add-item-property-batch_test.js b/test/add-item-property-batch_test.js index 3b84a54..451953b 100644 --- a/test/add-item-property-batch_test.js +++ b/test/add-item-property-batch_test.js @@ -26,16 +26,16 @@ describe('AddItemProperty', function(){ new rqs.AddItemProperty('prop','integer'), new rqs.AddItemProperty('number2','int'), new rqs.AddItemProperty('number2','int') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 201); - chai.equal(responses[1].code, 201); - chai.equal(responses[2].code, 400); - chai.equal(responses[3].code, 201); - chai.equal(responses[4].code, 409); + chai.equal(responses[0].code, 201); + chai.equal(responses[1].code, 201); + chai.equal(responses[2].code, 400); + chai.equal(responses[3].code, 201); + chai.equal(responses[4].code, 409); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/add-item-test.js b/test/add-item-test.js index 2b0a5a6..dd02bf4 100644 --- a/test/add-item-test.js +++ b/test/add-item-test.js @@ -31,7 +31,7 @@ describe('AddItem', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.AddItem('$$$not_valid$$$'); + req = new rqs.AddItem('***not_valid$$$'); env.client.send(req) .then((res) => { chai.fail(); diff --git a/test/add-purchase-batch_test.js b/test/add-purchase-batch_test.js index 3f29855..edb0ee2 100644 --- a/test/add-purchase-batch_test.js +++ b/test/add-purchase-batch_test.js @@ -29,19 +29,19 @@ describe('AddPurchase', function(){ new rqs.AddPurchase('entity_id','entity_id',{'timestamp': -15}), new rqs.AddPurchase('u_id2','i_id2',{'cascadeCreate': true,'timestamp': 5}), new rqs.AddPurchase('u_id2','i_id2',{'cascadeCreate': true,'timestamp': 5}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 200); - chai.equal(responses[3].code, 404); - chai.equal(responses[4].code, 404); - chai.equal(responses[5].code, 400); - chai.equal(responses[6].code, 200); - chai.equal(responses[7].code, 409); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 200); + chai.equal(responses[3].code, 404); + chai.equal(responses[4].code, 404); + chai.equal(responses[5].code, 400); + chai.equal(responses[6].code, 200); + chai.equal(responses[7].code, 409); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/add-rating-batch_test.js b/test/add-rating-batch_test.js index 967df0e..722b5b6 100644 --- a/test/add-rating-batch_test.js +++ b/test/add-rating-batch_test.js @@ -29,19 +29,19 @@ describe('AddRating', function(){ new rqs.AddRating('entity_id','entity_id',-2), new rqs.AddRating('u_id','i_id',0.3,{'cascadeCreate': true,'timestamp': 5}), new rqs.AddRating('u_id','i_id',0.3,{'cascadeCreate': true,'timestamp': 5}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 404); - chai.equal(responses[3].code, 404); - chai.equal(responses[4].code, 400); - chai.equal(responses[5].code, 400); - chai.equal(responses[6].code, 200); - chai.equal(responses[7].code, 409); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 404); + chai.equal(responses[3].code, 404); + chai.equal(responses[4].code, 400); + chai.equal(responses[5].code, 400); + chai.equal(responses[6].code, 200); + chai.equal(responses[7].code, 409); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/add-series-batch_test.js b/test/add-series-batch_test.js index db37f53..85e480c 100644 --- a/test/add-series-batch_test.js +++ b/test/add-series-batch_test.js @@ -22,18 +22,18 @@ describe('AddSeries', function(){ it ('works in batch', (done) => { let requests = [ new rqs.AddSeries('valid_id'), - new rqs.AddSeries('$$$not_valid$$$'), + new rqs.AddSeries('***not_valid$$$'), new rqs.AddSeries('valid_id2'), new rqs.AddSeries('valid_id2') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 201); - chai.equal(responses[1].code, 400); - chai.equal(responses[2].code, 201); - chai.equal(responses[3].code, 409); + chai.equal(responses[0].code, 201); + chai.equal(responses[1].code, 400); + chai.equal(responses[2].code, 201); + chai.equal(responses[3].code, 409); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/add-series-callback_test.js b/test/add-series-callback_test.js index 8ce7f05..d03edfc 100644 --- a/test/add-series-callback_test.js +++ b/test/add-series-callback_test.js @@ -35,7 +35,7 @@ describe('AddSeries', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.AddSeries('$$$not_valid$$$'); + req = new rqs.AddSeries('***not_valid$$$'); env.client.send(req,((err,res) => { if(err) { chai.equal(err.name, 'ResponseError'); diff --git a/test/add-series-test.js b/test/add-series-test.js index 0bb0e86..71a35c2 100644 --- a/test/add-series-test.js +++ b/test/add-series-test.js @@ -31,7 +31,7 @@ describe('AddSeries', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.AddSeries('$$$not_valid$$$'); + req = new rqs.AddSeries('***not_valid$$$'); env.client.send(req) .then((res) => { chai.fail(); diff --git a/test/add-user-batch_test.js b/test/add-user-batch_test.js index 7892e3a..87119f3 100644 --- a/test/add-user-batch_test.js +++ b/test/add-user-batch_test.js @@ -22,18 +22,18 @@ describe('AddUser', function(){ it ('works in batch', (done) => { let requests = [ new rqs.AddUser('valid_id'), - new rqs.AddUser('$$$not_valid$$$'), + new rqs.AddUser('***not_valid$$$'), new rqs.AddUser('valid_id2'), new rqs.AddUser('valid_id2') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 201); - chai.equal(responses[1].code, 400); - chai.equal(responses[2].code, 201); - chai.equal(responses[3].code, 409); + chai.equal(responses[0].code, 201); + chai.equal(responses[1].code, 400); + chai.equal(responses[2].code, 201); + chai.equal(responses[3].code, 409); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/add-user-callback_test.js b/test/add-user-callback_test.js index 63e5764..cfc163a 100644 --- a/test/add-user-callback_test.js +++ b/test/add-user-callback_test.js @@ -35,7 +35,7 @@ describe('AddUser', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.AddUser('$$$not_valid$$$'); + req = new rqs.AddUser('***not_valid$$$'); env.client.send(req,((err,res) => { if(err) { chai.equal(err.name, 'ResponseError'); diff --git a/test/add-user-property-batch_test.js b/test/add-user-property-batch_test.js index 7ed50e7..c9e9ab9 100644 --- a/test/add-user-property-batch_test.js +++ b/test/add-user-property-batch_test.js @@ -26,16 +26,16 @@ describe('AddUserProperty', function(){ new rqs.AddUserProperty('prop','integer'), new rqs.AddUserProperty('number2','int'), new rqs.AddUserProperty('number2','int') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 201); - chai.equal(responses[1].code, 201); - chai.equal(responses[2].code, 400); - chai.equal(responses[3].code, 201); - chai.equal(responses[4].code, 409); + chai.equal(responses[0].code, 201); + chai.equal(responses[1].code, 201); + chai.equal(responses[2].code, 400); + chai.equal(responses[3].code, 201); + chai.equal(responses[4].code, 409); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/add-user-test.js b/test/add-user-test.js index d4e7fde..a236e2e 100644 --- a/test/add-user-test.js +++ b/test/add-user-test.js @@ -31,7 +31,7 @@ describe('AddUser', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.AddUser('$$$not_valid$$$'); + req = new rqs.AddUser('***not_valid$$$'); env.client.send(req) .then((res) => { chai.fail(); diff --git a/test/delete-bookmark-batch_test.js b/test/delete-bookmark-batch_test.js index 74b1fec..6964865 100644 --- a/test/delete-bookmark-batch_test.js +++ b/test/delete-bookmark-batch_test.js @@ -24,13 +24,13 @@ describe('DeleteBookmark', function(){ let requests = [ new rqs.DeleteBookmark('user','item',{'timestamp': 0}), new rqs.DeleteBookmark('user','item') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/delete-cart-addition-batch_test.js b/test/delete-cart-addition-batch_test.js index a98e5c1..4332737 100644 --- a/test/delete-cart-addition-batch_test.js +++ b/test/delete-cart-addition-batch_test.js @@ -24,13 +24,13 @@ describe('DeleteCartAddition', function(){ let requests = [ new rqs.DeleteCartAddition('user','item',{'timestamp': 0}), new rqs.DeleteCartAddition('user','item') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/delete-detail-view-batch_test.js b/test/delete-detail-view-batch_test.js index a90ce4d..80f6a1f 100644 --- a/test/delete-detail-view-batch_test.js +++ b/test/delete-detail-view-batch_test.js @@ -24,13 +24,13 @@ describe('DeleteDetailView', function(){ let requests = [ new rqs.DeleteDetailView('user','item',{'timestamp': 0}), new rqs.DeleteDetailView('user','item') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/delete-group-batch_test.js b/test/delete-group-batch_test.js index efee7d4..1ef5d3a 100644 --- a/test/delete-group-batch_test.js +++ b/test/delete-group-batch_test.js @@ -23,17 +23,17 @@ describe('DeleteGroup', function(){ let requests = [ new rqs.DeleteGroup('entity_id'), new rqs.DeleteGroup('entity_id'), - new rqs.DeleteGroup('$$$not_valid$$$'), + new rqs.DeleteGroup('***not_valid$$$'), new rqs.DeleteGroup('valid_id') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 404); - chai.equal(responses[2].code, 400); - chai.equal(responses[3].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); + chai.equal(responses[2].code, 400); + chai.equal(responses[3].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/delete-group-callback_test.js b/test/delete-group-callback_test.js index c0db30c..662ee93 100644 --- a/test/delete-group-callback_test.js +++ b/test/delete-group-callback_test.js @@ -44,7 +44,7 @@ describe('DeleteGroup', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.DeleteGroup('$$$not_valid$$$'); + req = new rqs.DeleteGroup('***not_valid$$$'); env.client.send(req,((err,res) => { if(err) { chai.equal(err.name, 'ResponseError'); diff --git a/test/delete-group-test.js b/test/delete-group-test.js index 56b2a91..9afad11 100644 --- a/test/delete-group-test.js +++ b/test/delete-group-test.js @@ -39,7 +39,7 @@ describe('DeleteGroup', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.DeleteGroup('$$$not_valid$$$'); + req = new rqs.DeleteGroup('***not_valid$$$'); env.client.send(req) .then((res) => { chai.fail(); diff --git a/test/delete-item-batch_test.js b/test/delete-item-batch_test.js index 7c54273..012095c 100644 --- a/test/delete-item-batch_test.js +++ b/test/delete-item-batch_test.js @@ -23,17 +23,17 @@ describe('DeleteItem', function(){ let requests = [ new rqs.DeleteItem('entity_id'), new rqs.DeleteItem('entity_id'), - new rqs.DeleteItem('$$$not_valid$$$'), + new rqs.DeleteItem('***not_valid$$$'), new rqs.DeleteItem('valid_id') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 404); - chai.equal(responses[2].code, 400); - chai.equal(responses[3].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); + chai.equal(responses[2].code, 400); + chai.equal(responses[3].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/delete-item-callback_test.js b/test/delete-item-callback_test.js index fb0496c..2667ddc 100644 --- a/test/delete-item-callback_test.js +++ b/test/delete-item-callback_test.js @@ -44,7 +44,7 @@ describe('DeleteItem', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.DeleteItem('$$$not_valid$$$'); + req = new rqs.DeleteItem('***not_valid$$$'); env.client.send(req,((err,res) => { if(err) { chai.equal(err.name, 'ResponseError'); diff --git a/test/delete-item-property-batch_test.js b/test/delete-item-property-batch_test.js index 3314e64..275ea94 100644 --- a/test/delete-item-property-batch_test.js +++ b/test/delete-item-property-batch_test.js @@ -23,17 +23,17 @@ describe('DeleteItemProperty', function(){ let requests = [ new rqs.DeleteItemProperty('int_property'), new rqs.DeleteItemProperty('int_property'), - new rqs.DeleteItemProperty('$$$not_valid$$$'), + new rqs.DeleteItemProperty('***not_valid$$$'), new rqs.DeleteItemProperty('not_existing') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 404); - chai.equal(responses[2].code, 400); - chai.equal(responses[3].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); + chai.equal(responses[2].code, 400); + chai.equal(responses[3].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/delete-item-property-callback_test.js b/test/delete-item-property-callback_test.js index 14475f5..23cae00 100644 --- a/test/delete-item-property-callback_test.js +++ b/test/delete-item-property-callback_test.js @@ -44,7 +44,7 @@ describe('DeleteItemProperty', function(){ it ('fails with invalid property', (done) => { let req, req2, resp; - req = new rqs.DeleteItemProperty('$$$not_valid$$$'); + req = new rqs.DeleteItemProperty('***not_valid$$$'); env.client.send(req,((err,res) => { if(err) { chai.equal(err.name, 'ResponseError'); diff --git a/test/delete-item-property-test.js b/test/delete-item-property-test.js index f59d6de..f020c9c 100644 --- a/test/delete-item-property-test.js +++ b/test/delete-item-property-test.js @@ -39,7 +39,7 @@ describe('DeleteItemProperty', function(){ it ('fails with invalid property', (done) => { let req, req2, resp; - req = new rqs.DeleteItemProperty('$$$not_valid$$$'); + req = new rqs.DeleteItemProperty('***not_valid$$$'); env.client.send(req) .then((res) => { chai.fail(); diff --git a/test/delete-item-test.js b/test/delete-item-test.js index 8932ac6..36c7d62 100644 --- a/test/delete-item-test.js +++ b/test/delete-item-test.js @@ -39,7 +39,7 @@ describe('DeleteItem', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.DeleteItem('$$$not_valid$$$'); + req = new rqs.DeleteItem('***not_valid$$$'); env.client.send(req) .then((res) => { chai.fail(); diff --git a/test/delete-purchase-batch_test.js b/test/delete-purchase-batch_test.js index 85ac3e9..3a84f75 100644 --- a/test/delete-purchase-batch_test.js +++ b/test/delete-purchase-batch_test.js @@ -24,13 +24,13 @@ describe('DeletePurchase', function(){ let requests = [ new rqs.DeletePurchase('user','item',{'timestamp': 0}), new rqs.DeletePurchase('user','item') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/delete-rating-batch_test.js b/test/delete-rating-batch_test.js index e2e4a94..24dc2ed 100644 --- a/test/delete-rating-batch_test.js +++ b/test/delete-rating-batch_test.js @@ -24,13 +24,13 @@ describe('DeleteRating', function(){ let requests = [ new rqs.DeleteRating('user','item',{'timestamp': 0}), new rqs.DeleteRating('user','item') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/delete-series-batch_test.js b/test/delete-series-batch_test.js index 4626b80..c6a8654 100644 --- a/test/delete-series-batch_test.js +++ b/test/delete-series-batch_test.js @@ -23,17 +23,17 @@ describe('DeleteSeries', function(){ let requests = [ new rqs.DeleteSeries('entity_id'), new rqs.DeleteSeries('entity_id'), - new rqs.DeleteSeries('$$$not_valid$$$'), + new rqs.DeleteSeries('***not_valid$$$'), new rqs.DeleteSeries('valid_id') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 404); - chai.equal(responses[2].code, 400); - chai.equal(responses[3].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); + chai.equal(responses[2].code, 400); + chai.equal(responses[3].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/delete-series-callback_test.js b/test/delete-series-callback_test.js index 2b8eafb..5dd9835 100644 --- a/test/delete-series-callback_test.js +++ b/test/delete-series-callback_test.js @@ -44,7 +44,7 @@ describe('DeleteSeries', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.DeleteSeries('$$$not_valid$$$'); + req = new rqs.DeleteSeries('***not_valid$$$'); env.client.send(req,((err,res) => { if(err) { chai.equal(err.name, 'ResponseError'); diff --git a/test/delete-series-test.js b/test/delete-series-test.js index deac90a..fea7a87 100644 --- a/test/delete-series-test.js +++ b/test/delete-series-test.js @@ -39,7 +39,7 @@ describe('DeleteSeries', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.DeleteSeries('$$$not_valid$$$'); + req = new rqs.DeleteSeries('***not_valid$$$'); env.client.send(req) .then((res) => { chai.fail(); diff --git a/test/delete-user-batch_test.js b/test/delete-user-batch_test.js index ec20865..66066b5 100644 --- a/test/delete-user-batch_test.js +++ b/test/delete-user-batch_test.js @@ -23,17 +23,17 @@ describe('DeleteUser', function(){ let requests = [ new rqs.DeleteUser('entity_id'), new rqs.DeleteUser('entity_id'), - new rqs.DeleteUser('$$$not_valid$$$'), + new rqs.DeleteUser('***not_valid$$$'), new rqs.DeleteUser('valid_id') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 404); - chai.equal(responses[2].code, 400); - chai.equal(responses[3].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); + chai.equal(responses[2].code, 400); + chai.equal(responses[3].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/delete-user-callback_test.js b/test/delete-user-callback_test.js index 31027e0..3027d70 100644 --- a/test/delete-user-callback_test.js +++ b/test/delete-user-callback_test.js @@ -44,7 +44,7 @@ describe('DeleteUser', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.DeleteUser('$$$not_valid$$$'); + req = new rqs.DeleteUser('***not_valid$$$'); env.client.send(req,((err,res) => { if(err) { chai.equal(err.name, 'ResponseError'); diff --git a/test/delete-user-property-batch_test.js b/test/delete-user-property-batch_test.js index 44fb46f..58805fd 100644 --- a/test/delete-user-property-batch_test.js +++ b/test/delete-user-property-batch_test.js @@ -23,17 +23,17 @@ describe('DeleteUserProperty', function(){ let requests = [ new rqs.DeleteUserProperty('int_property'), new rqs.DeleteUserProperty('int_property'), - new rqs.DeleteUserProperty('$$$not_valid$$$'), + new rqs.DeleteUserProperty('***not_valid$$$'), new rqs.DeleteUserProperty('not_existing') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 404); - chai.equal(responses[2].code, 400); - chai.equal(responses[3].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); + chai.equal(responses[2].code, 400); + chai.equal(responses[3].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/delete-user-property-callback_test.js b/test/delete-user-property-callback_test.js index acf049c..af040c9 100644 --- a/test/delete-user-property-callback_test.js +++ b/test/delete-user-property-callback_test.js @@ -44,7 +44,7 @@ describe('DeleteUserProperty', function(){ it ('fails with invalid property', (done) => { let req, req2, resp; - req = new rqs.DeleteUserProperty('$$$not_valid$$$'); + req = new rqs.DeleteUserProperty('***not_valid$$$'); env.client.send(req,((err,res) => { if(err) { chai.equal(err.name, 'ResponseError'); diff --git a/test/delete-user-property-test.js b/test/delete-user-property-test.js index 688e1b0..7acd648 100644 --- a/test/delete-user-property-test.js +++ b/test/delete-user-property-test.js @@ -39,7 +39,7 @@ describe('DeleteUserProperty', function(){ it ('fails with invalid property', (done) => { let req, req2, resp; - req = new rqs.DeleteUserProperty('$$$not_valid$$$'); + req = new rqs.DeleteUserProperty('***not_valid$$$'); env.client.send(req) .then((res) => { chai.fail(); diff --git a/test/delete-user-test.js b/test/delete-user-test.js index 5e7fe77..3fed455 100644 --- a/test/delete-user-test.js +++ b/test/delete-user-test.js @@ -39,7 +39,7 @@ describe('DeleteUser', function(){ it ('fails with invalid entity id', (done) => { let req, req2, resp; - req = new rqs.DeleteUser('$$$not_valid$$$'); + req = new rqs.DeleteUser('***not_valid$$$'); env.client.send(req) .then((res) => { chai.fail(); diff --git a/test/delete-view-portion-batch_test.js b/test/delete-view-portion-batch_test.js index 46dfaaa..dff8bef 100644 --- a/test/delete-view-portion-batch_test.js +++ b/test/delete-view-portion-batch_test.js @@ -24,13 +24,13 @@ describe('DeleteViewPortion', function(){ let requests = [ new rqs.DeleteViewPortion('user','item'), new rqs.DeleteViewPortion('user','item') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/get-item-property-info-batch_test.js b/test/get-item-property-info-batch_test.js index cc137ab..70abc70 100644 --- a/test/get-item-property-info-batch_test.js +++ b/test/get-item-property-info-batch_test.js @@ -23,15 +23,15 @@ describe('GetItemPropertyInfo', function(){ let requests = [ new rqs.GetItemPropertyInfo('int_property'), new rqs.GetItemPropertyInfo('str_property') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.deepEqual('int', responses[0].json['type']); - chai.equal(responses[1].code, 200); - chai.deepEqual('string', responses[1].json['type']); + chai.equal(responses[0].code, 200); + chai.deepEqual('int', responses[0].json['type']); + chai.equal(responses[1].code, 200); + chai.deepEqual('string', responses[1].json['type']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/get-item-values-batch_test.js b/test/get-item-values-batch_test.js index e9a1f2f..a637599 100644 --- a/test/get-item-values-batch_test.js +++ b/test/get-item-values-batch_test.js @@ -22,14 +22,14 @@ describe('GetItemValues', function(){ it ('works in batch', (done) => { let requests = [ new rqs.GetItemValues('entity_id') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.deepEqual(42, responses[0].json['int_property']); - chai.deepEqual('hello', responses[0].json['str_property']); + chai.equal(responses[0].code, 200); + chai.deepEqual(42, responses[0].json['int_property']); + chai.deepEqual('hello', responses[0].json['str_property']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/get-user-property-info-batch_test.js b/test/get-user-property-info-batch_test.js index 371de68..29f62d5 100644 --- a/test/get-user-property-info-batch_test.js +++ b/test/get-user-property-info-batch_test.js @@ -23,15 +23,15 @@ describe('GetUserPropertyInfo', function(){ let requests = [ new rqs.GetUserPropertyInfo('int_property'), new rqs.GetUserPropertyInfo('str_property') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.deepEqual('int', responses[0].json['type']); - chai.equal(responses[1].code, 200); - chai.deepEqual('string', responses[1].json['type']); + chai.equal(responses[0].code, 200); + chai.deepEqual('int', responses[0].json['type']); + chai.equal(responses[1].code, 200); + chai.deepEqual('string', responses[1].json['type']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/get-user-values-batch_test.js b/test/get-user-values-batch_test.js index df6f9a0..ab15115 100644 --- a/test/get-user-values-batch_test.js +++ b/test/get-user-values-batch_test.js @@ -22,14 +22,14 @@ describe('GetUserValues', function(){ it ('works in batch', (done) => { let requests = [ new rqs.GetUserValues('entity_id') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.deepEqual(42, responses[0].json['int_property']); - chai.deepEqual('hello', responses[0].json['str_property']); + chai.equal(responses[0].code, 200); + chai.deepEqual(42, responses[0].json['int_property']); + chai.deepEqual('hello', responses[0].json['str_property']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/insert-to-group-batch_test.js b/test/insert-to-group-batch_test.js index 8c1db6f..663fd91 100644 --- a/test/insert-to-group-batch_test.js +++ b/test/insert-to-group-batch_test.js @@ -20,24 +20,34 @@ describe('InsertToGroup', function(){ }); }); it ('works in batch', (done) => { - let requests = [ - new rqs.AddItem('new_item'), - new rqs.InsertToGroup('entity_id','item','new_item'), - new rqs.InsertToGroup('new_set','item','new_item2',{'cascadeCreate': true}), - new rqs.AddItem('new_item3'), - new rqs.InsertToGroup('entity_id','item','new_item3'), - new rqs.InsertToGroup('entity_id','item','new_item3') - ]; - - env.client.send(new rqs.Batch(requests)) - .then((responses) => { - chai.equal(responses[0].code, 201); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 200); - chai.equal(responses[3].code, 201); - chai.equal(responses[4].code, 200); - chai.equal(responses[5].code, 409); - done(); - }); + env.client.send(new rqs.AddItem('new_item'),((err,res) => { + if(err) { + chai.fail(); + } + else { + env.client.send(new rqs.AddItem('new_item3'),((err,res) => { + if(err) { + chai.fail(); + } + else { + let requests = [ + new rqs.InsertToGroup('entity_id','item','new_item'), + new rqs.InsertToGroup('new_set','item','new_item2',{'cascadeCreate': true}), + new rqs.InsertToGroup('entity_id','item','new_item3'), + new rqs.InsertToGroup('entity_id','item','new_item3') + ]; + + env.client.send(new rqs.Batch(requests)) + .then((responses) => { + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 200); + chai.equal(responses[3].code, 409); + done(); + }); + } + })); + } + })); }); -}); \ No newline at end of file +}); diff --git a/test/insert-to-series-batch_test.js b/test/insert-to-series-batch_test.js index 0e95d17..f1b9188 100644 --- a/test/insert-to-series-batch_test.js +++ b/test/insert-to-series-batch_test.js @@ -20,24 +20,34 @@ describe('InsertToSeries', function(){ }); }); it ('works in batch', (done) => { - let requests = [ - new rqs.AddItem('new_item'), - new rqs.InsertToSeries('entity_id','item','new_item',3), - new rqs.InsertToSeries('new_set','item','new_item2',1,{'cascadeCreate': true}), - new rqs.AddItem('new_item3'), - new rqs.InsertToSeries('entity_id','item','new_item3',2), - new rqs.InsertToSeries('entity_id','item','new_item3',2) - ]; - - env.client.send(new rqs.Batch(requests)) - .then((responses) => { - chai.equal(responses[0].code, 201); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 200); - chai.equal(responses[3].code, 201); - chai.equal(responses[4].code, 200); - chai.equal(responses[5].code, 409); - done(); - }); + env.client.send(new rqs.AddItem('new_item'),((err,res) => { + if(err) { + chai.fail(); + } + else { + env.client.send(new rqs.AddItem('new_item3'),((err,res) => { + if(err) { + chai.fail(); + } + else { + let requests = [ + new rqs.InsertToSeries('entity_id','item','new_item',3), + new rqs.InsertToSeries('new_set','item','new_item2',1,{'cascadeCreate': true}), + new rqs.InsertToSeries('entity_id','item','new_item3',2), + new rqs.InsertToSeries('entity_id','item','new_item3',2) + ]; + + env.client.send(new rqs.Batch(requests)) + .then((responses) => { + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 200); + chai.equal(responses[3].code, 409); + done(); + }); + } + })); + } + })); }); -}); \ No newline at end of file +}); diff --git a/test/item-based-recommendation-batch_test.js b/test/item-based-recommendation-batch_test.js index 9dd7f2d..2037770 100644 --- a/test/item-based-recommendation-batch_test.js +++ b/test/item-based-recommendation-batch_test.js @@ -25,17 +25,17 @@ describe('ItemBasedRecommendation', function(){ new rqs.ItemBasedRecommendation('entity_id',9), new rqs.ItemBasedRecommendation('nonexisting',9,{'cascadeCreate': true}), new rqs.ItemBasedRecommendation('nonexisting2',9,{'cascadeCreate': true,'expertSettings': {}}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 9); - chai.equal(responses[1].code, 200); - chai.equal(responses[1].json.length, 9); - chai.equal(responses[2].code, 200); - chai.equal(responses[2].json.length, 9); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 9); + chai.equal(responses[1].code, 200); + chai.equal(responses[1].json.length, 9); + chai.equal(responses[2].code, 200); + chai.equal(responses[2].json.length, 9); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-group-items-batch_test.js b/test/list-group-items-batch_test.js index f9730b4..e206e23 100644 --- a/test/list-group-items-batch_test.js +++ b/test/list-group-items-batch_test.js @@ -22,15 +22,15 @@ describe('ListGroupItems', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListGroupItems('entity_id') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('entity_id', responses[0].json[0]['itemId']); - chai.deepEqual('item', responses[0].json[0]['itemType']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('entity_id', responses[0].json[0]['itemId']); + chai.deepEqual('item', responses[0].json[0]['itemType']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-groups-batch_test.js b/test/list-groups-batch_test.js index 31e9f24..1d8ecf4 100644 --- a/test/list-groups-batch_test.js +++ b/test/list-groups-batch_test.js @@ -22,13 +22,13 @@ describe('ListGroups', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListGroups() - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.deepEqual(['entity_id'], responses[0].json); + chai.equal(responses[0].code, 200); + chai.deepEqual(['entity_id'], responses[0].json); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-item-bookmarks-batch_test.js b/test/list-item-bookmarks-batch_test.js index 613aa9b..c070c91 100644 --- a/test/list-item-bookmarks-batch_test.js +++ b/test/list-item-bookmarks-batch_test.js @@ -23,15 +23,15 @@ describe('ListItemBookmarks', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListItemBookmarks('item') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('item', responses[0].json[0]['itemId']); - chai.deepEqual('user', responses[0].json[0]['userId']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('item', responses[0].json[0]['itemId']); + chai.deepEqual('user', responses[0].json[0]['userId']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-item-cart-additions-batch_test.js b/test/list-item-cart-additions-batch_test.js index c37c7d1..c6b5703 100644 --- a/test/list-item-cart-additions-batch_test.js +++ b/test/list-item-cart-additions-batch_test.js @@ -23,15 +23,15 @@ describe('ListItemCartAdditions', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListItemCartAdditions('item') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('item', responses[0].json[0]['itemId']); - chai.deepEqual('user', responses[0].json[0]['userId']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('item', responses[0].json[0]['itemId']); + chai.deepEqual('user', responses[0].json[0]['userId']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-item-detail-views-batch_test.js b/test/list-item-detail-views-batch_test.js index 8544bbd..3ff2825 100644 --- a/test/list-item-detail-views-batch_test.js +++ b/test/list-item-detail-views-batch_test.js @@ -23,15 +23,15 @@ describe('ListItemDetailViews', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListItemDetailViews('item') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('item', responses[0].json[0]['itemId']); - chai.deepEqual('user', responses[0].json[0]['userId']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('item', responses[0].json[0]['itemId']); + chai.deepEqual('user', responses[0].json[0]['userId']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-item-properties-batch_test.js b/test/list-item-properties-batch_test.js index 107fde2..0aff1a5 100644 --- a/test/list-item-properties-batch_test.js +++ b/test/list-item-properties-batch_test.js @@ -22,13 +22,13 @@ describe('ListItemProperties', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListItemProperties() - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 2); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 2); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-item-purchases-batch_test.js b/test/list-item-purchases-batch_test.js index 018988b..045a30e 100644 --- a/test/list-item-purchases-batch_test.js +++ b/test/list-item-purchases-batch_test.js @@ -23,15 +23,15 @@ describe('ListItemPurchases', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListItemPurchases('item') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('item', responses[0].json[0]['itemId']); - chai.deepEqual('user', responses[0].json[0]['userId']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('item', responses[0].json[0]['itemId']); + chai.deepEqual('user', responses[0].json[0]['userId']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-item-ratings-batch_test.js b/test/list-item-ratings-batch_test.js index 104b658..4a08f61 100644 --- a/test/list-item-ratings-batch_test.js +++ b/test/list-item-ratings-batch_test.js @@ -23,15 +23,15 @@ describe('ListItemRatings', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListItemRatings('item') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('item', responses[0].json[0]['itemId']); - chai.deepEqual('user', responses[0].json[0]['userId']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('item', responses[0].json[0]['itemId']); + chai.deepEqual('user', responses[0].json[0]['userId']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-item-view-portions-batch_test.js b/test/list-item-view-portions-batch_test.js index df18dac..65d9885 100644 --- a/test/list-item-view-portions-batch_test.js +++ b/test/list-item-view-portions-batch_test.js @@ -23,15 +23,15 @@ describe('ListItemViewPortions', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListItemViewPortions('item') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('item', responses[0].json[0]['itemId']); - chai.deepEqual('user', responses[0].json[0]['userId']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('item', responses[0].json[0]['itemId']); + chai.deepEqual('user', responses[0].json[0]['userId']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-items-batch_test.js b/test/list-items-batch_test.js index 9931bea..34bd3a7 100644 --- a/test/list-items-batch_test.js +++ b/test/list-items-batch_test.js @@ -23,15 +23,15 @@ describe('ListItems', function(){ let requests = [ new rqs.ListItems(), new rqs.ListItems() - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.deepEqual(['entity_id'], responses[0].json); - chai.equal(responses[1].code, 200); - chai.equal(responses[1].json.length, 1); + chai.equal(responses[0].code, 200); + chai.deepEqual(['entity_id'], responses[0].json); + chai.equal(responses[1].code, 200); + chai.equal(responses[1].json.length, 1); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-series-batch_test.js b/test/list-series-batch_test.js index 2fe3219..c7c973b 100644 --- a/test/list-series-batch_test.js +++ b/test/list-series-batch_test.js @@ -22,13 +22,13 @@ describe('ListSeries', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListSeries() - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.deepEqual(['entity_id'], responses[0].json); + chai.equal(responses[0].code, 200); + chai.deepEqual(['entity_id'], responses[0].json); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-series-items-batch_test.js b/test/list-series-items-batch_test.js index 1cf36d4..4f7f2a5 100644 --- a/test/list-series-items-batch_test.js +++ b/test/list-series-items-batch_test.js @@ -22,15 +22,15 @@ describe('ListSeriesItems', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListSeriesItems('entity_id') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('entity_id', responses[0].json[0]['itemId']); - chai.deepEqual('item', responses[0].json[0]['itemType']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('entity_id', responses[0].json[0]['itemId']); + chai.deepEqual('item', responses[0].json[0]['itemType']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-user-bookmarks-batch_test.js b/test/list-user-bookmarks-batch_test.js index 493fc21..d16bbc2 100644 --- a/test/list-user-bookmarks-batch_test.js +++ b/test/list-user-bookmarks-batch_test.js @@ -23,15 +23,15 @@ describe('ListUserBookmarks', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListUserBookmarks('user') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('item', responses[0].json[0]['itemId']); - chai.deepEqual('user', responses[0].json[0]['userId']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('item', responses[0].json[0]['itemId']); + chai.deepEqual('user', responses[0].json[0]['userId']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-user-cart-additions-batch_test.js b/test/list-user-cart-additions-batch_test.js index ae97ee2..20eccd4 100644 --- a/test/list-user-cart-additions-batch_test.js +++ b/test/list-user-cart-additions-batch_test.js @@ -23,15 +23,15 @@ describe('ListUserCartAdditions', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListUserCartAdditions('user') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('item', responses[0].json[0]['itemId']); - chai.deepEqual('user', responses[0].json[0]['userId']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('item', responses[0].json[0]['itemId']); + chai.deepEqual('user', responses[0].json[0]['userId']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-user-detail-views-batch_test.js b/test/list-user-detail-views-batch_test.js index 7c84026..3db590a 100644 --- a/test/list-user-detail-views-batch_test.js +++ b/test/list-user-detail-views-batch_test.js @@ -23,15 +23,15 @@ describe('ListUserDetailViews', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListUserDetailViews('user') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('item', responses[0].json[0]['itemId']); - chai.deepEqual('user', responses[0].json[0]['userId']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('item', responses[0].json[0]['itemId']); + chai.deepEqual('user', responses[0].json[0]['userId']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-user-properties-batch_test.js b/test/list-user-properties-batch_test.js index 2199616..000c7b6 100644 --- a/test/list-user-properties-batch_test.js +++ b/test/list-user-properties-batch_test.js @@ -22,13 +22,13 @@ describe('ListUserProperties', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListUserProperties() - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 2); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 2); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-user-purchases-batch_test.js b/test/list-user-purchases-batch_test.js index 2988fee..c0189ec 100644 --- a/test/list-user-purchases-batch_test.js +++ b/test/list-user-purchases-batch_test.js @@ -23,15 +23,15 @@ describe('ListUserPurchases', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListUserPurchases('user') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('item', responses[0].json[0]['itemId']); - chai.deepEqual('user', responses[0].json[0]['userId']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('item', responses[0].json[0]['itemId']); + chai.deepEqual('user', responses[0].json[0]['userId']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-user-ratings-batch_test.js b/test/list-user-ratings-batch_test.js index 7101dcf..711786b 100644 --- a/test/list-user-ratings-batch_test.js +++ b/test/list-user-ratings-batch_test.js @@ -23,15 +23,15 @@ describe('ListUserRatings', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListUserRatings('user') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('item', responses[0].json[0]['itemId']); - chai.deepEqual('user', responses[0].json[0]['userId']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('item', responses[0].json[0]['itemId']); + chai.deepEqual('user', responses[0].json[0]['userId']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-user-view-portions-batch_test.js b/test/list-user-view-portions-batch_test.js index bc10629..efee210 100644 --- a/test/list-user-view-portions-batch_test.js +++ b/test/list-user-view-portions-batch_test.js @@ -23,15 +23,15 @@ describe('ListUserViewPortions', function(){ it ('works in batch', (done) => { let requests = [ new rqs.ListUserViewPortions('user') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 1); - chai.deepEqual('item', responses[0].json[0]['itemId']); - chai.deepEqual('user', responses[0].json[0]['userId']); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 1); + chai.deepEqual('item', responses[0].json[0]['itemId']); + chai.deepEqual('user', responses[0].json[0]['userId']); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/list-users-batch_test.js b/test/list-users-batch_test.js index ec5f886..b755617 100644 --- a/test/list-users-batch_test.js +++ b/test/list-users-batch_test.js @@ -23,15 +23,15 @@ describe('ListUsers', function(){ let requests = [ new rqs.ListUsers(), new rqs.ListUsers() - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.deepEqual(['entity_id'], responses[0].json); - chai.equal(responses[1].code, 200); - chai.equal(responses[1].json.length, 1); + chai.equal(responses[0].code, 200); + chai.deepEqual(['entity_id'], responses[0].json); + chai.equal(responses[1].code, 200); + chai.equal(responses[1].json.length, 1); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/merge-users-batch_test.js b/test/merge-users-batch_test.js index a2877a4..49ed5bb 100644 --- a/test/merge-users-batch_test.js +++ b/test/merge-users-batch_test.js @@ -20,18 +20,23 @@ describe('MergeUsers', function(){ }); }); it ('works in batch', (done) => { - let requests = [ - new rqs.AddUser('target'), - new rqs.MergeUsers('target','entity_id'), - new rqs.MergeUsers('nonex_id','entity_id') - ]; - - env.client.send(new rqs.Batch(requests)) - .then((responses) => { - chai.equal(responses[0].code, 201); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 404); - done(); - }); + env.client.send(new rqs.AddUser('target'),((err,res) => { + if(err) { + chai.fail(); + } + else { + let requests = [ + new rqs.MergeUsers('target','entity_id'), + new rqs.MergeUsers('nonex_id','entity_id') + ]; + + env.client.send(new rqs.Batch(requests)) + .then((responses) => { + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); + done(); + }); + } + })); }); -}); \ No newline at end of file +}); diff --git a/test/recommend-items-to-item-batch_test.js b/test/recommend-items-to-item-batch_test.js index f5bee1c..73e1c1c 100644 --- a/test/recommend-items-to-item-batch_test.js +++ b/test/recommend-items-to-item-batch_test.js @@ -25,14 +25,14 @@ describe('RecommendItemsToItem', function(){ new rqs.RecommendItemsToItem('entity_id','entity_id',9), new rqs.RecommendItemsToItem('nonexisting','entity_id',9,{'cascadeCreate': true}), new rqs.RecommendItemsToItem('nonexisting2','entity_id',9,{'cascadeCreate': true,'expertSettings': {}}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 200); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 200); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/recommend-items-to-user-batch_test.js b/test/recommend-items-to-user-batch_test.js index 21cdbae..1a4c864 100644 --- a/test/recommend-items-to-user-batch_test.js +++ b/test/recommend-items-to-user-batch_test.js @@ -25,14 +25,14 @@ describe('RecommendItemsToUser', function(){ new rqs.RecommendItemsToUser('entity_id',9), new rqs.RecommendItemsToUser('nonexisting',9,{'cascadeCreate': true}), new rqs.RecommendItemsToUser('nonexisting2',9,{'cascadeCreate': true,'expertSettings': {}}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 200); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 200); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/recommend-next-items-batch_test.js b/test/recommend-next-items-batch_test.js new file mode 100644 index 0000000..baa334e --- /dev/null +++ b/test/recommend-next-items-batch_test.js @@ -0,0 +1,45 @@ +/* + This file is auto-generated, do not edit +*/ + +'use strict' +var chai = require('chai').assert; +var recombee = require('./../index.js'); +var rqs = recombee.requests; + +var env = require('./set-environment.js'); + +describe('RecommendNextItems', function(){ + this.timeout(150000); + + before(function(done){ + + env.setEnvironment() + .then(env.setRecommEntities) + .then(()=> { + done(); + }); + }); + it ('works in batch', (done) => { + env.client.send(new rqs.RecommendItemsToUser('entity_id',3,{'returnProperties': true}),((err,res) => { + if(err) { + chai.fail(); + } + else { + let requests = [ + new rqs.RecommendNextItems(res['recommId'],3), + new rqs.RecommendNextItems(res['recommId'],3) + ]; + + env.client.send(new rqs.Batch(requests)) + .then((responses) => { + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json['recomms'].length, 3); + chai.equal(responses[1].code, 200); + chai.equal(responses[1].json['recomms'].length, 3); + done(); + }); + } + })); + }); +}); diff --git a/test/recommend-next-items-callback_test.js b/test/recommend-next-items-callback_test.js new file mode 100644 index 0000000..78f40db --- /dev/null +++ b/test/recommend-next-items-callback_test.js @@ -0,0 +1,54 @@ +/* + This file is auto-generated, do not edit +*/ + +'use strict' +var chai = require('chai').assert; +var recombee = require('./../index.js'); +var rqs = recombee.requests; + +var env = require('./set-environment.js'); + +describe('RecommendNextItems', function(){ + this.timeout(150000); + + before(function(done){ + + env.setEnvironment() + .then(env.setRecommEntities) + .then(()=> { + done(); + }); + }); + + it ('recommends', (done) => { + let req, req2, resp; + req2 = new rqs.RecommendItemsToUser('entity_id',3,{'returnProperties': true}); + env.client.send(req2,((err,res) => { + if(err) { + chai.fail(); + } + else { + req = new rqs.RecommendNextItems(res['recommId'],3); + env.client.send(req,((err,res) => { + if(err) { + chai.fail(); + } + else { + chai.equal(res['recomms'].length, 3); + req = new rqs.RecommendNextItems(res['recommId'],3); + env.client.send(req,((err,res) => { + if(err) { + chai.fail(); + } + else { + chai.equal(res['recomms'].length, 3); + done(); + } + })); + } + })); + } + })); + }); +}); diff --git a/test/recommend-next-items-test.js b/test/recommend-next-items-test.js new file mode 100644 index 0000000..37e4887 --- /dev/null +++ b/test/recommend-next-items-test.js @@ -0,0 +1,42 @@ +/* + This file is auto-generated, do not edit +*/ + +'use strict' +var chai = require('chai').assert; +var recombee = require('./../index.js'); +var rqs = recombee.requests; + +var env = require('./set-environment.js'); + +describe('RecommendNextItems', function(){ + this.timeout(150000); + + before(function(done){ + + env.setEnvironment() + .then(env.setRecommEntities) + .then(()=> { + done(); + }); + }); + + it ('recommends', (done) => { + let req, req2, resp; + req2 = new rqs.RecommendItemsToUser('entity_id',3,{'returnProperties': true}); + env.client.send(req2) + .then((res) => { + req = new rqs.RecommendNextItems(res['recommId'],3); + env.client.send(req) + .then((res) => { + chai.equal(res['recomms'].length, 3); + req = new rqs.RecommendNextItems(res['recommId'],3); + env.client.send(req) + .then((res) => { + chai.equal(res['recomms'].length, 3); + done(); + }); + }); + }); + }); +}); diff --git a/test/recommend-users-to-item-batch_test.js b/test/recommend-users-to-item-batch_test.js index 16c1090..3755731 100644 --- a/test/recommend-users-to-item-batch_test.js +++ b/test/recommend-users-to-item-batch_test.js @@ -25,14 +25,14 @@ describe('RecommendUsersToItem', function(){ new rqs.RecommendUsersToItem('entity_id',9), new rqs.RecommendUsersToItem('nonexisting',9,{'cascadeCreate': true}), new rqs.RecommendUsersToItem('nonexisting2',9,{'cascadeCreate': true,'expertSettings': {}}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 200); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 200); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/recommend-users-to-user-batch_test.js b/test/recommend-users-to-user-batch_test.js index d9d2e3d..e70e7af 100644 --- a/test/recommend-users-to-user-batch_test.js +++ b/test/recommend-users-to-user-batch_test.js @@ -25,14 +25,14 @@ describe('RecommendUsersToUser', function(){ new rqs.RecommendUsersToUser('entity_id',9), new rqs.RecommendUsersToUser('nonexisting',9,{'cascadeCreate': true}), new rqs.RecommendUsersToUser('nonexisting2',9,{'cascadeCreate': true,'expertSettings': {}}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 200); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 200); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/remove-from-group-batch_test.js b/test/remove-from-group-batch_test.js index 2278940..a2a3020 100644 --- a/test/remove-from-group-batch_test.js +++ b/test/remove-from-group-batch_test.js @@ -23,13 +23,13 @@ describe('RemoveFromGroup', function(){ let requests = [ new rqs.RemoveFromGroup('entity_id','item','entity_id'), new rqs.RemoveFromGroup('entity_id','item','not_contained') - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/remove-from-series-batch_test.js b/test/remove-from-series-batch_test.js index ffce724..db5eca1 100644 --- a/test/remove-from-series-batch_test.js +++ b/test/remove-from-series-batch_test.js @@ -24,14 +24,14 @@ describe('RemoveFromSeries', function(){ new rqs.RemoveFromSeries('entity_id','item','entity_id',0), new rqs.RemoveFromSeries('entity_id','item','entity_id',1), new rqs.RemoveFromSeries('entity_id','item','not_contained',1) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 404); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 404); + chai.equal(responses[0].code, 404); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/search-items-batch_test.js b/test/search-items-batch_test.js index de3e739..acaa505 100644 --- a/test/search-items-batch_test.js +++ b/test/search-items-batch_test.js @@ -25,17 +25,17 @@ describe('SearchItems', function(){ new rqs.SearchItems('entity_id','hell',9), new rqs.SearchItems('entity_id','sdhskldf',9), new rqs.SearchItems('entity_id','hell',9,{'returnProperties': true}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json['recomms'].length, 1); - chai.equal(responses[1].code, 200); - chai.equal(responses[1].json['recomms'].length, 0); - chai.equal(responses[2].code, 200); - chai.equal(responses[2].json['recomms'].length, 1); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json['recomms'].length, 1); + chai.equal(responses[1].code, 200); + chai.equal(responses[1].json['recomms'].length, 0); + chai.equal(responses[2].code, 200); + chai.equal(responses[2].json['recomms'].length, 1); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/set-item-values-batch_test.js b/test/set-item-values-batch_test.js index 5c34a2a..832d88e 100644 --- a/test/set-item-values-batch_test.js +++ b/test/set-item-values-batch_test.js @@ -27,17 +27,17 @@ describe('SetItemValues', function(){ new rqs.SetItemValues('new_entity',{'int_property': 5,'str_property': 'test','!cascadeCreate': true}), new rqs.SetItemValues('new_entity2',{'int_property': 5,'str_property': 'test'},{'cascadeCreate': true}), new rqs.SetItemValues('nonexisting',{'int_property': 5}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 200); - chai.equal(responses[3].code, 200); - chai.equal(responses[4].code, 200); - chai.equal(responses[5].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 200); + chai.equal(responses[3].code, 200); + chai.equal(responses[4].code, 200); + chai.equal(responses[5].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/set-user-values-batch_test.js b/test/set-user-values-batch_test.js index 74c5837..bd05b27 100644 --- a/test/set-user-values-batch_test.js +++ b/test/set-user-values-batch_test.js @@ -27,17 +27,17 @@ describe('SetUserValues', function(){ new rqs.SetUserValues('new_entity',{'int_property': 5,'str_property': 'test','!cascadeCreate': true}), new rqs.SetUserValues('new_entity2',{'int_property': 5,'str_property': 'test'},{'cascadeCreate': true}), new rqs.SetUserValues('nonexisting',{'int_property': 5}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 200); - chai.equal(responses[3].code, 200); - chai.equal(responses[4].code, 200); - chai.equal(responses[5].code, 404); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 200); + chai.equal(responses[3].code, 200); + chai.equal(responses[4].code, 200); + chai.equal(responses[5].code, 404); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/set-view-portion-batch_test.js b/test/set-view-portion-batch_test.js index bd8d693..ef685ea 100644 --- a/test/set-view-portion-batch_test.js +++ b/test/set-view-portion-batch_test.js @@ -28,18 +28,18 @@ describe('SetViewPortion', function(){ new rqs.SetViewPortion('entity_id','entity_id',0,{'timestamp': -15}), new rqs.SetViewPortion('entity_id','entity_id',-2), new rqs.SetViewPortion('entity_id','entity_id',0.7,{'sessionId': 'a****'}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[1].code, 200); - chai.equal(responses[2].code, 404); - chai.equal(responses[3].code, 404); - chai.equal(responses[4].code, 400); - chai.equal(responses[5].code, 400); - chai.equal(responses[6].code, 400); + chai.equal(responses[0].code, 200); + chai.equal(responses[1].code, 200); + chai.equal(responses[2].code, 404); + chai.equal(responses[3].code, 404); + chai.equal(responses[4].code, 400); + chai.equal(responses[5].code, 400); + chai.equal(responses[6].code, 400); done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/user-based-recommendation-batch_test.js b/test/user-based-recommendation-batch_test.js index 0ccb428..5de5eb5 100644 --- a/test/user-based-recommendation-batch_test.js +++ b/test/user-based-recommendation-batch_test.js @@ -25,17 +25,17 @@ describe('UserBasedRecommendation', function(){ new rqs.UserBasedRecommendation('entity_id',9), new rqs.UserBasedRecommendation('nonexisting',9,{'cascadeCreate': true}), new rqs.UserBasedRecommendation('nonexisting2',9,{'cascadeCreate': true,'expertSettings': {}}) - ]; - + ]; + env.client.send(new rqs.Batch(requests)) .then((responses) => { - chai.equal(responses[0].code, 200); - chai.equal(responses[0].json.length, 9); - chai.equal(responses[1].code, 200); - chai.equal(responses[1].json.length, 9); - chai.equal(responses[2].code, 200); - chai.equal(responses[2].json.length, 9); + chai.equal(responses[0].code, 200); + chai.equal(responses[0].json.length, 9); + chai.equal(responses[1].code, 200); + chai.equal(responses[1].json.length, 9); + chai.equal(responses[2].code, 200); + chai.equal(responses[2].json.length, 9); done(); }); }); -}); \ No newline at end of file +});