using Apewer; using Apewer.Models; using System; using System.Collections.Generic; using System.Collections.Specialized; using System.IO; namespace Apewer.Web { /// [Serializable] public sealed class ApiResponse { private Json _data = Json.NewObject(); /// public StringPairs Headers { get; set; } = new StringPairs(); #if NETFX internal System.Web.HttpContext Context { get; set; } #endif #if NETCORE internal Microsoft.AspNetCore.Http.HttpContext Context { get; set; } #endif #region ApiInvoker。 /// 开始时间。 public string Beginning { get; set; } /// 结束时间。 public string Ending { get; set; } /// Application。 public string Application { get; set; } /// Function。 public string Function { get; set; } /// Random。 public string Random { get; set; } #endregion #region API 功能。 /// 状态。 public string Status { get; set; } /// 消息。 public string Message { get; set; } /// Data。 public Json Data { get { if (_data == null) _data = Json.NewObject(); return _data; } set { _data = value; } } internal ApiFormat Type = ApiFormat.Json; internal Exception Exception { get; set; } #endregion #region 输出纯文本。 internal string TextString { get; set; } internal string TextType { get; set; } #endregion #region 输出字节数组。 internal Stream BinaryStream { get; set; } internal byte[] BinaryBytes { get; set; } internal string BinaryType { get; set; } #endregion #region 输出文件。 internal Stream FileStream { get; set; } internal byte[] FileBytes { get; set; } internal string FileType { get; set; } internal string FileName { get; set; } #endregion #region 重定向。 internal string RedirectCode { get; set; } internal string RedirectUrl { get; set; } #endregion } }