IHttpClient.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. namespace MediaBrowser.Common.Net
  7. {
  8. /// <summary>
  9. /// Interface IHttpClient
  10. /// </summary>
  11. public interface IHttpClient
  12. {
  13. /// <summary>
  14. /// Gets the response.
  15. /// </summary>
  16. /// <param name="options">The options.</param>
  17. /// <returns>Task{HttpResponseInfo}.</returns>
  18. Task<HttpResponseInfo> GetResponse(HttpRequestOptions options);
  19. /// <summary>
  20. /// Gets the specified options.
  21. /// </summary>
  22. /// <param name="options">The options.</param>
  23. /// <returns>Task{Stream}.</returns>
  24. Task<Stream> Get(HttpRequestOptions options);
  25. /// <summary>
  26. /// Sends the asynchronous.
  27. /// </summary>
  28. /// <param name="options">The options.</param>
  29. /// <param name="httpMethod">The HTTP method.</param>
  30. /// <returns>Task{HttpResponseInfo}.</returns>
  31. Task<HttpResponseInfo> SendAsync(HttpRequestOptions options, string httpMethod);
  32. /// <summary>
  33. /// Posts the specified options.
  34. /// </summary>
  35. /// <param name="options">The options.</param>
  36. /// <returns>Task{HttpResponseInfo}.</returns>
  37. Task<HttpResponseInfo> Post(HttpRequestOptions options);
  38. /// <summary>
  39. /// Downloads the contents of a given url into a temporary location
  40. /// </summary>
  41. /// <param name="options">The options.</param>
  42. /// <returns>Task{System.String}.</returns>
  43. /// <exception cref="System.ArgumentNullException">progress</exception>
  44. /// <exception cref="MediaBrowser.Model.Net.HttpException"></exception>
  45. Task<string> GetTempFile(HttpRequestOptions options);
  46. /// <summary>
  47. /// Gets the temporary file response.
  48. /// </summary>
  49. /// <param name="options">The options.</param>
  50. /// <returns>Task{HttpResponseInfo}.</returns>
  51. Task<HttpResponseInfo> GetTempFileResponse(HttpRequestOptions options);
  52. }
  53. }