Chatwoot/app/javascript/dashboard/api/reports.js
Fayaz Ahmed 1c6a539c0a
feat: Add Reports for teams (#3116)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2021-10-06 23:53:51 +05:30

46 lines
1 KiB
JavaScript

/* global axios */
import ApiClient from './ApiClient';
class ReportsAPI extends ApiClient {
constructor() {
super('reports', { accountScoped: true, apiVersion: 'v2' });
}
getReports(metric, since, until, type = 'account', id) {
return axios.get(`${this.url}`, {
params: { metric, since, until, type, id },
});
}
getSummary(since, until, type = 'account', id) {
return axios.get(`${this.url}/summary`, {
params: { since, until, type, id },
});
}
getAgentReports(since, until) {
return axios.get(`${this.url}/agents`, {
params: { since, until },
});
}
getLabelReports(since, until) {
return axios.get(`${this.url}/labels`, {
params: { since, until },
});
}
getInboxReports(since, until) {
return axios.get(`${this.url}/inboxes`, {
params: { since, until },
});
}
getTeamReports(since, until) {
return axios.get(`${this.url}/teams`, {
params: { since, until },
});
}
}
export default new ReportsAPI();