|
| 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 |
0 commit comments