using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using ServiceStack.Web;
namespace MediaBrowser.Controller.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(IRequest 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(IRequest 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(IRequest 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(IRequest 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(IRequest requestContext, string path, FileShare fileShare = FileShare.Read, IDictionary responseHeaders = null, bool isHeadRequest = false);
///
/// Gets the static file result.
///
/// The request context.
/// The path.
/// Type of the content.
/// The cache curation.
/// The file share.
/// The response headers.
/// if set to true [is head request].
/// System.Object.
object GetStaticFileResult(IRequest requestContext,
string path,
string contentType,
TimeSpan? cacheCuration = null,
FileShare fileShare = FileShare.Read,
IDictionary responseHeaders = null,
bool isHeadRequest = false);
///
/// Gets the optimized serialized result using cache.
///
///
/// The request.
/// The result.
/// System.Object.
object GetOptimizedSerializedResultUsingCache(IRequest request, T result)
where T : class;
}
}