mix_push_message_entity.dart 1.46 KB
class MixPushMessageEntity {
  //通知栏标题,透传该字段为空
  final String? title;
  //通知栏副标题,透传该字段为空
  final String? description;
  //推送所属平台,比如mi/huawei
  final String? platform;
  //推送附属的内容信息
  final String? payload;
  //是否是透传推送
  final bool? passThrough;
  final String? msgId;

  MixPushMessageEntity(
      {this.title,
      this.description,
      this.platform,
      this.payload,
      this.passThrough,
      this.msgId});

  factory MixPushMessageEntity.fromJson(Map<String, dynamic> json) {
    return MixPushMessageEntity(
        title: json['title'],
        description: json['description'],
        platform: json['platform'],
        payload: json['payload'],
        passThrough: json['passThrough'],
        msgId: json['msgId']);
  }
  Map<String, dynamic> toJson() => {
        'title': title,
        'description': description,
        'platform': platform,
        'payload': payload,
        'passThrough': passThrough,
        'msgId': msgId,
      };
}

class MixPushPlatformEntity {
  final String? platformName;
  final String? regId;

  MixPushPlatformEntity({this.platformName, this.regId});

  factory MixPushPlatformEntity.fromJson(Map<String, dynamic> json) {
    return MixPushPlatformEntity(
        platformName: json['platformName'], regId: json['regId']);
  }

  Map<String, dynamic> toJson() => {
        'platformName': platformName,
        'regId': regId,
      };
}