chore: Add an option to download CSAT Reports (#4694)

This commit is contained in:
Pranav Raj S
2022-05-17 21:01:45 +05:30
committed by GitHub
parent 361ffbab82
commit 47f04ee3fe
16 changed files with 189 additions and 28 deletions

View File

@@ -18,6 +18,17 @@ class CSATReportsAPI extends ApiClient {
});
}
download({ from, to, user_ids } = {}) {
return axios.get(`${this.url}/download`, {
params: {
since: from,
until: to,
sort: '-created_at',
user_ids,
},
});
}
getMetrics({ from, to, user_ids } = {}) {
return axios.get(`${this.url}/metrics`, {
params: { since: from, until: to, user_ids },

View File

@@ -33,5 +33,23 @@ describe('#Reports API', () => {
}
);
});
it('#download', () => {
csatReportsAPI.download({
from: 1622485800,
to: 1623695400,
user_ids: 1,
});
expect(context.axiosMock.get).toHaveBeenCalledWith(
'/api/v1/csat_survey_responses/download',
{
params: {
since: 1622485800,
until: 1623695400,
user_ids: 1,
sort: '-created_at',
},
}
);
});
});
});