Added a couple more methods to ApiClient
This commit is contained in:
parent
97a11da208
commit
23ea228079
|
@ -1,12 +1,12 @@
|
||||||
using System;
|
using MediaBrowser.Api.HttpHandlers;
|
||||||
using System.ComponentModel.Composition;
|
|
||||||
using System.Net;
|
|
||||||
using System.Reactive.Linq;
|
|
||||||
using MediaBrowser.Api.HttpHandlers;
|
|
||||||
using MediaBrowser.Common.Net.Handlers;
|
using MediaBrowser.Common.Net.Handlers;
|
||||||
using MediaBrowser.Common.Plugins;
|
using MediaBrowser.Common.Plugins;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Model.Plugins;
|
using MediaBrowser.Model.Plugins;
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel.Composition;
|
||||||
|
using System.Net;
|
||||||
|
using System.Reactive.Linq;
|
||||||
|
|
||||||
namespace MediaBrowser.Api
|
namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,13 +76,18 @@ namespace MediaBrowser.ApiInteraction
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the recently added items
|
/// Gets in-progress items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <returns></returns>
|
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
||||||
public async Task<DTOBaseItem[]> GetRecentlyAddedItemsAsync(Guid userId)
|
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))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
|
@ -91,14 +96,38 @@ namespace MediaBrowser.ApiInteraction
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets recently added items within a specific folder
|
/// Gets recently added items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <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();
|
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))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user