@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.
54 lines • 2.2 kB
JavaScript
import Resource from '../../Resource.js';
export default class Condition extends Resource {
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,
});
}
}
//# sourceMappingURL=Condition.js.map