using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Sync;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Model.ApiClient
{
///
/// Class ApiClientExtensions
///
public static class ApiClientExtensions
{
///
/// Gets the image stream async.
///
/// The API client.
/// The URL.
/// Task{Stream}.
public static Task GetImageStreamAsync(this IApiClient apiClient, string url)
{
return apiClient.GetImageStreamAsync(url, CancellationToken.None);
}
public static Task GetPublicUsersAsync(this IApiClient apiClient)
{
return apiClient.GetPublicUsersAsync(CancellationToken.None);
}
public static Task GetItemsAsync(this IApiClient apiClient, ItemQuery query)
{
return apiClient.GetItemsAsync(query, CancellationToken.None);
}
public static Task GetSyncOptions(this IApiClient apiClient, SyncJob job)
{
return apiClient.GetSyncOptions(new SyncJobRequest
{
Category = job.Category,
ItemIds = job.RequestedItemIds,
ParentId = job.ParentId,
TargetId = job.TargetId,
UserId = job.UserId
});
}
}
}