UNPKG

recombee-api-client

Version:

Node.js client (SDK) for easy use of the Recombee recommendation API

68 lines (58 loc) 2.28 kB
/* This file is auto-generated, do not edit */ 'use strict'; const rqs = require("./request"); /** * Creates a Segmentation that splits the items into segments based on values of a particular item property. * A segment is created for each unique value of the property. * In case of `set` properties, a segment is created for each value in the set. Item belongs to all these segments. */ class CreatePropertyBasedSegmentation extends rqs.Request { /** * Construct the request * @param {string} segmentationId - ID of the newly created Segmentation * @param {string} sourceType - What type of data should be segmented. Currently only `items` are supported. * @param {string} propertyName - Name of the property on which the Segmentation should be based * @param {Object} optional - Optional parameters given as an object with structure name of the parameter: value * - Allowed parameters: * - *title* * - Type: string * - Description: Human-readable name that is shown in the Recombee Admin UI. * - *description* * - Type: string * - Description: Description that is shown in the Recombee Admin UI. */ constructor(segmentationId, sourceType, propertyName, optional) { super('PUT', `/segmentations/property-based/${segmentationId}`, 10000, false); this.segmentationId = segmentationId; this.sourceType = sourceType; this.propertyName = propertyName; optional = optional || {}; this.title = optional.title; this.description = optional.description; } /** * Get body parameters * @return {Object} The values of body parameters (name of parameter: value of the parameter) */ bodyParameters() { let params = {}; params.sourceType = this.sourceType; params.propertyName = this.propertyName; if(this.title !== undefined) params.title = this.title; if(this.description !== undefined) params.description = this.description; 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.CreatePropertyBasedSegmentation = CreatePropertyBasedSegmentation