aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ApiInteraction.Portable/ApiClient.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.ApiInteraction.Portable/ApiClient.cs')
-rw-r--r--MediaBrowser.ApiInteraction.Portable/ApiClient.cs65
1 files changed, 60 insertions, 5 deletions
diff --git a/MediaBrowser.ApiInteraction.Portable/ApiClient.cs b/MediaBrowser.ApiInteraction.Portable/ApiClient.cs
index edadc9f05..f63847e5c 100644
--- a/MediaBrowser.ApiInteraction.Portable/ApiClient.cs
+++ b/MediaBrowser.ApiInteraction.Portable/ApiClient.cs
@@ -114,6 +114,23 @@ namespace MediaBrowser.ApiInteraction.Portable
}
/// <summary>
+ /// Gets favorite items
+ /// </summary>
+ /// <param name="userId">The user id.</param>
+ /// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
+ public void GetFavoriteItemsAsync(Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
+ {
+ string url = ApiUrl + "/itemlist?listtype=favorites&userId=" + userId.ToString();
+
+ if (folderId.HasValue)
+ {
+ url += "&id=" + folderId.ToString();
+ }
+
+ GetDataAsync(url, callback);
+ }
+
+ /// <summary>
/// Gets recently added items that are unplayed.
/// </summary>
/// <param name="userId">The user id.</param>
@@ -143,40 +160,60 @@ namespace MediaBrowser.ApiInteraction.Portable
/// <summary>
/// Gets all items that contain a given Year
/// </summary>
- public void GetItemsWithYearAsync(string name, Guid userId, Action<DTOBaseItem[]> callback)
+ public void GetItemsWithYearAsync(string name, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=itemswithyear&userId=" + userId.ToString() + "&name=" + name;
+ if (folderId.HasValue)
+ {
+ url += "&id=" + folderId.ToString();
+ }
+
GetDataAsync(url, callback);
}
/// <summary>
/// Gets all items that contain a given Genre
/// </summary>
- public void GetItemsWithGenreAsync(string name, Guid userId, Action<DTOBaseItem[]> callback)
+ public void GetItemsWithGenreAsync(string name, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=itemswithgenre&userId=" + userId.ToString() + "&name=" + name;
+ if (folderId.HasValue)
+ {
+ url += "&id=" + folderId.ToString();
+ }
+
GetDataAsync(url, callback);
}
/// <summary>
/// Gets all items that contain a given Person
/// </summary>
- public void GetItemsWithPersonAsync(string name, Guid userId, Action<DTOBaseItem[]> callback)
+ public void GetItemsWithPersonAsync(string name, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=itemswithperson&userId=" + userId.ToString() + "&name=" + name;
+ if (folderId.HasValue)
+ {
+ url += "&id=" + folderId.ToString();
+ }
+
GetDataAsync(url, callback);
}
/// <summary>
/// Gets all items that contain a given Person
/// </summary>
- public void GetItemsWithPersonAsync(string name, string personType, Guid userId, Action<DTOBaseItem[]> callback)
+ public void GetItemsWithPersonAsync(string name, string personType, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=itemswithperson&userId=" + userId.ToString() + "&name=" + name;
+ if (folderId.HasValue)
+ {
+ url += "&id=" + folderId.ToString();
+ }
+
url += "&persontype=" + personType;
GetDataAsync(url, callback);
@@ -195,10 +232,15 @@ namespace MediaBrowser.ApiInteraction.Portable
/// <summary>
/// Gets all items that contain a given Studio
/// </summary>
- public void GetItemsWithStudioAsync(string name, Guid userId, Action<DTOBaseItem[]> callback)
+ public void GetItemsWithStudioAsync(string name, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=itemswithstudio&userId=" + userId.ToString() + "&name=" + name;
+ if (folderId.HasValue)
+ {
+ url += "&id=" + folderId.ToString();
+ }
+
GetDataAsync(url, callback);
}
@@ -345,6 +387,19 @@ namespace MediaBrowser.ApiInteraction.Portable
}
/// <summary>
+ /// Updates a user's favorite status for an item and returns the updated UserItemData object.
+ /// </summary>
+ public void UpdateFavoriteStatusAsync(Guid itemId, Guid userId, bool isFavorite, Action<DTOUserItemData> callback)
+ {
+ string url = ApiUrl + "/favoritestatus?id=" + itemId;
+
+ url += "&userid=" + userId;
+ url += "&isfavorite=" + (isFavorite ? "1" : "0");
+
+ GetDataAsync(url, callback);
+ }
+
+ /// <summary>
/// Performs a GET request, and deserializes the response stream to an object of Type T
/// </summary>
private void GetDataAsync<T>(string url, Action<T> callback)