@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.
110 lines • 4.19 kB
JavaScript
import ReadServiceResource from '../ReadServiceResource.js';
export default class Dimensions extends ReadServiceResource {
static baseUrl = '/rest/ua/v15/dimensions';
/**
* Get all the dimensions.
* @param params
*/
list(params) {
return this.api.get(this.buildPathWithOrg(Dimensions.baseUrl, params));
}
/**
* Get all the exportable dimensions.
* @param params
*/
listExportableDimensions(params) {
return this.api.get(this.buildPathWithOrg(`${Dimensions.baseUrl}/exportables`, params));
}
/**
* Get a dimension.
* @param apiName Format must be `EVENT.DIMENSION` where EVENT is the event type and DIMENSION is the name of the dimension.
*/
get(apiName) {
return this.api.get(this.buildPathWithOrg(`${Dimensions.baseUrl}/${apiName}`));
}
/**
* Get the values for a dimension.
* @param dimension The dimension to fetch.
* @param params
*/
getValues(dimension, params) {
return this.api.get(this.buildPathWithOrg(`${Dimensions.baseUrl}/${dimension}/values`, params));
}
/**
* Get all the custom dimensions.
* @param includeOnlyParents This will filter out dimensions which are covered by others.
* Only parent/master dimensions will be output.
*/
listCustomDimensions(includeOnlyParents = false) {
return this.api.get(this.buildPathWithOrg(`${Dimensions.baseUrl}/custom`, { includeOnlyParents }));
}
/**
* Create a custom dimension.
* @param model
* @param params
*/
createCustomDimension(model, params) {
return this.api.post(this.buildPathWithOrg(`${Dimensions.baseUrl}/custom`, params), model);
}
/**
* Get a custom dimension.
* @param apiName Format must be `EVENT.DIMENSION` where EVENT is the event type and DIMENSION is the name of the dimension.
*/
getCustomDimension(apiName) {
return this.api.get(this.buildPathWithOrg(`${Dimensions.baseUrl}/custom/${apiName}`, { org: this.api.organizationId }));
}
/**
* Get the values for a custom dimension.
* @param dimension The dimension to fetch.
* @param params
*/
getCustomDimensionValues(dimension, params) {
return this.api.get(this.buildPathWithOrg(`${Dimensions.baseUrl}/custom/${dimension}/values`, params));
}
/**
* Create or edit a custom dimension.
* @param apiName Format must be `EVENT.DIMENSION` where EVENT is the event type and DIMENSION is the name of the dimension.
* @param model
* @param updatePastEvents Whether to update the custom dimension in past events (deprecated).
*/
updateCustomDimension(apiName, model, updatePastEvents = false) {
return this.api.put(this.buildPathWithOrg(`${Dimensions.baseUrl}/custom/${apiName}`, { updatePastEvents }), model);
}
/**
* Delete a custom dimension.
* @param apiName Format must be `EVENT.DIMENSION` where EVENT is the event type and DIMENSION is the name of the dimension.
*/
deleteCustomDimension(apiName) {
return this.api.delete(this.buildPathWithOrg(`${Dimensions.baseUrl}/custom/${apiName}`));
}
/**
* Get the custom dimensions service status.
*/
getCustomDimensionStatus() {
return this.api.get(`${Dimensions.baseUrl}/custom/status`);
}
/**
* Health check for the custom dimensions service.
*/
checkCustomDimensionHealth() {
return this.api.get(`${Dimensions.baseUrl}/custom/monitoring/health`);
}
/**
* Get a list of dimensions that have data but are not created yet.
* @param event The type of event for which to look for suggestions.
* @param params
*/
listUncreatedDimensions(event, params) {
return this.api.get(this.buildPath(`${Dimensions.baseUrl}/custom/${event}/suggestions`, {
...params,
org: this.api.organizationId,
}));
}
checkHealth() {
return this.api.get(`${Dimensions.baseUrl}/monitoring/health`);
}
checkStatus() {
return this.api.get(`${Dimensions.baseUrl}/status`);
}
}
//# sourceMappingURL=Dimensions.js.map