mirror of
https://github.com/chatwoot/chatwoot.git
synced 2026-06-16 21:06:22 +08:00
60 lines
1.4 KiB
JavaScript
60 lines
1.4 KiB
JavaScript
/* global axios */
|
|
import CacheEnabledApiClient from './CacheEnabledApiClient';
|
|
import ApiClient from './ApiClient';
|
|
|
|
// eslint-disable-next-line no-underscore-dangle
|
|
const BaseClass = window.__WOOT_ISOLATED_SHELL__
|
|
? ApiClient
|
|
: CacheEnabledApiClient;
|
|
|
|
class Inboxes extends BaseClass {
|
|
constructor() {
|
|
super('inboxes', { accountScoped: true });
|
|
}
|
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
get cacheModelName() {
|
|
return 'inbox';
|
|
}
|
|
|
|
getCampaigns(inboxId) {
|
|
return axios.get(`${this.url}/${inboxId}/campaigns`);
|
|
}
|
|
|
|
deleteInboxAvatar(inboxId) {
|
|
return axios.delete(`${this.url}/${inboxId}/avatar`);
|
|
}
|
|
|
|
getAgentBot(inboxId) {
|
|
return axios.get(`${this.url}/${inboxId}/agent_bot`);
|
|
}
|
|
|
|
setAgentBot(inboxId, botId) {
|
|
return axios.post(`${this.url}/${inboxId}/set_agent_bot`, {
|
|
agent_bot: botId,
|
|
});
|
|
}
|
|
|
|
syncTemplates(inboxId) {
|
|
return axios.post(`${this.url}/${inboxId}/sync_templates`);
|
|
}
|
|
|
|
createCSATTemplate(inboxId, template) {
|
|
return axios.post(`${this.url}/${inboxId}/csat_template`, {
|
|
template,
|
|
});
|
|
}
|
|
|
|
getCSATTemplateStatus(inboxId) {
|
|
return axios.get(`${this.url}/${inboxId}/csat_template`);
|
|
}
|
|
|
|
analyzeCSATTemplateUtility(inboxId, template) {
|
|
return axios.post(`${this.url}/${inboxId}/csat_template/analyze`, {
|
|
template,
|
|
});
|
|
}
|
|
}
|
|
|
|
export default new Inboxes();
|