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.
181 lines
4.0 KiB
181 lines
4.0 KiB
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'notification.g.dart';
|
|
|
|
@JsonEnum()
|
|
enum NotificationLifetime {
|
|
@JsonValue(0)
|
|
persistent,
|
|
@JsonValue(1)
|
|
onlyOne
|
|
}
|
|
|
|
@JsonEnum()
|
|
enum NotificationType {
|
|
@JsonValue(0)
|
|
application,
|
|
@JsonValue(10)
|
|
system,
|
|
@JsonValue(20)
|
|
user,
|
|
@JsonValue(30)
|
|
serviceCallback;
|
|
}
|
|
|
|
@JsonEnum()
|
|
enum NotificationContentType {
|
|
@JsonValue(0)
|
|
text,
|
|
@JsonValue(1)
|
|
html,
|
|
@JsonValue(2)
|
|
markdown,
|
|
@JsonValue(3)
|
|
json;
|
|
}
|
|
|
|
@JsonEnum()
|
|
enum NotificationSeverity {
|
|
@JsonValue(0)
|
|
success,
|
|
@JsonValue(10)
|
|
info,
|
|
@JsonValue(20)
|
|
warn,
|
|
@JsonValue(30)
|
|
error,
|
|
@JsonValue(40)
|
|
fatal;
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class NotificationData {
|
|
NotificationData({
|
|
required this.type,
|
|
required this.extraProperties,
|
|
});
|
|
String type;
|
|
Map<String, dynamic> extraProperties;
|
|
|
|
factory NotificationData.fromJson(Map<String, dynamic> json) => _$NotificationDataFromJson(json);
|
|
Map<String, dynamic> toJson() => _$NotificationDataToJson(this);
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class NotificationInfo {
|
|
NotificationInfo({
|
|
this.tenantId,
|
|
required this.id,
|
|
required this.name,
|
|
required this.creationTime,
|
|
required this.lifetime,
|
|
required this.type,
|
|
required this.contentType,
|
|
required this.severity,
|
|
required this.data,
|
|
});
|
|
String? tenantId;
|
|
String name;
|
|
String id;
|
|
DateTime creationTime;
|
|
NotificationLifetime lifetime;
|
|
NotificationType type;
|
|
NotificationContentType contentType;
|
|
NotificationSeverity severity;
|
|
NotificationData data;
|
|
|
|
factory NotificationInfo.fromJson(Map<String, dynamic> json) => _$NotificationInfoFromJson(json);
|
|
Map<String, dynamic> toJson() => _$NotificationInfoToJson(this);
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class NotificationSendDto {
|
|
NotificationSendDto({
|
|
required this.name,
|
|
this.templateName,
|
|
required this.data,
|
|
this.culture,
|
|
required this.toUserId,
|
|
this.toUserName,
|
|
this.severity,
|
|
});
|
|
String name;
|
|
String? templateName;
|
|
Map<String, dynamic> data = {};
|
|
String? culture;
|
|
String? toUserId;
|
|
String? toUserName;
|
|
NotificationSeverity? severity;
|
|
factory NotificationSendDto.fromJson(Map<String, dynamic> json) => _$NotificationSendDtoFromJson(json);
|
|
Map<String, dynamic> toJson() => _$NotificationSendDtoToJson(this);
|
|
}
|
|
|
|
|
|
@JsonSerializable()
|
|
class NotificationDto {
|
|
NotificationDto({
|
|
required this.name,
|
|
this.displayName,
|
|
this.description,
|
|
required this.lifetime,
|
|
required this.type,
|
|
required this.contentType,
|
|
});
|
|
String name;
|
|
String? displayName;
|
|
String? description;
|
|
NotificationLifetime lifetime;
|
|
NotificationType type;
|
|
NotificationContentType contentType;
|
|
factory NotificationDto.fromJson(Map<String, dynamic> json) => _$NotificationDtoFromJson(json);
|
|
Map<String, dynamic> toJson() => _$NotificationDtoToJson(this);
|
|
}
|
|
|
|
|
|
@JsonSerializable()
|
|
class NotificationGroupDto {
|
|
NotificationGroupDto({
|
|
required this.name,
|
|
this.displayName,
|
|
this.notifications,
|
|
});
|
|
String name;
|
|
String? displayName;
|
|
List<NotificationDto>? notifications = [];
|
|
factory NotificationGroupDto.fromJson(Map<String, dynamic> json) => _$NotificationGroupDtoFromJson(json);
|
|
Map<String, dynamic> toJson() => _$NotificationGroupDtoToJson(this);
|
|
}
|
|
|
|
|
|
@JsonSerializable()
|
|
class NotificationTemplateDto {
|
|
NotificationTemplateDto({
|
|
required this.name,
|
|
this.description,
|
|
this.title,
|
|
this.content,
|
|
this.culture,
|
|
});
|
|
String name;
|
|
String? description;
|
|
String? title;
|
|
String? content;
|
|
String? culture;
|
|
factory NotificationTemplateDto.fromJson(Map<String, dynamic> json) => _$NotificationTemplateDtoFromJson(json);
|
|
Map<String, dynamic> toJson() => _$NotificationTemplateDtoToJson(this);
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class UserSubscreNotificationDto {
|
|
UserSubscreNotificationDto({
|
|
required this.name,
|
|
});
|
|
String name;
|
|
factory UserSubscreNotificationDto.fromJson(Map<String, dynamic> json) => _$UserSubscreNotificationDtoFromJson(json);
|
|
Map<String, dynamic> toJson() => _$UserSubscreNotificationDtoToJson(this);
|
|
}
|
|
|
|
class SetSubscriptionDto {
|
|
SetSubscriptionDto(this.name);
|
|
String name;
|
|
}
|
|
|