SimpleCloudNotifier/flutter/lib/models/subscription.dart

36 lines
1.2 KiB
Dart
Raw Permalink Normal View History

2024-02-18 17:36:58 +01:00
class Subscription {
final String subscriptionID;
final String subscriberUserID;
final String channelOwnerUserID;
final String channelID;
final String channelInternalName;
final String timestampCreated;
final bool confirmed;
const Subscription({
required this.subscriptionID,
required this.subscriberUserID,
required this.channelOwnerUserID,
required this.channelID,
required this.channelInternalName,
required this.timestampCreated,
required this.confirmed,
});
factory Subscription.fromJson(Map<String, dynamic> json) {
2024-05-25 18:09:39 +02:00
return Subscription(
2024-05-25 21:36:05 +02:00
subscriptionID: json['subscription_id'] as String,
subscriberUserID: json['subscriber_user_id'] as String,
channelOwnerUserID: json['channel_owner_user_id'] as String,
channelID: json['channel_id'] as String,
channelInternalName: json['channel_internal_name'] as String,
timestampCreated: json['timestamp_created'] as String,
confirmed: json['confirmed'] as bool,
2024-05-25 18:09:39 +02:00
);
2024-02-18 17:36:58 +01:00
}
2024-05-27 17:21:29 +02:00
static List<Subscription> fromJsonArray(List<dynamic> jsonArr) {
return jsonArr.map<Subscription>((e) => Subscription.fromJson(e as Map<String, dynamic>)).toList();
}
2024-02-18 17:36:58 +01:00
}