using System; using System.Collections.Generic; using System.IO; using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Common.Net { /// /// Interface IHttpClient /// public interface IHttpClient : IDisposable { /// /// Performs a GET request and returns the resulting stream /// /// The URL. /// The resource pool. /// The cancellation token. /// Task{Stream}. /// Task Get(string url, SemaphoreSlim resourcePool, CancellationToken cancellationToken); /// /// Gets the specified URL. /// /// The URL. /// The cancellation token. /// Task{Stream}. Task Get(string url, CancellationToken cancellationToken); /// /// Performs a POST request /// /// The URL. /// Params to add to the POST data. /// The resource pool. /// The cancellation token. /// stream on success, null on failure /// postData /// Task Post(string url, Dictionary postData, SemaphoreSlim resourcePool, CancellationToken cancellationToken); /// /// Posts the specified URL. /// /// The URL. /// The post data. /// The cancellation token. /// Task{Stream}. Task Post(string url, Dictionary postData, CancellationToken cancellationToken); /// /// Downloads the contents of a given url into a temporary location /// /// The URL. /// The resource pool. /// The cancellation token. /// The progress. /// The user agent. /// Task{System.String}. /// progress /// Task GetTempFile(string url, SemaphoreSlim resourcePool, CancellationToken cancellationToken, IProgress progress, string userAgent = null); /// /// Gets the temp file. /// /// The URL. /// The cancellation token. /// The progress. /// The user agent. /// Task{System.String}. Task GetTempFile(string url, CancellationToken cancellationToken, IProgress progress, string userAgent = null); /// /// Downloads the contents of a given url into a MemoryStream /// /// The URL. /// The resource pool. /// The cancellation token. /// Task{MemoryStream}. /// Task GetMemoryStream(string url, SemaphoreSlim resourcePool, CancellationToken cancellationToken); /// /// Gets the memory stream. /// /// The URL. /// The cancellation token. /// Task{MemoryStream}. Task GetMemoryStream(string url, CancellationToken cancellationToken); } }