diff --git a/MediaBrowser.Api/Plugin.cs b/MediaBrowser.Api/Plugin.cs index f254adbb6b..24038767ec 100644 --- a/MediaBrowser.Api/Plugin.cs +++ b/MediaBrowser.Api/Plugin.cs @@ -1,12 +1,12 @@ -using System; -using System.ComponentModel.Composition; -using System.Net; -using System.Reactive.Linq; -using MediaBrowser.Api.HttpHandlers; +using MediaBrowser.Api.HttpHandlers; using MediaBrowser.Common.Net.Handlers; using MediaBrowser.Common.Plugins; using MediaBrowser.Controller; using MediaBrowser.Model.Plugins; +using System; +using System.ComponentModel.Composition; +using System.Net; +using System.Reactive.Linq; namespace MediaBrowser.Api { diff --git a/MediaBrowser.ApiInteraction/ApiClient.cs b/MediaBrowser.ApiInteraction/ApiClient.cs index 8e6859a484..f2fd903093 100644 --- a/MediaBrowser.ApiInteraction/ApiClient.cs +++ b/MediaBrowser.ApiInteraction/ApiClient.cs @@ -76,13 +76,18 @@ namespace MediaBrowser.ApiInteraction } /// - /// Gets the recently added items + /// Gets in-progress items /// /// The user id. - /// - public async Task GetRecentlyAddedItemsAsync(Guid userId) + /// (Optional) Specify a folder Id to localize the search to a specific folder. + public async Task GetInProgressItemsItemsAsync(Guid userId, Guid? folderId = null) { - string url = ApiUrl + "/itemlist?listtype=recentlyaddeditems&userId=" + userId.ToString(); + string url = ApiUrl + "/itemlist?listtype=inprogressitems&userId=" + userId.ToString(); + + if (folderId.HasValue) + { + url += "&id=" + folderId.ToString(); + } using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false)) { @@ -91,21 +96,45 @@ namespace MediaBrowser.ApiInteraction } /// - /// Gets recently added items within a specific folder + /// Gets recently added items /// /// The user id. - public async Task GetRecentlyAddedItemsAsync(Guid userId, Guid folderId) + /// (Optional) Specify a folder Id to localize the search to a specific folder. + public async Task GetRecentlyAddedItemsAsync(Guid userId, Guid? folderId = null) { string url = ApiUrl + "/itemlist?listtype=recentlyaddeditems&userId=" + userId.ToString(); - url += "&id=" + folderId.ToString(); + if (folderId.HasValue) + { + url += "&id=" + folderId.ToString(); + } using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false)) { return DeserializeFromStream(stream); } } - + + /// + /// Gets recently added items that are unplayed. + /// + /// The user id. + /// (Optional) Specify a folder Id to localize the search to a specific folder. + public async Task GetRecentlyAddedUnplayedItemsAsync(Guid userId, Guid? folderId = null) + { + string url = ApiUrl + "/itemlist?listtype=recentlyaddedunplayeditems&userId=" + userId.ToString(); + + if (folderId.HasValue) + { + url += "&id=" + folderId.ToString(); + } + + using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false)) + { + return DeserializeFromStream(stream); + } + } + /// /// Gets all Years ///