aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.WebDashboard/ApiClient.js
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-07-06 17:23:32 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-07-06 17:23:32 -0400
commit53450bd514eec97d58eb18b8a01feab36475826b (patch)
tree5cd1b4013852619b0e108a8f2442ab893a924441 /MediaBrowser.WebDashboard/ApiClient.js
parentb3054a6a2216e36cc37279a1fc0f4c14e6668c8f (diff)
added a notifications service
Diffstat (limited to 'MediaBrowser.WebDashboard/ApiClient.js')
-rw-r--r--MediaBrowser.WebDashboard/ApiClient.js57
1 files changed, 56 insertions, 1 deletions
diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.js
index ebea5b986..a90d2dcf8 100644
--- a/MediaBrowser.WebDashboard/ApiClient.js
+++ b/MediaBrowser.WebDashboard/ApiClient.js
@@ -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({