IAsyncHttpClient.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using MediaBrowser.Model.Logging;
  2. using System;
  3. using System.IO;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. namespace MediaBrowser.ApiInteraction
  7. {
  8. /// <summary>
  9. /// Interface IHttpClient
  10. /// </summary>
  11. public interface IAsyncHttpClient : IDisposable
  12. {
  13. /// <summary>
  14. /// Sets the authorization header that should be supplied on every request
  15. /// </summary>
  16. /// <param name="header"></param>
  17. void SetAuthorizationHeader(string header);
  18. /// <summary>
  19. /// Gets the stream async.
  20. /// </summary>
  21. /// <param name="url">The URL.</param>
  22. /// <param name="logger">The logger.</param>
  23. /// <param name="cancellationToken">The cancellation token.</param>
  24. /// <returns>Task{Stream}.</returns>
  25. Task<Stream> GetStreamAsync(string url, ILogger logger, CancellationToken cancellationToken);
  26. /// <summary>
  27. /// Deletes the async.
  28. /// </summary>
  29. /// <param name="url">The URL.</param>
  30. /// <param name="logger">The logger.</param>
  31. /// <param name="cancellationToken">The cancellation token.</param>
  32. /// <returns>Task.</returns>
  33. Task DeleteAsync(string url, ILogger logger, CancellationToken cancellationToken);
  34. /// <summary>
  35. /// Posts the async.
  36. /// </summary>
  37. /// <param name="url">The URL.</param>
  38. /// <param name="contentType">Type of the content.</param>
  39. /// <param name="postContent">Content of the post.</param>
  40. /// <param name="logger">The logger.</param>
  41. /// <param name="cancellationToken">The cancellation token.</param>
  42. /// <returns>Task{Stream}.</returns>
  43. Task<Stream> PostAsync(string url, string contentType, string postContent, ILogger logger, CancellationToken cancellationToken);
  44. }
  45. }