aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-09-07 16:59:59 -0400
committerLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-09-07 16:59:59 -0400
commit23ea2280799588a1c156dcb1f933767f0a96c366 (patch)
tree99b059ae770c0807a3da4c2b29d4b88704c09aa7
parent97a11da208b386d65ac9058b99cdcb635a69b603 (diff)
Added a couple more methods to ApiClient
-rw-r--r--MediaBrowser.Api/Plugin.cs10
-rw-r--r--MediaBrowser.ApiInteraction/ApiClient.cs45
2 files changed, 42 insertions, 13 deletions
diff --git a/MediaBrowser.Api/Plugin.cs b/MediaBrowser.Api/Plugin.cs
index f254adbb6..24038767e 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 8e6859a48..f2fd90309 100644
--- a/MediaBrowser.ApiInteraction/ApiClient.cs
+++ b/MediaBrowser.ApiInteraction/ApiClient.cs
@@ -76,13 +76,18 @@ namespace MediaBrowser.ApiInteraction
}
/// <summary>
- /// Gets the recently added items
+ /// Gets in-progress items
/// </summary>
/// <param name="userId">The user id.</param>
- /// <returns></returns>
- public async Task<DTOBaseItem[]> GetRecentlyAddedItemsAsync(Guid userId)
+ /// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
+ public async Task<DTOBaseItem[]> 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
}
/// <summary>
- /// Gets recently added items within a specific folder
+ /// Gets recently added items
/// </summary>
/// <param name="userId">The user id.</param>
- public async Task<DTOBaseItem[]> GetRecentlyAddedItemsAsync(Guid userId, Guid folderId)
+ /// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
+ public async Task<DTOBaseItem[]> 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<DTOBaseItem[]>(stream);
}
}
-
+
+ /// <summary>
+ /// Gets recently added items that are unplayed.
+ /// </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 async Task<DTOBaseItem[]> 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<DTOBaseItem[]>(stream);
+ }
+ }
+
/// <summary>
/// Gets all Years
/// </summary>