Skip to content

Commit d062549

Browse files
committed
Support Item Segmentations
1 parent ef84cf3 commit d062549

File tree

119 files changed

+3287
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+3287
-191
lines changed

lib/api-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ApiClient {
4545
url: url,
4646
headers: {'Accept': 'application/json',
4747
'Content-Type': 'application/json',
48-
'User-Agent': 'recombee-node-api-client/4.0.0'},
48+
'User-Agent': 'recombee-node-api-client/4.1.0'},
4949
timeout: request.timeout,
5050
agent: this.options.agent
5151
};

lib/requests/add-bookmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
const rqs = require("./request");
77

88
/**
9-
* Adds a bookmark of a given item made by a given user.
9+
* Adds a bookmark of the given item made by the given user.
1010
*/
1111
class AddBookmark extends rqs.Request {
1212

lib/requests/add-cart-addition.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
const rqs = require("./request");
77

88
/**
9-
* Adds a cart addition of a given item made by a given user.
9+
* Adds a cart addition of the given item made by the given user.
1010
*/
1111
class AddCartAddition extends rqs.Request {
1212

@@ -24,10 +24,10 @@ class AddCartAddition extends rqs.Request {
2424
* - Description: Sets whether the given user/item should be created if not present in the database.
2525
* - *amount*
2626
* - Type: number
27-
* - Description: Amount (number) added to cart. The default is 1. For example if `user-x` adds two `item-y` during a single order (session...), the `amount` should equal to 2.
27+
* - Description: Amount (number) added to cart. The default is 1. For example, if `user-x` adds two `item-y` during a single order (session...), the `amount` should equal 2.
2828
* - *price*
2929
* - Type: number
30-
* - Description: Price of the added item. If `amount` is greater than 1, sum of prices of all the items should be given.
30+
* - Description: Price of the added item. If `amount` is greater than 1, the sum of prices of all the items should be given.
3131
* - *recommId*
3232
* - Type: string
3333
* - Description: If this cart addition is based on a recommendation request, `recommId` is the id of the clicked recommendation.

lib/requests/add-detail-view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
const rqs = require("./request");
77

88
/**
9-
* Adds a detail view of a given item made by a given user.
9+
* Adds a detail view of the given item made by the given user.
1010
*/
1111
class AddDetailView extends rqs.Request {
1212

lib/requests/add-group.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
const rqs = require("./request");
77

88
/**
9-
* Creates new group in the database.
9+
* Creates a new group in the database.
1010
*/
1111
class AddGroup extends rqs.Request {
1212

lib/requests/add-item-property.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class AddItemProperty extends rqs.Request {
1212

1313
/**
1414
* Construct the request
15-
* @param {string} propertyName - Name of the item property to be created. Currently, the following names are reserved:`id`, `itemid`, case insensitively. Also, the length of the property name must not exceed 63 characters.
15+
* @param {string} propertyName - Name of the item property to be created. Currently, the following names are reserved: `id`, `itemid`, case-insensitively. Also, the length of the property name must not exceed 63 characters.
1616
* @param {string} type - Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`, `image` or `imageList`.
1717
* * `int`- Signed integer number.
1818
* * `double` - Floating point number. It uses 64-bit base-2 format (IEEE 754 standard).

lib/requests/add-item.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
const rqs = require("./request");
77

88
/**
9-
* Adds new item of given `itemId` to the items catalog.
10-
* All the item properties for the newly created items are set null.
9+
* Adds new item of the given `itemId` to the items catalog.
10+
* All the item properties for the newly created items are set to null.
1111
*/
1212
class AddItem extends rqs.Request {
1313

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
This file is auto-generated, do not edit
3+
*/
4+
5+
'use strict';
6+
const rqs = require("./request");
7+
8+
/**
9+
* Adds a new Segment into a Manual ReQL Segmentation.
10+
* The new Segment is defined by a [ReQL](https://docs.recombee.com/reql.html) filter that returns `true` for an item in case that this item belongs to the segment.
11+
*/
12+
class AddManualReqlSegment extends rqs.Request {
13+
14+
/**
15+
* Construct the request
16+
* @param {string} segmentationId - ID of the Segmentation to which the new Segment should be added
17+
* @param {string} segmentId - ID of the newly created Segment
18+
* @param {string} filter - ReQL filter that returns `true` for items that belong to this Segment. Otherwise returns `false`.
19+
* @param {Object} optional - Optional parameters given as an object with structure name of the parameter: value
20+
* - Allowed parameters:
21+
* - *title*
22+
* - Type: string
23+
* - Description: Human-readable name of the Segment that is shown in the Recombee Admin UI.
24+
*/
25+
constructor(segmentationId, segmentId, filter, optional) {
26+
super('PUT', `/segmentations/manual-reql/${segmentationId}/segments/${segmentId}`, 10000, false);
27+
this.segmentationId = segmentationId;
28+
this.segmentId = segmentId;
29+
this.filter = filter;
30+
optional = optional || {};
31+
this.title = optional.title;
32+
}
33+
34+
/**
35+
* Get body parameters
36+
* @return {Object} The values of body parameters (name of parameter: value of the parameter)
37+
*/
38+
bodyParameters() {
39+
let params = {};
40+
params.filter = this.filter;
41+
42+
if(this.title !== undefined)
43+
params.title = this.title;
44+
45+
return params;
46+
}
47+
48+
/**
49+
* Get query parameters
50+
* @return {Object} The values of query parameters (name of parameter: value of the parameter)
51+
*/
52+
queryParameters() {
53+
let params = {};
54+
return params;
55+
}
56+
}
57+
58+
exports.AddManualReqlSegment = AddManualReqlSegment

lib/requests/add-purchase.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
const rqs = require("./request");
77

88
/**
9-
* Adds a purchase of a given item made by a given user.
9+
* Adds a purchase of the given item made by the given user.
1010
*/
1111
class AddPurchase extends rqs.Request {
1212

@@ -24,13 +24,13 @@ class AddPurchase extends rqs.Request {
2424
* - Description: Sets whether the given user/item should be created if not present in the database.
2525
* - *amount*
2626
* - Type: number
27-
* - Description: Amount (number) of purchased items. The default is 1. For example if `user-x` purchases two `item-y` during a single order (session...), the `amount` should equal to 2.
27+
* - Description: Amount (number) of purchased items. The default is 1. For example, if `user-x` purchases two `item-y` during a single order (session...), the `amount` should equal 2.
2828
* - *price*
2929
* - Type: number
30-
* - Description: Price paid by the user for the item. If `amount` is greater than 1, sum of prices of all the items should be given.
30+
* - Description: Price paid by the user for the item. If `amount` is greater than 1, the sum of prices of all the items should be given.
3131
* - *profit*
3232
* - Type: number
33-
* - Description: Your profit from the purchased item. The profit is natural in e-commerce domain (for example if `user-x` purchases `item-y` for $100 and the gross margin is 30 %, then the profit is $30), but is applicable also in other domains (for example at a news company it may be income from displayed advertisement on article page). If `amount` is greater than 1, sum of profit of all the items should be given.
33+
* - Description: Your profit from the purchased item. The profit is natural in the e-commerce domain (for example, if `user-x` purchases `item-y` for $100 and the gross margin is 30 %, then the profit is $30) but is also applicable in other domains (for example, at a news company it may be income from a displayed advertisement on article page). If `amount` is greater than 1, the sum of profit of all the items should be given.
3434
* - *recommId*
3535
* - Type: string
3636
* - Description: If this purchase is based on a recommendation request, `recommId` is the id of the clicked recommendation.

lib/requests/add-rating.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
const rqs = require("./request");
77

88
/**
9-
* Adds a rating of given item made by a given user.
9+
* Adds a rating of the given item made by the given user.
1010
*/
1111
class AddRating extends rqs.Request {
1212

0 commit comments

Comments
 (0)