diff options
Diffstat (limited to 'MediaBrowser.Common/Net')
| -rw-r--r-- | MediaBrowser.Common/Net/HttpRequestOptions.cs | 47 | ||||
| -rw-r--r-- | MediaBrowser.Common/Net/IHttpClient.cs | 20 |
2 files changed, 50 insertions, 17 deletions
diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs new file mode 100644 index 000000000..a45acb206 --- /dev/null +++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs @@ -0,0 +1,47 @@ +using System; +using System.Threading; + +namespace MediaBrowser.Common.Net +{ + /// <summary> + /// Class HttpRequestOptions + /// </summary> + public class HttpRequestOptions + { + /// <summary> + /// Gets or sets the URL. + /// </summary> + /// <value>The URL.</value> + public string Url { get; set; } + + /// <summary> + /// Gets or sets the cancellation token. + /// </summary> + /// <value>The cancellation token.</value> + public CancellationToken CancellationToken { get; set; } + + /// <summary> + /// Gets or sets the resource pool. + /// </summary> + /// <value>The resource pool.</value> + public SemaphoreSlim ResourcePool { get; set; } + + /// <summary> + /// Gets or sets the user agent. + /// </summary> + /// <value>The user agent.</value> + public string UserAgent { get; set; } + + /// <summary> + /// Gets or sets the max resume count. + /// </summary> + /// <value>The max resume count.</value> + public int MaxResumeCount { get; set; } + + /// <summary> + /// Gets or sets the progress. + /// </summary> + /// <value>The progress.</value> + public IProgress<double> Progress { get; set; } + } +} diff --git a/MediaBrowser.Common/Net/IHttpClient.cs b/MediaBrowser.Common/Net/IHttpClient.cs index cec3ccff2..f443341a0 100644 --- a/MediaBrowser.Common/Net/IHttpClient.cs +++ b/MediaBrowser.Common/Net/IHttpClient.cs @@ -49,29 +49,15 @@ namespace MediaBrowser.Common.Net /// <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> - /// <param name="url">The URL.</param> - /// <param name="resourcePool">The resource pool.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <param name="progress">The progress.</param> - /// <param name="userAgent">The user agent.</param> + /// <param name="options">The options.</param> /// <returns>Task{System.String}.</returns> /// <exception cref="System.ArgumentNullException">progress</exception> /// <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); + Task<string> GetTempFile(HttpRequestOptions options); /// <summary> /// Downloads the contents of a given url into a MemoryStream |
