2020-01-13 05:47:03 +00:00
|
|
|
/* global axios */
|
2020-01-01 17:00:43 +00:00
|
|
|
import ApiClient from './ApiClient';
|
|
|
|
|
|
|
|
class ContactAPI extends ApiClient {
|
|
|
|
constructor() {
|
2020-03-09 17:57:10 +00:00
|
|
|
super('contacts', { accountScoped: true });
|
2020-01-01 17:00:43 +00:00
|
|
|
}
|
2020-01-13 05:47:03 +00:00
|
|
|
|
2021-05-13 08:02:19 +00:00
|
|
|
get(page, sortAttr = 'name') {
|
|
|
|
return axios.get(`${this.url}?page=${page}&sort=${sortAttr}`);
|
2020-11-10 09:55:26 +00:00
|
|
|
}
|
|
|
|
|
2020-01-13 05:47:03 +00:00
|
|
|
getConversations(contactId) {
|
|
|
|
return axios.get(`${this.url}/${contactId}/conversations`);
|
|
|
|
}
|
2020-11-10 09:55:26 +00:00
|
|
|
|
2021-04-16 15:01:07 +00:00
|
|
|
getContactableInboxes(contactId) {
|
|
|
|
return axios.get(`${this.url}/${contactId}/contactable_inboxes`);
|
|
|
|
}
|
|
|
|
|
2021-05-13 08:02:19 +00:00
|
|
|
search(search = '', page = 1, sortAttr = 'name') {
|
|
|
|
return axios.get(
|
|
|
|
`${this.url}/search?q=${search}&page=${page}&sort=${sortAttr}`
|
|
|
|
);
|
2020-11-10 09:55:26 +00:00
|
|
|
}
|
2020-01-01 17:00:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default new ContactAPI();
|