diff --git a/MediaBrowser.Model/ApiClient/ApiClientExtensions.cs b/MediaBrowser.Model/ApiClient/ApiClientExtensions.cs new file mode 100644 index 0000000000..20b707edd9 --- /dev/null +++ b/MediaBrowser.Model/ApiClient/ApiClientExtensions.cs @@ -0,0 +1,23 @@ +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); + } + } +} diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs index 7180ed5bcd..02589d7ead 100644 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ b/MediaBrowser.Model/ApiClient/IApiClient.cs @@ -14,6 +14,7 @@ using MediaBrowser.Model.Users; using System; using System.Collections.Generic; using System.IO; +using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Model.ApiClient @@ -113,9 +114,10 @@ namespace MediaBrowser.Model.ApiClient /// Gets an image stream based on a url /// /// The URL. + /// The cancellation token. /// Task{Stream}. /// url - Task GetImageStreamAsync(string url); + Task GetImageStreamAsync(string url, CancellationToken cancellationToken); /// /// Gets a BaseItem diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 1c4f798f49..8f1194f7ff 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -41,6 +41,7 @@ +