IHttpResultFactory.cs 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #pragma warning disable CS1591
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Threading.Tasks;
  6. using MediaBrowser.Model.Services;
  7. namespace MediaBrowser.Controller.Net
  8. {
  9. /// <summary>
  10. /// Interface IHttpResultFactory.
  11. /// </summary>
  12. public interface IHttpResultFactory
  13. {
  14. /// <summary>
  15. /// Gets the result.
  16. /// </summary>
  17. /// <param name="content">The content.</param>
  18. /// <param name="contentType">Type of the content.</param>
  19. /// <param name="responseHeaders">The response headers.</param>
  20. /// <returns>System.Object.</returns>
  21. object GetResult(string content, string contentType, IDictionary<string, string> responseHeaders = null);
  22. object GetResult(IRequest requestContext, byte[] content, string contentType, IDictionary<string, string> responseHeaders = null);
  23. object GetResult(IRequest requestContext, Stream content, string contentType, IDictionary<string, string> responseHeaders = null);
  24. object GetResult(IRequest requestContext, string content, string contentType, IDictionary<string, string> responseHeaders = null);
  25. object GetRedirectResult(string url);
  26. object GetResult<T>(IRequest requestContext, T result, IDictionary<string, string> responseHeaders = null)
  27. where T : class;
  28. /// <summary>
  29. /// Gets the static result.
  30. /// </summary>
  31. /// <param name="requestContext">The request context.</param>
  32. /// <param name="cacheKey">The cache key.</param>
  33. /// <param name="lastDateModified">The last date modified.</param>
  34. /// <param name="cacheDuration">Duration of the cache.</param>
  35. /// <param name="contentType">Type of the content.</param>
  36. /// <param name="factoryFn">The factory fn.</param>
  37. /// <param name="responseHeaders">The response headers.</param>
  38. /// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param>
  39. /// <returns>System.Object.</returns>
  40. Task<object> GetStaticResult(IRequest requestContext,
  41. Guid cacheKey,
  42. DateTime? lastDateModified,
  43. TimeSpan? cacheDuration,
  44. string contentType, Func<Task<Stream>> factoryFn,
  45. IDictionary<string, string> responseHeaders = null,
  46. bool isHeadRequest = false);
  47. /// <summary>
  48. /// Gets the static result.
  49. /// </summary>
  50. /// <param name="requestContext">The request context.</param>
  51. /// <param name="options">The options.</param>
  52. /// <returns>System.Object.</returns>
  53. Task<object> GetStaticResult(IRequest requestContext, StaticResultOptions options);
  54. /// <summary>
  55. /// Gets the static file result.
  56. /// </summary>
  57. /// <param name="requestContext">The request context.</param>
  58. /// <param name="path">The path.</param>
  59. /// <param name="fileShare">The file share.</param>
  60. /// <returns>System.Object.</returns>
  61. Task<object> GetStaticFileResult(IRequest requestContext, string path, FileShare fileShare = FileShare.Read);
  62. /// <summary>
  63. /// Gets the static file result.
  64. /// </summary>
  65. /// <param name="requestContext">The request context.</param>
  66. /// <param name="options">The options.</param>
  67. /// <returns>System.Object.</returns>
  68. Task<object> GetStaticFileResult(IRequest requestContext,
  69. StaticFileResultOptions options);
  70. }
  71. }