Files
g.hnyhua.cn/Jiguang.JPush/Model/SinglePayload.cs
2026-02-07 15:48:27 +08:00

51 lines
1.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Newtonsoft.Json;
namespace Jiguang.JPush.Model
{
public class SinglePayload
{
/// <summary>
/// 推送平台。可以为 "android" / "ios" / "all"。
/// </summary>
[JsonProperty("platform", DefaultValueHandling = DefaultValueHandling.Include)]
public object Platform { get; set; } = "all";
/// <summary>
/// 推送设备指定。
/// 如果是调用RegID方式批量单推接口/v3/push/batch/regid/single那此处就是指定regid值
/// 如果是调用Alias方式批量单推接口/v3/push/batch/alias/single那此处就是指定alias值。
/// </summary>
[JsonProperty("target", DefaultValueHandling = DefaultValueHandling.Include)]
public string Target { get; set; }
[JsonProperty("notification", NullValueHandling = NullValueHandling.Ignore)]
public Notification Notification { get; set; }
[JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)]
public Message Message { get; set; }
[JsonProperty("sms_message", NullValueHandling = NullValueHandling.Ignore)]
public SmsMessage SMSMessage { get; set; }
[JsonProperty("options", DefaultValueHandling = DefaultValueHandling.Include)]
public Options Options { get; set; } = new Options
{
IsApnsProduction = false
};
internal string GetJson()
{
return JsonConvert.SerializeObject(this, new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Ignore
});
}
public override string ToString()
{
return GetJson();
}
}
}