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.

98 lines 3.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const ReadServiceResource_js_1 = tslib_1.__importDefault(require("../ReadServiceResource.js")); class Reports extends ReadServiceResource_js_1.default { static baseUrl = '/rest/ua/v15/reports'; /** * Get the persisted reports of one or all types. * @param options */ list(options) { return this.api.get(this.buildPathWithOrg(Reports.baseUrl, options)); } /** * Get a report. * @param reportId The unique identifier of a report. This id is generated by the server when creating a report. * @param options */ get(reportId, options) { return this.api.get(this.buildPathWithOrg(`${Reports.baseUrl}/${reportId}`, options)); } /** * Create a report. * @param report */ create(report) { return this.api.post(this.buildPathWithOrg(Reports.baseUrl), report); } /** * Update a report. * @param reportId The unique identifier of a report. This id is generated by the server when creating a report. * @param report */ update(reportId, report) { return this.api.put(this.buildPathWithOrg(`${Reports.baseUrl}/${reportId}`), report); } /** * Delete a report. * @param reportId The unique identifier of a report. This id is generated by the server when creating a report. */ delete(reportId) { return this.api.delete(this.buildPathWithOrg(`${Reports.baseUrl}/${reportId}`)); } /** * Get the users and groups who can view a report. * @param reportId The unique identifier of a report. This id is generated by the server when creating a report. */ getAccess(reportId) { return this.api.get(this.buildPathWithOrg(`${Reports.baseUrl}/${reportId}/access`)); } /** * Set the users and groups who are allowed to view a report. * @param reportId The unique identifier of a report. This id is generated by the server when creating a report. * @param reportAccess */ setAccess(reportId, reportAccess) { return this.api.put(this.buildPathWithOrg(`${Reports.baseUrl}/${reportId}/access`), reportAccess); } /** * Get the users who can view a report. * @param reportId The unique identifier of a report. This id is generated by the server when creating a report. */ getUsers(reportId) { return this.api.get(this.buildPathWithOrg(`${Reports.baseUrl}/${reportId}/users`)); } /** * Set the users who are allowed to view a report. * @param reportId The unique identifier of a report. This id is generated by the server when creating a report. * @param userIds */ setUsers(reportId, userIds) { return this.api.put(this.buildPathWithOrg(`${Reports.baseUrl}/${reportId}/users`), userIds); } /** * Get a report template. * @param templateId The unique identifier of a template. * @param options */ getReportTemplate(templateId, options) { return this.api.get(this.buildPathWithOrg(`${Reports.baseUrl}/templates/${templateId}`, options)); } /** * Get metadata about available report templates. * @param type The type of the report. Must be either 'explorer' or 'dashboard'. * @param options */ listReportTemplates(type, options) { return this.api.get(this.buildPathWithOrg(`${Reports.baseUrl}/templates`, { type, ...options })); } checkHealth() { return this.api.get(`${Reports.baseUrl}/monitoring/health`); } checkStatus() { return this.api.get(`${Reports.baseUrl}/status`); } } exports.default = Reports; //# sourceMappingURL=Reports.js.map