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.
95 lines
2.1 KiB
95 lines
2.1 KiB
using Apewer.Models;
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace Apewer.Web
|
|
{
|
|
|
|
/// <summary></summary>
|
|
[Serializable]
|
|
public sealed class ApiResponse
|
|
{
|
|
|
|
private Json _data = Json.NewObject();
|
|
internal DateTime Beginning;
|
|
internal DateTime Ending;
|
|
internal ApiFormat Type = ApiFormat.Json;
|
|
internal Exception Exception;
|
|
|
|
/// <summary>头。</summary>
|
|
public StringPairs Headers { get; set; } = new StringPairs();
|
|
|
|
/// <summary>Cookies。</summary>
|
|
public StringPairs Cookies { get; set; } = new StringPairs();
|
|
|
|
/// <summary>Application。</summary>
|
|
public string Application { get; set; }
|
|
|
|
/// <summary>Function。</summary>
|
|
public string Function { get; set; }
|
|
|
|
/// <summary>Random。</summary>
|
|
public string Random { get; set; }
|
|
|
|
/// <summary>状态。</summary>
|
|
public string Status { get; set; }
|
|
|
|
/// <summary>消息。</summary>
|
|
public string Message { get; set; }
|
|
|
|
/// <summary>获取或设置 Ticket。</summary>
|
|
public string Ticket { get; set; }
|
|
|
|
/// <summary>设置缓存过期时间,单位为秒。默认值:0,立即过期,不缓存。</summary>
|
|
/// <remarks>在 .NET Framework 中,此设置可能无效。</remarks>
|
|
public int Expires { get; set; }
|
|
|
|
/// <summary>自定义数据。</summary>
|
|
public Json Data
|
|
{
|
|
get { return _data; }
|
|
set { _data = value ?? Json.NewObject(); }
|
|
}
|
|
|
|
#region 输出纯文本。
|
|
|
|
internal string TextString;
|
|
|
|
internal string TextType;
|
|
|
|
#endregion
|
|
|
|
#region 输出字节数组。
|
|
|
|
internal Stream BinaryStream;
|
|
|
|
internal byte[] BinaryBytes;
|
|
|
|
internal string BinaryType;
|
|
|
|
#endregion
|
|
|
|
#region 输出文件。
|
|
|
|
internal Stream FileStream;
|
|
|
|
internal byte[] FileBytes;
|
|
|
|
internal string FileType;
|
|
|
|
internal string FileName;
|
|
|
|
#endregion
|
|
|
|
#region 重定向。
|
|
|
|
internal string RedirectCode;
|
|
|
|
internal string RedirectUrl;
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|