diff options
Diffstat (limited to 'MediaBrowser.WebDashboard/ApiClient.js')
| -rw-r--r-- | MediaBrowser.WebDashboard/ApiClient.js | 189 |
1 files changed, 188 insertions, 1 deletions
diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.js index 056140304..ebea5b986 100644 --- a/MediaBrowser.WebDashboard/ApiClient.js +++ b/MediaBrowser.WebDashboard/ApiClient.js @@ -497,6 +497,24 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.refreshGameGenre = function (name, force) { + + if (!name) { + throw new Error("null name"); + } + + var url = self.getUrl("GameGenres/" + self.encodeName(name) + "/Refresh", { + + forced: force || false + + }); + + return self.ajax({ + type: "POST", + url: url + }); + }; + self.refreshPerson = function (name, force) { if (!name) { @@ -1263,6 +1281,27 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.getGameGenre = function (name, userId) { + + if (!name) { + throw new Error("null name"); + } + + var options = {}; + + if (userId) { + options.userId = userId; + } + + var url = self.getUrl("GameGenres/" + self.encodeName(name), options); + + return self.ajax({ + type: "GET", + url: url, + dataType: "json" + }); + }; + /** * Gets an artist */ @@ -1553,6 +1592,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.getGameGenreImageUrl = function (name, options) { + + if (!name) { + throw new Error("null name"); + } + + options = options || { + + }; + + var url = "GameGenres/" + 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 @@ -1922,7 +1996,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; - self.updateMusicGenres = function (item) { + self.updateMusicGenre = function (item) { if (!item) { throw new Error("null item"); @@ -1938,6 +2012,22 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.updateGameGenre = function (item) { + + if (!item) { + throw new Error("null item"); + } + + var url = self.getUrl("GameGenres/" + self.encodeName(item.Name)); + + return self.ajax({ + type: "POST", + url: url, + data: JSON.stringify(item), + contentType: "application/json" + }); + }; + /** * Updates plugin security info */ @@ -2136,6 +2226,24 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.getGameGenres = function (userId, options) { + + if (!userId) { + throw new Error("null userId"); + } + + options = options || {}; + options.userId = userId; + + var url = self.getUrl("GameGenres", options); + + return self.ajax({ + type: "GET", + url: url, + dataType: "json" + }); + }; + /** Gets people from an item */ @@ -2484,6 +2592,26 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.updateFavoriteGameGenreStatus = 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/GameGenres/" + 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 @@ -2590,6 +2718,26 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.updateGameGenreRating = 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/GameGenres/" + 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 @@ -2685,6 +2833,24 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.clearGameGenreRating = function (userId, name) { + + if (!userId) { + throw new Error("null userId"); + } + + if (!name) { + throw new Error("null name"); + } + + var url = self.getUrl("Users/" + userId + "/Ratings/GameGenres/" + self.encodeName(name)); + + return self.ajax({ + type: "DELETE", + url: url + }); + }; + self.getItemCounts = function (userId) { var options = {}; @@ -2771,6 +2937,27 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.getGameGenreItemCounts = function (userId, name) { + + if (!userId) { + throw new Error("null userId"); + } + + if (!name) { + throw new Error("null name"); + } + + var url = self.getUrl("GameGenres/" + 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 */ |
