2020-04-03 07:34:58 +00:00
|
|
|
import { API } from 'widget/helpers/axios';
|
|
|
|
|
2021-09-29 08:58:32 +00:00
|
|
|
const buildUrl = endPoint => `/public/api/v1/${endPoint}`;
|
2020-04-03 07:34:58 +00:00
|
|
|
|
|
|
|
export default {
|
2021-09-15 07:21:57 +00:00
|
|
|
create(inboxIdentifier, userObject) {
|
|
|
|
return API.post(buildUrl(`inboxes/${inboxIdentifier}/contacts`), {
|
2020-04-03 07:34:58 +00:00
|
|
|
...userObject,
|
|
|
|
});
|
|
|
|
},
|
2021-09-15 07:21:57 +00:00
|
|
|
|
|
|
|
get(inboxIdentifier, contactIdentifier) {
|
|
|
|
return API.get(
|
|
|
|
buildUrl(`inboxes/${inboxIdentifier}/contacts/${contactIdentifier}`)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
update(inboxIdentifier, contactIdentifier, userObject) {
|
|
|
|
return API.patch(
|
|
|
|
buildUrl(`inboxes/${inboxIdentifier}/contacts/${contactIdentifier}`),
|
|
|
|
{
|
|
|
|
...userObject,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2020-08-21 14:00:27 +00:00
|
|
|
setCustomAttibutes(customAttributes = {}) {
|
|
|
|
return API.patch(buildUrl('widget/contact'), {
|
|
|
|
custom_attributes: customAttributes,
|
|
|
|
});
|
|
|
|
},
|
2020-04-03 07:34:58 +00:00
|
|
|
};
|