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