2019-08-14 09:48:44 +00:00
|
|
|
/* global axios */
|
2020-03-09 17:57:10 +00:00
|
|
|
import ApiClient from './ApiClient';
|
2019-08-14 09:48:44 +00:00
|
|
|
|
2020-03-09 17:57:10 +00:00
|
|
|
class ReportsAPI extends ApiClient {
|
|
|
|
constructor() {
|
2020-05-11 06:10:14 +00:00
|
|
|
super('reports', { accountScoped: true, apiVersion: 'v2' });
|
2020-03-09 17:57:10 +00:00
|
|
|
}
|
|
|
|
|
2022-02-15 11:40:49 +00:00
|
|
|
getReports(metric, since, until, type = 'account', id, group_by) {
|
2021-08-27 17:16:32 +00:00
|
|
|
return axios.get(`${this.url}`, {
|
2022-02-15 11:40:49 +00:00
|
|
|
params: { metric, since, until, type, id, group_by },
|
2020-03-09 17:57:10 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-02-15 11:40:49 +00:00
|
|
|
getSummary(since, until, type = 'account', id, group_by) {
|
2021-08-27 17:16:32 +00:00
|
|
|
return axios.get(`${this.url}/summary`, {
|
2022-02-15 11:40:49 +00:00
|
|
|
params: { since, until, type, id, group_by },
|
2020-03-09 17:57:10 +00:00
|
|
|
});
|
|
|
|
}
|
2020-12-15 18:05:03 +00:00
|
|
|
|
|
|
|
getAgentReports(since, until) {
|
|
|
|
return axios.get(`${this.url}/agents`, {
|
|
|
|
params: { since, until },
|
|
|
|
});
|
|
|
|
}
|
feat - Add filter for reports by agent, label and inboxes (#3084)
* Adds filter for agents, labels and inboxes
* Added Inboxes Reports Feature
* Fixed populating of filter dropdown issue
* If applied, fixes code climate style-lint warnings
* Fixes codeclimate warnings
* if applied, Refactors sidebar file to fix codclimate warnings
* if applied, fixes the download reports button for filtered report-data
* If applied, replaces native img tag with thumbnail component
* If applied, replaces hardcoded color string with variable
* If applied, adds a11y labels to multiselect dropdowns
* If applied, Renames reports methods to generic names
* If applied, Adds test cases for Labels and Inboxes
* If applied, write a test spec for fileDownload helper
* if applied, Moves fileDownload method to a utils folder
* If applied, Fixes the report file name type
* Test Spec for Reports Store module
* Fix specs - add restoreAllMocks
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2021-09-30 07:43:45 +00:00
|
|
|
|
|
|
|
getLabelReports(since, until) {
|
|
|
|
return axios.get(`${this.url}/labels`, {
|
|
|
|
params: { since, until },
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
getInboxReports(since, until) {
|
|
|
|
return axios.get(`${this.url}/inboxes`, {
|
|
|
|
params: { since, until },
|
|
|
|
});
|
|
|
|
}
|
2021-10-06 18:23:51 +00:00
|
|
|
|
|
|
|
getTeamReports(since, until) {
|
|
|
|
return axios.get(`${this.url}/teams`, {
|
|
|
|
params: { since, until },
|
|
|
|
});
|
|
|
|
}
|
2020-03-09 17:57:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default new ReportsAPI();
|