using ServiceStack.ServiceHost; using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; namespace MediaBrowser.Common.Net { /// /// Interface IHttpResultFactory /// public interface IHttpResultFactory { /// /// Throws the error. /// /// The status code. /// The error message. /// The response headers. void ThrowError(int statusCode, string errorMessage, IDictionary responseHeaders = null); /// /// Gets the result. /// /// The content. /// Type of the content. /// The response headers. /// System.Object. object GetResult(object content, string contentType, IDictionary responseHeaders = null); /// /// Gets the optimized result. /// /// /// The request context. /// The result. /// The response headers. /// System.Object. object GetOptimizedResult(IRequestContext requestContext, T result, IDictionary responseHeaders = null) where T : class; /// /// Gets the optimized result using cache. /// /// /// The request context. /// The cache key. /// The last date modified. /// Duration of the cache. /// The factory function that creates the response object. /// The response headers. /// System.Object. object GetOptimizedResultUsingCache(IRequestContext requestContext, Guid cacheKey, DateTime lastDateModified, TimeSpan? cacheDuration, Func factoryFn, IDictionary responseHeaders = null) where T : class; /// /// Gets the cached result. /// /// /// The request context. /// The cache key. /// The last date modified. /// Duration of the cache. /// The factory fn. /// Type of the content. /// The response headers. /// System.Object. object GetCachedResult(IRequestContext requestContext, Guid cacheKey, DateTime lastDateModified, TimeSpan? cacheDuration, Func factoryFn, string contentType, IDictionary responseHeaders = null) where T : class; /// /// Gets the static result. /// /// The request context. /// The cache key. /// The last date modified. /// Duration of the cache. /// Type of the content. /// The factory fn. /// The response headers. /// if set to true [is head request]. /// System.Object. object GetStaticResult(IRequestContext requestContext, Guid cacheKey, DateTime? lastDateModified, TimeSpan? cacheDuration, string contentType, Func> factoryFn, IDictionary responseHeaders = null, bool isHeadRequest = false); /// /// Gets the static file result. /// /// The request context. /// The path. /// The file share. /// The response headers. /// if set to true [is head request]. /// System.Object. object GetStaticFileResult(IRequestContext requestContext, string path, FileShare fileShare = FileShare.Read, IDictionary responseHeaders = null, bool isHeadRequest = false); } }