recombee-api-client 5.0.2 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/LICENSE +21 -0
  2. package/lib/api-client.js +1 -1
  3. package/lib/index.d.ts +137 -79
  4. package/lib/requests/add-manual-reql-segment.js +1 -1
  5. package/lib/requests/add-search-synonym.js +1 -1
  6. package/lib/requests/create-auto-reql-segmentation.js +1 -1
  7. package/lib/requests/create-manual-reql-segmentation.js +1 -1
  8. package/lib/requests/delete-item.js +1 -1
  9. package/lib/requests/delete-more-items.js +2 -2
  10. package/lib/requests/delete-search-synonym.js +1 -1
  11. package/lib/requests/index.js +2 -1
  12. package/lib/requests/list-items.js +1 -1
  13. package/lib/requests/list-scenarios.js +40 -0
  14. package/lib/requests/list-users.js +1 -1
  15. package/lib/requests/merge-users.js +2 -0
  16. package/lib/requests/recommend-item-segments-to-item-segment.js +6 -6
  17. package/lib/requests/recommend-item-segments-to-item.js +6 -6
  18. package/lib/requests/recommend-item-segments-to-user.js +6 -6
  19. package/lib/requests/recommend-items-to-item-segment.js +12 -12
  20. package/lib/requests/recommend-items-to-item.js +14 -14
  21. package/lib/requests/recommend-items-to-user.js +13 -13
  22. package/lib/requests/recommend-next-items.js +4 -4
  23. package/lib/requests/recommend-users-to-item.js +9 -9
  24. package/lib/requests/recommend-users-to-user.js +11 -11
  25. package/lib/requests/search-item-segments.js +5 -5
  26. package/lib/requests/search-items.js +9 -9
  27. package/lib/requests/set-item-values.js +1 -1
  28. package/lib/requests/set-user-values.js +1 -1
  29. package/lib/requests/set-view-portion.js +1 -1
  30. package/lib/requests/update-more-items.js +1 -1
  31. package/package.json +8 -7
  32. package/test/list-scenarios-batch_test.js +33 -0
  33. package/test/list-scenarios-callback_test.js +35 -0
  34. package/test/list-scenarios-test.js +31 -0
@@ -21,7 +21,7 @@ class RecommendUsersToUser extends rqs.Request {
21
21
  * - *scenario*
22
22
  * - Type: string
23
23
  * - Description: Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".
24
- * You can set various settings to the [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
24
+ * You can set various settings to the [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
25
25
  * The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.
26
26
  * - *cascadeCreate*
27
27
  * - Type: boolean
@@ -80,30 +80,30 @@ class RecommendUsersToUser extends rqs.Request {
80
80
  * ```
81
81
  * - *filter*
82
82
  * - Type: string
83
- * - Description: Boolean-returning [ReQL](https://docs.recombee.com/reql.html) expression, which allows you to filter recommended items based on the values of their attributes.
84
- * Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
83
+ * - Description: Boolean-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to filter recommended users based on the values of their attributes.
84
+ * Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
85
85
  * - *booster*
86
86
  * - Type: string
87
- * - Description: Number-returning [ReQL](https://docs.recombee.com/reql.html) expression, which allows you to boost the recommendation rate of some items based on the values of their attributes.
88
- * Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
87
+ * - Description: Number-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to boost the recommendation rate of some users based on the values of their attributes.
88
+ * Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
89
89
  * - *logic*
90
90
  * - Type: string | object
91
91
  * - Description: Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
92
- * See [this section](https://docs.recombee.com/recommendation_logics.html) for a list of available logics and other details.
92
+ * See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.
93
93
  * The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
94
- * Logic can also be set to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
94
+ * Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
95
95
  * - *diversity*
96
96
  * - Type: number
97
- * - Description: **Expert option** Real number from [0.0, 1.0], which determines how mutually dissimilar the recommended users should be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
97
+ * - Description: **Expert option:** Real number from [0.0, 1.0], which determines how mutually dissimilar the recommended users should be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
98
98
  * - *minRelevance*
99
99
  * - Type: string
100
- * - Description: **Expert option** Specifies the threshold of how relevant must the recommended users be. Possible values one of: "low", "medium", "high".
100
+ * - Description: **Expert option:** Specifies the threshold of how relevant must the recommended users be. Possible values one of: "low", "medium", "high".
101
101
  * - *rotationRate*
102
102
  * - Type: number
103
- * - 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 a backward fashion. You may penalize a user 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 users.
103
+ * - 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 a backward fashion. You may penalize a user 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 users.
104
104
  * - *rotationTime*
105
105
  * - Type: number
106
- * - Description: **Expert option** Taking *rotationRate* into account, specifies how long it takes for a user to recover from the penalization. For example, `rotationTime=7200.0` means that users recommended less than 2 hours ago are penalized.
106
+ * - Description: **Expert option:** Taking *rotationRate* into account, specifies how long it takes for a user to recover from the penalization. For example, `rotationTime=7200.0` means that users recommended less than 2 hours ago are penalized.
107
107
  * - *expertSettings*
108
108
  * - Type: object
109
109
  * - Description: Dictionary of custom options.
@@ -27,23 +27,23 @@ class SearchItemSegments extends rqs.Request {
27
27
  * - *scenario*
28
28
  * - Type: string
29
29
  * - Description: Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".
30
- * You can set various settings to the [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
30
+ * You can set various settings to the [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
31
31
  * The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.
32
32
  * - *cascadeCreate*
33
33
  * - Type: boolean
34
34
  * - Description: If the user does not exist in the database, returns a list of non-personalized recommendations and creates the user in the database. This allows, for example, rotations in the following recommendations for that user, as the user will be already known to the system.
35
35
  * - *filter*
36
36
  * - Type: string
37
- * - Description: Boolean-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to filter recommended segments based on the `segmentationId`.
37
+ * - Description: Boolean-returning [ReQL](https://docs.recombee.com/reql) expression which allows you to filter recommended segments based on the `segmentationId`.
38
38
  * - *booster*
39
39
  * - Type: string
40
- * - Description: Number-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to boost recommendation rate of some segments based on the `segmentationId`.
40
+ * - Description: Number-returning [ReQL](https://docs.recombee.com/reql) expression which allows you to boost recommendation rate of some segments based on the `segmentationId`.
41
41
  * - *logic*
42
42
  * - Type: string | object
43
43
  * - Description: Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
44
- * See [this section](https://docs.recombee.com/recommendation_logics.html) for a list of available logics and other details.
44
+ * See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.
45
45
  * The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
46
- * Logic can also be set to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
46
+ * Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
47
47
  * - *expertSettings*
48
48
  * - Type: object
49
49
  * - Description: Dictionary of custom options.
@@ -11,8 +11,8 @@ const rqs = require("./request");
11
11
  * This endpoint should be used in a search box on 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 the current state of the query, or once after submitting the whole query.
12
12
  * The returned items are sorted by relevance (the first item being the most relevant).
13
13
  * Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to:
14
- * - 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).
15
- * - 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).
14
+ * - 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#reported-metrics).
15
+ * - Get subsequent search results when the user scrolls down or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api#recommend-next-items).
16
16
  * It is also possible to use POST HTTP method (for example in the case of a very long ReQL filter) - query parameters then become body parameters.
17
17
  */
18
18
  class SearchItems extends rqs.Request {
@@ -27,7 +27,7 @@ class SearchItems extends rqs.Request {
27
27
  * - *scenario*
28
28
  * - Type: string
29
29
  * - Description: Scenario defines a particular search field in your user interface.
30
- * You can set various settings to the [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each field performs.
30
+ * You can set various settings to the [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each field performs.
31
31
  * The AI that optimizes models to get the best results may optimize different scenarios separately, or even use different models in each of the scenarios.
32
32
  * - *cascadeCreate*
33
33
  * - Type: boolean
@@ -92,18 +92,18 @@ class SearchItems extends rqs.Request {
92
92
  * ```
93
93
  * - *filter*
94
94
  * - Type: string
95
- * - Description: Boolean-returning [ReQL](https://docs.recombee.com/reql.html) expression, which allows you to filter recommended items based on the values of their attributes.
96
- * Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
95
+ * - Description: Boolean-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to filter recommended items based on the values of their attributes.
96
+ * Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
97
97
  * - *booster*
98
98
  * - Type: string
99
- * - Description: Number-returning [ReQL](https://docs.recombee.com/reql.html) expression, which allows you to boost the recommendation rate of some items based on the values of their attributes.
100
- * Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
99
+ * - Description: Number-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to boost the recommendation rate of some items based on the values of their attributes.
100
+ * Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
101
101
  * - *logic*
102
102
  * - Type: string | object
103
103
  * - Description: Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
104
- * See [this section](https://docs.recombee.com/recommendation_logics.html) for a list of available logics and other details.
104
+ * See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.
105
105
  * The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
106
- * Logic can also be set to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
106
+ * Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
107
107
  * - *expertSettings*
108
108
  * - Type: object
109
109
  * - Description: Dictionary of custom options.
@@ -2,7 +2,7 @@
2
2
  const svr = require("./set-values");
3
3
 
4
4
  /**
5
- * Set/update (some) property values of a given item. The properties (columns) must be previously created by [Add item property](https://docs.recombee.com/api.html#add-item-property).
5
+ * Set/update (some) property values of a given item. The properties (columns) must be previously created by [Add item property](https://docs.recombee.com/api#add-item-property).
6
6
  */
7
7
  class SetItemValues extends svr.SetValues {
8
8
 
@@ -2,7 +2,7 @@
2
2
  const svr = require("./set-values");
3
3
 
4
4
  /**
5
- * Set/update (some) property values of a given user. The properties (columns) must be previously created by [Add user property](https://docs.recombee.com/api.html#add-user-property).
5
+ * Set/update (some) property values of a given user. The properties (columns) must be previously created by [Add user property](https://docs.recombee.com/api#add-user-property).
6
6
  */
7
7
  class SetUserValues extends svr.SetValues {
8
8
  /**
@@ -23,7 +23,7 @@ class SetViewPortion extends rqs.Request {
23
23
  * - Description: ID of the session in which the user viewed the item. Default is `null` (`None`, `nil`, `NULL` etc., depending on the language).
24
24
  * - *timestamp*
25
25
  * - Type: string | number
26
- * - Description: UTC timestamp of the rating as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
26
+ * - Description: UTC timestamp of the view portion as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
27
27
  * - *cascadeCreate*
28
28
  * - Type: boolean
29
29
  * - Description: Sets whether the given user/item should be created if not present in the database.
@@ -19,7 +19,7 @@ class UpdateMoreItems extends rqs.Request {
19
19
 
20
20
  /**
21
21
  * Construct the request
22
- * @param {string} filter - A [ReQL](https://docs.recombee.com/reql.html) expression, which returns `true` for the items that shall be updated.
22
+ * @param {string} filter - A [ReQL](https://docs.recombee.com/reql) expression, which returns `true` for the items that shall be updated.
23
23
  * @param {object} changes - A dictionary where the keys are properties that shall be updated.
24
24
  */
25
25
  constructor(filter, changes) {
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "recombee-api-client",
3
- "version": "5.0.2",
3
+ "version": "5.1.1",
4
4
  "description": "Node.js client (SDK) for easy use of the Recombee recommendation API",
5
5
  "main": "index.js",
6
6
  "types": "lib/index.d.ts",
7
+ "packageManager": "pnpm@8.12.0",
7
8
  "scripts": {
8
9
  "test": "mocha test"
9
10
  },
@@ -21,7 +22,7 @@
21
22
  "SDK"
22
23
  ],
23
24
  "engines": {
24
- "node": ">=13.2.0"
25
+ "node": ">=18"
25
26
  },
26
27
  "author": "Ondrej Fiedler <ondrej.fiedler@recombee.com> (https://www.recombee.com/)",
27
28
  "license": "MIT",
@@ -30,12 +31,12 @@
30
31
  },
31
32
  "homepage": "https://github.com/Recombee/node-api-client#readme",
32
33
  "dependencies": {
33
- "jssha": "^2.3.0",
34
- "ky": "^1.7.2"
34
+ "jssha": "2.4.2",
35
+ "ky": "1.7.5"
35
36
  },
36
37
  "devDependencies": {
37
- "chai": "^3.5.0",
38
- "mocha": "~10.2.0",
39
- "typescript": "~5.3.3"
38
+ "chai": "3.5.0",
39
+ "mocha": "10.2.0",
40
+ "typescript": "5.3.3"
40
41
  }
41
42
  }
@@ -0,0 +1,33 @@
1
+ /*
2
+ This file is auto-generated, do not edit
3
+ */
4
+
5
+ 'use strict'
6
+ var chai = require('chai').assert;
7
+ var recombee = require('./../index.js');
8
+ var rqs = recombee.requests;
9
+
10
+ var env = require('./set-environment.js');
11
+
12
+ describe('ListScenarios', function(){
13
+ this.timeout(150000);
14
+
15
+ before(function(done){
16
+
17
+ env.setEnvironment()
18
+ .then(()=> {
19
+ setTimeout(done, 20000);
20
+ });
21
+ });
22
+ it ('works in batch', (done) => {
23
+ let requests = [
24
+ new rqs.ListScenarios()
25
+ ];
26
+
27
+ env.client.send(new rqs.Batch(requests))
28
+ .then((responses) => {
29
+ chai.equal(responses[0].code, 200);
30
+ done();
31
+ });
32
+ });
33
+ });
@@ -0,0 +1,35 @@
1
+ /*
2
+ This file is auto-generated, do not edit
3
+ */
4
+
5
+ 'use strict'
6
+ var chai = require('chai').assert;
7
+ var recombee = require('./../index.js');
8
+ var rqs = recombee.requests;
9
+
10
+ var env = require('./set-environment.js');
11
+
12
+ describe('ListScenarios', function(){
13
+ this.timeout(150000);
14
+
15
+ before(function(done){
16
+
17
+ env.setEnvironment()
18
+ .then(()=> {
19
+ setTimeout(done, 20000);
20
+ });
21
+ });
22
+
23
+ it ('lists scenarios', (done) => {
24
+ let req, req2, resp;
25
+ req = new rqs.ListScenarios();
26
+ env.client.send(req,((err,res) => {
27
+ if(err) {
28
+ chai.fail();
29
+ }
30
+ else {
31
+ done();
32
+ }
33
+ }));
34
+ });
35
+ });
@@ -0,0 +1,31 @@
1
+ /*
2
+ This file is auto-generated, do not edit
3
+ */
4
+
5
+ 'use strict'
6
+ var chai = require('chai').assert;
7
+ var recombee = require('./../index.js');
8
+ var rqs = recombee.requests;
9
+
10
+ var env = require('./set-environment.js');
11
+
12
+ describe('ListScenarios', function(){
13
+ this.timeout(150000);
14
+
15
+ before(function(done){
16
+
17
+ env.setEnvironment()
18
+ .then(()=> {
19
+ setTimeout(done, 20000);
20
+ });
21
+ });
22
+
23
+ it ('lists scenarios', (done) => {
24
+ let req, req2, resp;
25
+ req = new rqs.ListScenarios();
26
+ env.client.send(req)
27
+ .then((res) => {
28
+ done();
29
+ });
30
+ });
31
+ });