UNPKG

@coveo/platform-client

Version:

The main goal of this package is to provide an easy to configure and straightforward way of querying Coveo Cloud APIs using JavaScript.

58 lines 2.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const Resource_js_1 = tslib_1.__importDefault(require("../../Resource.js")); class Condition extends Resource_js_1.default { static baseUrl = `/rest/search/v1/admin/pipelines/statements`; /** * Returns a paginated list of condition models. * @param options */ list(options = {}) { return this.api.get(this.buildPath(Condition.baseUrl, { feature: 'when', organizationId: this.api.organizationId, ...options })); } /** * Creates and returns a new condition model. * @param conditionModel */ create(conditionModel) { return this.api.post(this.buildPath(Condition.baseUrl, { organizationId: this.api.organizationId }), conditionModel); } /** * Delete a condition model. * @param conditionId The unique identifier of the condition to be deleted. */ delete(conditionId) { return this.api.delete(this.buildPath(`${Condition.baseUrl}/${conditionId}`, { organizationId: this.api.organizationId })); } /** * Returns a condition model. * @param conditionId The unique identifier of the condition to be fetched. */ get(conditionId) { return this.api.get(this.buildPath(`${Condition.baseUrl}/${conditionId}`, { organizationId: this.api.organizationId })); } /** * Update a condition model with the model sent and returns the updated condition model. * @param conditionId The unique identifier of the condition to be updated. * @param conditionModel */ update(conditionId, conditionModel) { return this.api.put(this.buildPath(`${Condition.baseUrl}/${conditionId}`, { organizationId: this.api.organizationId }), conditionModel); } /** * Bulk get a list of conditions corresponding of the ids sent. * @param {string[]} conditionIds The list of condition's ids to be fetched. Limit of 1000 incoming ids. * @param {ListConditionsOptions} params */ bulkGet(conditionIds, params = {}) { return this.api.post(this.buildPath(`${Condition.baseUrl}/bulkGet`, { organizationId: this.api.organizationId, ...params, }), { ids: conditionIds, }); } } exports.default = Condition; //# sourceMappingURL=Condition.js.map