mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add ability to mark studios, genres and people as favorites
This commit is contained in:
parent
4bff5dc5de
commit
210572734a
3 changed files with 114 additions and 11 deletions
83
ApiClient.js
83
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
|
||||
|
@ -1723,6 +1723,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue