aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.WebDashboard/ApiClient.js
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-06-10 23:31:00 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-06-10 23:31:00 -0400
commit18325159c5b46d2aa31d2dafd837ede7214b28ef (patch)
tree4966247933da5aeffad1672d87c67c1ebbb036f1 /MediaBrowser.WebDashboard/ApiClient.js
parentfab983b6dcf7b282e8c96e3509209fcc568fb922 (diff)
added a new MusicGenre entity
Diffstat (limited to 'MediaBrowser.WebDashboard/ApiClient.js')
-rw-r--r--MediaBrowser.WebDashboard/ApiClient.js153
1 files changed, 153 insertions, 0 deletions
diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.js
index 572cb0cf2..39c154b4b 100644
--- a/MediaBrowser.WebDashboard/ApiClient.js
+++ b/MediaBrowser.WebDashboard/ApiClient.js
@@ -1152,6 +1152,27 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
});
};
+ self.getMusicGenre = function (name, userId) {
+
+ if (!name) {
+ throw new Error("null name");
+ }
+
+ var options = {};
+
+ if (userId) {
+ options.userId = userId;
+ }
+
+ var url = self.getUrl("MusicGenres/" + self.encodeName(name), options);
+
+ return self.ajax({
+ type: "GET",
+ url: url,
+ dataType: "json"
+ });
+ };
+
/**
* Gets an artist
*/
@@ -1425,6 +1446,41 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
};
/**
+ * Constructs a url for a genre image
+ * @param {String} name
+ * @param {Object} options
+ * Options supports the following properties:
+ * width - download the image at a fixed width
+ * height - download the image at a fixed height
+ * maxWidth - download the image at a maxWidth
+ * maxHeight - download the image at a maxHeight
+ * quality - A scale of 0-100. This should almost always be omitted as the default will suffice.
+ * For best results do not specify both width and height together, as aspect ratio might be altered.
+ */
+ self.getMusicGenreImageUrl = function (name, options) {
+
+ if (!name) {
+ throw new Error("null name");
+ }
+
+ options = options || {
+
+ };
+
+ var url = "MusicGenres/" + self.encodeName(name) + "/Images/" + options.type;
+
+ if (options.index != null) {
+ url += "/" + options.index;
+ }
+
+ // Don't put these on the query string
+ delete options.type;
+ delete options.index;
+
+ return self.getUrl(url, options);
+ };
+
+ /**
* Constructs a url for a artist image
* @param {String} name
* @param {Object} options
@@ -1910,6 +1966,24 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
});
};
+ self.getMusicGenres = function (userId, options) {
+
+ if (!userId) {
+ throw new Error("null userId");
+ }
+
+ options = options || {};
+ options.userId = userId;
+
+ var url = self.getUrl("MusicGenres", options);
+
+ return self.ajax({
+ type: "GET",
+ url: url,
+ dataType: "json"
+ });
+ };
+
/**
Gets people from an item
*/
@@ -2217,6 +2291,26 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
});
};
+ self.updateFavoriteMusicGenreStatus = function (userId, name, isFavorite) {
+
+ if (!userId) {
+ throw new Error("null userId");
+ }
+
+ if (!name) {
+ throw new Error("null name");
+ }
+
+ var url = self.getUrl("Users/" + userId + "/Favorites/MusicGenres/" + self.encodeName(name));
+
+ var method = isFavorite ? "POST" : "DELETE";
+
+ return self.ajax({
+ type: method,
+ url: url
+ });
+ };
+
/**
* Updates a user's rating for an item by name.
* @param {String} userId
@@ -2303,6 +2397,26 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
});
};
+ self.updateMusicGenreRating = function (userId, name, likes) {
+
+ if (!userId) {
+ throw new Error("null userId");
+ }
+
+ if (!name) {
+ throw new Error("null name");
+ }
+
+ var url = self.getUrl("Users/" + userId + "/Ratings/MusicGenres/" + self.encodeName(name), {
+ likes: likes
+ });
+
+ return self.ajax({
+ type: "POST",
+ url: url
+ });
+ };
+
/**
* Clears a user's rating for an item by name.
* @param {String} userId
@@ -2380,6 +2494,24 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
});
};
+ self.clearMusicGenreRating = function (userId, name) {
+
+ if (!userId) {
+ throw new Error("null userId");
+ }
+
+ if (!name) {
+ throw new Error("null name");
+ }
+
+ var url = self.getUrl("Users/" + userId + "/Ratings/MusicGenres/" + self.encodeName(name));
+
+ return self.ajax({
+ type: "DELETE",
+ url: url
+ });
+ };
+
self.getItemCounts = function (userId) {
var options = {};
@@ -2445,6 +2577,27 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
});
};
+ self.getMusicGenreItemCounts = function (userId, name) {
+
+ if (!userId) {
+ throw new Error("null userId");
+ }
+
+ if (!name) {
+ throw new Error("null name");
+ }
+
+ var url = self.getUrl("MusicGenres/" + self.encodeName(name) + "/Counts", {
+ userId: userId
+ });
+
+ return self.ajax({
+ type: "GET",
+ url: url,
+ dataType: "json"
+ });
+ };
+
/**
Gets a variety of item counts that an artist appears in
*/