selfprivacy.org.app/lib/logic/models/json/dns_records.dart

36 lines
867 B
Dart
Raw Normal View History

2021-01-06 19:35:57 +02:00
import 'package:json_annotation/json_annotation.dart';
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/schema.graphql.dart';
2021-01-06 19:35:57 +02:00
part 'dns_records.g.dart';
@JsonSerializable(createToJson: true, createFactory: false)
2022-02-16 09:09:53 +02:00
class DnsRecord {
DnsRecord({
2021-03-15 17:39:44 +02:00
required this.type,
required this.name,
required this.content,
2021-01-06 19:35:57 +02:00
this.ttl = 3600,
this.priority = 10,
this.proxied = false,
});
DnsRecord.fromGraphQL(
final Fragment$dnsRecordFields record,
) : this(
type: record.recordType,
name: record.name,
content: record.content,
ttl: record.ttl,
priority: record.priority ?? 10,
);
2021-01-06 19:35:57 +02:00
final String type;
2021-03-15 17:39:44 +02:00
final String? name;
final String? content;
2021-01-06 19:35:57 +02:00
final int ttl;
final int priority;
final bool proxied;
2022-06-05 22:36:32 +03:00
Map<String, dynamic> toJson() => _$DnsRecordToJson(this);
2021-01-06 19:35:57 +02:00
}