made IHttpClient a little more flexible, allow Semaphore to be optional

This commit is contained in:
LukePulverenti
2013-03-03 00:25:42 -05:00
parent f26a3e3c61
commit 627b8370a8
2 changed files with 119 additions and 19 deletions

View File

@@ -21,6 +21,14 @@ namespace MediaBrowser.Common.Net
/// <exception cref="MediaBrowser.Model.Net.HttpException"></exception>
Task<Stream> Get(string url, SemaphoreSlim resourcePool, CancellationToken cancellationToken);
/// <summary>
/// Gets the specified URL.
/// </summary>
/// <param name="url">The URL.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{Stream}.</returns>
Task<Stream> Get(string url, CancellationToken cancellationToken);
/// <summary>
/// Performs a POST request
/// </summary>
@@ -33,6 +41,15 @@ namespace MediaBrowser.Common.Net
/// <exception cref="MediaBrowser.Model.Net.HttpException"></exception>
Task<Stream> Post(string url, Dictionary<string, string> postData, SemaphoreSlim resourcePool, CancellationToken cancellationToken);
/// <summary>
/// Posts the specified URL.
/// </summary>
/// <param name="url">The URL.</param>
/// <param name="postData">The post data.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{Stream}.</returns>
Task<Stream> Post(string url, Dictionary<string, string> postData, CancellationToken cancellationToken);
/// <summary>
/// Downloads the contents of a given url into a temporary location
/// </summary>
@@ -46,6 +63,16 @@ namespace MediaBrowser.Common.Net
/// <exception cref="MediaBrowser.Model.Net.HttpException"></exception>
Task<string> GetTempFile(string url, SemaphoreSlim resourcePool, CancellationToken cancellationToken, IProgress<double> progress, string userAgent = null);
/// <summary>
/// Gets the temp file.
/// </summary>
/// <param name="url">The URL.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="progress">The progress.</param>
/// <param name="userAgent">The user agent.</param>
/// <returns>Task{System.String}.</returns>
Task<string> GetTempFile(string url, CancellationToken cancellationToken, IProgress<double> progress, string userAgent = null);
/// <summary>
/// Downloads the contents of a given url into a MemoryStream
/// </summary>
@@ -55,5 +82,13 @@ namespace MediaBrowser.Common.Net
/// <returns>Task{MemoryStream}.</returns>
/// <exception cref="MediaBrowser.Model.Net.HttpException"></exception>
Task<MemoryStream> GetMemoryStream(string url, SemaphoreSlim resourcePool, CancellationToken cancellationToken);
/// <summary>
/// Gets the memory stream.
/// </summary>
/// <param name="url">The URL.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{MemoryStream}.</returns>
Task<MemoryStream> GetMemoryStream(string url, CancellationToken cancellationToken);
}
}