aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.WebDashboard/ApiClient.js
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-04-12 20:42:51 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-04-12 20:42:51 -0400
commitb3cb8fda22337e22d6d4ee45d5ec6e9cf69be7fa (patch)
treed871f98cd8c5dd08c2432a3bccd8ffe758f8be84 /MediaBrowser.WebDashboard/ApiClient.js
parentb721aab2ba9dac5e5e3a7b53c066791d23e83bc2 (diff)
add ability to mark studios, genres and people as favorites
Diffstat (limited to 'MediaBrowser.WebDashboard/ApiClient.js')
-rw-r--r--MediaBrowser.WebDashboard/ApiClient.js83
1 files changed, 82 insertions, 1 deletions
diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.js
index be4267d3c..65012f94d 100644
--- a/MediaBrowser.WebDashboard/ApiClient.js
+++ b/MediaBrowser.WebDashboard/ApiClient.js
@@ -1671,7 +1671,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
};
/**
- * Updates a user's favorite status for an item and returns the updated UserItemData object.
+ * Updates a user's favorite status for an item.
* @param {String} userId
* @param {String} itemId
* @param {Boolean} isFavorite
@@ -1724,6 +1724,87 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
};
/**
+ * Updates a user's favorite status for a person.
+ * @param {String} userId
+ * @param {String} name
+ * @param {Boolean} isFavorite
+ */
+ self.updateFavoritePersonStatus = function (userId, name, isFavorite) {
+
+ if (!userId) {
+ throw new Error("null userId");
+ }
+
+ if (!name) {
+ throw new Error("null name");
+ }
+
+ var url = self.getUrl("Users/" + userId + "/FavoritePersons/" + name);
+
+ var method = isFavorite ? "POST" : "DELETE";
+
+ return self.ajax({
+ type: method,
+ url: url,
+ dataType: "json"
+ });
+ };
+
+ /**
+ * Updates a user's favorite status for a genre.
+ * @param {String} userId
+ * @param {String} name
+ * @param {Boolean} isFavorite
+ */
+ self.updateFavoriteGenreStatus = function (userId, name, isFavorite) {
+
+ if (!userId) {
+ throw new Error("null userId");
+ }
+
+ if (!name) {
+ throw new Error("null name");
+ }
+
+ var url = self.getUrl("Users/" + userId + "/FavoriteGenre/" + name);
+
+ var method = isFavorite ? "POST" : "DELETE";
+
+ return self.ajax({
+ type: method,
+ url: url,
+ dataType: "json"
+ });
+ };
+
+ /**
+ * Updates a user's favorite status for a studio.
+ * @param {String} userId
+ * @param {String} name
+ * @param {Boolean} isFavorite
+ */
+ self.updateFavoriteStudioStatus = function (userId, name, isFavorite) {
+
+ if (!userId) {
+ throw new Error("null userId");
+ }
+
+ if (!name) {
+ throw new Error("null name");
+ }
+
+ var url = self.getUrl("Users/" + userId + "/FavoriteStudios/" + name);
+
+ var method = isFavorite ? "POST" : "DELETE";
+
+ return self.ajax({
+ type: method,
+ url: url,
+ dataType: "json"
+ });
+ };
+
+ /**
* Clears a user's personal rating for an item
* @param {String} userId
* @param {String} itemId