import 'package:json_annotation/json_annotation.dart'; part 'request.g.dart'; @JsonSerializable(explicitToJson: true) class Request { String? rawUrl; String url; Object? extra; Map? labels; RequestProxy? proxy; bool skipVerifyCert; Request({ this.rawUrl, required this.url, this.extra, this.labels, this.proxy, this.skipVerifyCert = false, }); factory Request.fromJson(Map json) => _$RequestFromJson(json); Map toJson() => _$RequestToJson(this); } @JsonSerializable() class ReqExtraHttp { String method; Map header; String body; ReqExtraHttp({ this.method = 'GET', this.header = const {}, this.body = '', }); factory ReqExtraHttp.fromJson(Map json) => _$ReqExtraHttpFromJson(json); Map toJson() => _$ReqExtraHttpToJson(this); } @JsonSerializable() class ReqExtraBt { List trackers; ReqExtraBt({ this.trackers = const [], }); factory ReqExtraBt.fromJson(Map json) => _$ReqExtraBtFromJson(json); Map toJson() => _$ReqExtraBtToJson(this); } enum RequestProxyMode { follow, none, custom, } @JsonSerializable() class RequestProxy { RequestProxyMode mode; String scheme; String host; String usr; String pwd; RequestProxy({ this.mode = RequestProxyMode.follow, this.scheme = 'http', this.host = '', this.usr = '', this.pwd = '', }); factory RequestProxy.fromJson(Map json) => _$RequestProxyFromJson(json); Map toJson() => _$RequestProxyToJson(this); }