angles-javascript-client
Version:
This is the javascript client for the Angles Dashboard. It allows you to store your test results.
64 lines • 2.2 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MetricRequests = void 0;
const moment_1 = __importDefault(require("moment"));
const BaseRequests_1 = require("./BaseRequests");
class MetricRequests extends BaseRequests_1.BaseRequests {
constructor(axiosInstance) {
super(axiosInstance);
}
/**
* Will retrieve metrics for a specific period and will group it by a specified period
*
* @param teamId
* @param componentId
* @param fromDate
* @param toDate
* @param groupingPeriod
*/
getPhaseMetrics(teamId, componentId, fromDate, toDate, groupingPeriod) {
const url = new URL(this.axios.defaults.baseURL + `/metrics/phase?teamId=${teamId}`);
if (componentId) {
url.searchParams.append('componentId', componentId);
}
if (fromDate) {
url.searchParams.append('fromDate', moment_1.default(fromDate).format('YYYY-MM-DD'));
}
if (toDate) {
url.searchParams.append('toDate', moment_1.default(toDate).format('YYYY-MM-DD'));
}
if (groupingPeriod) {
url.searchParams.append('groupingPeriod', groupingPeriod);
}
return this.get(url.toString());
}
/**
* Will retrieve screenshot metrics grouped by tags and views.
*
* @param view
* @param tag
* @param limit
* @param thumbnail
*/
getScreenshotMetrics(view, tag, limit, thumbnail) {
const url = new URL(this.axios.defaults.baseURL + `/metrics/screenshot?`);
if (view) {
url.searchParams.append('view', view);
}
if (tag) {
url.searchParams.append('tag', tag);
}
if (limit) {
url.searchParams.append('limit', String(limit));
}
if (thumbnail) {
url.searchParams.append('thumbnail', String(thumbnail));
}
return this.get(url.toString());
}
}
exports.MetricRequests = MetricRequests;
//# sourceMappingURL=MetricRequests.js.map