UNPKG

dcard

Version:

👫 Unofficial Dcard API wrapper for Node.js developers.

54 lines (42 loc) • 1.95 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.deleteNotification = exports.getNotificationStatus = exports.seeAllNotification = exports.seeNotification = exports.readAllNotification = exports.readNotification = exports.listNotification = undefined; var _qs = require('qs'); var _qs2 = _interopRequireDefault(_qs); var _request = require('../request'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var listNotification = exports.listNotification = function listNotification(options) { return (0, _request.api)('notifications?' + _qs2.default.stringify(options)).then(_request.filterError).then(_request.parseJSON); }; var readNotification = exports.readNotification = function readNotification(id) { return (0, _request.api)('notifications/' + id + '/read', { method: 'post' }).then(_request.filterError); }; var readAllNotification = exports.readAllNotification = function readAllNotification() { return (0, _request.api)('notifications/read', { method: 'post' }).then(_request.filterError); }; var seeNotification = exports.seeNotification = function seeNotification(id) { return (0, _request.api)('notifications/' + id + '/see', { method: 'post' }).then(_request.filterError); }; var seeAllNotification = exports.seeAllNotification = function seeAllNotification() { return (0, _request.api)('notifications/see', { method: 'post' }).then(_request.filterError); }; var getNotificationStatus = exports.getNotificationStatus = function getNotificationStatus() { return (0, _request.api)('notifications/status').then(_request.filterError).then(_request.parseJSON); }; var deleteNotification = exports.deleteNotification = function deleteNotification(id) { return (0, _request.api)('notifications/' + id, { method: 'delete' }).then(_request.filterError).then(function () { return { id: id }; }); };