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.
112 lines
2.6 KiB
112 lines
2.6 KiB
using Apewer;
|
|
using Apewer.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Specialized;
|
|
using System.IO;
|
|
|
|
namespace Apewer.Web
|
|
{
|
|
|
|
/// <summary></summary>
|
|
[Serializable]
|
|
public sealed class ApiResponse
|
|
{
|
|
|
|
private Json _data = Json.NewObject();
|
|
|
|
/// <summary>HTTP 头。</summary>
|
|
public StringPairs Headers { get; set; } = new StringPairs();
|
|
|
|
/// <summary>Cookies。</summary>
|
|
public StringPairs Cookies { 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。
|
|
|
|
/// <summary>开始时间。</summary>
|
|
public string Beginning { get; set; }
|
|
|
|
/// <summary>结束时间。</summary>
|
|
public string Ending { get; set; }
|
|
|
|
/// <summary>Application。</summary>
|
|
public string Application { get; set; }
|
|
|
|
/// <summary>Function。</summary>
|
|
public string Function { get; set; }
|
|
|
|
/// <summary>Random。</summary>
|
|
public string Random { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region API 功能。
|
|
|
|
/// <summary>状态。</summary>
|
|
public string Status { get; set; }
|
|
|
|
/// <summary>消息。</summary>
|
|
public string Message { get; set; }
|
|
|
|
/// <summary>Data。</summary>
|
|
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; }
|
|
|
|
/// <summary>设置缓存过期时间,单位为秒。默认值:0,立即过期,不缓存。</summary>
|
|
/// <remarks>在 .NET Framework 中,此设置可能无效。</remarks>
|
|
public int Expires { 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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|