You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.3 KiB

  1. using Apewer;
  2. using Apewer.Models;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Collections.Specialized;
  6. using System.IO;
  7. namespace Apewer.Web
  8. {
  9. /// <summary></summary>
  10. [Serializable]
  11. public sealed class ApiResponse
  12. {
  13. private Json _data = Json.NewObject();
  14. /// <summary></summary>
  15. public StringPairs Headers { get; set; } = new StringPairs();
  16. #if NETFX
  17. internal System.Web.HttpContext Context { get; set; }
  18. #endif
  19. #if NETCORE
  20. internal Microsoft.AspNetCore.Http.HttpContext Context { get; set; }
  21. #endif
  22. #region ApiInvoker。
  23. /// <summary>开始时间。</summary>
  24. public string Beginning { get; set; }
  25. /// <summary>结束时间。</summary>
  26. public string Ending { get; set; }
  27. /// <summary>Application。</summary>
  28. public string Application { get; set; }
  29. /// <summary>Function。</summary>
  30. public string Function { get; set; }
  31. /// <summary>Random。</summary>
  32. public string Random { get; set; }
  33. #endregion
  34. #region API 功能。
  35. /// <summary>状态。</summary>
  36. public string Status { get; set; }
  37. /// <summary>消息。</summary>
  38. public string Message { get; set; }
  39. /// <summary>Data。</summary>
  40. public Json Data { get { if (_data == null) _data = Json.NewObject(); return _data; } set { _data = value; } }
  41. internal ApiFormat Type = ApiFormat.Json;
  42. internal Exception Exception { get; set; }
  43. #endregion
  44. #region 输出纯文本。
  45. internal string TextString { get; set; }
  46. internal string TextType { get; set; }
  47. #endregion
  48. #region 输出字节数组。
  49. internal Stream BinaryStream { get; set; }
  50. internal byte[] BinaryBytes { get; set; }
  51. internal string BinaryType { get; set; }
  52. #endregion
  53. #region 输出文件。
  54. internal Stream FileStream { get; set; }
  55. internal byte[] FileBytes { get; set; }
  56. internal string FileType { get; set; }
  57. internal string FileName { get; set; }
  58. #endregion
  59. #region 重定向。
  60. internal string RedirectCode { get; set; }
  61. internal string RedirectUrl { get; set; }
  62. #endregion
  63. }
  64. }