@magicbell/core
Version:
Official MagicBell API wrapper
30 lines • 942 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const ajax_js_1 = require("../../lib/ajax.js");
/**
* Class to interact with the user preferences API endpoints.
*
* @example
* const repo = new NotificationPreferencesRepository();
* await repo.update({ categories: { comment: commentPreferences } });
*/
class NotificationPreferencesRepository {
remotePathOrUrl;
constructor(remotePathOrUrl = '/notification_preferences') {
this.remotePathOrUrl = remotePathOrUrl;
}
/**
* Get the user preferences from the API server.
*/
get() {
return (0, ajax_js_1.fetchAPI)(this.remotePathOrUrl);
}
/**
* Update user preferences in the API server.
*/
update(data) {
return (0, ajax_js_1.putAPI)(this.remotePathOrUrl, data);
}
}
exports.default = NotificationPreferencesRepository;
//# sourceMappingURL=NotificationPreferencesRepository.js.map