From 28ccfb1bd17eceb683d428d1c0e2d2ea52a2f7ff Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Sun, 24 Feb 2013 19:13:45 -0500 Subject: extracted httpclient dependancy --- MediaBrowser.Common/Net/IHttpClient.cs | 61 ++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 MediaBrowser.Common/Net/IHttpClient.cs (limited to 'MediaBrowser.Common/Net/IHttpClient.cs') diff --git a/MediaBrowser.Common/Net/IHttpClient.cs b/MediaBrowser.Common/Net/IHttpClient.cs new file mode 100644 index 000000000..ef0dd69b7 --- /dev/null +++ b/MediaBrowser.Common/Net/IHttpClient.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Common.Net +{ + 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); + + /// + /// 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); + + /// + /// 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); + + /// + /// 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); + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + void Dispose(); + } +} \ No newline at end of file -- cgit v1.2.3