1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

added a notifications service

This commit is contained in:
Luke Pulverenti 2013-07-06 17:23:32 -04:00
parent 95a8a246b9
commit cfb3392c35
8 changed files with 411 additions and 4 deletions

View file

@ -243,6 +243,61 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
});
};
self.getNotificationSummary = function (userId) {
if (!userId) {
throw new Error("null userId");
}
var url = self.getUrl("Notifications/" + userId + "/Summary");
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
self.getNotifications = function (userId, options) {
if (!userId) {
throw new Error("null userId");
}
var url = self.getUrl("Notifications/" + userId, options || {});
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
self.markNotificationsRead = function (userId, idList, isRead) {
if (!userId) {
throw new Error("null userId");
}
if (!idList || !idList.length) {
throw new Error("null idList");
}
var suffix = isRead ? "Read" : "Unread";
var params = {
UserId: userId,
Ids: idList.join(',')
};
var url = self.getUrl("Notifications/" + userId + "/" + suffix, params);
return self.ajax({
type: "POST",
url: url
});
};
/**
* Gets the current server status
*/
@ -1937,7 +1992,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
if (!item) {
throw new Error("null item");
}
var url = self.getUrl("Artists/" + self.encodeName(item.Name));
return self.ajax({