jellyfin/MediaBrowser.Model/ApiClient/ApiClientExtensions.cs

49 lines
1.5 KiB
C#
Raw Normal View History

2014-01-14 20:03:35 +00:00
using MediaBrowser.Model.Dto;
2014-08-07 02:51:09 +00:00
using MediaBrowser.Model.Querying;
2015-02-07 13:43:44 +00:00
using MediaBrowser.Model.Sync;
2014-01-14 20:03:35 +00:00
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Model.ApiClient
{
/// <summary>
/// Class ApiClientExtensions
/// </summary>
public static class ApiClientExtensions
{
/// <summary>
/// Gets the image stream async.
/// </summary>
/// <param name="apiClient">The API client.</param>
/// <param name="url">The URL.</param>
/// <returns>Task{Stream}.</returns>
public static Task<Stream> GetImageStreamAsync(this IApiClient apiClient, string url)
{
return apiClient.GetImageStreamAsync(url, CancellationToken.None);
}
public static Task<UserDto[]> GetPublicUsersAsync(this IApiClient apiClient)
{
return apiClient.GetPublicUsersAsync(CancellationToken.None);
}
2014-08-07 02:51:09 +00:00
public static Task<ItemsResult> GetItemsAsync(this IApiClient apiClient, ItemQuery query)
{
return apiClient.GetItemsAsync(query, CancellationToken.None);
}
2015-02-07 13:43:44 +00:00
public static Task<SyncDialogOptions> GetSyncOptions(this IApiClient apiClient, SyncJob job)
{
2015-03-08 04:44:31 +00:00
return apiClient.GetSyncOptions(new SyncJobRequest
{
Category = job.Category,
ItemIds = job.RequestedItemIds,
ParentId = job.ParentId,
TargetId = job.TargetId,
UserId = job.UserId
});
2015-02-07 13:43:44 +00:00
}
}
}