2
0

IHttpResultFactory.cs 3.4 KB

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