mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-04 20:30:35 +00:00
Load services from api
This commit is contained in:
parent
3359acbf27
commit
393528e4c0
11 changed files with 495 additions and 394 deletions
49
lib/models/blocked_services.dart
Normal file
49
lib/models/blocked_services.dart
Normal file
|
@ -0,0 +1,49 @@
|
|||
class BlockedServicesFromApi {
|
||||
final List<BlockedService> blockedServices;
|
||||
|
||||
BlockedServicesFromApi({
|
||||
required this.blockedServices,
|
||||
});
|
||||
|
||||
factory BlockedServicesFromApi.fromJson(Map<String, dynamic> json) => BlockedServicesFromApi(
|
||||
blockedServices: List<BlockedService>.from(json["blocked_services"].map((x) => BlockedService.fromJson(x))),
|
||||
);
|
||||
}
|
||||
|
||||
class BlockedServices {
|
||||
int loadStatus = 0;
|
||||
List<BlockedService>? services;
|
||||
|
||||
BlockedServices({
|
||||
this.loadStatus = 0,
|
||||
this.services
|
||||
});
|
||||
}
|
||||
|
||||
class BlockedService {
|
||||
final String id;
|
||||
final String name;
|
||||
final String iconSvg;
|
||||
final List<String> rules;
|
||||
|
||||
BlockedService({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.iconSvg,
|
||||
required this.rules,
|
||||
});
|
||||
|
||||
factory BlockedService.fromJson(Map<String, dynamic> json) => BlockedService(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
iconSvg: json["icon_svg"],
|
||||
rules: List<String>.from(json["rules"].map((x) => x)),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"icon_svg": iconSvg,
|
||||
"rules": List<dynamic>.from(rules.map((x) => x)),
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue