Chatwoot/app/javascript/dashboard/api/inbox/conversation.js
Nithin David Thomas eaafc45f45
feat: Show teams on sidebar (#1754)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
Co-authored-by: Sojan <sojan@pepalo.com>
2021-02-13 14:58:05 +05:30

77 lines
1.7 KiB
JavaScript

/* global axios */
import ApiClient from '../ApiClient';
class ConversationApi extends ApiClient {
constructor() {
super('conversations', { accountScoped: true });
}
get({ inboxId, status, assigneeType, page, labels, teamId }) {
return axios.get(this.url, {
params: {
inbox_id: inboxId,
team_id: teamId,
status,
assignee_type: assigneeType,
page,
labels,
},
});
}
search({ q }) {
return axios.get(`${this.url}/search`, {
params: {
q,
page: 1,
},
});
}
toggleStatus(conversationId) {
return axios.post(`${this.url}/${conversationId}/toggle_status`, {});
}
assignAgent({ conversationId, agentId }) {
axios.post(
`${this.url}/${conversationId}/assignments?assignee_id=${agentId}`,
{}
);
}
markMessageRead({ id }) {
return axios.post(`${this.url}/${id}/update_last_seen`);
}
toggleTyping({ conversationId, status }) {
return axios.post(`${this.url}/${conversationId}/toggle_typing_status`, {
typing_status: status,
});
}
mute(conversationId) {
return axios.post(`${this.url}/${conversationId}/mute`);
}
unmute(conversationId) {
return axios.post(`${this.url}/${conversationId}/unmute`);
}
meta({ inboxId, status, assigneeType, labels, teamId }) {
return axios.get(`${this.url}/meta`, {
params: {
inbox_id: inboxId,
status,
assignee_type: assigneeType,
labels,
team_id: teamId,
},
});
}
sendEmailTranscript({ conversationId, email }) {
return axios.post(`${this.url}/${conversationId}/transcript`, { email });
}
}
export default new ConversationApi();