From 64ca18ef442f60cf482cf8408d0f74d33465b201 Mon Sep 17 00:00:00 2001 From: ZhuJHua <1624109111@qq.com> Date: Fri, 18 Apr 2025 11:54:16 +0800 Subject: [PATCH] fix: qweather api error (cherry picked from commit 2e206a93354ab89be53e3ca9541d3ab130d8c61e) --- build.yaml | 19 + lib/api/api.dart | 16 +- lib/common/models/geo.dart | 138 +- lib/common/models/geo.freezed.dart | 768 ++++++++ lib/common/models/geo.g.dart | 70 + lib/common/models/github.dart | 422 +---- lib/common/models/github.freezed.dart | 1997 ++++++++++++++++++++ lib/common/models/github.g.dart | 183 ++ lib/common/models/hitokoto.dart | 78 +- lib/common/models/hitokoto.freezed.dart | 370 ++++ lib/common/models/hitokoto.g.dart | 39 + lib/common/models/hunyuan.dart | 175 +- lib/common/models/hunyuan.freezed.dart | 1250 ++++++++++++ lib/common/models/hunyuan.g.dart | 88 + lib/common/models/image.dart | 160 +- lib/common/models/image.freezed.dart | 825 ++++++++ lib/common/models/image.g.dart | 76 + lib/common/models/weather.dart | 164 +- lib/common/models/weather.freezed.dart | 861 +++++++++ lib/common/models/weather.g.dart | 79 + lib/l10n/app_localizations.dart | 37 +- lib/l10n/app_localizations_en.dart | 61 +- lib/l10n/app_localizations_zh.dart | 13 +- lib/pages/analyse/analyse_logic.dart | 9 +- lib/pages/assistant/assistant_logic.dart | 11 +- lib/pages/edit/edit_logic.dart | 70 +- lib/pages/laboratory/laboratory_logic.dart | 11 + lib/pages/laboratory/laboratory_view.dart | 15 + lib/persistence/pref.dart | 2 + lib/utils/http_util.dart | 5 +- lib/utils/notice_util.dart | 2 +- 31 files changed, 7040 insertions(+), 974 deletions(-) create mode 100644 build.yaml create mode 100644 lib/common/models/geo.freezed.dart create mode 100644 lib/common/models/geo.g.dart create mode 100644 lib/common/models/github.freezed.dart create mode 100644 lib/common/models/github.g.dart create mode 100644 lib/common/models/hitokoto.freezed.dart create mode 100644 lib/common/models/hitokoto.g.dart create mode 100644 lib/common/models/hunyuan.freezed.dart create mode 100644 lib/common/models/hunyuan.g.dart create mode 100644 lib/common/models/image.freezed.dart create mode 100644 lib/common/models/image.g.dart create mode 100644 lib/common/models/weather.freezed.dart create mode 100644 lib/common/models/weather.g.dart diff --git a/build.yaml b/build.yaml new file mode 100644 index 0000000..8093126 --- /dev/null +++ b/build.yaml @@ -0,0 +1,19 @@ +targets: + $default: + builders: + json_serializable: + options: + any_map: false + checked: false + constructor: "" + create_factory: true + create_field_map: false + create_json_keys: false + create_per_field_to_json: false + create_to_json: true + disallow_unrecognized_keys: false + explicit_to_json: false + field_rename: none + generic_argument_factories: false + ignore_unannotated: false + include_if_null: false \ No newline at end of file diff --git a/lib/api/api.dart b/lib/api/api.dart index 69f74fe..a3daea2 100644 --- a/lib/api/api.dart +++ b/lib/api/api.dart @@ -36,7 +36,7 @@ class Api { //请求正文 final body = { 'Model': hunyuanModel, - 'Messages': messages.map((value) => value.toMap()).toList(), + 'Messages': messages.map((value) => value.toJson()).toList(), 'Stream': true, }; @@ -49,15 +49,15 @@ class Api { ); //构造请求头 final header = PublicHeader( - 'ChatCompletions', - timestamp ~/ 1000, - '2023-09-01', - authorization, + action: 'ChatCompletions', + timestamp: timestamp ~/ 1000, + version: '2023-09-01', + authorization: authorization, ); //发起请求 return await HttpUtil().postStream( 'https://hunyuan.tencentcloudapi.com', - header: header.toMap(), + header: header.toJson(), data: body, ); } @@ -97,7 +97,7 @@ class Api { 'lang': local, }; final res = await HttpUtil().get( - 'https://geoapi.qweather.com/v2/city/lookup', + 'https://${PrefUtil.getValue('qweatherApiHost')}/geo/v2/city/lookup', parameters: parameters, ); final geo = await compute( @@ -131,7 +131,7 @@ class Api { 'lang': local, }; final res = await HttpUtil().get( - 'https://devapi.qweather.com/v7/weather/now', + 'https://${PrefUtil.getValue('qweatherApiHost')}/v7/weather/now', parameters: parameters, ); final weather = await compute( diff --git a/lib/common/models/geo.dart b/lib/common/models/geo.dart index 70078bd..9f1a1e1 100644 --- a/lib/common/models/geo.dart +++ b/lib/common/models/geo.dart @@ -1,113 +1,45 @@ -class GeoResponse { - String? code; - List? location; - Refer? refer; +import 'package:freezed_annotation/freezed_annotation.dart'; - GeoResponse({this.code, this.location, this.refer}); +part 'geo.freezed.dart'; +part 'geo.g.dart'; - GeoResponse.fromJson(Map json) { - code = json["code"]; - location = - json["location"] == null - ? null - : (json["location"] as List) - .map((e) => Location.fromJson(e)) - .toList(); - refer = json["refer"] == null ? null : Refer.fromJson(json["refer"]); - } +@freezed +abstract class GeoResponse with _$GeoResponse { + const factory GeoResponse({ + String? code, + List? location, + Refer? refer, + }) = _GeoResponse; - Map toJson() { - final Map data = {}; - data["code"] = code; - data["location"] = location?.map((e) => e.toJson()).toList(); - data["refer"] = refer?.toJson(); - return data; - } + factory GeoResponse.fromJson(Map json) => + _$GeoResponseFromJson(json); } -class Refer { - List? sources; - List? license; +@freezed +abstract class Refer with _$Refer { + const factory Refer({List? sources, List? license}) = _Refer; - Refer({this.sources, this.license}); - - Refer.fromJson(Map json) { - sources = - json["sources"] == null ? null : List.from(json["sources"]); - license = - json["license"] == null ? null : List.from(json["license"]); - } - - Map toJson() { - final Map data = {}; - data["sources"] = sources; - data["license"] = license; - return data; - } + factory Refer.fromJson(Map json) => _$ReferFromJson(json); } -class Location { - String? name; - String? id; - String? lat; - String? lon; - String? adm2; - String? adm1; - String? country; - String? tz; - String? utcOffset; - String? isDst; - String? type; - String? rank; - String? fxLink; +@freezed +abstract class Location with _$Location { + const factory Location({ + String? name, + String? id, + String? lat, + String? lon, + String? adm2, + String? adm1, + String? country, + String? tz, + String? utcOffset, + String? isDst, + String? type, + String? rank, + String? fxLink, + }) = _Location; - Location({ - this.name, - this.id, - this.lat, - this.lon, - this.adm2, - this.adm1, - this.country, - this.tz, - this.utcOffset, - this.isDst, - this.type, - this.rank, - this.fxLink, - }); - - Location.fromJson(Map json) { - name = json["name"]; - id = json["id"]; - lat = json["lat"]; - lon = json["lon"]; - adm2 = json["adm2"]; - adm1 = json["adm1"]; - country = json["country"]; - tz = json["tz"]; - utcOffset = json["utcOffset"]; - isDst = json["isDst"]; - type = json["type"]; - rank = json["rank"]; - fxLink = json["fxLink"]; - } - - Map toJson() { - final Map data = {}; - data["name"] = name; - data["id"] = id; - data["lat"] = lat; - data["lon"] = lon; - data["adm2"] = adm2; - data["adm1"] = adm1; - data["country"] = country; - data["tz"] = tz; - data["utcOffset"] = utcOffset; - data["isDst"] = isDst; - data["type"] = type; - data["rank"] = rank; - data["fxLink"] = fxLink; - return data; - } + factory Location.fromJson(Map json) => + _$LocationFromJson(json); } diff --git a/lib/common/models/geo.freezed.dart b/lib/common/models/geo.freezed.dart new file mode 100644 index 0000000..7d25248 --- /dev/null +++ b/lib/common/models/geo.freezed.dart @@ -0,0 +1,768 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'geo.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$GeoResponse { + + String? get code; + + List? get location; + + Refer? get refer; + + /// Create a copy of GeoResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GeoResponseCopyWith get copyWith => + _$GeoResponseCopyWithImpl(this as GeoResponse, _$identity); + + /// Serializes this GeoResponse to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is GeoResponse && + (identical(other.code, code) || other.code == code) && + const DeepCollectionEquality().equals(other.location, location) && + (identical(other.refer, refer) || other.refer == refer)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, code, const DeepCollectionEquality().hash(location), refer); + + @override + String toString() { + return 'GeoResponse(code: $code, location: $location, refer: $refer)'; + } + + +} + +/// @nodoc +abstract mixin class $GeoResponseCopyWith<$Res> { + factory $GeoResponseCopyWith(GeoResponse value, + $Res Function(GeoResponse) _then) = _$GeoResponseCopyWithImpl; + + @useResult + $Res call({ + String? code, List? location, Refer? refer + }); + + + $ReferCopyWith<$Res>? get refer; + +} + +/// @nodoc +class _$GeoResponseCopyWithImpl<$Res> + implements $GeoResponseCopyWith<$Res> { + _$GeoResponseCopyWithImpl(this._self, this._then); + + final GeoResponse _self; + final $Res Function(GeoResponse) _then; + + /// Create a copy of GeoResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? code = freezed, Object? location = freezed, Object? refer = freezed,}) { + return _then(_self.copyWith( + code: freezed == code + ? _self.code + : code // ignore: cast_nullable_to_non_nullable + as String?, + location: freezed == location + ? _self.location + : location // ignore: cast_nullable_to_non_nullable + as List?, + refer: freezed == refer + ? _self.refer + : refer // ignore: cast_nullable_to_non_nullable + as Refer?, + )); + } + + /// Create a copy of GeoResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ReferCopyWith<$Res>? get refer { + if (_self.refer == null) { + return null; + } + + return $ReferCopyWith<$Res>(_self.refer!, (value) { + return _then(_self.copyWith(refer: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _GeoResponse implements GeoResponse { + const _GeoResponse({this.code, final List? location, this.refer}) + : _location = location; + + factory _GeoResponse.fromJson(Map json) => + _$GeoResponseFromJson(json); + + @override final String? code; + final List? _location; + + @override List? get location { + final value = _location; + if (value == null) return null; + if (_location is EqualUnmodifiableListView) return _location; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override final Refer? refer; + + /// Create a copy of GeoResponse + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$GeoResponseCopyWith<_GeoResponse> get copyWith => + __$GeoResponseCopyWithImpl<_GeoResponse>(this, _$identity); + + @override + Map toJson() { + return _$GeoResponseToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _GeoResponse && + (identical(other.code, code) || other.code == code) && + const DeepCollectionEquality().equals(other._location, _location) && + (identical(other.refer, refer) || other.refer == refer)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, code, const DeepCollectionEquality().hash(_location), refer); + + @override + String toString() { + return 'GeoResponse(code: $code, location: $location, refer: $refer)'; + } + + +} + +/// @nodoc +abstract mixin class _$GeoResponseCopyWith<$Res> + implements $GeoResponseCopyWith<$Res> { + factory _$GeoResponseCopyWith(_GeoResponse value, + $Res Function(_GeoResponse) _then) = __$GeoResponseCopyWithImpl; + + @override + @useResult + $Res call({ + String? code, List? location, Refer? refer + }); + + + @override $ReferCopyWith<$Res>? get refer; + +} + +/// @nodoc +class __$GeoResponseCopyWithImpl<$Res> + implements _$GeoResponseCopyWith<$Res> { + __$GeoResponseCopyWithImpl(this._self, this._then); + + final _GeoResponse _self; + final $Res Function(_GeoResponse) _then; + + /// Create a copy of GeoResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? code = freezed, Object? location = freezed, Object? refer = freezed,}) { + return _then(_GeoResponse( + code: freezed == code + ? _self.code + : code // ignore: cast_nullable_to_non_nullable + as String?, + location: freezed == location + ? _self._location + : location // ignore: cast_nullable_to_non_nullable + as List?, + refer: freezed == refer + ? _self.refer + : refer // ignore: cast_nullable_to_non_nullable + as Refer?, + )); + } + + /// Create a copy of GeoResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ReferCopyWith<$Res>? get refer { + if (_self.refer == null) { + return null; + } + + return $ReferCopyWith<$Res>(_self.refer!, (value) { + return _then(_self.copyWith(refer: value)); + }); + } +} + + +/// @nodoc +mixin _$Refer { + + List? get sources; + + List? get license; + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReferCopyWith get copyWith => + _$ReferCopyWithImpl(this as Refer, _$identity); + + /// Serializes this Refer to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Refer && + const DeepCollectionEquality().equals(other.sources, sources) && + const DeepCollectionEquality().equals(other.license, license)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, const DeepCollectionEquality().hash(sources), + const DeepCollectionEquality().hash(license)); + + @override + String toString() { + return 'Refer(sources: $sources, license: $license)'; + } + + +} + +/// @nodoc +abstract mixin class $ReferCopyWith<$Res> { + factory $ReferCopyWith(Refer value, + $Res Function(Refer) _then) = _$ReferCopyWithImpl; + + @useResult + $Res call({ + List? sources, List? license + }); + + +} + +/// @nodoc +class _$ReferCopyWithImpl<$Res> + implements $ReferCopyWith<$Res> { + _$ReferCopyWithImpl(this._self, this._then); + + final Refer _self; + final $Res Function(Refer) _then; + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? sources = freezed, Object? license = freezed,}) { + return _then(_self.copyWith( + sources: freezed == sources + ? _self.sources + : sources // ignore: cast_nullable_to_non_nullable + as List?, + license: freezed == license + ? _self.license + : license // ignore: cast_nullable_to_non_nullable + as List?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Refer implements Refer { + const _Refer({final List? sources, final List? license}) + : _sources = sources, + _license = license; + + factory _Refer.fromJson(Map json) => _$ReferFromJson(json); + + final List? _sources; + + @override List? get sources { + final value = _sources; + if (value == null) return null; + if (_sources is EqualUnmodifiableListView) return _sources; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + final List? _license; + + @override List? get license { + final value = _license; + if (value == null) return null; + if (_license is EqualUnmodifiableListView) return _license; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ReferCopyWith<_Refer> get copyWith => + __$ReferCopyWithImpl<_Refer>(this, _$identity); + + @override + Map toJson() { + return _$ReferToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Refer && + const DeepCollectionEquality().equals(other._sources, _sources) && + const DeepCollectionEquality().equals(other._license, _license)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, const DeepCollectionEquality().hash(_sources), + const DeepCollectionEquality().hash(_license)); + + @override + String toString() { + return 'Refer(sources: $sources, license: $license)'; + } + + +} + +/// @nodoc +abstract mixin class _$ReferCopyWith<$Res> implements $ReferCopyWith<$Res> { + factory _$ReferCopyWith(_Refer value, + $Res Function(_Refer) _then) = __$ReferCopyWithImpl; + + @override + @useResult + $Res call({ + List? sources, List? license + }); + + +} + +/// @nodoc +class __$ReferCopyWithImpl<$Res> + implements _$ReferCopyWith<$Res> { + __$ReferCopyWithImpl(this._self, this._then); + + final _Refer _self; + final $Res Function(_Refer) _then; + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({Object? sources = freezed, Object? license = freezed,}) { + return _then(_Refer( + sources: freezed == sources + ? _self._sources + : sources // ignore: cast_nullable_to_non_nullable + as List?, + license: freezed == license + ? _self._license + : license // ignore: cast_nullable_to_non_nullable + as List?, + )); + } + + +} + + +/// @nodoc +mixin _$Location { + + String? get name; + + String? get id; + + String? get lat; + + String? get lon; + + String? get adm2; + + String? get adm1; + + String? get country; + + String? get tz; + + String? get utcOffset; + + String? get isDst; + + String? get type; + + String? get rank; + + String? get fxLink; + + /// Create a copy of Location + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $LocationCopyWith get copyWith => + _$LocationCopyWithImpl(this as Location, _$identity); + + /// Serializes this Location to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Location && + (identical(other.name, name) || other.name == name) && + (identical(other.id, id) || other.id == id) && + (identical(other.lat, lat) || other.lat == lat) && + (identical(other.lon, lon) || other.lon == lon) && + (identical(other.adm2, adm2) || other.adm2 == adm2) && + (identical(other.adm1, adm1) || other.adm1 == adm1) && + (identical(other.country, country) || other.country == country) && + (identical(other.tz, tz) || other.tz == tz) && + (identical(other.utcOffset, utcOffset) || + other.utcOffset == utcOffset) && + (identical(other.isDst, isDst) || other.isDst == isDst) && + (identical(other.type, type) || other.type == type) && + (identical(other.rank, rank) || other.rank == rank) && + (identical(other.fxLink, fxLink) || other.fxLink == fxLink)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + name, + id, + lat, + lon, + adm2, + adm1, + country, + tz, + utcOffset, + isDst, + type, + rank, + fxLink); + + @override + String toString() { + return 'Location(name: $name, id: $id, lat: $lat, lon: $lon, adm2: $adm2, adm1: $adm1, country: $country, tz: $tz, utcOffset: $utcOffset, isDst: $isDst, type: $type, rank: $rank, fxLink: $fxLink)'; + } + + +} + +/// @nodoc +abstract mixin class $LocationCopyWith<$Res> { + factory $LocationCopyWith(Location value, + $Res Function(Location) _then) = _$LocationCopyWithImpl; + + @useResult + $Res call({ + String? name, String? id, String? lat, String? lon, String? adm2, String? adm1, String? country, String? tz, String? utcOffset, String? isDst, String? type, String? rank, String? fxLink + }); + + +} + +/// @nodoc +class _$LocationCopyWithImpl<$Res> + implements $LocationCopyWith<$Res> { + _$LocationCopyWithImpl(this._self, this._then); + + final Location _self; + final $Res Function(Location) _then; + + /// Create a copy of Location + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? name = freezed, Object? id = freezed, Object? lat = freezed, Object? lon = freezed, Object? adm2 = freezed, Object? adm1 = freezed, Object? country = freezed, Object? tz = freezed, Object? utcOffset = freezed, Object? isDst = freezed, Object? type = freezed, Object? rank = freezed, Object? fxLink = freezed,}) { + return _then(_self.copyWith( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as String?, + lat: freezed == lat + ? _self.lat + : lat // ignore: cast_nullable_to_non_nullable + as String?, + lon: freezed == lon + ? _self.lon + : lon // ignore: cast_nullable_to_non_nullable + as String?, + adm2: freezed == adm2 + ? _self.adm2 + : adm2 // ignore: cast_nullable_to_non_nullable + as String?, + adm1: freezed == adm1 + ? _self.adm1 + : adm1 // ignore: cast_nullable_to_non_nullable + as String?, + country: freezed == country + ? _self.country + : country // ignore: cast_nullable_to_non_nullable + as String?, + tz: freezed == tz ? _self.tz : tz // ignore: cast_nullable_to_non_nullable + as String?, + utcOffset: freezed == utcOffset + ? _self.utcOffset + : utcOffset // ignore: cast_nullable_to_non_nullable + as String?, + isDst: freezed == isDst + ? _self.isDst + : isDst // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + rank: freezed == rank + ? _self.rank + : rank // ignore: cast_nullable_to_non_nullable + as String?, + fxLink: freezed == fxLink + ? _self.fxLink + : fxLink // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Location implements Location { + const _Location( + {this.name, this.id, this.lat, this.lon, this.adm2, this.adm1, this.country, this.tz, this.utcOffset, this.isDst, this.type, this.rank, this.fxLink}); + + factory _Location.fromJson(Map json) => + _$LocationFromJson(json); + + @override final String? name; + @override final String? id; + @override final String? lat; + @override final String? lon; + @override final String? adm2; + @override final String? adm1; + @override final String? country; + @override final String? tz; + @override final String? utcOffset; + @override final String? isDst; + @override final String? type; + @override final String? rank; + @override final String? fxLink; + + /// Create a copy of Location + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$LocationCopyWith<_Location> get copyWith => + __$LocationCopyWithImpl<_Location>(this, _$identity); + + @override + Map toJson() { + return _$LocationToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Location && + (identical(other.name, name) || other.name == name) && + (identical(other.id, id) || other.id == id) && + (identical(other.lat, lat) || other.lat == lat) && + (identical(other.lon, lon) || other.lon == lon) && + (identical(other.adm2, adm2) || other.adm2 == adm2) && + (identical(other.adm1, adm1) || other.adm1 == adm1) && + (identical(other.country, country) || other.country == country) && + (identical(other.tz, tz) || other.tz == tz) && + (identical(other.utcOffset, utcOffset) || + other.utcOffset == utcOffset) && + (identical(other.isDst, isDst) || other.isDst == isDst) && + (identical(other.type, type) || other.type == type) && + (identical(other.rank, rank) || other.rank == rank) && + (identical(other.fxLink, fxLink) || other.fxLink == fxLink)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + name, + id, + lat, + lon, + adm2, + adm1, + country, + tz, + utcOffset, + isDst, + type, + rank, + fxLink); + + @override + String toString() { + return 'Location(name: $name, id: $id, lat: $lat, lon: $lon, adm2: $adm2, adm1: $adm1, country: $country, tz: $tz, utcOffset: $utcOffset, isDst: $isDst, type: $type, rank: $rank, fxLink: $fxLink)'; + } + + +} + +/// @nodoc +abstract mixin class _$LocationCopyWith<$Res> + implements $LocationCopyWith<$Res> { + factory _$LocationCopyWith(_Location value, + $Res Function(_Location) _then) = __$LocationCopyWithImpl; + + @override + @useResult + $Res call({ + String? name, String? id, String? lat, String? lon, String? adm2, String? adm1, String? country, String? tz, String? utcOffset, String? isDst, String? type, String? rank, String? fxLink + }); + + +} + +/// @nodoc +class __$LocationCopyWithImpl<$Res> + implements _$LocationCopyWith<$Res> { + __$LocationCopyWithImpl(this._self, this._then); + + final _Location _self; + final $Res Function(_Location) _then; + + /// Create a copy of Location + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? name = freezed, Object? id = freezed, Object? lat = freezed, Object? lon = freezed, Object? adm2 = freezed, Object? adm1 = freezed, Object? country = freezed, Object? tz = freezed, Object? utcOffset = freezed, Object? isDst = freezed, Object? type = freezed, Object? rank = freezed, Object? fxLink = freezed,}) { + return _then(_Location( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as String?, + lat: freezed == lat + ? _self.lat + : lat // ignore: cast_nullable_to_non_nullable + as String?, + lon: freezed == lon + ? _self.lon + : lon // ignore: cast_nullable_to_non_nullable + as String?, + adm2: freezed == adm2 + ? _self.adm2 + : adm2 // ignore: cast_nullable_to_non_nullable + as String?, + adm1: freezed == adm1 + ? _self.adm1 + : adm1 // ignore: cast_nullable_to_non_nullable + as String?, + country: freezed == country + ? _self.country + : country // ignore: cast_nullable_to_non_nullable + as String?, + tz: freezed == tz ? _self.tz : tz // ignore: cast_nullable_to_non_nullable + as String?, + utcOffset: freezed == utcOffset + ? _self.utcOffset + : utcOffset // ignore: cast_nullable_to_non_nullable + as String?, + isDst: freezed == isDst + ? _self.isDst + : isDst // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + rank: freezed == rank + ? _self.rank + : rank // ignore: cast_nullable_to_non_nullable + as String?, + fxLink: freezed == fxLink + ? _self.fxLink + : fxLink // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + +} + +// dart format on diff --git a/lib/common/models/geo.g.dart b/lib/common/models/geo.g.dart new file mode 100644 index 0000000..d03fb5f --- /dev/null +++ b/lib/common/models/geo.g.dart @@ -0,0 +1,70 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'geo.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_GeoResponse _$GeoResponseFromJson(Map json) => _GeoResponse( + code: json['code'] as String?, + location: + (json['location'] as List?) + ?.map((e) => Location.fromJson(e as Map)) + .toList(), + refer: + json['refer'] == null + ? null + : Refer.fromJson(json['refer'] as Map), +); + +Map _$GeoResponseToJson(_GeoResponse instance) => + { + if (instance.code case final value?) 'code': value, + if (instance.location case final value?) 'location': value, + if (instance.refer case final value?) 'refer': value, + }; + +_Refer _$ReferFromJson(Map json) => _Refer( + sources: + (json['sources'] as List?)?.map((e) => e as String).toList(), + license: + (json['license'] as List?)?.map((e) => e as String).toList(), +); + +Map _$ReferToJson(_Refer instance) => { + if (instance.sources case final value?) 'sources': value, + if (instance.license case final value?) 'license': value, +}; + +_Location _$LocationFromJson(Map json) => _Location( + name: json['name'] as String?, + id: json['id'] as String?, + lat: json['lat'] as String?, + lon: json['lon'] as String?, + adm2: json['adm2'] as String?, + adm1: json['adm1'] as String?, + country: json['country'] as String?, + tz: json['tz'] as String?, + utcOffset: json['utcOffset'] as String?, + isDst: json['isDst'] as String?, + type: json['type'] as String?, + rank: json['rank'] as String?, + fxLink: json['fxLink'] as String?, +); + +Map _$LocationToJson(_Location instance) => { + if (instance.name case final value?) 'name': value, + if (instance.id case final value?) 'id': value, + if (instance.lat case final value?) 'lat': value, + if (instance.lon case final value?) 'lon': value, + if (instance.adm2 case final value?) 'adm2': value, + if (instance.adm1 case final value?) 'adm1': value, + if (instance.country case final value?) 'country': value, + if (instance.tz case final value?) 'tz': value, + if (instance.utcOffset case final value?) 'utcOffset': value, + if (instance.isDst case final value?) 'isDst': value, + if (instance.type case final value?) 'type': value, + if (instance.rank case final value?) 'rank': value, + if (instance.fxLink case final value?) 'fxLink': value, +}; diff --git a/lib/common/models/github.dart b/lib/common/models/github.dart index c41fd84..7cb58a3 100644 --- a/lib/common/models/github.dart +++ b/lib/common/models/github.dart @@ -1,341 +1,107 @@ -class GithubRelease { - String? url; - String? assetsUrl; - String? uploadUrl; - String? htmlUrl; - int? id; - Author? author; - String? nodeId; - String? tagName; - String? targetCommitish; - String? name; - bool? draft; - bool? prerelease; - String? createdAt; - String? publishedAt; - List? assets; - String? tarballUrl; - String? zipballUrl; - String? body; +import 'package:freezed_annotation/freezed_annotation.dart'; - GithubRelease({ - this.url, - this.assetsUrl, - this.uploadUrl, - this.htmlUrl, - this.id, - this.author, - this.nodeId, - this.tagName, - this.targetCommitish, - this.name, - this.draft, - this.prerelease, - this.createdAt, - this.publishedAt, - this.assets, - this.tarballUrl, - this.zipballUrl, - this.body, - }); +part 'github.freezed.dart'; +part 'github.g.dart'; - GithubRelease.fromJson(Map json) { - url = json["url"]; - assetsUrl = json["assets_url"]; - uploadUrl = json["upload_url"]; - htmlUrl = json["html_url"]; - id = json["id"]; - author = json["author"] == null ? null : Author.fromJson(json["author"]); - nodeId = json["node_id"]; - tagName = json["tag_name"]; - targetCommitish = json["target_commitish"]; - name = json["name"]; - draft = json["draft"]; - prerelease = json["prerelease"]; - createdAt = json["created_at"]; - publishedAt = json["published_at"]; - assets = - json["assets"] == null - ? null - : (json["assets"] as List).map((e) => Assets.fromJson(e)).toList(); - tarballUrl = json["tarball_url"]; - zipballUrl = json["zipball_url"]; - body = json["body"]; - } +@freezed +abstract class GithubRelease with _$GithubRelease { + const factory GithubRelease({ + String? url, + @JsonKey(name: 'assets_url') String? assetsUrl, + @JsonKey(name: 'upload_url') String? uploadUrl, + @JsonKey(name: 'html_url') String? htmlUrl, + int? id, + Author? author, + @JsonKey(name: 'node_id') String? nodeId, + @JsonKey(name: 'tag_name') String? tagName, + @JsonKey(name: 'target_commitish') String? targetCommitish, + String? name, + bool? draft, + bool? prerelease, + @JsonKey(name: 'created_at') String? createdAt, + @JsonKey(name: 'published_at') String? publishedAt, + List? assets, + @JsonKey(name: 'tarball_url') String? tarballUrl, + @JsonKey(name: 'zipball_url') String? zipballUrl, + String? body, + }) = _GithubRelease; - Map toJson() { - final Map data = {}; - data["url"] = url; - data["assets_url"] = assetsUrl; - data["upload_url"] = uploadUrl; - data["html_url"] = htmlUrl; - data["id"] = id; - if (author != null) { - data["author"] = author?.toJson(); - } - data["node_id"] = nodeId; - data["tag_name"] = tagName; - data["target_commitish"] = targetCommitish; - data["name"] = name; - data["draft"] = draft; - data["prerelease"] = prerelease; - data["created_at"] = createdAt; - data["published_at"] = publishedAt; - if (assets != null) { - data["assets"] = assets?.map((e) => e.toJson()).toList(); - } - data["tarball_url"] = tarballUrl; - data["zipball_url"] = zipballUrl; - data["body"] = body; - return data; - } + factory GithubRelease.fromJson(Map json) => + _$GithubReleaseFromJson(json); } -class Assets { - String? url; - int? id; - String? nodeId; - String? name; - dynamic label; - Uploader? uploader; - String? contentType; - String? state; - int? size; - int? downloadCount; - String? createdAt; - String? updatedAt; - String? browserDownloadUrl; +@freezed +abstract class Assets with _$Assets { + const factory Assets({ + String? url, + int? id, + @JsonKey(name: 'node_id') String? nodeId, + String? name, + dynamic label, + Uploader? uploader, + @JsonKey(name: 'content_type') String? contentType, + String? state, + int? size, + @JsonKey(name: 'download_count') int? downloadCount, + @JsonKey(name: 'created_at') String? createdAt, + @JsonKey(name: 'updated_at') String? updatedAt, + @JsonKey(name: 'browser_download_url') String? browserDownloadUrl, + }) = _Assets; - Assets({ - this.url, - this.id, - this.nodeId, - this.name, - this.label, - this.uploader, - this.contentType, - this.state, - this.size, - this.downloadCount, - this.createdAt, - this.updatedAt, - this.browserDownloadUrl, - }); - - Assets.fromJson(Map json) { - url = json["url"]; - id = json["id"]; - nodeId = json["node_id"]; - name = json["name"]; - label = json["label"]; - uploader = - json["uploader"] == null ? null : Uploader.fromJson(json["uploader"]); - contentType = json["content_type"]; - state = json["state"]; - size = json["size"]; - downloadCount = json["download_count"]; - createdAt = json["created_at"]; - updatedAt = json["updated_at"]; - browserDownloadUrl = json["browser_download_url"]; - } - - Map toJson() { - final Map data = {}; - data["url"] = url; - data["id"] = id; - data["node_id"] = nodeId; - data["name"] = name; - data["label"] = label; - if (uploader != null) { - data["uploader"] = uploader?.toJson(); - } - data["content_type"] = contentType; - data["state"] = state; - data["size"] = size; - data["download_count"] = downloadCount; - data["created_at"] = createdAt; - data["updated_at"] = updatedAt; - data["browser_download_url"] = browserDownloadUrl; - return data; - } + factory Assets.fromJson(Map json) => _$AssetsFromJson(json); } -class Uploader { - String? login; - int? id; - String? nodeId; - String? avatarUrl; - String? gravatarId; - String? url; - String? htmlUrl; - String? followersUrl; - String? followingUrl; - String? gistsUrl; - String? starredUrl; - String? subscriptionsUrl; - String? organizationsUrl; - String? reposUrl; - String? eventsUrl; - String? receivedEventsUrl; - String? type; - String? userViewType; - bool? siteAdmin; +@freezed +abstract class Uploader with _$Uploader { + const factory Uploader({ + String? login, + int? id, + @JsonKey(name: 'node_id') String? nodeId, + @JsonKey(name: 'avatar_url') String? avatarUrl, + @JsonKey(name: 'gravatar_id') String? gravatarId, + String? url, + @JsonKey(name: 'html_url') String? htmlUrl, + @JsonKey(name: 'followers_url') String? followersUrl, + @JsonKey(name: 'following_url') String? followingUrl, + @JsonKey(name: 'gists_url') String? gistsUrl, + @JsonKey(name: 'starred_url') String? starredUrl, + @JsonKey(name: 'subscriptions_url') String? subscriptionsUrl, + @JsonKey(name: 'organizations_url') String? organizationsUrl, + @JsonKey(name: 'repos_url') String? reposUrl, + @JsonKey(name: 'events_url') String? eventsUrl, + @JsonKey(name: 'received_events_url') String? receivedEventsUrl, + String? type, + @JsonKey(name: 'user_view_type') String? userViewType, + @JsonKey(name: 'site_admin') bool? siteAdmin, + }) = _Uploader; - Uploader({ - this.login, - this.id, - this.nodeId, - this.avatarUrl, - this.gravatarId, - this.url, - this.htmlUrl, - this.followersUrl, - this.followingUrl, - this.gistsUrl, - this.starredUrl, - this.subscriptionsUrl, - this.organizationsUrl, - this.reposUrl, - this.eventsUrl, - this.receivedEventsUrl, - this.type, - this.userViewType, - this.siteAdmin, - }); - - Uploader.fromJson(Map json) { - login = json["login"]; - id = json["id"]; - nodeId = json["node_id"]; - avatarUrl = json["avatar_url"]; - gravatarId = json["gravatar_id"]; - url = json["url"]; - htmlUrl = json["html_url"]; - followersUrl = json["followers_url"]; - followingUrl = json["following_url"]; - gistsUrl = json["gists_url"]; - starredUrl = json["starred_url"]; - subscriptionsUrl = json["subscriptions_url"]; - organizationsUrl = json["organizations_url"]; - reposUrl = json["repos_url"]; - eventsUrl = json["events_url"]; - receivedEventsUrl = json["received_events_url"]; - type = json["type"]; - userViewType = json["user_view_type"]; - siteAdmin = json["site_admin"]; - } - - Map toJson() { - final Map data = {}; - data["login"] = login; - data["id"] = id; - data["node_id"] = nodeId; - data["avatar_url"] = avatarUrl; - data["gravatar_id"] = gravatarId; - data["url"] = url; - data["html_url"] = htmlUrl; - data["followers_url"] = followersUrl; - data["following_url"] = followingUrl; - data["gists_url"] = gistsUrl; - data["starred_url"] = starredUrl; - data["subscriptions_url"] = subscriptionsUrl; - data["organizations_url"] = organizationsUrl; - data["repos_url"] = reposUrl; - data["events_url"] = eventsUrl; - data["received_events_url"] = receivedEventsUrl; - data["type"] = type; - data["user_view_type"] = userViewType; - data["site_admin"] = siteAdmin; - return data; - } + factory Uploader.fromJson(Map json) => + _$UploaderFromJson(json); } -class Author { - String? login; - int? id; - String? nodeId; - String? avatarUrl; - String? gravatarId; - String? url; - String? htmlUrl; - String? followersUrl; - String? followingUrl; - String? gistsUrl; - String? starredUrl; - String? subscriptionsUrl; - String? organizationsUrl; - String? reposUrl; - String? eventsUrl; - String? receivedEventsUrl; - String? type; - String? userViewType; - bool? siteAdmin; +@freezed +abstract class Author with _$Author { + const factory Author({ + String? login, + int? id, + @JsonKey(name: 'node_id') String? nodeId, + @JsonKey(name: 'avatar_url') String? avatarUrl, + @JsonKey(name: 'gravatar_id') String? gravatarId, + String? url, + @JsonKey(name: 'html_url') String? htmlUrl, + @JsonKey(name: 'followers_url') String? followersUrl, + @JsonKey(name: 'following_url') String? followingUrl, + @JsonKey(name: 'gists_url') String? gistsUrl, + @JsonKey(name: 'starred_url') String? starredUrl, + @JsonKey(name: 'subscriptions_url') String? subscriptionsUrl, + @JsonKey(name: 'organizations_url') String? organizationsUrl, + @JsonKey(name: 'repos_url') String? reposUrl, + @JsonKey(name: 'events_url') String? eventsUrl, + @JsonKey(name: 'received_events_url') String? receivedEventsUrl, + String? type, + @JsonKey(name: 'user_view_type') String? userViewType, + @JsonKey(name: 'site_admin') bool? siteAdmin, + }) = _Author; - Author({ - this.login, - this.id, - this.nodeId, - this.avatarUrl, - this.gravatarId, - this.url, - this.htmlUrl, - this.followersUrl, - this.followingUrl, - this.gistsUrl, - this.starredUrl, - this.subscriptionsUrl, - this.organizationsUrl, - this.reposUrl, - this.eventsUrl, - this.receivedEventsUrl, - this.type, - this.userViewType, - this.siteAdmin, - }); - - Author.fromJson(Map json) { - login = json["login"]; - id = json["id"]; - nodeId = json["node_id"]; - avatarUrl = json["avatar_url"]; - gravatarId = json["gravatar_id"]; - url = json["url"]; - htmlUrl = json["html_url"]; - followersUrl = json["followers_url"]; - followingUrl = json["following_url"]; - gistsUrl = json["gists_url"]; - starredUrl = json["starred_url"]; - subscriptionsUrl = json["subscriptions_url"]; - organizationsUrl = json["organizations_url"]; - reposUrl = json["repos_url"]; - eventsUrl = json["events_url"]; - receivedEventsUrl = json["received_events_url"]; - type = json["type"]; - userViewType = json["user_view_type"]; - siteAdmin = json["site_admin"]; - } - - Map toJson() { - final Map data = {}; - data["login"] = login; - data["id"] = id; - data["node_id"] = nodeId; - data["avatar_url"] = avatarUrl; - data["gravatar_id"] = gravatarId; - data["url"] = url; - data["html_url"] = htmlUrl; - data["followers_url"] = followersUrl; - data["following_url"] = followingUrl; - data["gists_url"] = gistsUrl; - data["starred_url"] = starredUrl; - data["subscriptions_url"] = subscriptionsUrl; - data["organizations_url"] = organizationsUrl; - data["repos_url"] = reposUrl; - data["events_url"] = eventsUrl; - data["received_events_url"] = receivedEventsUrl; - data["type"] = type; - data["user_view_type"] = userViewType; - data["site_admin"] = siteAdmin; - return data; - } + factory Author.fromJson(Map json) => _$AuthorFromJson(json); } diff --git a/lib/common/models/github.freezed.dart b/lib/common/models/github.freezed.dart new file mode 100644 index 0000000..e48e692 --- /dev/null +++ b/lib/common/models/github.freezed.dart @@ -0,0 +1,1997 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'github.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$GithubRelease { + + String? get url; + + @JsonKey(name: 'assets_url') String? get assetsUrl; + + @JsonKey(name: 'upload_url') String? get uploadUrl; + + @JsonKey(name: 'html_url') String? get htmlUrl; + + int? get id; + + Author? get author; + + @JsonKey(name: 'node_id') String? get nodeId; + + @JsonKey(name: 'tag_name') String? get tagName; + + @JsonKey(name: 'target_commitish') String? get targetCommitish; + + String? get name; + + bool? get draft; + + bool? get prerelease; + + @JsonKey(name: 'created_at') String? get createdAt; + + @JsonKey(name: 'published_at') String? get publishedAt; + + List? get assets; + + @JsonKey(name: 'tarball_url') String? get tarballUrl; + + @JsonKey(name: 'zipball_url') String? get zipballUrl; + + String? get body; + + /// Create a copy of GithubRelease + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GithubReleaseCopyWith get copyWith => + _$GithubReleaseCopyWithImpl( + this as GithubRelease, _$identity); + + /// Serializes this GithubRelease to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is GithubRelease && + (identical(other.url, url) || other.url == url) && + (identical(other.assetsUrl, assetsUrl) || + other.assetsUrl == assetsUrl) && + (identical(other.uploadUrl, uploadUrl) || + other.uploadUrl == uploadUrl) && + (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && + (identical(other.id, id) || other.id == id) && + (identical(other.author, author) || other.author == author) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.tagName, tagName) || other.tagName == tagName) && + (identical(other.targetCommitish, targetCommitish) || + other.targetCommitish == targetCommitish) && + (identical(other.name, name) || other.name == name) && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.prerelease, prerelease) || + other.prerelease == prerelease) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.publishedAt, publishedAt) || + other.publishedAt == publishedAt) && + const DeepCollectionEquality().equals(other.assets, assets) && + (identical(other.tarballUrl, tarballUrl) || + other.tarballUrl == tarballUrl) && + (identical(other.zipballUrl, zipballUrl) || + other.zipballUrl == zipballUrl) && + (identical(other.body, body) || other.body == body)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + url, + assetsUrl, + uploadUrl, + htmlUrl, + id, + author, + nodeId, + tagName, + targetCommitish, + name, + draft, + prerelease, + createdAt, + publishedAt, + const DeepCollectionEquality().hash(assets), + tarballUrl, + zipballUrl, + body); + + @override + String toString() { + return 'GithubRelease(url: $url, assetsUrl: $assetsUrl, uploadUrl: $uploadUrl, htmlUrl: $htmlUrl, id: $id, author: $author, nodeId: $nodeId, tagName: $tagName, targetCommitish: $targetCommitish, name: $name, draft: $draft, prerelease: $prerelease, createdAt: $createdAt, publishedAt: $publishedAt, assets: $assets, tarballUrl: $tarballUrl, zipballUrl: $zipballUrl, body: $body)'; + } + + +} + +/// @nodoc +abstract mixin class $GithubReleaseCopyWith<$Res> { + factory $GithubReleaseCopyWith(GithubRelease value, + $Res Function(GithubRelease) _then) = _$GithubReleaseCopyWithImpl; + + @useResult + $Res call({ + String? url, @JsonKey(name: 'assets_url') String? assetsUrl, @JsonKey( + name: 'upload_url') String? uploadUrl, @JsonKey( + name: 'html_url') String? htmlUrl, int? id, Author? author, @JsonKey( + name: 'node_id') String? nodeId, @JsonKey( + name: 'tag_name') String? tagName, @JsonKey( + name: 'target_commitish') String? targetCommitish, String? name, bool? draft, bool? prerelease, @JsonKey( + name: 'created_at') String? createdAt, @JsonKey( + name: 'published_at') String? publishedAt, List< + Assets>? assets, @JsonKey( + name: 'tarball_url') String? tarballUrl, @JsonKey( + name: 'zipball_url') String? zipballUrl, String? body + }); + + + $AuthorCopyWith<$Res>? get author; + +} + +/// @nodoc +class _$GithubReleaseCopyWithImpl<$Res> + implements $GithubReleaseCopyWith<$Res> { + _$GithubReleaseCopyWithImpl(this._self, this._then); + + final GithubRelease _self; + final $Res Function(GithubRelease) _then; + + /// Create a copy of GithubRelease + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? url = freezed, Object? assetsUrl = freezed, Object? uploadUrl = freezed, Object? htmlUrl = freezed, Object? id = freezed, Object? author = freezed, Object? nodeId = freezed, Object? tagName = freezed, Object? targetCommitish = freezed, Object? name = freezed, Object? draft = freezed, Object? prerelease = freezed, Object? createdAt = freezed, Object? publishedAt = freezed, Object? assets = freezed, Object? tarballUrl = freezed, Object? zipballUrl = freezed, Object? body = freezed,}) { + return _then(_self.copyWith( + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + assetsUrl: freezed == assetsUrl + ? _self.assetsUrl + : assetsUrl // ignore: cast_nullable_to_non_nullable + as String?, + uploadUrl: freezed == uploadUrl + ? _self.uploadUrl + : uploadUrl // ignore: cast_nullable_to_non_nullable + as String?, + htmlUrl: freezed == htmlUrl + ? _self.htmlUrl + : htmlUrl // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + author: freezed == author + ? _self.author + : author // ignore: cast_nullable_to_non_nullable + as Author?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + tagName: freezed == tagName + ? _self.tagName + : tagName // ignore: cast_nullable_to_non_nullable + as String?, + targetCommitish: freezed == targetCommitish + ? _self.targetCommitish + : targetCommitish // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + draft: freezed == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as bool?, + prerelease: freezed == prerelease + ? _self.prerelease + : prerelease // ignore: cast_nullable_to_non_nullable + as bool?, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as String?, + publishedAt: freezed == publishedAt + ? _self.publishedAt + : publishedAt // ignore: cast_nullable_to_non_nullable + as String?, + assets: freezed == assets + ? _self.assets + : assets // ignore: cast_nullable_to_non_nullable + as List?, + tarballUrl: freezed == tarballUrl + ? _self.tarballUrl + : tarballUrl // ignore: cast_nullable_to_non_nullable + as String?, + zipballUrl: freezed == zipballUrl + ? _self.zipballUrl + : zipballUrl // ignore: cast_nullable_to_non_nullable + as String?, + body: freezed == body + ? _self.body + : body // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + /// Create a copy of GithubRelease + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $AuthorCopyWith<$Res>? get author { + if (_self.author == null) { + return null; + } + + return $AuthorCopyWith<$Res>(_self.author!, (value) { + return _then(_self.copyWith(author: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _GithubRelease implements GithubRelease { + const _GithubRelease( + {this.url, @JsonKey(name: 'assets_url') this.assetsUrl, @JsonKey( + name: 'upload_url') this.uploadUrl, @JsonKey( + name: 'html_url') this.htmlUrl, this.id, this.author, @JsonKey( + name: 'node_id') this.nodeId, @JsonKey( + name: 'tag_name') this.tagName, @JsonKey( + name: 'target_commitish') this.targetCommitish, this.name, this.draft, this.prerelease, @JsonKey( + name: 'created_at') this.createdAt, @JsonKey( + name: 'published_at') this.publishedAt, final List< + Assets>? assets, @JsonKey( + name: 'tarball_url') this.tarballUrl, @JsonKey( + name: 'zipball_url') this.zipballUrl, this.body}) : _assets = assets; + + factory _GithubRelease.fromJson(Map json) => + _$GithubReleaseFromJson(json); + + @override final String? url; + @override + @JsonKey(name: 'assets_url') + final String? assetsUrl; + @override + @JsonKey(name: 'upload_url') + final String? uploadUrl; + @override + @JsonKey(name: 'html_url') + final String? htmlUrl; + @override final int? id; + @override final Author? author; + @override + @JsonKey(name: 'node_id') + final String? nodeId; + @override + @JsonKey(name: 'tag_name') + final String? tagName; + @override + @JsonKey(name: 'target_commitish') + final String? targetCommitish; + @override final String? name; + @override final bool? draft; + @override final bool? prerelease; + @override + @JsonKey(name: 'created_at') + final String? createdAt; + @override + @JsonKey(name: 'published_at') + final String? publishedAt; + final List? _assets; + + @override List? get assets { + final value = _assets; + if (value == null) return null; + if (_assets is EqualUnmodifiableListView) return _assets; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + @JsonKey(name: 'tarball_url') + final String? tarballUrl; + @override + @JsonKey(name: 'zipball_url') + final String? zipballUrl; + @override final String? body; + + /// Create a copy of GithubRelease + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$GithubReleaseCopyWith<_GithubRelease> get copyWith => + __$GithubReleaseCopyWithImpl<_GithubRelease>(this, _$identity); + + @override + Map toJson() { + return _$GithubReleaseToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _GithubRelease && + (identical(other.url, url) || other.url == url) && + (identical(other.assetsUrl, assetsUrl) || + other.assetsUrl == assetsUrl) && + (identical(other.uploadUrl, uploadUrl) || + other.uploadUrl == uploadUrl) && + (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && + (identical(other.id, id) || other.id == id) && + (identical(other.author, author) || other.author == author) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.tagName, tagName) || other.tagName == tagName) && + (identical(other.targetCommitish, targetCommitish) || + other.targetCommitish == targetCommitish) && + (identical(other.name, name) || other.name == name) && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.prerelease, prerelease) || + other.prerelease == prerelease) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.publishedAt, publishedAt) || + other.publishedAt == publishedAt) && + const DeepCollectionEquality().equals(other._assets, _assets) && + (identical(other.tarballUrl, tarballUrl) || + other.tarballUrl == tarballUrl) && + (identical(other.zipballUrl, zipballUrl) || + other.zipballUrl == zipballUrl) && + (identical(other.body, body) || other.body == body)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + url, + assetsUrl, + uploadUrl, + htmlUrl, + id, + author, + nodeId, + tagName, + targetCommitish, + name, + draft, + prerelease, + createdAt, + publishedAt, + const DeepCollectionEquality().hash(_assets), + tarballUrl, + zipballUrl, + body); + + @override + String toString() { + return 'GithubRelease(url: $url, assetsUrl: $assetsUrl, uploadUrl: $uploadUrl, htmlUrl: $htmlUrl, id: $id, author: $author, nodeId: $nodeId, tagName: $tagName, targetCommitish: $targetCommitish, name: $name, draft: $draft, prerelease: $prerelease, createdAt: $createdAt, publishedAt: $publishedAt, assets: $assets, tarballUrl: $tarballUrl, zipballUrl: $zipballUrl, body: $body)'; + } + + +} + +/// @nodoc +abstract mixin class _$GithubReleaseCopyWith<$Res> + implements $GithubReleaseCopyWith<$Res> { + factory _$GithubReleaseCopyWith(_GithubRelease value, + $Res Function(_GithubRelease) _then) = __$GithubReleaseCopyWithImpl; + + @override + @useResult + $Res call({ + String? url, @JsonKey(name: 'assets_url') String? assetsUrl, @JsonKey( + name: 'upload_url') String? uploadUrl, @JsonKey( + name: 'html_url') String? htmlUrl, int? id, Author? author, @JsonKey( + name: 'node_id') String? nodeId, @JsonKey( + name: 'tag_name') String? tagName, @JsonKey( + name: 'target_commitish') String? targetCommitish, String? name, bool? draft, bool? prerelease, @JsonKey( + name: 'created_at') String? createdAt, @JsonKey( + name: 'published_at') String? publishedAt, List< + Assets>? assets, @JsonKey( + name: 'tarball_url') String? tarballUrl, @JsonKey( + name: 'zipball_url') String? zipballUrl, String? body + }); + + + @override $AuthorCopyWith<$Res>? get author; + +} + +/// @nodoc +class __$GithubReleaseCopyWithImpl<$Res> + implements _$GithubReleaseCopyWith<$Res> { + __$GithubReleaseCopyWithImpl(this._self, this._then); + + final _GithubRelease _self; + final $Res Function(_GithubRelease) _then; + + /// Create a copy of GithubRelease + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? url = freezed, Object? assetsUrl = freezed, Object? uploadUrl = freezed, Object? htmlUrl = freezed, Object? id = freezed, Object? author = freezed, Object? nodeId = freezed, Object? tagName = freezed, Object? targetCommitish = freezed, Object? name = freezed, Object? draft = freezed, Object? prerelease = freezed, Object? createdAt = freezed, Object? publishedAt = freezed, Object? assets = freezed, Object? tarballUrl = freezed, Object? zipballUrl = freezed, Object? body = freezed,}) { + return _then(_GithubRelease( + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + assetsUrl: freezed == assetsUrl + ? _self.assetsUrl + : assetsUrl // ignore: cast_nullable_to_non_nullable + as String?, + uploadUrl: freezed == uploadUrl + ? _self.uploadUrl + : uploadUrl // ignore: cast_nullable_to_non_nullable + as String?, + htmlUrl: freezed == htmlUrl + ? _self.htmlUrl + : htmlUrl // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + author: freezed == author + ? _self.author + : author // ignore: cast_nullable_to_non_nullable + as Author?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + tagName: freezed == tagName + ? _self.tagName + : tagName // ignore: cast_nullable_to_non_nullable + as String?, + targetCommitish: freezed == targetCommitish + ? _self.targetCommitish + : targetCommitish // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + draft: freezed == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as bool?, + prerelease: freezed == prerelease + ? _self.prerelease + : prerelease // ignore: cast_nullable_to_non_nullable + as bool?, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as String?, + publishedAt: freezed == publishedAt + ? _self.publishedAt + : publishedAt // ignore: cast_nullable_to_non_nullable + as String?, + assets: freezed == assets + ? _self._assets + : assets // ignore: cast_nullable_to_non_nullable + as List?, + tarballUrl: freezed == tarballUrl + ? _self.tarballUrl + : tarballUrl // ignore: cast_nullable_to_non_nullable + as String?, + zipballUrl: freezed == zipballUrl + ? _self.zipballUrl + : zipballUrl // ignore: cast_nullable_to_non_nullable + as String?, + body: freezed == body + ? _self.body + : body // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + /// Create a copy of GithubRelease + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $AuthorCopyWith<$Res>? get author { + if (_self.author == null) { + return null; + } + + return $AuthorCopyWith<$Res>(_self.author!, (value) { + return _then(_self.copyWith(author: value)); + }); + } +} + + +/// @nodoc +mixin _$Assets { + + String? get url; + + int? get id; + + @JsonKey(name: 'node_id') String? get nodeId; + + String? get name; + + dynamic get label; + + Uploader? get uploader; + + @JsonKey(name: 'content_type') String? get contentType; + + String? get state; + + int? get size; + + @JsonKey(name: 'download_count') int? get downloadCount; + + @JsonKey(name: 'created_at') String? get createdAt; + + @JsonKey(name: 'updated_at') String? get updatedAt; + + @JsonKey(name: 'browser_download_url') String? get browserDownloadUrl; + + /// Create a copy of Assets + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AssetsCopyWith get copyWith => + _$AssetsCopyWithImpl(this as Assets, _$identity); + + /// Serializes this Assets to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Assets && + (identical(other.url, url) || other.url == url) && + (identical(other.id, id) || other.id == id) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.label, label) && + (identical(other.uploader, uploader) || + other.uploader == uploader) && + (identical(other.contentType, contentType) || + other.contentType == contentType) && + (identical(other.state, state) || other.state == state) && + (identical(other.size, size) || other.size == size) && + (identical(other.downloadCount, downloadCount) || + other.downloadCount == downloadCount) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt) && + (identical(other.browserDownloadUrl, browserDownloadUrl) || + other.browserDownloadUrl == browserDownloadUrl)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + url, + id, + nodeId, + name, + const DeepCollectionEquality().hash(label), + uploader, + contentType, + state, + size, + downloadCount, + createdAt, + updatedAt, + browserDownloadUrl); + + @override + String toString() { + return 'Assets(url: $url, id: $id, nodeId: $nodeId, name: $name, label: $label, uploader: $uploader, contentType: $contentType, state: $state, size: $size, downloadCount: $downloadCount, createdAt: $createdAt, updatedAt: $updatedAt, browserDownloadUrl: $browserDownloadUrl)'; + } + + +} + +/// @nodoc +abstract mixin class $AssetsCopyWith<$Res> { + factory $AssetsCopyWith(Assets value, + $Res Function(Assets) _then) = _$AssetsCopyWithImpl; + + @useResult + $Res call({ + String? url, int? id, @JsonKey( + name: 'node_id') String? nodeId, String? name, dynamic label, Uploader? uploader, @JsonKey( + name: 'content_type') String? contentType, String? state, int? size, @JsonKey( + name: 'download_count') int? downloadCount, @JsonKey( + name: 'created_at') String? createdAt, @JsonKey( + name: 'updated_at') String? updatedAt, @JsonKey( + name: 'browser_download_url') String? browserDownloadUrl + }); + + + $UploaderCopyWith<$Res>? get uploader; + +} + +/// @nodoc +class _$AssetsCopyWithImpl<$Res> + implements $AssetsCopyWith<$Res> { + _$AssetsCopyWithImpl(this._self, this._then); + + final Assets _self; + final $Res Function(Assets) _then; + + /// Create a copy of Assets + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? url = freezed, Object? id = freezed, Object? nodeId = freezed, Object? name = freezed, Object? label = freezed, Object? uploader = freezed, Object? contentType = freezed, Object? state = freezed, Object? size = freezed, Object? downloadCount = freezed, Object? createdAt = freezed, Object? updatedAt = freezed, Object? browserDownloadUrl = freezed,}) { + return _then(_self.copyWith( + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + label: freezed == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as dynamic, + uploader: freezed == uploader + ? _self.uploader + : uploader // ignore: cast_nullable_to_non_nullable + as Uploader?, + contentType: freezed == contentType + ? _self.contentType + : contentType // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _self.state + : state // ignore: cast_nullable_to_non_nullable + as String?, + size: freezed == size + ? _self.size + : size // ignore: cast_nullable_to_non_nullable + as int?, + downloadCount: freezed == downloadCount + ? _self.downloadCount + : downloadCount // ignore: cast_nullable_to_non_nullable + as int?, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as String?, + updatedAt: freezed == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as String?, + browserDownloadUrl: freezed == browserDownloadUrl + ? _self.browserDownloadUrl + : browserDownloadUrl // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + /// Create a copy of Assets + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $UploaderCopyWith<$Res>? get uploader { + if (_self.uploader == null) { + return null; + } + + return $UploaderCopyWith<$Res>(_self.uploader!, (value) { + return _then(_self.copyWith(uploader: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _Assets implements Assets { + const _Assets({this.url, this.id, @JsonKey( + name: 'node_id') this.nodeId, this.name, this.label, this.uploader, @JsonKey( + name: 'content_type') this.contentType, this.state, this.size, @JsonKey( + name: 'download_count') this.downloadCount, @JsonKey( + name: 'created_at') this.createdAt, @JsonKey( + name: 'updated_at') this.updatedAt, @JsonKey( + name: 'browser_download_url') this.browserDownloadUrl}); + + factory _Assets.fromJson(Map json) => _$AssetsFromJson(json); + + @override final String? url; + @override final int? id; + @override + @JsonKey(name: 'node_id') + final String? nodeId; + @override final String? name; + @override final dynamic label; + @override final Uploader? uploader; + @override + @JsonKey(name: 'content_type') + final String? contentType; + @override final String? state; + @override final int? size; + @override + @JsonKey(name: 'download_count') + final int? downloadCount; + @override + @JsonKey(name: 'created_at') + final String? createdAt; + @override + @JsonKey(name: 'updated_at') + final String? updatedAt; + @override + @JsonKey(name: 'browser_download_url') + final String? browserDownloadUrl; + + /// Create a copy of Assets + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$AssetsCopyWith<_Assets> get copyWith => + __$AssetsCopyWithImpl<_Assets>(this, _$identity); + + @override + Map toJson() { + return _$AssetsToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Assets && + (identical(other.url, url) || other.url == url) && + (identical(other.id, id) || other.id == id) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.label, label) && + (identical(other.uploader, uploader) || + other.uploader == uploader) && + (identical(other.contentType, contentType) || + other.contentType == contentType) && + (identical(other.state, state) || other.state == state) && + (identical(other.size, size) || other.size == size) && + (identical(other.downloadCount, downloadCount) || + other.downloadCount == downloadCount) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt) && + (identical(other.browserDownloadUrl, browserDownloadUrl) || + other.browserDownloadUrl == browserDownloadUrl)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + url, + id, + nodeId, + name, + const DeepCollectionEquality().hash(label), + uploader, + contentType, + state, + size, + downloadCount, + createdAt, + updatedAt, + browserDownloadUrl); + + @override + String toString() { + return 'Assets(url: $url, id: $id, nodeId: $nodeId, name: $name, label: $label, uploader: $uploader, contentType: $contentType, state: $state, size: $size, downloadCount: $downloadCount, createdAt: $createdAt, updatedAt: $updatedAt, browserDownloadUrl: $browserDownloadUrl)'; + } + + +} + +/// @nodoc +abstract mixin class _$AssetsCopyWith<$Res> implements $AssetsCopyWith<$Res> { + factory _$AssetsCopyWith(_Assets value, + $Res Function(_Assets) _then) = __$AssetsCopyWithImpl; + + @override + @useResult + $Res call({ + String? url, int? id, @JsonKey( + name: 'node_id') String? nodeId, String? name, dynamic label, Uploader? uploader, @JsonKey( + name: 'content_type') String? contentType, String? state, int? size, @JsonKey( + name: 'download_count') int? downloadCount, @JsonKey( + name: 'created_at') String? createdAt, @JsonKey( + name: 'updated_at') String? updatedAt, @JsonKey( + name: 'browser_download_url') String? browserDownloadUrl + }); + + + @override $UploaderCopyWith<$Res>? get uploader; + +} + +/// @nodoc +class __$AssetsCopyWithImpl<$Res> + implements _$AssetsCopyWith<$Res> { + __$AssetsCopyWithImpl(this._self, this._then); + + final _Assets _self; + final $Res Function(_Assets) _then; + + /// Create a copy of Assets + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? url = freezed, Object? id = freezed, Object? nodeId = freezed, Object? name = freezed, Object? label = freezed, Object? uploader = freezed, Object? contentType = freezed, Object? state = freezed, Object? size = freezed, Object? downloadCount = freezed, Object? createdAt = freezed, Object? updatedAt = freezed, Object? browserDownloadUrl = freezed,}) { + return _then(_Assets( + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + label: freezed == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as dynamic, + uploader: freezed == uploader + ? _self.uploader + : uploader // ignore: cast_nullable_to_non_nullable + as Uploader?, + contentType: freezed == contentType + ? _self.contentType + : contentType // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _self.state + : state // ignore: cast_nullable_to_non_nullable + as String?, + size: freezed == size + ? _self.size + : size // ignore: cast_nullable_to_non_nullable + as int?, + downloadCount: freezed == downloadCount + ? _self.downloadCount + : downloadCount // ignore: cast_nullable_to_non_nullable + as int?, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as String?, + updatedAt: freezed == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as String?, + browserDownloadUrl: freezed == browserDownloadUrl + ? _self.browserDownloadUrl + : browserDownloadUrl // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + /// Create a copy of Assets + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $UploaderCopyWith<$Res>? get uploader { + if (_self.uploader == null) { + return null; + } + + return $UploaderCopyWith<$Res>(_self.uploader!, (value) { + return _then(_self.copyWith(uploader: value)); + }); + } +} + + +/// @nodoc +mixin _$Uploader { + + String? get login; + + int? get id; + + @JsonKey(name: 'node_id') String? get nodeId; + + @JsonKey(name: 'avatar_url') String? get avatarUrl; + + @JsonKey(name: 'gravatar_id') String? get gravatarId; + + String? get url; + + @JsonKey(name: 'html_url') String? get htmlUrl; + + @JsonKey(name: 'followers_url') String? get followersUrl; + + @JsonKey(name: 'following_url') String? get followingUrl; + + @JsonKey(name: 'gists_url') String? get gistsUrl; + + @JsonKey(name: 'starred_url') String? get starredUrl; + + @JsonKey(name: 'subscriptions_url') String? get subscriptionsUrl; + + @JsonKey(name: 'organizations_url') String? get organizationsUrl; + + @JsonKey(name: 'repos_url') String? get reposUrl; + + @JsonKey(name: 'events_url') String? get eventsUrl; + + @JsonKey(name: 'received_events_url') String? get receivedEventsUrl; + + String? get type; + + @JsonKey(name: 'user_view_type') String? get userViewType; + + @JsonKey(name: 'site_admin') bool? get siteAdmin; + + /// Create a copy of Uploader + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UploaderCopyWith get copyWith => + _$UploaderCopyWithImpl(this as Uploader, _$identity); + + /// Serializes this Uploader to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Uploader && + (identical(other.login, login) || other.login == login) && + (identical(other.id, id) || other.id == id) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.avatarUrl, avatarUrl) || + other.avatarUrl == avatarUrl) && + (identical(other.gravatarId, gravatarId) || + other.gravatarId == gravatarId) && + (identical(other.url, url) || other.url == url) && + (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && + (identical(other.followersUrl, followersUrl) || + other.followersUrl == followersUrl) && + (identical(other.followingUrl, followingUrl) || + other.followingUrl == followingUrl) && + (identical(other.gistsUrl, gistsUrl) || + other.gistsUrl == gistsUrl) && + (identical(other.starredUrl, starredUrl) || + other.starredUrl == starredUrl) && + (identical(other.subscriptionsUrl, subscriptionsUrl) || + other.subscriptionsUrl == subscriptionsUrl) && + (identical(other.organizationsUrl, organizationsUrl) || + other.organizationsUrl == organizationsUrl) && + (identical(other.reposUrl, reposUrl) || + other.reposUrl == reposUrl) && + (identical(other.eventsUrl, eventsUrl) || + other.eventsUrl == eventsUrl) && + (identical(other.receivedEventsUrl, receivedEventsUrl) || + other.receivedEventsUrl == receivedEventsUrl) && + (identical(other.type, type) || other.type == type) && + (identical(other.userViewType, userViewType) || + other.userViewType == userViewType) && + (identical(other.siteAdmin, siteAdmin) || + other.siteAdmin == siteAdmin)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hashAll([ + runtimeType, + login, + id, + nodeId, + avatarUrl, + gravatarId, + url, + htmlUrl, + followersUrl, + followingUrl, + gistsUrl, + starredUrl, + subscriptionsUrl, + organizationsUrl, + reposUrl, + eventsUrl, + receivedEventsUrl, + type, + userViewType, + siteAdmin + ]); + + @override + String toString() { + return 'Uploader(login: $login, id: $id, nodeId: $nodeId, avatarUrl: $avatarUrl, gravatarId: $gravatarId, url: $url, htmlUrl: $htmlUrl, followersUrl: $followersUrl, followingUrl: $followingUrl, gistsUrl: $gistsUrl, starredUrl: $starredUrl, subscriptionsUrl: $subscriptionsUrl, organizationsUrl: $organizationsUrl, reposUrl: $reposUrl, eventsUrl: $eventsUrl, receivedEventsUrl: $receivedEventsUrl, type: $type, userViewType: $userViewType, siteAdmin: $siteAdmin)'; + } + + +} + +/// @nodoc +abstract mixin class $UploaderCopyWith<$Res> { + factory $UploaderCopyWith(Uploader value, + $Res Function(Uploader) _then) = _$UploaderCopyWithImpl; + + @useResult + $Res call({ + String? login, int? id, @JsonKey(name: 'node_id') String? nodeId, @JsonKey( + name: 'avatar_url') String? avatarUrl, @JsonKey( + name: 'gravatar_id') String? gravatarId, String? url, @JsonKey( + name: 'html_url') String? htmlUrl, @JsonKey( + name: 'followers_url') String? followersUrl, @JsonKey( + name: 'following_url') String? followingUrl, @JsonKey( + name: 'gists_url') String? gistsUrl, @JsonKey( + name: 'starred_url') String? starredUrl, @JsonKey( + name: 'subscriptions_url') String? subscriptionsUrl, @JsonKey( + name: 'organizations_url') String? organizationsUrl, @JsonKey( + name: 'repos_url') String? reposUrl, @JsonKey( + name: 'events_url') String? eventsUrl, @JsonKey( + name: 'received_events_url') String? receivedEventsUrl, String? type, @JsonKey( + name: 'user_view_type') String? userViewType, @JsonKey( + name: 'site_admin') bool? siteAdmin + }); + + +} + +/// @nodoc +class _$UploaderCopyWithImpl<$Res> + implements $UploaderCopyWith<$Res> { + _$UploaderCopyWithImpl(this._self, this._then); + + final Uploader _self; + final $Res Function(Uploader) _then; + + /// Create a copy of Uploader + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? login = freezed, Object? id = freezed, Object? nodeId = freezed, Object? avatarUrl = freezed, Object? gravatarId = freezed, Object? url = freezed, Object? htmlUrl = freezed, Object? followersUrl = freezed, Object? followingUrl = freezed, Object? gistsUrl = freezed, Object? starredUrl = freezed, Object? subscriptionsUrl = freezed, Object? organizationsUrl = freezed, Object? reposUrl = freezed, Object? eventsUrl = freezed, Object? receivedEventsUrl = freezed, Object? type = freezed, Object? userViewType = freezed, Object? siteAdmin = freezed,}) { + return _then(_self.copyWith( + login: freezed == login + ? _self.login + : login // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + avatarUrl: freezed == avatarUrl + ? _self.avatarUrl + : avatarUrl // ignore: cast_nullable_to_non_nullable + as String?, + gravatarId: freezed == gravatarId + ? _self.gravatarId + : gravatarId // ignore: cast_nullable_to_non_nullable + as String?, + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + htmlUrl: freezed == htmlUrl + ? _self.htmlUrl + : htmlUrl // ignore: cast_nullable_to_non_nullable + as String?, + followersUrl: freezed == followersUrl + ? _self.followersUrl + : followersUrl // ignore: cast_nullable_to_non_nullable + as String?, + followingUrl: freezed == followingUrl + ? _self.followingUrl + : followingUrl // ignore: cast_nullable_to_non_nullable + as String?, + gistsUrl: freezed == gistsUrl + ? _self.gistsUrl + : gistsUrl // ignore: cast_nullable_to_non_nullable + as String?, + starredUrl: freezed == starredUrl + ? _self.starredUrl + : starredUrl // ignore: cast_nullable_to_non_nullable + as String?, + subscriptionsUrl: freezed == subscriptionsUrl + ? _self.subscriptionsUrl + : subscriptionsUrl // ignore: cast_nullable_to_non_nullable + as String?, + organizationsUrl: freezed == organizationsUrl + ? _self.organizationsUrl + : organizationsUrl // ignore: cast_nullable_to_non_nullable + as String?, + reposUrl: freezed == reposUrl + ? _self.reposUrl + : reposUrl // ignore: cast_nullable_to_non_nullable + as String?, + eventsUrl: freezed == eventsUrl + ? _self.eventsUrl + : eventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + receivedEventsUrl: freezed == receivedEventsUrl + ? _self.receivedEventsUrl + : receivedEventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + userViewType: freezed == userViewType + ? _self.userViewType + : userViewType // ignore: cast_nullable_to_non_nullable + as String?, + siteAdmin: freezed == siteAdmin + ? _self.siteAdmin + : siteAdmin // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Uploader implements Uploader { + const _Uploader( + {this.login, this.id, @JsonKey(name: 'node_id') this.nodeId, @JsonKey( + name: 'avatar_url') this.avatarUrl, @JsonKey( + name: 'gravatar_id') this.gravatarId, this.url, @JsonKey( + name: 'html_url') this.htmlUrl, @JsonKey( + name: 'followers_url') this.followersUrl, @JsonKey( + name: 'following_url') this.followingUrl, @JsonKey( + name: 'gists_url') this.gistsUrl, @JsonKey( + name: 'starred_url') this.starredUrl, @JsonKey( + name: 'subscriptions_url') this.subscriptionsUrl, @JsonKey( + name: 'organizations_url') this.organizationsUrl, @JsonKey( + name: 'repos_url') this.reposUrl, @JsonKey( + name: 'events_url') this.eventsUrl, @JsonKey( + name: 'received_events_url') this.receivedEventsUrl, this.type, @JsonKey( + name: 'user_view_type') this.userViewType, @JsonKey( + name: 'site_admin') this.siteAdmin}); + + factory _Uploader.fromJson(Map json) => + _$UploaderFromJson(json); + + @override final String? login; + @override final int? id; + @override + @JsonKey(name: 'node_id') + final String? nodeId; + @override + @JsonKey(name: 'avatar_url') + final String? avatarUrl; + @override + @JsonKey(name: 'gravatar_id') + final String? gravatarId; + @override final String? url; + @override + @JsonKey(name: 'html_url') + final String? htmlUrl; + @override + @JsonKey(name: 'followers_url') + final String? followersUrl; + @override + @JsonKey(name: 'following_url') + final String? followingUrl; + @override + @JsonKey(name: 'gists_url') + final String? gistsUrl; + @override + @JsonKey(name: 'starred_url') + final String? starredUrl; + @override + @JsonKey(name: 'subscriptions_url') + final String? subscriptionsUrl; + @override + @JsonKey(name: 'organizations_url') + final String? organizationsUrl; + @override + @JsonKey(name: 'repos_url') + final String? reposUrl; + @override + @JsonKey(name: 'events_url') + final String? eventsUrl; + @override + @JsonKey(name: 'received_events_url') + final String? receivedEventsUrl; + @override final String? type; + @override + @JsonKey(name: 'user_view_type') + final String? userViewType; + @override + @JsonKey(name: 'site_admin') + final bool? siteAdmin; + + /// Create a copy of Uploader + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UploaderCopyWith<_Uploader> get copyWith => + __$UploaderCopyWithImpl<_Uploader>(this, _$identity); + + @override + Map toJson() { + return _$UploaderToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Uploader && + (identical(other.login, login) || other.login == login) && + (identical(other.id, id) || other.id == id) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.avatarUrl, avatarUrl) || + other.avatarUrl == avatarUrl) && + (identical(other.gravatarId, gravatarId) || + other.gravatarId == gravatarId) && + (identical(other.url, url) || other.url == url) && + (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && + (identical(other.followersUrl, followersUrl) || + other.followersUrl == followersUrl) && + (identical(other.followingUrl, followingUrl) || + other.followingUrl == followingUrl) && + (identical(other.gistsUrl, gistsUrl) || + other.gistsUrl == gistsUrl) && + (identical(other.starredUrl, starredUrl) || + other.starredUrl == starredUrl) && + (identical(other.subscriptionsUrl, subscriptionsUrl) || + other.subscriptionsUrl == subscriptionsUrl) && + (identical(other.organizationsUrl, organizationsUrl) || + other.organizationsUrl == organizationsUrl) && + (identical(other.reposUrl, reposUrl) || + other.reposUrl == reposUrl) && + (identical(other.eventsUrl, eventsUrl) || + other.eventsUrl == eventsUrl) && + (identical(other.receivedEventsUrl, receivedEventsUrl) || + other.receivedEventsUrl == receivedEventsUrl) && + (identical(other.type, type) || other.type == type) && + (identical(other.userViewType, userViewType) || + other.userViewType == userViewType) && + (identical(other.siteAdmin, siteAdmin) || + other.siteAdmin == siteAdmin)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hashAll([ + runtimeType, + login, + id, + nodeId, + avatarUrl, + gravatarId, + url, + htmlUrl, + followersUrl, + followingUrl, + gistsUrl, + starredUrl, + subscriptionsUrl, + organizationsUrl, + reposUrl, + eventsUrl, + receivedEventsUrl, + type, + userViewType, + siteAdmin + ]); + + @override + String toString() { + return 'Uploader(login: $login, id: $id, nodeId: $nodeId, avatarUrl: $avatarUrl, gravatarId: $gravatarId, url: $url, htmlUrl: $htmlUrl, followersUrl: $followersUrl, followingUrl: $followingUrl, gistsUrl: $gistsUrl, starredUrl: $starredUrl, subscriptionsUrl: $subscriptionsUrl, organizationsUrl: $organizationsUrl, reposUrl: $reposUrl, eventsUrl: $eventsUrl, receivedEventsUrl: $receivedEventsUrl, type: $type, userViewType: $userViewType, siteAdmin: $siteAdmin)'; + } + + +} + +/// @nodoc +abstract mixin class _$UploaderCopyWith<$Res> + implements $UploaderCopyWith<$Res> { + factory _$UploaderCopyWith(_Uploader value, + $Res Function(_Uploader) _then) = __$UploaderCopyWithImpl; + + @override + @useResult + $Res call({ + String? login, int? id, @JsonKey(name: 'node_id') String? nodeId, @JsonKey( + name: 'avatar_url') String? avatarUrl, @JsonKey( + name: 'gravatar_id') String? gravatarId, String? url, @JsonKey( + name: 'html_url') String? htmlUrl, @JsonKey( + name: 'followers_url') String? followersUrl, @JsonKey( + name: 'following_url') String? followingUrl, @JsonKey( + name: 'gists_url') String? gistsUrl, @JsonKey( + name: 'starred_url') String? starredUrl, @JsonKey( + name: 'subscriptions_url') String? subscriptionsUrl, @JsonKey( + name: 'organizations_url') String? organizationsUrl, @JsonKey( + name: 'repos_url') String? reposUrl, @JsonKey( + name: 'events_url') String? eventsUrl, @JsonKey( + name: 'received_events_url') String? receivedEventsUrl, String? type, @JsonKey( + name: 'user_view_type') String? userViewType, @JsonKey( + name: 'site_admin') bool? siteAdmin + }); + + +} + +/// @nodoc +class __$UploaderCopyWithImpl<$Res> + implements _$UploaderCopyWith<$Res> { + __$UploaderCopyWithImpl(this._self, this._then); + + final _Uploader _self; + final $Res Function(_Uploader) _then; + + /// Create a copy of Uploader + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? login = freezed, Object? id = freezed, Object? nodeId = freezed, Object? avatarUrl = freezed, Object? gravatarId = freezed, Object? url = freezed, Object? htmlUrl = freezed, Object? followersUrl = freezed, Object? followingUrl = freezed, Object? gistsUrl = freezed, Object? starredUrl = freezed, Object? subscriptionsUrl = freezed, Object? organizationsUrl = freezed, Object? reposUrl = freezed, Object? eventsUrl = freezed, Object? receivedEventsUrl = freezed, Object? type = freezed, Object? userViewType = freezed, Object? siteAdmin = freezed,}) { + return _then(_Uploader( + login: freezed == login + ? _self.login + : login // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + avatarUrl: freezed == avatarUrl + ? _self.avatarUrl + : avatarUrl // ignore: cast_nullable_to_non_nullable + as String?, + gravatarId: freezed == gravatarId + ? _self.gravatarId + : gravatarId // ignore: cast_nullable_to_non_nullable + as String?, + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + htmlUrl: freezed == htmlUrl + ? _self.htmlUrl + : htmlUrl // ignore: cast_nullable_to_non_nullable + as String?, + followersUrl: freezed == followersUrl + ? _self.followersUrl + : followersUrl // ignore: cast_nullable_to_non_nullable + as String?, + followingUrl: freezed == followingUrl + ? _self.followingUrl + : followingUrl // ignore: cast_nullable_to_non_nullable + as String?, + gistsUrl: freezed == gistsUrl + ? _self.gistsUrl + : gistsUrl // ignore: cast_nullable_to_non_nullable + as String?, + starredUrl: freezed == starredUrl + ? _self.starredUrl + : starredUrl // ignore: cast_nullable_to_non_nullable + as String?, + subscriptionsUrl: freezed == subscriptionsUrl + ? _self.subscriptionsUrl + : subscriptionsUrl // ignore: cast_nullable_to_non_nullable + as String?, + organizationsUrl: freezed == organizationsUrl + ? _self.organizationsUrl + : organizationsUrl // ignore: cast_nullable_to_non_nullable + as String?, + reposUrl: freezed == reposUrl + ? _self.reposUrl + : reposUrl // ignore: cast_nullable_to_non_nullable + as String?, + eventsUrl: freezed == eventsUrl + ? _self.eventsUrl + : eventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + receivedEventsUrl: freezed == receivedEventsUrl + ? _self.receivedEventsUrl + : receivedEventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + userViewType: freezed == userViewType + ? _self.userViewType + : userViewType // ignore: cast_nullable_to_non_nullable + as String?, + siteAdmin: freezed == siteAdmin + ? _self.siteAdmin + : siteAdmin // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } + + +} + + +/// @nodoc +mixin _$Author { + + String? get login; + + int? get id; + + @JsonKey(name: 'node_id') String? get nodeId; + + @JsonKey(name: 'avatar_url') String? get avatarUrl; + + @JsonKey(name: 'gravatar_id') String? get gravatarId; + + String? get url; + + @JsonKey(name: 'html_url') String? get htmlUrl; + + @JsonKey(name: 'followers_url') String? get followersUrl; + + @JsonKey(name: 'following_url') String? get followingUrl; + + @JsonKey(name: 'gists_url') String? get gistsUrl; + + @JsonKey(name: 'starred_url') String? get starredUrl; + + @JsonKey(name: 'subscriptions_url') String? get subscriptionsUrl; + + @JsonKey(name: 'organizations_url') String? get organizationsUrl; + + @JsonKey(name: 'repos_url') String? get reposUrl; + + @JsonKey(name: 'events_url') String? get eventsUrl; + + @JsonKey(name: 'received_events_url') String? get receivedEventsUrl; + + String? get type; + + @JsonKey(name: 'user_view_type') String? get userViewType; + + @JsonKey(name: 'site_admin') bool? get siteAdmin; + + /// Create a copy of Author + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AuthorCopyWith get copyWith => + _$AuthorCopyWithImpl(this as Author, _$identity); + + /// Serializes this Author to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Author && + (identical(other.login, login) || other.login == login) && + (identical(other.id, id) || other.id == id) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.avatarUrl, avatarUrl) || + other.avatarUrl == avatarUrl) && + (identical(other.gravatarId, gravatarId) || + other.gravatarId == gravatarId) && + (identical(other.url, url) || other.url == url) && + (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && + (identical(other.followersUrl, followersUrl) || + other.followersUrl == followersUrl) && + (identical(other.followingUrl, followingUrl) || + other.followingUrl == followingUrl) && + (identical(other.gistsUrl, gistsUrl) || + other.gistsUrl == gistsUrl) && + (identical(other.starredUrl, starredUrl) || + other.starredUrl == starredUrl) && + (identical(other.subscriptionsUrl, subscriptionsUrl) || + other.subscriptionsUrl == subscriptionsUrl) && + (identical(other.organizationsUrl, organizationsUrl) || + other.organizationsUrl == organizationsUrl) && + (identical(other.reposUrl, reposUrl) || + other.reposUrl == reposUrl) && + (identical(other.eventsUrl, eventsUrl) || + other.eventsUrl == eventsUrl) && + (identical(other.receivedEventsUrl, receivedEventsUrl) || + other.receivedEventsUrl == receivedEventsUrl) && + (identical(other.type, type) || other.type == type) && + (identical(other.userViewType, userViewType) || + other.userViewType == userViewType) && + (identical(other.siteAdmin, siteAdmin) || + other.siteAdmin == siteAdmin)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hashAll([ + runtimeType, + login, + id, + nodeId, + avatarUrl, + gravatarId, + url, + htmlUrl, + followersUrl, + followingUrl, + gistsUrl, + starredUrl, + subscriptionsUrl, + organizationsUrl, + reposUrl, + eventsUrl, + receivedEventsUrl, + type, + userViewType, + siteAdmin + ]); + + @override + String toString() { + return 'Author(login: $login, id: $id, nodeId: $nodeId, avatarUrl: $avatarUrl, gravatarId: $gravatarId, url: $url, htmlUrl: $htmlUrl, followersUrl: $followersUrl, followingUrl: $followingUrl, gistsUrl: $gistsUrl, starredUrl: $starredUrl, subscriptionsUrl: $subscriptionsUrl, organizationsUrl: $organizationsUrl, reposUrl: $reposUrl, eventsUrl: $eventsUrl, receivedEventsUrl: $receivedEventsUrl, type: $type, userViewType: $userViewType, siteAdmin: $siteAdmin)'; + } + + +} + +/// @nodoc +abstract mixin class $AuthorCopyWith<$Res> { + factory $AuthorCopyWith(Author value, + $Res Function(Author) _then) = _$AuthorCopyWithImpl; + + @useResult + $Res call({ + String? login, int? id, @JsonKey(name: 'node_id') String? nodeId, @JsonKey( + name: 'avatar_url') String? avatarUrl, @JsonKey( + name: 'gravatar_id') String? gravatarId, String? url, @JsonKey( + name: 'html_url') String? htmlUrl, @JsonKey( + name: 'followers_url') String? followersUrl, @JsonKey( + name: 'following_url') String? followingUrl, @JsonKey( + name: 'gists_url') String? gistsUrl, @JsonKey( + name: 'starred_url') String? starredUrl, @JsonKey( + name: 'subscriptions_url') String? subscriptionsUrl, @JsonKey( + name: 'organizations_url') String? organizationsUrl, @JsonKey( + name: 'repos_url') String? reposUrl, @JsonKey( + name: 'events_url') String? eventsUrl, @JsonKey( + name: 'received_events_url') String? receivedEventsUrl, String? type, @JsonKey( + name: 'user_view_type') String? userViewType, @JsonKey( + name: 'site_admin') bool? siteAdmin + }); + + +} + +/// @nodoc +class _$AuthorCopyWithImpl<$Res> + implements $AuthorCopyWith<$Res> { + _$AuthorCopyWithImpl(this._self, this._then); + + final Author _self; + final $Res Function(Author) _then; + + /// Create a copy of Author + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? login = freezed, Object? id = freezed, Object? nodeId = freezed, Object? avatarUrl = freezed, Object? gravatarId = freezed, Object? url = freezed, Object? htmlUrl = freezed, Object? followersUrl = freezed, Object? followingUrl = freezed, Object? gistsUrl = freezed, Object? starredUrl = freezed, Object? subscriptionsUrl = freezed, Object? organizationsUrl = freezed, Object? reposUrl = freezed, Object? eventsUrl = freezed, Object? receivedEventsUrl = freezed, Object? type = freezed, Object? userViewType = freezed, Object? siteAdmin = freezed,}) { + return _then(_self.copyWith( + login: freezed == login + ? _self.login + : login // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + avatarUrl: freezed == avatarUrl + ? _self.avatarUrl + : avatarUrl // ignore: cast_nullable_to_non_nullable + as String?, + gravatarId: freezed == gravatarId + ? _self.gravatarId + : gravatarId // ignore: cast_nullable_to_non_nullable + as String?, + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + htmlUrl: freezed == htmlUrl + ? _self.htmlUrl + : htmlUrl // ignore: cast_nullable_to_non_nullable + as String?, + followersUrl: freezed == followersUrl + ? _self.followersUrl + : followersUrl // ignore: cast_nullable_to_non_nullable + as String?, + followingUrl: freezed == followingUrl + ? _self.followingUrl + : followingUrl // ignore: cast_nullable_to_non_nullable + as String?, + gistsUrl: freezed == gistsUrl + ? _self.gistsUrl + : gistsUrl // ignore: cast_nullable_to_non_nullable + as String?, + starredUrl: freezed == starredUrl + ? _self.starredUrl + : starredUrl // ignore: cast_nullable_to_non_nullable + as String?, + subscriptionsUrl: freezed == subscriptionsUrl + ? _self.subscriptionsUrl + : subscriptionsUrl // ignore: cast_nullable_to_non_nullable + as String?, + organizationsUrl: freezed == organizationsUrl + ? _self.organizationsUrl + : organizationsUrl // ignore: cast_nullable_to_non_nullable + as String?, + reposUrl: freezed == reposUrl + ? _self.reposUrl + : reposUrl // ignore: cast_nullable_to_non_nullable + as String?, + eventsUrl: freezed == eventsUrl + ? _self.eventsUrl + : eventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + receivedEventsUrl: freezed == receivedEventsUrl + ? _self.receivedEventsUrl + : receivedEventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + userViewType: freezed == userViewType + ? _self.userViewType + : userViewType // ignore: cast_nullable_to_non_nullable + as String?, + siteAdmin: freezed == siteAdmin + ? _self.siteAdmin + : siteAdmin // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Author implements Author { + const _Author( + {this.login, this.id, @JsonKey(name: 'node_id') this.nodeId, @JsonKey( + name: 'avatar_url') this.avatarUrl, @JsonKey( + name: 'gravatar_id') this.gravatarId, this.url, @JsonKey( + name: 'html_url') this.htmlUrl, @JsonKey( + name: 'followers_url') this.followersUrl, @JsonKey( + name: 'following_url') this.followingUrl, @JsonKey( + name: 'gists_url') this.gistsUrl, @JsonKey( + name: 'starred_url') this.starredUrl, @JsonKey( + name: 'subscriptions_url') this.subscriptionsUrl, @JsonKey( + name: 'organizations_url') this.organizationsUrl, @JsonKey( + name: 'repos_url') this.reposUrl, @JsonKey( + name: 'events_url') this.eventsUrl, @JsonKey( + name: 'received_events_url') this.receivedEventsUrl, this.type, @JsonKey( + name: 'user_view_type') this.userViewType, @JsonKey( + name: 'site_admin') this.siteAdmin}); + + factory _Author.fromJson(Map json) => _$AuthorFromJson(json); + + @override final String? login; + @override final int? id; + @override + @JsonKey(name: 'node_id') + final String? nodeId; + @override + @JsonKey(name: 'avatar_url') + final String? avatarUrl; + @override + @JsonKey(name: 'gravatar_id') + final String? gravatarId; + @override final String? url; + @override + @JsonKey(name: 'html_url') + final String? htmlUrl; + @override + @JsonKey(name: 'followers_url') + final String? followersUrl; + @override + @JsonKey(name: 'following_url') + final String? followingUrl; + @override + @JsonKey(name: 'gists_url') + final String? gistsUrl; + @override + @JsonKey(name: 'starred_url') + final String? starredUrl; + @override + @JsonKey(name: 'subscriptions_url') + final String? subscriptionsUrl; + @override + @JsonKey(name: 'organizations_url') + final String? organizationsUrl; + @override + @JsonKey(name: 'repos_url') + final String? reposUrl; + @override + @JsonKey(name: 'events_url') + final String? eventsUrl; + @override + @JsonKey(name: 'received_events_url') + final String? receivedEventsUrl; + @override final String? type; + @override + @JsonKey(name: 'user_view_type') + final String? userViewType; + @override + @JsonKey(name: 'site_admin') + final bool? siteAdmin; + + /// Create a copy of Author + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$AuthorCopyWith<_Author> get copyWith => + __$AuthorCopyWithImpl<_Author>(this, _$identity); + + @override + Map toJson() { + return _$AuthorToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Author && + (identical(other.login, login) || other.login == login) && + (identical(other.id, id) || other.id == id) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.avatarUrl, avatarUrl) || + other.avatarUrl == avatarUrl) && + (identical(other.gravatarId, gravatarId) || + other.gravatarId == gravatarId) && + (identical(other.url, url) || other.url == url) && + (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && + (identical(other.followersUrl, followersUrl) || + other.followersUrl == followersUrl) && + (identical(other.followingUrl, followingUrl) || + other.followingUrl == followingUrl) && + (identical(other.gistsUrl, gistsUrl) || + other.gistsUrl == gistsUrl) && + (identical(other.starredUrl, starredUrl) || + other.starredUrl == starredUrl) && + (identical(other.subscriptionsUrl, subscriptionsUrl) || + other.subscriptionsUrl == subscriptionsUrl) && + (identical(other.organizationsUrl, organizationsUrl) || + other.organizationsUrl == organizationsUrl) && + (identical(other.reposUrl, reposUrl) || + other.reposUrl == reposUrl) && + (identical(other.eventsUrl, eventsUrl) || + other.eventsUrl == eventsUrl) && + (identical(other.receivedEventsUrl, receivedEventsUrl) || + other.receivedEventsUrl == receivedEventsUrl) && + (identical(other.type, type) || other.type == type) && + (identical(other.userViewType, userViewType) || + other.userViewType == userViewType) && + (identical(other.siteAdmin, siteAdmin) || + other.siteAdmin == siteAdmin)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hashAll([ + runtimeType, + login, + id, + nodeId, + avatarUrl, + gravatarId, + url, + htmlUrl, + followersUrl, + followingUrl, + gistsUrl, + starredUrl, + subscriptionsUrl, + organizationsUrl, + reposUrl, + eventsUrl, + receivedEventsUrl, + type, + userViewType, + siteAdmin + ]); + + @override + String toString() { + return 'Author(login: $login, id: $id, nodeId: $nodeId, avatarUrl: $avatarUrl, gravatarId: $gravatarId, url: $url, htmlUrl: $htmlUrl, followersUrl: $followersUrl, followingUrl: $followingUrl, gistsUrl: $gistsUrl, starredUrl: $starredUrl, subscriptionsUrl: $subscriptionsUrl, organizationsUrl: $organizationsUrl, reposUrl: $reposUrl, eventsUrl: $eventsUrl, receivedEventsUrl: $receivedEventsUrl, type: $type, userViewType: $userViewType, siteAdmin: $siteAdmin)'; + } + + +} + +/// @nodoc +abstract mixin class _$AuthorCopyWith<$Res> implements $AuthorCopyWith<$Res> { + factory _$AuthorCopyWith(_Author value, + $Res Function(_Author) _then) = __$AuthorCopyWithImpl; + + @override + @useResult + $Res call({ + String? login, int? id, @JsonKey(name: 'node_id') String? nodeId, @JsonKey( + name: 'avatar_url') String? avatarUrl, @JsonKey( + name: 'gravatar_id') String? gravatarId, String? url, @JsonKey( + name: 'html_url') String? htmlUrl, @JsonKey( + name: 'followers_url') String? followersUrl, @JsonKey( + name: 'following_url') String? followingUrl, @JsonKey( + name: 'gists_url') String? gistsUrl, @JsonKey( + name: 'starred_url') String? starredUrl, @JsonKey( + name: 'subscriptions_url') String? subscriptionsUrl, @JsonKey( + name: 'organizations_url') String? organizationsUrl, @JsonKey( + name: 'repos_url') String? reposUrl, @JsonKey( + name: 'events_url') String? eventsUrl, @JsonKey( + name: 'received_events_url') String? receivedEventsUrl, String? type, @JsonKey( + name: 'user_view_type') String? userViewType, @JsonKey( + name: 'site_admin') bool? siteAdmin + }); + + +} + +/// @nodoc +class __$AuthorCopyWithImpl<$Res> + implements _$AuthorCopyWith<$Res> { + __$AuthorCopyWithImpl(this._self, this._then); + + final _Author _self; + final $Res Function(_Author) _then; + + /// Create a copy of Author + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? login = freezed, Object? id = freezed, Object? nodeId = freezed, Object? avatarUrl = freezed, Object? gravatarId = freezed, Object? url = freezed, Object? htmlUrl = freezed, Object? followersUrl = freezed, Object? followingUrl = freezed, Object? gistsUrl = freezed, Object? starredUrl = freezed, Object? subscriptionsUrl = freezed, Object? organizationsUrl = freezed, Object? reposUrl = freezed, Object? eventsUrl = freezed, Object? receivedEventsUrl = freezed, Object? type = freezed, Object? userViewType = freezed, Object? siteAdmin = freezed,}) { + return _then(_Author( + login: freezed == login + ? _self.login + : login // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + avatarUrl: freezed == avatarUrl + ? _self.avatarUrl + : avatarUrl // ignore: cast_nullable_to_non_nullable + as String?, + gravatarId: freezed == gravatarId + ? _self.gravatarId + : gravatarId // ignore: cast_nullable_to_non_nullable + as String?, + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + htmlUrl: freezed == htmlUrl + ? _self.htmlUrl + : htmlUrl // ignore: cast_nullable_to_non_nullable + as String?, + followersUrl: freezed == followersUrl + ? _self.followersUrl + : followersUrl // ignore: cast_nullable_to_non_nullable + as String?, + followingUrl: freezed == followingUrl + ? _self.followingUrl + : followingUrl // ignore: cast_nullable_to_non_nullable + as String?, + gistsUrl: freezed == gistsUrl + ? _self.gistsUrl + : gistsUrl // ignore: cast_nullable_to_non_nullable + as String?, + starredUrl: freezed == starredUrl + ? _self.starredUrl + : starredUrl // ignore: cast_nullable_to_non_nullable + as String?, + subscriptionsUrl: freezed == subscriptionsUrl + ? _self.subscriptionsUrl + : subscriptionsUrl // ignore: cast_nullable_to_non_nullable + as String?, + organizationsUrl: freezed == organizationsUrl + ? _self.organizationsUrl + : organizationsUrl // ignore: cast_nullable_to_non_nullable + as String?, + reposUrl: freezed == reposUrl + ? _self.reposUrl + : reposUrl // ignore: cast_nullable_to_non_nullable + as String?, + eventsUrl: freezed == eventsUrl + ? _self.eventsUrl + : eventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + receivedEventsUrl: freezed == receivedEventsUrl + ? _self.receivedEventsUrl + : receivedEventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + userViewType: freezed == userViewType + ? _self.userViewType + : userViewType // ignore: cast_nullable_to_non_nullable + as String?, + siteAdmin: freezed == siteAdmin + ? _self.siteAdmin + : siteAdmin // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } + + +} + +// dart format on diff --git a/lib/common/models/github.g.dart b/lib/common/models/github.g.dart new file mode 100644 index 0000000..55c4a06 --- /dev/null +++ b/lib/common/models/github.g.dart @@ -0,0 +1,183 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'github.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_GithubRelease _$GithubReleaseFromJson(Map json) => + _GithubRelease( + url: json['url'] as String?, + assetsUrl: json['assets_url'] as String?, + uploadUrl: json['upload_url'] as String?, + htmlUrl: json['html_url'] as String?, + id: (json['id'] as num?)?.toInt(), + author: + json['author'] == null + ? null + : Author.fromJson(json['author'] as Map), + nodeId: json['node_id'] as String?, + tagName: json['tag_name'] as String?, + targetCommitish: json['target_commitish'] as String?, + name: json['name'] as String?, + draft: json['draft'] as bool?, + prerelease: json['prerelease'] as bool?, + createdAt: json['created_at'] as String?, + publishedAt: json['published_at'] as String?, + assets: + (json['assets'] as List?) + ?.map((e) => Assets.fromJson(e as Map)) + .toList(), + tarballUrl: json['tarball_url'] as String?, + zipballUrl: json['zipball_url'] as String?, + body: json['body'] as String?, + ); + +Map _$GithubReleaseToJson(_GithubRelease instance) => + { + if (instance.url case final value?) 'url': value, + if (instance.assetsUrl case final value?) 'assets_url': value, + if (instance.uploadUrl case final value?) 'upload_url': value, + if (instance.htmlUrl case final value?) 'html_url': value, + if (instance.id case final value?) 'id': value, + if (instance.author case final value?) 'author': value, + if (instance.nodeId case final value?) 'node_id': value, + if (instance.tagName case final value?) 'tag_name': value, + if (instance.targetCommitish case final value?) 'target_commitish': value, + if (instance.name case final value?) 'name': value, + if (instance.draft case final value?) 'draft': value, + if (instance.prerelease case final value?) 'prerelease': value, + if (instance.createdAt case final value?) 'created_at': value, + if (instance.publishedAt case final value?) 'published_at': value, + if (instance.assets case final value?) 'assets': value, + if (instance.tarballUrl case final value?) 'tarball_url': value, + if (instance.zipballUrl case final value?) 'zipball_url': value, + if (instance.body case final value?) 'body': value, + }; + +_Assets _$AssetsFromJson(Map json) => _Assets( + url: json['url'] as String?, + id: (json['id'] as num?)?.toInt(), + nodeId: json['node_id'] as String?, + name: json['name'] as String?, + label: json['label'], + uploader: + json['uploader'] == null + ? null + : Uploader.fromJson(json['uploader'] as Map), + contentType: json['content_type'] as String?, + state: json['state'] as String?, + size: (json['size'] as num?)?.toInt(), + downloadCount: (json['download_count'] as num?)?.toInt(), + createdAt: json['created_at'] as String?, + updatedAt: json['updated_at'] as String?, + browserDownloadUrl: json['browser_download_url'] as String?, +); + +Map _$AssetsToJson(_Assets instance) => { + if (instance.url case final value?) 'url': value, + if (instance.id case final value?) 'id': value, + if (instance.nodeId case final value?) 'node_id': value, + if (instance.name case final value?) 'name': value, + if (instance.label case final value?) 'label': value, + if (instance.uploader case final value?) 'uploader': value, + if (instance.contentType case final value?) 'content_type': value, + if (instance.state case final value?) 'state': value, + if (instance.size case final value?) 'size': value, + if (instance.downloadCount case final value?) 'download_count': value, + if (instance.createdAt case final value?) 'created_at': value, + if (instance.updatedAt case final value?) 'updated_at': value, + if (instance.browserDownloadUrl case final value?) + 'browser_download_url': value, +}; + +_Uploader _$UploaderFromJson(Map json) => _Uploader( + login: json['login'] as String?, + id: (json['id'] as num?)?.toInt(), + nodeId: json['node_id'] as String?, + avatarUrl: json['avatar_url'] as String?, + gravatarId: json['gravatar_id'] as String?, + url: json['url'] as String?, + htmlUrl: json['html_url'] as String?, + followersUrl: json['followers_url'] as String?, + followingUrl: json['following_url'] as String?, + gistsUrl: json['gists_url'] as String?, + starredUrl: json['starred_url'] as String?, + subscriptionsUrl: json['subscriptions_url'] as String?, + organizationsUrl: json['organizations_url'] as String?, + reposUrl: json['repos_url'] as String?, + eventsUrl: json['events_url'] as String?, + receivedEventsUrl: json['received_events_url'] as String?, + type: json['type'] as String?, + userViewType: json['user_view_type'] as String?, + siteAdmin: json['site_admin'] as bool?, +); + +Map _$UploaderToJson(_Uploader instance) => { + if (instance.login case final value?) 'login': value, + if (instance.id case final value?) 'id': value, + if (instance.nodeId case final value?) 'node_id': value, + if (instance.avatarUrl case final value?) 'avatar_url': value, + if (instance.gravatarId case final value?) 'gravatar_id': value, + if (instance.url case final value?) 'url': value, + if (instance.htmlUrl case final value?) 'html_url': value, + if (instance.followersUrl case final value?) 'followers_url': value, + if (instance.followingUrl case final value?) 'following_url': value, + if (instance.gistsUrl case final value?) 'gists_url': value, + if (instance.starredUrl case final value?) 'starred_url': value, + if (instance.subscriptionsUrl case final value?) 'subscriptions_url': value, + if (instance.organizationsUrl case final value?) 'organizations_url': value, + if (instance.reposUrl case final value?) 'repos_url': value, + if (instance.eventsUrl case final value?) 'events_url': value, + if (instance.receivedEventsUrl case final value?) + 'received_events_url': value, + if (instance.type case final value?) 'type': value, + if (instance.userViewType case final value?) 'user_view_type': value, + if (instance.siteAdmin case final value?) 'site_admin': value, +}; + +_Author _$AuthorFromJson(Map json) => _Author( + login: json['login'] as String?, + id: (json['id'] as num?)?.toInt(), + nodeId: json['node_id'] as String?, + avatarUrl: json['avatar_url'] as String?, + gravatarId: json['gravatar_id'] as String?, + url: json['url'] as String?, + htmlUrl: json['html_url'] as String?, + followersUrl: json['followers_url'] as String?, + followingUrl: json['following_url'] as String?, + gistsUrl: json['gists_url'] as String?, + starredUrl: json['starred_url'] as String?, + subscriptionsUrl: json['subscriptions_url'] as String?, + organizationsUrl: json['organizations_url'] as String?, + reposUrl: json['repos_url'] as String?, + eventsUrl: json['events_url'] as String?, + receivedEventsUrl: json['received_events_url'] as String?, + type: json['type'] as String?, + userViewType: json['user_view_type'] as String?, + siteAdmin: json['site_admin'] as bool?, +); + +Map _$AuthorToJson(_Author instance) => { + if (instance.login case final value?) 'login': value, + if (instance.id case final value?) 'id': value, + if (instance.nodeId case final value?) 'node_id': value, + if (instance.avatarUrl case final value?) 'avatar_url': value, + if (instance.gravatarId case final value?) 'gravatar_id': value, + if (instance.url case final value?) 'url': value, + if (instance.htmlUrl case final value?) 'html_url': value, + if (instance.followersUrl case final value?) 'followers_url': value, + if (instance.followingUrl case final value?) 'following_url': value, + if (instance.gistsUrl case final value?) 'gists_url': value, + if (instance.starredUrl case final value?) 'starred_url': value, + if (instance.subscriptionsUrl case final value?) 'subscriptions_url': value, + if (instance.organizationsUrl case final value?) 'organizations_url': value, + if (instance.reposUrl case final value?) 'repos_url': value, + if (instance.eventsUrl case final value?) 'events_url': value, + if (instance.receivedEventsUrl case final value?) + 'received_events_url': value, + if (instance.type case final value?) 'type': value, + if (instance.userViewType case final value?) 'user_view_type': value, + if (instance.siteAdmin case final value?) 'site_admin': value, +}; diff --git a/lib/common/models/hitokoto.dart b/lib/common/models/hitokoto.dart index 1ea54a5..2a4fe0f 100644 --- a/lib/common/models/hitokoto.dart +++ b/lib/common/models/hitokoto.dart @@ -1,61 +1,25 @@ -class HitokotoResponse { - int? id; - String? uuid; - String? hitokoto; - String? type; - String? from; - String? fromWho; - String? creator; - int? creatorUid; - int? reviewer; - String? commitFrom; - String? createdAt; - int? length; +import 'package:freezed_annotation/freezed_annotation.dart'; - HitokotoResponse({ - this.id, - this.uuid, - this.hitokoto, - this.type, - this.from, - this.fromWho, - this.creator, - this.creatorUid, - this.reviewer, - this.commitFrom, - this.createdAt, - this.length, - }); +part 'hitokoto.freezed.dart'; +part 'hitokoto.g.dart'; - HitokotoResponse.fromJson(Map json) { - id = json["id"]; - uuid = json["uuid"]; - hitokoto = json["hitokoto"]; - type = json["type"]; - from = json["from"]; - fromWho = json["from_who"]; - creator = json["creator"]; - creatorUid = json["creator_uid"]; - reviewer = json["reviewer"]; - commitFrom = json["commit_from"]; - createdAt = json["created_at"]; - length = json["length"]; - } +@freezed +abstract class HitokotoResponse with _$HitokotoResponse { + const factory HitokotoResponse({ + int? id, + String? uuid, + String? hitokoto, + String? type, + String? from, + @JsonKey(name: 'from_who') String? fromWho, + String? creator, + @JsonKey(name: 'creator_uid') int? creatorUid, + int? reviewer, + @JsonKey(name: 'commit_from') String? commitFrom, + @JsonKey(name: 'created_at') String? createdAt, + int? length, + }) = _HitokotoResponse; - Map toJson() { - final Map data = {}; - data["id"] = id; - data["uuid"] = uuid; - data["hitokoto"] = hitokoto; - data["type"] = type; - data["from"] = from; - data["from_who"] = fromWho; - data["creator"] = creator; - data["creator_uid"] = creatorUid; - data["reviewer"] = reviewer; - data["commit_from"] = commitFrom; - data["created_at"] = createdAt; - data["length"] = length; - return data; - } + factory HitokotoResponse.fromJson(Map json) => + _$HitokotoResponseFromJson(json); } diff --git a/lib/common/models/hitokoto.freezed.dart b/lib/common/models/hitokoto.freezed.dart new file mode 100644 index 0000000..9d84cfe --- /dev/null +++ b/lib/common/models/hitokoto.freezed.dart @@ -0,0 +1,370 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'hitokoto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$HitokotoResponse { + + int? get id; + + String? get uuid; + + String? get hitokoto; + + String? get type; + + String? get from; + + @JsonKey(name: 'from_who') String? get fromWho; + + String? get creator; + + @JsonKey(name: 'creator_uid') int? get creatorUid; + + int? get reviewer; + + @JsonKey(name: 'commit_from') String? get commitFrom; + + @JsonKey(name: 'created_at') String? get createdAt; + + int? get length; + + /// Create a copy of HitokotoResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $HitokotoResponseCopyWith get copyWith => + _$HitokotoResponseCopyWithImpl( + this as HitokotoResponse, _$identity); + + /// Serializes this HitokotoResponse to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is HitokotoResponse && + (identical(other.id, id) || other.id == id) && + (identical(other.uuid, uuid) || other.uuid == uuid) && + (identical(other.hitokoto, hitokoto) || + other.hitokoto == hitokoto) && + (identical(other.type, type) || other.type == type) && + (identical(other.from, from) || other.from == from) && + (identical(other.fromWho, fromWho) || other.fromWho == fromWho) && + (identical(other.creator, creator) || other.creator == creator) && + (identical(other.creatorUid, creatorUid) || + other.creatorUid == creatorUid) && + (identical(other.reviewer, reviewer) || + other.reviewer == reviewer) && + (identical(other.commitFrom, commitFrom) || + other.commitFrom == commitFrom) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.length, length) || other.length == length)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + id, + uuid, + hitokoto, + type, + from, + fromWho, + creator, + creatorUid, + reviewer, + commitFrom, + createdAt, + length); + + @override + String toString() { + return 'HitokotoResponse(id: $id, uuid: $uuid, hitokoto: $hitokoto, type: $type, from: $from, fromWho: $fromWho, creator: $creator, creatorUid: $creatorUid, reviewer: $reviewer, commitFrom: $commitFrom, createdAt: $createdAt, length: $length)'; + } + + +} + +/// @nodoc +abstract mixin class $HitokotoResponseCopyWith<$Res> { + factory $HitokotoResponseCopyWith(HitokotoResponse value, + $Res Function(HitokotoResponse) _then) = _$HitokotoResponseCopyWithImpl; + + @useResult + $Res call({ + int? id, String? uuid, String? hitokoto, String? type, String? from, @JsonKey( + name: 'from_who') String? fromWho, String? creator, @JsonKey( + name: 'creator_uid') int? creatorUid, int? reviewer, @JsonKey( + name: 'commit_from') String? commitFrom, @JsonKey( + name: 'created_at') String? createdAt, int? length + }); + + +} + +/// @nodoc +class _$HitokotoResponseCopyWithImpl<$Res> + implements $HitokotoResponseCopyWith<$Res> { + _$HitokotoResponseCopyWithImpl(this._self, this._then); + + final HitokotoResponse _self; + final $Res Function(HitokotoResponse) _then; + + /// Create a copy of HitokotoResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? id = freezed, Object? uuid = freezed, Object? hitokoto = freezed, Object? type = freezed, Object? from = freezed, Object? fromWho = freezed, Object? creator = freezed, Object? creatorUid = freezed, Object? reviewer = freezed, Object? commitFrom = freezed, Object? createdAt = freezed, Object? length = freezed,}) { + return _then(_self.copyWith( + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + uuid: freezed == uuid + ? _self.uuid + : uuid // ignore: cast_nullable_to_non_nullable + as String?, + hitokoto: freezed == hitokoto + ? _self.hitokoto + : hitokoto // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + from: freezed == from + ? _self.from + : from // ignore: cast_nullable_to_non_nullable + as String?, + fromWho: freezed == fromWho + ? _self.fromWho + : fromWho // ignore: cast_nullable_to_non_nullable + as String?, + creator: freezed == creator + ? _self.creator + : creator // ignore: cast_nullable_to_non_nullable + as String?, + creatorUid: freezed == creatorUid + ? _self.creatorUid + : creatorUid // ignore: cast_nullable_to_non_nullable + as int?, + reviewer: freezed == reviewer + ? _self.reviewer + : reviewer // ignore: cast_nullable_to_non_nullable + as int?, + commitFrom: freezed == commitFrom + ? _self.commitFrom + : commitFrom // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as String?, + length: freezed == length + ? _self.length + : length // ignore: cast_nullable_to_non_nullable + as int?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _HitokotoResponse implements HitokotoResponse { + const _HitokotoResponse( + {this.id, this.uuid, this.hitokoto, this.type, this.from, @JsonKey( + name: 'from_who') this.fromWho, this.creator, @JsonKey( + name: 'creator_uid') this.creatorUid, this.reviewer, @JsonKey( + name: 'commit_from') this.commitFrom, @JsonKey( + name: 'created_at') this.createdAt, this.length}); + + factory _HitokotoResponse.fromJson(Map json) => + _$HitokotoResponseFromJson(json); + + @override final int? id; + @override final String? uuid; + @override final String? hitokoto; + @override final String? type; + @override final String? from; + @override + @JsonKey(name: 'from_who') + final String? fromWho; + @override final String? creator; + @override + @JsonKey(name: 'creator_uid') + final int? creatorUid; + @override final int? reviewer; + @override + @JsonKey(name: 'commit_from') + final String? commitFrom; + @override + @JsonKey(name: 'created_at') + final String? createdAt; + @override final int? length; + + /// Create a copy of HitokotoResponse + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$HitokotoResponseCopyWith<_HitokotoResponse> get copyWith => + __$HitokotoResponseCopyWithImpl<_HitokotoResponse>(this, _$identity); + + @override + Map toJson() { + return _$HitokotoResponseToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _HitokotoResponse && + (identical(other.id, id) || other.id == id) && + (identical(other.uuid, uuid) || other.uuid == uuid) && + (identical(other.hitokoto, hitokoto) || + other.hitokoto == hitokoto) && + (identical(other.type, type) || other.type == type) && + (identical(other.from, from) || other.from == from) && + (identical(other.fromWho, fromWho) || other.fromWho == fromWho) && + (identical(other.creator, creator) || other.creator == creator) && + (identical(other.creatorUid, creatorUid) || + other.creatorUid == creatorUid) && + (identical(other.reviewer, reviewer) || + other.reviewer == reviewer) && + (identical(other.commitFrom, commitFrom) || + other.commitFrom == commitFrom) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.length, length) || other.length == length)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + id, + uuid, + hitokoto, + type, + from, + fromWho, + creator, + creatorUid, + reviewer, + commitFrom, + createdAt, + length); + + @override + String toString() { + return 'HitokotoResponse(id: $id, uuid: $uuid, hitokoto: $hitokoto, type: $type, from: $from, fromWho: $fromWho, creator: $creator, creatorUid: $creatorUid, reviewer: $reviewer, commitFrom: $commitFrom, createdAt: $createdAt, length: $length)'; + } + + +} + +/// @nodoc +abstract mixin class _$HitokotoResponseCopyWith<$Res> + implements $HitokotoResponseCopyWith<$Res> { + factory _$HitokotoResponseCopyWith(_HitokotoResponse value, + $Res Function(_HitokotoResponse) _then) = __$HitokotoResponseCopyWithImpl; + + @override + @useResult + $Res call({ + int? id, String? uuid, String? hitokoto, String? type, String? from, @JsonKey( + name: 'from_who') String? fromWho, String? creator, @JsonKey( + name: 'creator_uid') int? creatorUid, int? reviewer, @JsonKey( + name: 'commit_from') String? commitFrom, @JsonKey( + name: 'created_at') String? createdAt, int? length + }); + + +} + +/// @nodoc +class __$HitokotoResponseCopyWithImpl<$Res> + implements _$HitokotoResponseCopyWith<$Res> { + __$HitokotoResponseCopyWithImpl(this._self, this._then); + + final _HitokotoResponse _self; + final $Res Function(_HitokotoResponse) _then; + + /// Create a copy of HitokotoResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? id = freezed, Object? uuid = freezed, Object? hitokoto = freezed, Object? type = freezed, Object? from = freezed, Object? fromWho = freezed, Object? creator = freezed, Object? creatorUid = freezed, Object? reviewer = freezed, Object? commitFrom = freezed, Object? createdAt = freezed, Object? length = freezed,}) { + return _then(_HitokotoResponse( + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + uuid: freezed == uuid + ? _self.uuid + : uuid // ignore: cast_nullable_to_non_nullable + as String?, + hitokoto: freezed == hitokoto + ? _self.hitokoto + : hitokoto // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + from: freezed == from + ? _self.from + : from // ignore: cast_nullable_to_non_nullable + as String?, + fromWho: freezed == fromWho + ? _self.fromWho + : fromWho // ignore: cast_nullable_to_non_nullable + as String?, + creator: freezed == creator + ? _self.creator + : creator // ignore: cast_nullable_to_non_nullable + as String?, + creatorUid: freezed == creatorUid + ? _self.creatorUid + : creatorUid // ignore: cast_nullable_to_non_nullable + as int?, + reviewer: freezed == reviewer + ? _self.reviewer + : reviewer // ignore: cast_nullable_to_non_nullable + as int?, + commitFrom: freezed == commitFrom + ? _self.commitFrom + : commitFrom // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as String?, + length: freezed == length + ? _self.length + : length // ignore: cast_nullable_to_non_nullable + as int?, + )); + } + + +} + +// dart format on diff --git a/lib/common/models/hitokoto.g.dart b/lib/common/models/hitokoto.g.dart new file mode 100644 index 0000000..2b59034 --- /dev/null +++ b/lib/common/models/hitokoto.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'hitokoto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_HitokotoResponse _$HitokotoResponseFromJson(Map json) => + _HitokotoResponse( + id: (json['id'] as num?)?.toInt(), + uuid: json['uuid'] as String?, + hitokoto: json['hitokoto'] as String?, + type: json['type'] as String?, + from: json['from'] as String?, + fromWho: json['from_who'] as String?, + creator: json['creator'] as String?, + creatorUid: (json['creator_uid'] as num?)?.toInt(), + reviewer: (json['reviewer'] as num?)?.toInt(), + commitFrom: json['commit_from'] as String?, + createdAt: json['created_at'] as String?, + length: (json['length'] as num?)?.toInt(), + ); + +Map _$HitokotoResponseToJson(_HitokotoResponse instance) => + { + if (instance.id case final value?) 'id': value, + if (instance.uuid case final value?) 'uuid': value, + if (instance.hitokoto case final value?) 'hitokoto': value, + if (instance.type case final value?) 'type': value, + if (instance.from case final value?) 'from': value, + if (instance.fromWho case final value?) 'from_who': value, + if (instance.creator case final value?) 'creator': value, + if (instance.creatorUid case final value?) 'creator_uid': value, + if (instance.reviewer case final value?) 'reviewer': value, + if (instance.commitFrom case final value?) 'commit_from': value, + if (instance.createdAt case final value?) 'created_at': value, + if (instance.length case final value?) 'length': value, + }; diff --git a/lib/common/models/hunyuan.dart b/lib/common/models/hunyuan.dart index fddbf83..f05655e 100644 --- a/lib/common/models/hunyuan.dart +++ b/lib/common/models/hunyuan.dart @@ -1,139 +1,74 @@ -class PublicHeader { - String? action; - int? timestamp; - String? version; - String? authorization; +import 'package:freezed_annotation/freezed_annotation.dart'; - Map toMap() { - return { - 'X-TC-Action': action, - 'X-TC-Timestamp': timestamp, - 'X-TC-Version': version, - 'Authorization': authorization, - }; - } +part 'hunyuan.freezed.dart'; +part 'hunyuan.g.dart'; - PublicHeader.fromMap(Map map) { - action = map['X-TC-Action']; - timestamp = map['X-TC-Timestamp']; - version = map['X-TC-Version']; - authorization = map['Authorization']; - } +@freezed +abstract class PublicHeader with _$PublicHeader { + const factory PublicHeader({ + @JsonKey(name: 'X-TC-Action') String? action, + @JsonKey(name: 'X-TC-Timestamp') int? timestamp, + @JsonKey(name: 'X-TC-Version') String? version, + @JsonKey(name: 'Authorization') String? authorization, + }) = _PublicHeader; - PublicHeader(this.action, this.timestamp, this.version, this.authorization); + factory PublicHeader.fromJson(Map json) => + _$PublicHeaderFromJson(json); } -class Message { - late String role; - late String content; +@freezed +abstract class Message with _$Message { + const factory Message({ + @JsonKey(name: 'Role') required String role, + @JsonKey(name: 'Content') required String content, + }) = _Message; - Message(this.role, this.content); - - Map toMap() { - return {'Role': role, 'Content': content}; - } - - Message.fromMap(Map map) { - role = map['Role']; - content = map['Content']; - } + factory Message.fromJson(Map json) => + _$MessageFromJson(json); } -class HunyuanResponse { - String? note; - List? choices; - int? created; - String? id; - Usage? usage; +@freezed +abstract class HunyuanResponse with _$HunyuanResponse { + const factory HunyuanResponse({ + @JsonKey(name: 'Note') String? note, + @JsonKey(name: 'Choices') List? choices, + @JsonKey(name: 'Created') int? created, + @JsonKey(name: 'Id') String? id, + @JsonKey(name: 'Usage') Usage? usage, + }) = _HunyuanResponse; - HunyuanResponse({this.note, this.choices, this.created, this.id, this.usage}); - - HunyuanResponse.fromJson(Map json) { - note = json["Note"]; - choices = - json["Choices"] == null - ? null - : (json["Choices"] as List) - .map((e) => Choices.fromJson(e)) - .toList(); - created = json["Created"]; - id = json["Id"]; - usage = json["Usage"] == null ? null : Usage.fromJson(json["Usage"]); - } - - Map toJson() { - final Map data = {}; - data["Note"] = note; - if (choices != null) { - data["Choices"] = choices?.map((e) => e.toJson()).toList(); - } - data["Created"] = created; - data["Id"] = id; - if (usage != null) { - data["Usage"] = usage?.toJson(); - } - return data; - } + factory HunyuanResponse.fromJson(Map json) => + _$HunyuanResponseFromJson(json); } -class Usage { - int? promptTokens; - int? completionTokens; - int? totalTokens; +@freezed +abstract class Usage with _$Usage { + const factory Usage({ + @JsonKey(name: 'PromptTokens') int? promptTokens, + @JsonKey(name: 'CompletionTokens') int? completionTokens, + @JsonKey(name: 'TotalTokens') int? totalTokens, + }) = _Usage; - Usage({this.promptTokens, this.completionTokens, this.totalTokens}); - - Usage.fromJson(Map json) { - promptTokens = json["PromptTokens"]; - completionTokens = json["CompletionTokens"]; - totalTokens = json["TotalTokens"]; - } - - Map toJson() { - final Map data = {}; - data["PromptTokens"] = promptTokens; - data["CompletionTokens"] = completionTokens; - data["TotalTokens"] = totalTokens; - return data; - } + factory Usage.fromJson(Map json) => _$UsageFromJson(json); } -class Choices { - String? finishReason; - Delta? delta; +@freezed +abstract class Choices with _$Choices { + const factory Choices({ + @JsonKey(name: 'FinishReason') String? finishReason, + @JsonKey(name: 'Delta') Delta? delta, + }) = _Choices; - Choices({this.finishReason, this.delta}); - - Choices.fromJson(Map json) { - finishReason = json["FinishReason"]; - delta = json["Delta"] == null ? null : Delta.fromJson(json["Delta"]); - } - - Map toJson() { - final Map data = {}; - data["FinishReason"] = finishReason; - if (delta != null) { - data["Delta"] = delta?.toJson(); - } - return data; - } + factory Choices.fromJson(Map json) => + _$ChoicesFromJson(json); } -class Delta { - String? role; - String? content; +@freezed +abstract class Delta with _$Delta { + const factory Delta({ + @JsonKey(name: 'Role') String? role, + @JsonKey(name: 'Content') String? content, + }) = _Delta; - Delta({this.role, this.content}); - - Delta.fromJson(Map json) { - role = json["Role"]; - content = json["Content"]; - } - - Map toJson() { - final Map data = {}; - data["Role"] = role; - data["Content"] = content; - return data; - } + factory Delta.fromJson(Map json) => _$DeltaFromJson(json); } diff --git a/lib/common/models/hunyuan.freezed.dart b/lib/common/models/hunyuan.freezed.dart new file mode 100644 index 0000000..ea8215b --- /dev/null +++ b/lib/common/models/hunyuan.freezed.dart @@ -0,0 +1,1250 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'hunyuan.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$PublicHeader { + + @JsonKey(name: 'X-TC-Action') String? get action; + + @JsonKey(name: 'X-TC-Timestamp') int? get timestamp; + + @JsonKey(name: 'X-TC-Version') String? get version; + + @JsonKey(name: 'Authorization') String? get authorization; + + /// Create a copy of PublicHeader + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PublicHeaderCopyWith get copyWith => + _$PublicHeaderCopyWithImpl( + this as PublicHeader, _$identity); + + /// Serializes this PublicHeader to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is PublicHeader && + (identical(other.action, action) || other.action == action) && + (identical(other.timestamp, timestamp) || + other.timestamp == timestamp) && + (identical(other.version, version) || other.version == version) && + (identical(other.authorization, authorization) || + other.authorization == authorization)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, action, timestamp, version, authorization); + + @override + String toString() { + return 'PublicHeader(action: $action, timestamp: $timestamp, version: $version, authorization: $authorization)'; + } + + +} + +/// @nodoc +abstract mixin class $PublicHeaderCopyWith<$Res> { + factory $PublicHeaderCopyWith(PublicHeader value, + $Res Function(PublicHeader) _then) = _$PublicHeaderCopyWithImpl; + + @useResult + $Res call({ + @JsonKey(name: 'X-TC-Action') String? action, @JsonKey( + name: 'X-TC-Timestamp') int? timestamp, @JsonKey( + name: 'X-TC-Version') String? version, @JsonKey( + name: 'Authorization') String? authorization + }); + + +} + +/// @nodoc +class _$PublicHeaderCopyWithImpl<$Res> + implements $PublicHeaderCopyWith<$Res> { + _$PublicHeaderCopyWithImpl(this._self, this._then); + + final PublicHeader _self; + final $Res Function(PublicHeader) _then; + + /// Create a copy of PublicHeader + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? action = freezed, Object? timestamp = freezed, Object? version = freezed, Object? authorization = freezed,}) { + return _then(_self.copyWith( + action: freezed == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String?, + timestamp: freezed == timestamp + ? _self.timestamp + : timestamp // ignore: cast_nullable_to_non_nullable + as int?, + version: freezed == version + ? _self.version + : version // ignore: cast_nullable_to_non_nullable + as String?, + authorization: freezed == authorization + ? _self.authorization + : authorization // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _PublicHeader implements PublicHeader { + const _PublicHeader({@JsonKey(name: 'X-TC-Action') this.action, @JsonKey( + name: 'X-TC-Timestamp') this.timestamp, @JsonKey( + name: 'X-TC-Version') this.version, @JsonKey( + name: 'Authorization') this.authorization}); + + factory _PublicHeader.fromJson(Map json) => + _$PublicHeaderFromJson(json); + + @override + @JsonKey(name: 'X-TC-Action') + final String? action; + @override + @JsonKey(name: 'X-TC-Timestamp') + final int? timestamp; + @override + @JsonKey(name: 'X-TC-Version') + final String? version; + @override + @JsonKey(name: 'Authorization') + final String? authorization; + + /// Create a copy of PublicHeader + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PublicHeaderCopyWith<_PublicHeader> get copyWith => + __$PublicHeaderCopyWithImpl<_PublicHeader>(this, _$identity); + + @override + Map toJson() { + return _$PublicHeaderToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _PublicHeader && + (identical(other.action, action) || other.action == action) && + (identical(other.timestamp, timestamp) || + other.timestamp == timestamp) && + (identical(other.version, version) || other.version == version) && + (identical(other.authorization, authorization) || + other.authorization == authorization)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, action, timestamp, version, authorization); + + @override + String toString() { + return 'PublicHeader(action: $action, timestamp: $timestamp, version: $version, authorization: $authorization)'; + } + + +} + +/// @nodoc +abstract mixin class _$PublicHeaderCopyWith<$Res> + implements $PublicHeaderCopyWith<$Res> { + factory _$PublicHeaderCopyWith(_PublicHeader value, + $Res Function(_PublicHeader) _then) = __$PublicHeaderCopyWithImpl; + + @override + @useResult + $Res call({ + @JsonKey(name: 'X-TC-Action') String? action, @JsonKey( + name: 'X-TC-Timestamp') int? timestamp, @JsonKey( + name: 'X-TC-Version') String? version, @JsonKey( + name: 'Authorization') String? authorization + }); + + +} + +/// @nodoc +class __$PublicHeaderCopyWithImpl<$Res> + implements _$PublicHeaderCopyWith<$Res> { + __$PublicHeaderCopyWithImpl(this._self, this._then); + + final _PublicHeader _self; + final $Res Function(_PublicHeader) _then; + + /// Create a copy of PublicHeader + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? action = freezed, Object? timestamp = freezed, Object? version = freezed, Object? authorization = freezed,}) { + return _then(_PublicHeader( + action: freezed == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String?, + timestamp: freezed == timestamp + ? _self.timestamp + : timestamp // ignore: cast_nullable_to_non_nullable + as int?, + version: freezed == version + ? _self.version + : version // ignore: cast_nullable_to_non_nullable + as String?, + authorization: freezed == authorization + ? _self.authorization + : authorization // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + +} + + +/// @nodoc +mixin _$Message { + + @JsonKey(name: 'Role') String get role; + + @JsonKey(name: 'Content') String get content; + + /// Create a copy of Message + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageCopyWith get copyWith => + _$MessageCopyWithImpl(this as Message, _$identity); + + /// Serializes this Message to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Message && + (identical(other.role, role) || other.role == role) && + (identical(other.content, content) || other.content == content)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, role, content); + + @override + String toString() { + return 'Message(role: $role, content: $content)'; + } + + +} + +/// @nodoc +abstract mixin class $MessageCopyWith<$Res> { + factory $MessageCopyWith(Message value, + $Res Function(Message) _then) = _$MessageCopyWithImpl; + + @useResult + $Res call({ + @JsonKey(name: 'Role') String role, @JsonKey(name: 'Content') String content + }); + + +} + +/// @nodoc +class _$MessageCopyWithImpl<$Res> + implements $MessageCopyWith<$Res> { + _$MessageCopyWithImpl(this._self, this._then); + + final Message _self; + final $Res Function(Message) _then; + + /// Create a copy of Message + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? role = null, Object? content = null,}) { + return _then(_self.copyWith( + role: null == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String, + content: null == content + ? _self.content + : content // ignore: cast_nullable_to_non_nullable + as String, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Message implements Message { + const _Message({@JsonKey(name: 'Role') required this.role, @JsonKey( + name: 'Content') required this.content}); + + factory _Message.fromJson(Map json) => + _$MessageFromJson(json); + + @override + @JsonKey(name: 'Role') + final String role; + @override + @JsonKey(name: 'Content') + final String content; + + /// Create a copy of Message + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$MessageCopyWith<_Message> get copyWith => + __$MessageCopyWithImpl<_Message>(this, _$identity); + + @override + Map toJson() { + return _$MessageToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Message && + (identical(other.role, role) || other.role == role) && + (identical(other.content, content) || other.content == content)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, role, content); + + @override + String toString() { + return 'Message(role: $role, content: $content)'; + } + + +} + +/// @nodoc +abstract mixin class _$MessageCopyWith<$Res> implements $MessageCopyWith<$Res> { + factory _$MessageCopyWith(_Message value, + $Res Function(_Message) _then) = __$MessageCopyWithImpl; + + @override + @useResult + $Res call({ + @JsonKey(name: 'Role') String role, @JsonKey(name: 'Content') String content + }); + + +} + +/// @nodoc +class __$MessageCopyWithImpl<$Res> + implements _$MessageCopyWith<$Res> { + __$MessageCopyWithImpl(this._self, this._then); + + final _Message _self; + final $Res Function(_Message) _then; + + /// Create a copy of Message + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({Object? role = null, Object? content = null,}) { + return _then(_Message( + role: null == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String, + content: null == content + ? _self.content + : content // ignore: cast_nullable_to_non_nullable + as String, + )); + } + + +} + + +/// @nodoc +mixin _$HunyuanResponse { + + @JsonKey(name: 'Note') String? get note; + + @JsonKey(name: 'Choices') List? get choices; + + @JsonKey(name: 'Created') int? get created; + + @JsonKey(name: 'Id') String? get id; + + @JsonKey(name: 'Usage') Usage? get usage; + + /// Create a copy of HunyuanResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $HunyuanResponseCopyWith get copyWith => + _$HunyuanResponseCopyWithImpl( + this as HunyuanResponse, _$identity); + + /// Serializes this HunyuanResponse to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is HunyuanResponse && + (identical(other.note, note) || other.note == note) && + const DeepCollectionEquality().equals(other.choices, choices) && + (identical(other.created, created) || other.created == created) && + (identical(other.id, id) || other.id == id) && + (identical(other.usage, usage) || other.usage == usage)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, note, const DeepCollectionEquality().hash(choices), + created, + id, usage); + + @override + String toString() { + return 'HunyuanResponse(note: $note, choices: $choices, created: $created, id: $id, usage: $usage)'; + } + + +} + +/// @nodoc +abstract mixin class $HunyuanResponseCopyWith<$Res> { + factory $HunyuanResponseCopyWith(HunyuanResponse value, + $Res Function(HunyuanResponse) _then) = _$HunyuanResponseCopyWithImpl; + + @useResult + $Res call({ + @JsonKey(name: 'Note') String? note, @JsonKey(name: 'Choices') List< + Choices>? choices, @JsonKey(name: 'Created') int? created, @JsonKey( + name: 'Id') String? id, @JsonKey(name: 'Usage') Usage? usage + }); + + + $UsageCopyWith<$Res>? get usage; + +} + +/// @nodoc +class _$HunyuanResponseCopyWithImpl<$Res> + implements $HunyuanResponseCopyWith<$Res> { + _$HunyuanResponseCopyWithImpl(this._self, this._then); + + final HunyuanResponse _self; + final $Res Function(HunyuanResponse) _then; + + /// Create a copy of HunyuanResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? note = freezed, Object? choices = freezed, Object? created = freezed, Object? id = freezed, Object? usage = freezed,}) { + return _then(_self.copyWith( + note: freezed == note + ? _self.note + : note // ignore: cast_nullable_to_non_nullable + as String?, + choices: freezed == choices + ? _self.choices + : choices // ignore: cast_nullable_to_non_nullable + as List?, + created: freezed == created + ? _self.created + : created // ignore: cast_nullable_to_non_nullable + as int?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as String?, + usage: freezed == usage + ? _self.usage + : usage // ignore: cast_nullable_to_non_nullable + as Usage?, + )); + } + + /// Create a copy of HunyuanResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $UsageCopyWith<$Res>? get usage { + if (_self.usage == null) { + return null; + } + + return $UsageCopyWith<$Res>(_self.usage!, (value) { + return _then(_self.copyWith(usage: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _HunyuanResponse implements HunyuanResponse { + const _HunyuanResponse( + {@JsonKey(name: 'Note') this.note, @JsonKey(name: 'Choices') final List< + Choices>? choices, @JsonKey(name: 'Created') this.created, @JsonKey( + name: 'Id') this.id, @JsonKey(name: 'Usage') this.usage}) + : _choices = choices; + + factory _HunyuanResponse.fromJson(Map json) => + _$HunyuanResponseFromJson(json); + + @override + @JsonKey(name: 'Note') + final String? note; + final List? _choices; + + @override + @JsonKey(name: 'Choices') + List? get choices { + final value = _choices; + if (value == null) return null; + if (_choices is EqualUnmodifiableListView) return _choices; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + @JsonKey(name: 'Created') + final int? created; + @override + @JsonKey(name: 'Id') + final String? id; + @override + @JsonKey(name: 'Usage') + final Usage? usage; + + /// Create a copy of HunyuanResponse + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$HunyuanResponseCopyWith<_HunyuanResponse> get copyWith => + __$HunyuanResponseCopyWithImpl<_HunyuanResponse>(this, _$identity); + + @override + Map toJson() { + return _$HunyuanResponseToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _HunyuanResponse && + (identical(other.note, note) || other.note == note) && + const DeepCollectionEquality().equals(other._choices, _choices) && + (identical(other.created, created) || other.created == created) && + (identical(other.id, id) || other.id == id) && + (identical(other.usage, usage) || other.usage == usage)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, note, const DeepCollectionEquality().hash(_choices), + created, + id, usage); + + @override + String toString() { + return 'HunyuanResponse(note: $note, choices: $choices, created: $created, id: $id, usage: $usage)'; + } + + +} + +/// @nodoc +abstract mixin class _$HunyuanResponseCopyWith<$Res> + implements $HunyuanResponseCopyWith<$Res> { + factory _$HunyuanResponseCopyWith(_HunyuanResponse value, + $Res Function(_HunyuanResponse) _then) = __$HunyuanResponseCopyWithImpl; + + @override + @useResult + $Res call({ + @JsonKey(name: 'Note') String? note, @JsonKey(name: 'Choices') List< + Choices>? choices, @JsonKey(name: 'Created') int? created, @JsonKey( + name: 'Id') String? id, @JsonKey(name: 'Usage') Usage? usage + }); + + + @override $UsageCopyWith<$Res>? get usage; + +} + +/// @nodoc +class __$HunyuanResponseCopyWithImpl<$Res> + implements _$HunyuanResponseCopyWith<$Res> { + __$HunyuanResponseCopyWithImpl(this._self, this._then); + + final _HunyuanResponse _self; + final $Res Function(_HunyuanResponse) _then; + + /// Create a copy of HunyuanResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? note = freezed, Object? choices = freezed, Object? created = freezed, Object? id = freezed, Object? usage = freezed,}) { + return _then(_HunyuanResponse( + note: freezed == note + ? _self.note + : note // ignore: cast_nullable_to_non_nullable + as String?, + choices: freezed == choices + ? _self._choices + : choices // ignore: cast_nullable_to_non_nullable + as List?, + created: freezed == created + ? _self.created + : created // ignore: cast_nullable_to_non_nullable + as int?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as String?, + usage: freezed == usage + ? _self.usage + : usage // ignore: cast_nullable_to_non_nullable + as Usage?, + )); + } + + /// Create a copy of HunyuanResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $UsageCopyWith<$Res>? get usage { + if (_self.usage == null) { + return null; + } + + return $UsageCopyWith<$Res>(_self.usage!, (value) { + return _then(_self.copyWith(usage: value)); + }); + } +} + + +/// @nodoc +mixin _$Usage { + + @JsonKey(name: 'PromptTokens') int? get promptTokens; + + @JsonKey(name: 'CompletionTokens') int? get completionTokens; + + @JsonKey(name: 'TotalTokens') int? get totalTokens; + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UsageCopyWith get copyWith => + _$UsageCopyWithImpl(this as Usage, _$identity); + + /// Serializes this Usage to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Usage && + (identical(other.promptTokens, promptTokens) || + other.promptTokens == promptTokens) && + (identical(other.completionTokens, completionTokens) || + other.completionTokens == completionTokens) && + (identical(other.totalTokens, totalTokens) || + other.totalTokens == totalTokens)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, promptTokens, completionTokens, totalTokens); + + @override + String toString() { + return 'Usage(promptTokens: $promptTokens, completionTokens: $completionTokens, totalTokens: $totalTokens)'; + } + + +} + +/// @nodoc +abstract mixin class $UsageCopyWith<$Res> { + factory $UsageCopyWith(Usage value, + $Res Function(Usage) _then) = _$UsageCopyWithImpl; + + @useResult + $Res call({ + @JsonKey(name: 'PromptTokens') int? promptTokens, @JsonKey( + name: 'CompletionTokens') int? completionTokens, @JsonKey( + name: 'TotalTokens') int? totalTokens + }); + + +} + +/// @nodoc +class _$UsageCopyWithImpl<$Res> + implements $UsageCopyWith<$Res> { + _$UsageCopyWithImpl(this._self, this._then); + + final Usage _self; + final $Res Function(Usage) _then; + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? promptTokens = freezed, Object? completionTokens = freezed, Object? totalTokens = freezed,}) { + return _then(_self.copyWith( + promptTokens: freezed == promptTokens + ? _self.promptTokens + : promptTokens // ignore: cast_nullable_to_non_nullable + as int?, + completionTokens: freezed == completionTokens + ? _self.completionTokens + : completionTokens // ignore: cast_nullable_to_non_nullable + as int?, + totalTokens: freezed == totalTokens + ? _self.totalTokens + : totalTokens // ignore: cast_nullable_to_non_nullable + as int?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Usage implements Usage { + const _Usage({@JsonKey(name: 'PromptTokens') this.promptTokens, @JsonKey( + name: 'CompletionTokens') this.completionTokens, @JsonKey( + name: 'TotalTokens') this.totalTokens}); + + factory _Usage.fromJson(Map json) => _$UsageFromJson(json); + + @override + @JsonKey(name: 'PromptTokens') + final int? promptTokens; + @override + @JsonKey(name: 'CompletionTokens') + final int? completionTokens; + @override + @JsonKey(name: 'TotalTokens') + final int? totalTokens; + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UsageCopyWith<_Usage> get copyWith => + __$UsageCopyWithImpl<_Usage>(this, _$identity); + + @override + Map toJson() { + return _$UsageToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Usage && + (identical(other.promptTokens, promptTokens) || + other.promptTokens == promptTokens) && + (identical(other.completionTokens, completionTokens) || + other.completionTokens == completionTokens) && + (identical(other.totalTokens, totalTokens) || + other.totalTokens == totalTokens)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, promptTokens, completionTokens, totalTokens); + + @override + String toString() { + return 'Usage(promptTokens: $promptTokens, completionTokens: $completionTokens, totalTokens: $totalTokens)'; + } + + +} + +/// @nodoc +abstract mixin class _$UsageCopyWith<$Res> implements $UsageCopyWith<$Res> { + factory _$UsageCopyWith(_Usage value, + $Res Function(_Usage) _then) = __$UsageCopyWithImpl; + + @override + @useResult + $Res call({ + @JsonKey(name: 'PromptTokens') int? promptTokens, @JsonKey( + name: 'CompletionTokens') int? completionTokens, @JsonKey( + name: 'TotalTokens') int? totalTokens + }); + + +} + +/// @nodoc +class __$UsageCopyWithImpl<$Res> + implements _$UsageCopyWith<$Res> { + __$UsageCopyWithImpl(this._self, this._then); + + final _Usage _self; + final $Res Function(_Usage) _then; + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? promptTokens = freezed, Object? completionTokens = freezed, Object? totalTokens = freezed,}) { + return _then(_Usage( + promptTokens: freezed == promptTokens + ? _self.promptTokens + : promptTokens // ignore: cast_nullable_to_non_nullable + as int?, + completionTokens: freezed == completionTokens + ? _self.completionTokens + : completionTokens // ignore: cast_nullable_to_non_nullable + as int?, + totalTokens: freezed == totalTokens + ? _self.totalTokens + : totalTokens // ignore: cast_nullable_to_non_nullable + as int?, + )); + } + + +} + + +/// @nodoc +mixin _$Choices { + + @JsonKey(name: 'FinishReason') String? get finishReason; + + @JsonKey(name: 'Delta') Delta? get delta; + + /// Create a copy of Choices + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChoicesCopyWith get copyWith => + _$ChoicesCopyWithImpl(this as Choices, _$identity); + + /// Serializes this Choices to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Choices && + (identical(other.finishReason, finishReason) || + other.finishReason == finishReason) && + (identical(other.delta, delta) || other.delta == delta)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, finishReason, delta); + + @override + String toString() { + return 'Choices(finishReason: $finishReason, delta: $delta)'; + } + + +} + +/// @nodoc +abstract mixin class $ChoicesCopyWith<$Res> { + factory $ChoicesCopyWith(Choices value, + $Res Function(Choices) _then) = _$ChoicesCopyWithImpl; + + @useResult + $Res call({ + @JsonKey(name: 'FinishReason') String? finishReason, @JsonKey( + name: 'Delta') Delta? delta + }); + + + $DeltaCopyWith<$Res>? get delta; + +} + +/// @nodoc +class _$ChoicesCopyWithImpl<$Res> + implements $ChoicesCopyWith<$Res> { + _$ChoicesCopyWithImpl(this._self, this._then); + + final Choices _self; + final $Res Function(Choices) _then; + + /// Create a copy of Choices + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? finishReason = freezed, Object? delta = freezed,}) { + return _then(_self.copyWith( + finishReason: freezed == finishReason + ? _self.finishReason + : finishReason // ignore: cast_nullable_to_non_nullable + as String?, + delta: freezed == delta + ? _self.delta + : delta // ignore: cast_nullable_to_non_nullable + as Delta?, + )); + } + + /// Create a copy of Choices + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $DeltaCopyWith<$Res>? get delta { + if (_self.delta == null) { + return null; + } + + return $DeltaCopyWith<$Res>(_self.delta!, (value) { + return _then(_self.copyWith(delta: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _Choices implements Choices { + const _Choices({@JsonKey(name: 'FinishReason') this.finishReason, @JsonKey( + name: 'Delta') this.delta}); + + factory _Choices.fromJson(Map json) => + _$ChoicesFromJson(json); + + @override + @JsonKey(name: 'FinishReason') + final String? finishReason; + @override + @JsonKey(name: 'Delta') + final Delta? delta; + + /// Create a copy of Choices + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ChoicesCopyWith<_Choices> get copyWith => + __$ChoicesCopyWithImpl<_Choices>(this, _$identity); + + @override + Map toJson() { + return _$ChoicesToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Choices && + (identical(other.finishReason, finishReason) || + other.finishReason == finishReason) && + (identical(other.delta, delta) || other.delta == delta)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, finishReason, delta); + + @override + String toString() { + return 'Choices(finishReason: $finishReason, delta: $delta)'; + } + + +} + +/// @nodoc +abstract mixin class _$ChoicesCopyWith<$Res> implements $ChoicesCopyWith<$Res> { + factory _$ChoicesCopyWith(_Choices value, + $Res Function(_Choices) _then) = __$ChoicesCopyWithImpl; + + @override + @useResult + $Res call({ + @JsonKey(name: 'FinishReason') String? finishReason, @JsonKey( + name: 'Delta') Delta? delta + }); + + + @override $DeltaCopyWith<$Res>? get delta; + +} + +/// @nodoc +class __$ChoicesCopyWithImpl<$Res> + implements _$ChoicesCopyWith<$Res> { + __$ChoicesCopyWithImpl(this._self, this._then); + + final _Choices _self; + final $Res Function(_Choices) _then; + + /// Create a copy of Choices + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({Object? finishReason = freezed, Object? delta = freezed,}) { + return _then(_Choices( + finishReason: freezed == finishReason + ? _self.finishReason + : finishReason // ignore: cast_nullable_to_non_nullable + as String?, + delta: freezed == delta + ? _self.delta + : delta // ignore: cast_nullable_to_non_nullable + as Delta?, + )); + } + + /// Create a copy of Choices + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $DeltaCopyWith<$Res>? get delta { + if (_self.delta == null) { + return null; + } + + return $DeltaCopyWith<$Res>(_self.delta!, (value) { + return _then(_self.copyWith(delta: value)); + }); + } +} + + +/// @nodoc +mixin _$Delta { + + @JsonKey(name: 'Role') String? get role; + + @JsonKey(name: 'Content') String? get content; + + /// Create a copy of Delta + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeltaCopyWith get copyWith => + _$DeltaCopyWithImpl(this as Delta, _$identity); + + /// Serializes this Delta to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Delta && + (identical(other.role, role) || other.role == role) && + (identical(other.content, content) || other.content == content)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, role, content); + + @override + String toString() { + return 'Delta(role: $role, content: $content)'; + } + + +} + +/// @nodoc +abstract mixin class $DeltaCopyWith<$Res> { + factory $DeltaCopyWith(Delta value, + $Res Function(Delta) _then) = _$DeltaCopyWithImpl; + + @useResult + $Res call({ + @JsonKey(name: 'Role') String? role, @JsonKey( + name: 'Content') String? content + }); + + +} + +/// @nodoc +class _$DeltaCopyWithImpl<$Res> + implements $DeltaCopyWith<$Res> { + _$DeltaCopyWithImpl(this._self, this._then); + + final Delta _self; + final $Res Function(Delta) _then; + + /// Create a copy of Delta + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? role = freezed, Object? content = freezed,}) { + return _then(_self.copyWith( + role: freezed == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String?, + content: freezed == content + ? _self.content + : content // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Delta implements Delta { + const _Delta({@JsonKey(name: 'Role') this.role, @JsonKey( + name: 'Content') this.content}); + + factory _Delta.fromJson(Map json) => _$DeltaFromJson(json); + + @override + @JsonKey(name: 'Role') + final String? role; + @override + @JsonKey(name: 'Content') + final String? content; + + /// Create a copy of Delta + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$DeltaCopyWith<_Delta> get copyWith => + __$DeltaCopyWithImpl<_Delta>(this, _$identity); + + @override + Map toJson() { + return _$DeltaToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Delta && + (identical(other.role, role) || other.role == role) && + (identical(other.content, content) || other.content == content)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, role, content); + + @override + String toString() { + return 'Delta(role: $role, content: $content)'; + } + + +} + +/// @nodoc +abstract mixin class _$DeltaCopyWith<$Res> implements $DeltaCopyWith<$Res> { + factory _$DeltaCopyWith(_Delta value, + $Res Function(_Delta) _then) = __$DeltaCopyWithImpl; + + @override + @useResult + $Res call({ + @JsonKey(name: 'Role') String? role, @JsonKey( + name: 'Content') String? content + }); + + +} + +/// @nodoc +class __$DeltaCopyWithImpl<$Res> + implements _$DeltaCopyWith<$Res> { + __$DeltaCopyWithImpl(this._self, this._then); + + final _Delta _self; + final $Res Function(_Delta) _then; + + /// Create a copy of Delta + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({Object? role = freezed, Object? content = freezed,}) { + return _then(_Delta( + role: freezed == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String?, + content: freezed == content + ? _self.content + : content // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + +} + +// dart format on diff --git a/lib/common/models/hunyuan.g.dart b/lib/common/models/hunyuan.g.dart new file mode 100644 index 0000000..82036ef --- /dev/null +++ b/lib/common/models/hunyuan.g.dart @@ -0,0 +1,88 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'hunyuan.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_PublicHeader _$PublicHeaderFromJson(Map json) => + _PublicHeader( + action: json['X-TC-Action'] as String?, + timestamp: (json['X-TC-Timestamp'] as num?)?.toInt(), + version: json['X-TC-Version'] as String?, + authorization: json['Authorization'] as String?, + ); + +Map _$PublicHeaderToJson(_PublicHeader instance) => + { + if (instance.action case final value?) 'X-TC-Action': value, + if (instance.timestamp case final value?) 'X-TC-Timestamp': value, + if (instance.version case final value?) 'X-TC-Version': value, + if (instance.authorization case final value?) 'Authorization': value, + }; + +_Message _$MessageFromJson(Map json) => + _Message(role: json['Role'] as String, content: json['Content'] as String); + +Map _$MessageToJson(_Message instance) => { + 'Role': instance.role, + 'Content': instance.content, +}; + +_HunyuanResponse _$HunyuanResponseFromJson(Map json) => + _HunyuanResponse( + note: json['Note'] as String?, + choices: + (json['Choices'] as List?) + ?.map((e) => Choices.fromJson(e as Map)) + .toList(), + created: (json['Created'] as num?)?.toInt(), + id: json['Id'] as String?, + usage: + json['Usage'] == null + ? null + : Usage.fromJson(json['Usage'] as Map), + ); + +Map _$HunyuanResponseToJson(_HunyuanResponse instance) => + { + if (instance.note case final value?) 'Note': value, + if (instance.choices case final value?) 'Choices': value, + if (instance.created case final value?) 'Created': value, + if (instance.id case final value?) 'Id': value, + if (instance.usage case final value?) 'Usage': value, + }; + +_Usage _$UsageFromJson(Map json) => _Usage( + promptTokens: (json['PromptTokens'] as num?)?.toInt(), + completionTokens: (json['CompletionTokens'] as num?)?.toInt(), + totalTokens: (json['TotalTokens'] as num?)?.toInt(), +); + +Map _$UsageToJson(_Usage instance) => { + if (instance.promptTokens case final value?) 'PromptTokens': value, + if (instance.completionTokens case final value?) 'CompletionTokens': value, + if (instance.totalTokens case final value?) 'TotalTokens': value, +}; + +_Choices _$ChoicesFromJson(Map json) => _Choices( + finishReason: json['FinishReason'] as String?, + delta: + json['Delta'] == null + ? null + : Delta.fromJson(json['Delta'] as Map), +); + +Map _$ChoicesToJson(_Choices instance) => { + if (instance.finishReason case final value?) 'FinishReason': value, + if (instance.delta case final value?) 'Delta': value, +}; + +_Delta _$DeltaFromJson(Map json) => + _Delta(role: json['Role'] as String?, content: json['Content'] as String?); + +Map _$DeltaToJson(_Delta instance) => { + if (instance.role case final value?) 'Role': value, + if (instance.content case final value?) 'Content': value, +}; diff --git a/lib/common/models/image.dart b/lib/common/models/image.dart index f9e0b44..5cd4ecf 100644 --- a/lib/common/models/image.dart +++ b/lib/common/models/image.dart @@ -1,130 +1,50 @@ -class BingImage { - List? images; - Tooltips? tooltips; +import 'package:freezed_annotation/freezed_annotation.dart'; - BingImage({this.images, this.tooltips}); +part 'image.freezed.dart'; +part 'image.g.dart'; - BingImage.fromJson(Map json) { - images = - json["images"] == null - ? null - : (json["images"] as List).map((e) => Images.fromJson(e)).toList(); - tooltips = - json["tooltips"] == null ? null : Tooltips.fromJson(json["tooltips"]); - } +@freezed +abstract class BingImage with _$BingImage { + const factory BingImage({List? images, Tooltips? tooltips}) = + _BingImage; - Map toJson() { - final Map data = {}; - if (images != null) { - data["images"] = images?.map((e) => e.toJson()).toList(); - } - if (tooltips != null) { - data["tooltips"] = tooltips?.toJson(); - } - return data; - } + factory BingImage.fromJson(Map json) => + _$BingImageFromJson(json); } -class Tooltips { - String? loading; - String? previous; - String? next; - String? walle; - String? walls; +@freezed +abstract class Tooltips with _$Tooltips { + const factory Tooltips({ + String? loading, + String? previous, + String? next, + String? walle, + String? walls, + }) = _Tooltips; - Tooltips({this.loading, this.previous, this.next, this.walle, this.walls}); - - Tooltips.fromJson(Map json) { - loading = json["loading"]; - previous = json["previous"]; - next = json["next"]; - walle = json["walle"]; - walls = json["walls"]; - } - - Map toJson() { - final Map data = {}; - data["loading"] = loading; - data["previous"] = previous; - data["next"] = next; - data["walle"] = walle; - data["walls"] = walls; - return data; - } + factory Tooltips.fromJson(Map json) => + _$TooltipsFromJson(json); } -class Images { - String? startdate; - String? fullstartdate; - String? enddate; - String? url; - String? urlbase; - String? copyright; - String? copyrightlink; - String? title; - String? quiz; - bool? wp; - String? hsh; - int? drk; - int? top; - int? bot; - List? hs; +@freezed +abstract class Images with _$Images { + const factory Images({ + String? startdate, + String? fullstartdate, + String? enddate, + String? url, + String? urlbase, + String? copyright, + String? copyrightlink, + String? title, + String? quiz, + bool? wp, + String? hsh, + int? drk, + int? top, + int? bot, + List? hs, + }) = _Images; - Images({ - this.startdate, - this.fullstartdate, - this.enddate, - this.url, - this.urlbase, - this.copyright, - this.copyrightlink, - this.title, - this.quiz, - this.wp, - this.hsh, - this.drk, - this.top, - this.bot, - this.hs, - }); - - Images.fromJson(Map json) { - startdate = json["startdate"]; - fullstartdate = json["fullstartdate"]; - enddate = json["enddate"]; - url = json["url"]; - urlbase = json["urlbase"]; - copyright = json["copyright"]; - copyrightlink = json["copyrightlink"]; - title = json["title"]; - quiz = json["quiz"]; - wp = json["wp"]; - hsh = json["hsh"]; - drk = json["drk"]; - top = json["top"]; - bot = json["bot"]; - hs = json["hs"] ?? []; - } - - Map toJson() { - final Map data = {}; - data["startdate"] = startdate; - data["fullstartdate"] = fullstartdate; - data["enddate"] = enddate; - data["url"] = url; - data["urlbase"] = urlbase; - data["copyright"] = copyright; - data["copyrightlink"] = copyrightlink; - data["title"] = title; - data["quiz"] = quiz; - data["wp"] = wp; - data["hsh"] = hsh; - data["drk"] = drk; - data["top"] = top; - data["bot"] = bot; - if (hs != null) { - data["hs"] = hs; - } - return data; - } + factory Images.fromJson(Map json) => _$ImagesFromJson(json); } diff --git a/lib/common/models/image.freezed.dart b/lib/common/models/image.freezed.dart new file mode 100644 index 0000000..cd5f539 --- /dev/null +++ b/lib/common/models/image.freezed.dart @@ -0,0 +1,825 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'image.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$BingImage { + + List? get images; + + Tooltips? get tooltips; + + /// Create a copy of BingImage + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BingImageCopyWith get copyWith => + _$BingImageCopyWithImpl(this as BingImage, _$identity); + + /// Serializes this BingImage to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is BingImage && + const DeepCollectionEquality().equals(other.images, images) && + (identical(other.tooltips, tooltips) || + other.tooltips == tooltips)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, const DeepCollectionEquality().hash(images), tooltips); + + @override + String toString() { + return 'BingImage(images: $images, tooltips: $tooltips)'; + } + + +} + +/// @nodoc +abstract mixin class $BingImageCopyWith<$Res> { + factory $BingImageCopyWith(BingImage value, + $Res Function(BingImage) _then) = _$BingImageCopyWithImpl; + + @useResult + $Res call({ + List? images, Tooltips? tooltips + }); + + + $TooltipsCopyWith<$Res>? get tooltips; + +} + +/// @nodoc +class _$BingImageCopyWithImpl<$Res> + implements $BingImageCopyWith<$Res> { + _$BingImageCopyWithImpl(this._self, this._then); + + final BingImage _self; + final $Res Function(BingImage) _then; + + /// Create a copy of BingImage + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? images = freezed, Object? tooltips = freezed,}) { + return _then(_self.copyWith( + images: freezed == images + ? _self.images + : images // ignore: cast_nullable_to_non_nullable + as List?, + tooltips: freezed == tooltips + ? _self.tooltips + : tooltips // ignore: cast_nullable_to_non_nullable + as Tooltips?, + )); + } + + /// Create a copy of BingImage + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $TooltipsCopyWith<$Res>? get tooltips { + if (_self.tooltips == null) { + return null; + } + + return $TooltipsCopyWith<$Res>(_self.tooltips!, (value) { + return _then(_self.copyWith(tooltips: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _BingImage implements BingImage { + const _BingImage({final List? images, this.tooltips}) + : _images = images; + + factory _BingImage.fromJson(Map json) => + _$BingImageFromJson(json); + + final List? _images; + + @override List? get images { + final value = _images; + if (value == null) return null; + if (_images is EqualUnmodifiableListView) return _images; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override final Tooltips? tooltips; + + /// Create a copy of BingImage + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$BingImageCopyWith<_BingImage> get copyWith => + __$BingImageCopyWithImpl<_BingImage>(this, _$identity); + + @override + Map toJson() { + return _$BingImageToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _BingImage && + const DeepCollectionEquality().equals(other._images, _images) && + (identical(other.tooltips, tooltips) || + other.tooltips == tooltips)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, const DeepCollectionEquality().hash(_images), tooltips); + + @override + String toString() { + return 'BingImage(images: $images, tooltips: $tooltips)'; + } + + +} + +/// @nodoc +abstract mixin class _$BingImageCopyWith<$Res> + implements $BingImageCopyWith<$Res> { + factory _$BingImageCopyWith(_BingImage value, + $Res Function(_BingImage) _then) = __$BingImageCopyWithImpl; + + @override + @useResult + $Res call({ + List? images, Tooltips? tooltips + }); + + + @override $TooltipsCopyWith<$Res>? get tooltips; + +} + +/// @nodoc +class __$BingImageCopyWithImpl<$Res> + implements _$BingImageCopyWith<$Res> { + __$BingImageCopyWithImpl(this._self, this._then); + + final _BingImage _self; + final $Res Function(_BingImage) _then; + + /// Create a copy of BingImage + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({Object? images = freezed, Object? tooltips = freezed,}) { + return _then(_BingImage( + images: freezed == images + ? _self._images + : images // ignore: cast_nullable_to_non_nullable + as List?, + tooltips: freezed == tooltips + ? _self.tooltips + : tooltips // ignore: cast_nullable_to_non_nullable + as Tooltips?, + )); + } + + /// Create a copy of BingImage + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $TooltipsCopyWith<$Res>? get tooltips { + if (_self.tooltips == null) { + return null; + } + + return $TooltipsCopyWith<$Res>(_self.tooltips!, (value) { + return _then(_self.copyWith(tooltips: value)); + }); + } +} + + +/// @nodoc +mixin _$Tooltips { + + String? get loading; + + String? get previous; + + String? get next; + + String? get walle; + + String? get walls; + + /// Create a copy of Tooltips + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $TooltipsCopyWith get copyWith => + _$TooltipsCopyWithImpl(this as Tooltips, _$identity); + + /// Serializes this Tooltips to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Tooltips && + (identical(other.loading, loading) || other.loading == loading) && + (identical(other.previous, previous) || + other.previous == previous) && + (identical(other.next, next) || other.next == next) && + (identical(other.walle, walle) || other.walle == walle) && + (identical(other.walls, walls) || other.walls == walls)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, loading, previous, next, walle, walls); + + @override + String toString() { + return 'Tooltips(loading: $loading, previous: $previous, next: $next, walle: $walle, walls: $walls)'; + } + + +} + +/// @nodoc +abstract mixin class $TooltipsCopyWith<$Res> { + factory $TooltipsCopyWith(Tooltips value, + $Res Function(Tooltips) _then) = _$TooltipsCopyWithImpl; + + @useResult + $Res call({ + String? loading, String? previous, String? next, String? walle, String? walls + }); + + +} + +/// @nodoc +class _$TooltipsCopyWithImpl<$Res> + implements $TooltipsCopyWith<$Res> { + _$TooltipsCopyWithImpl(this._self, this._then); + + final Tooltips _self; + final $Res Function(Tooltips) _then; + + /// Create a copy of Tooltips + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? loading = freezed, Object? previous = freezed, Object? next = freezed, Object? walle = freezed, Object? walls = freezed,}) { + return _then(_self.copyWith( + loading: freezed == loading + ? _self.loading + : loading // ignore: cast_nullable_to_non_nullable + as String?, + previous: freezed == previous + ? _self.previous + : previous // ignore: cast_nullable_to_non_nullable + as String?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + walle: freezed == walle + ? _self.walle + : walle // ignore: cast_nullable_to_non_nullable + as String?, + walls: freezed == walls + ? _self.walls + : walls // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Tooltips implements Tooltips { + const _Tooltips( + {this.loading, this.previous, this.next, this.walle, this.walls}); + + factory _Tooltips.fromJson(Map json) => + _$TooltipsFromJson(json); + + @override final String? loading; + @override final String? previous; + @override final String? next; + @override final String? walle; + @override final String? walls; + + /// Create a copy of Tooltips + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$TooltipsCopyWith<_Tooltips> get copyWith => + __$TooltipsCopyWithImpl<_Tooltips>(this, _$identity); + + @override + Map toJson() { + return _$TooltipsToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Tooltips && + (identical(other.loading, loading) || other.loading == loading) && + (identical(other.previous, previous) || + other.previous == previous) && + (identical(other.next, next) || other.next == next) && + (identical(other.walle, walle) || other.walle == walle) && + (identical(other.walls, walls) || other.walls == walls)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, loading, previous, next, walle, walls); + + @override + String toString() { + return 'Tooltips(loading: $loading, previous: $previous, next: $next, walle: $walle, walls: $walls)'; + } + + +} + +/// @nodoc +abstract mixin class _$TooltipsCopyWith<$Res> + implements $TooltipsCopyWith<$Res> { + factory _$TooltipsCopyWith(_Tooltips value, + $Res Function(_Tooltips) _then) = __$TooltipsCopyWithImpl; + + @override + @useResult + $Res call({ + String? loading, String? previous, String? next, String? walle, String? walls + }); + + +} + +/// @nodoc +class __$TooltipsCopyWithImpl<$Res> + implements _$TooltipsCopyWith<$Res> { + __$TooltipsCopyWithImpl(this._self, this._then); + + final _Tooltips _self; + final $Res Function(_Tooltips) _then; + + /// Create a copy of Tooltips + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? loading = freezed, Object? previous = freezed, Object? next = freezed, Object? walle = freezed, Object? walls = freezed,}) { + return _then(_Tooltips( + loading: freezed == loading + ? _self.loading + : loading // ignore: cast_nullable_to_non_nullable + as String?, + previous: freezed == previous + ? _self.previous + : previous // ignore: cast_nullable_to_non_nullable + as String?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + walle: freezed == walle + ? _self.walle + : walle // ignore: cast_nullable_to_non_nullable + as String?, + walls: freezed == walls + ? _self.walls + : walls // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + +} + + +/// @nodoc +mixin _$Images { + + String? get startdate; + + String? get fullstartdate; + + String? get enddate; + + String? get url; + + String? get urlbase; + + String? get copyright; + + String? get copyrightlink; + + String? get title; + + String? get quiz; + + bool? get wp; + + String? get hsh; + + int? get drk; + + int? get top; + + int? get bot; + + List? get hs; + + /// Create a copy of Images + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ImagesCopyWith get copyWith => + _$ImagesCopyWithImpl(this as Images, _$identity); + + /// Serializes this Images to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Images && + (identical(other.startdate, startdate) || + other.startdate == startdate) && + (identical(other.fullstartdate, fullstartdate) || + other.fullstartdate == fullstartdate) && + (identical(other.enddate, enddate) || other.enddate == enddate) && + (identical(other.url, url) || other.url == url) && + (identical(other.urlbase, urlbase) || other.urlbase == urlbase) && + (identical(other.copyright, copyright) || + other.copyright == copyright) && + (identical(other.copyrightlink, copyrightlink) || + other.copyrightlink == copyrightlink) && + (identical(other.title, title) || other.title == title) && + (identical(other.quiz, quiz) || other.quiz == quiz) && + (identical(other.wp, wp) || other.wp == wp) && + (identical(other.hsh, hsh) || other.hsh == hsh) && + (identical(other.drk, drk) || other.drk == drk) && + (identical(other.top, top) || other.top == top) && + (identical(other.bot, bot) || other.bot == bot) && + const DeepCollectionEquality().equals(other.hs, hs)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + startdate, + fullstartdate, + enddate, + url, + urlbase, + copyright, + copyrightlink, + title, + quiz, + wp, + hsh, + drk, + top, + bot, + const DeepCollectionEquality().hash(hs)); + + @override + String toString() { + return 'Images(startdate: $startdate, fullstartdate: $fullstartdate, enddate: $enddate, url: $url, urlbase: $urlbase, copyright: $copyright, copyrightlink: $copyrightlink, title: $title, quiz: $quiz, wp: $wp, hsh: $hsh, drk: $drk, top: $top, bot: $bot, hs: $hs)'; + } + + +} + +/// @nodoc +abstract mixin class $ImagesCopyWith<$Res> { + factory $ImagesCopyWith(Images value, + $Res Function(Images) _then) = _$ImagesCopyWithImpl; + + @useResult + $Res call({ + String? startdate, String? fullstartdate, String? enddate, String? url, String? urlbase, String? copyright, String? copyrightlink, String? title, String? quiz, bool? wp, String? hsh, int? drk, int? top, int? bot, List< + dynamic>? hs + }); + + +} + +/// @nodoc +class _$ImagesCopyWithImpl<$Res> + implements $ImagesCopyWith<$Res> { + _$ImagesCopyWithImpl(this._self, this._then); + + final Images _self; + final $Res Function(Images) _then; + + /// Create a copy of Images + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? startdate = freezed, Object? fullstartdate = freezed, Object? enddate = freezed, Object? url = freezed, Object? urlbase = freezed, Object? copyright = freezed, Object? copyrightlink = freezed, Object? title = freezed, Object? quiz = freezed, Object? wp = freezed, Object? hsh = freezed, Object? drk = freezed, Object? top = freezed, Object? bot = freezed, Object? hs = freezed,}) { + return _then(_self.copyWith( + startdate: freezed == startdate + ? _self.startdate + : startdate // ignore: cast_nullable_to_non_nullable + as String?, + fullstartdate: freezed == fullstartdate + ? _self.fullstartdate + : fullstartdate // ignore: cast_nullable_to_non_nullable + as String?, + enddate: freezed == enddate + ? _self.enddate + : enddate // ignore: cast_nullable_to_non_nullable + as String?, + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + urlbase: freezed == urlbase + ? _self.urlbase + : urlbase // ignore: cast_nullable_to_non_nullable + as String?, + copyright: freezed == copyright + ? _self.copyright + : copyright // ignore: cast_nullable_to_non_nullable + as String?, + copyrightlink: freezed == copyrightlink + ? _self.copyrightlink + : copyrightlink // ignore: cast_nullable_to_non_nullable + as String?, + title: freezed == title + ? _self.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + quiz: freezed == quiz + ? _self.quiz + : quiz // ignore: cast_nullable_to_non_nullable + as String?, + wp: freezed == wp ? _self.wp : wp // ignore: cast_nullable_to_non_nullable + as bool?, + hsh: freezed == hsh + ? _self.hsh + : hsh // ignore: cast_nullable_to_non_nullable + as String?, + drk: freezed == drk + ? _self.drk + : drk // ignore: cast_nullable_to_non_nullable + as int?, + top: freezed == top + ? _self.top + : top // ignore: cast_nullable_to_non_nullable + as int?, + bot: freezed == bot + ? _self.bot + : bot // ignore: cast_nullable_to_non_nullable + as int?, + hs: freezed == hs ? _self.hs : hs // ignore: cast_nullable_to_non_nullable + as List?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Images implements Images { + const _Images( + {this.startdate, this.fullstartdate, this.enddate, this.url, this.urlbase, this.copyright, this.copyrightlink, this.title, this.quiz, this.wp, this.hsh, this.drk, this.top, this.bot, final List< + dynamic>? hs}) : _hs = hs; + + factory _Images.fromJson(Map json) => _$ImagesFromJson(json); + + @override final String? startdate; + @override final String? fullstartdate; + @override final String? enddate; + @override final String? url; + @override final String? urlbase; + @override final String? copyright; + @override final String? copyrightlink; + @override final String? title; + @override final String? quiz; + @override final bool? wp; + @override final String? hsh; + @override final int? drk; + @override final int? top; + @override final int? bot; + final List? _hs; + + @override List? get hs { + final value = _hs; + if (value == null) return null; + if (_hs is EqualUnmodifiableListView) return _hs; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + + /// Create a copy of Images + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ImagesCopyWith<_Images> get copyWith => + __$ImagesCopyWithImpl<_Images>(this, _$identity); + + @override + Map toJson() { + return _$ImagesToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Images && + (identical(other.startdate, startdate) || + other.startdate == startdate) && + (identical(other.fullstartdate, fullstartdate) || + other.fullstartdate == fullstartdate) && + (identical(other.enddate, enddate) || other.enddate == enddate) && + (identical(other.url, url) || other.url == url) && + (identical(other.urlbase, urlbase) || other.urlbase == urlbase) && + (identical(other.copyright, copyright) || + other.copyright == copyright) && + (identical(other.copyrightlink, copyrightlink) || + other.copyrightlink == copyrightlink) && + (identical(other.title, title) || other.title == title) && + (identical(other.quiz, quiz) || other.quiz == quiz) && + (identical(other.wp, wp) || other.wp == wp) && + (identical(other.hsh, hsh) || other.hsh == hsh) && + (identical(other.drk, drk) || other.drk == drk) && + (identical(other.top, top) || other.top == top) && + (identical(other.bot, bot) || other.bot == bot) && + const DeepCollectionEquality().equals(other._hs, _hs)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + startdate, + fullstartdate, + enddate, + url, + urlbase, + copyright, + copyrightlink, + title, + quiz, + wp, + hsh, + drk, + top, + bot, + const DeepCollectionEquality().hash(_hs)); + + @override + String toString() { + return 'Images(startdate: $startdate, fullstartdate: $fullstartdate, enddate: $enddate, url: $url, urlbase: $urlbase, copyright: $copyright, copyrightlink: $copyrightlink, title: $title, quiz: $quiz, wp: $wp, hsh: $hsh, drk: $drk, top: $top, bot: $bot, hs: $hs)'; + } + + +} + +/// @nodoc +abstract mixin class _$ImagesCopyWith<$Res> implements $ImagesCopyWith<$Res> { + factory _$ImagesCopyWith(_Images value, + $Res Function(_Images) _then) = __$ImagesCopyWithImpl; + + @override + @useResult + $Res call({ + String? startdate, String? fullstartdate, String? enddate, String? url, String? urlbase, String? copyright, String? copyrightlink, String? title, String? quiz, bool? wp, String? hsh, int? drk, int? top, int? bot, List< + dynamic>? hs + }); + + +} + +/// @nodoc +class __$ImagesCopyWithImpl<$Res> + implements _$ImagesCopyWith<$Res> { + __$ImagesCopyWithImpl(this._self, this._then); + + final _Images _self; + final $Res Function(_Images) _then; + + /// Create a copy of Images + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? startdate = freezed, Object? fullstartdate = freezed, Object? enddate = freezed, Object? url = freezed, Object? urlbase = freezed, Object? copyright = freezed, Object? copyrightlink = freezed, Object? title = freezed, Object? quiz = freezed, Object? wp = freezed, Object? hsh = freezed, Object? drk = freezed, Object? top = freezed, Object? bot = freezed, Object? hs = freezed,}) { + return _then(_Images( + startdate: freezed == startdate + ? _self.startdate + : startdate // ignore: cast_nullable_to_non_nullable + as String?, + fullstartdate: freezed == fullstartdate + ? _self.fullstartdate + : fullstartdate // ignore: cast_nullable_to_non_nullable + as String?, + enddate: freezed == enddate + ? _self.enddate + : enddate // ignore: cast_nullable_to_non_nullable + as String?, + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + urlbase: freezed == urlbase + ? _self.urlbase + : urlbase // ignore: cast_nullable_to_non_nullable + as String?, + copyright: freezed == copyright + ? _self.copyright + : copyright // ignore: cast_nullable_to_non_nullable + as String?, + copyrightlink: freezed == copyrightlink + ? _self.copyrightlink + : copyrightlink // ignore: cast_nullable_to_non_nullable + as String?, + title: freezed == title + ? _self.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + quiz: freezed == quiz + ? _self.quiz + : quiz // ignore: cast_nullable_to_non_nullable + as String?, + wp: freezed == wp ? _self.wp : wp // ignore: cast_nullable_to_non_nullable + as bool?, + hsh: freezed == hsh + ? _self.hsh + : hsh // ignore: cast_nullable_to_non_nullable + as String?, + drk: freezed == drk + ? _self.drk + : drk // ignore: cast_nullable_to_non_nullable + as int?, + top: freezed == top + ? _self.top + : top // ignore: cast_nullable_to_non_nullable + as int?, + bot: freezed == bot + ? _self.bot + : bot // ignore: cast_nullable_to_non_nullable + as int?, + hs: freezed == hs + ? _self._hs + : hs // ignore: cast_nullable_to_non_nullable + as List?, + )); + } + + +} + +// dart format on diff --git a/lib/common/models/image.g.dart b/lib/common/models/image.g.dart new file mode 100644 index 0000000..234cf41 --- /dev/null +++ b/lib/common/models/image.g.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'image.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_BingImage _$BingImageFromJson(Map json) => _BingImage( + images: + (json['images'] as List?) + ?.map((e) => Images.fromJson(e as Map)) + .toList(), + tooltips: + json['tooltips'] == null + ? null + : Tooltips.fromJson(json['tooltips'] as Map), +); + +Map _$BingImageToJson(_BingImage instance) => + { + if (instance.images case final value?) 'images': value, + if (instance.tooltips case final value?) 'tooltips': value, + }; + +_Tooltips _$TooltipsFromJson(Map json) => _Tooltips( + loading: json['loading'] as String?, + previous: json['previous'] as String?, + next: json['next'] as String?, + walle: json['walle'] as String?, + walls: json['walls'] as String?, +); + +Map _$TooltipsToJson(_Tooltips instance) => { + if (instance.loading case final value?) 'loading': value, + if (instance.previous case final value?) 'previous': value, + if (instance.next case final value?) 'next': value, + if (instance.walle case final value?) 'walle': value, + if (instance.walls case final value?) 'walls': value, +}; + +_Images _$ImagesFromJson(Map json) => _Images( + startdate: json['startdate'] as String?, + fullstartdate: json['fullstartdate'] as String?, + enddate: json['enddate'] as String?, + url: json['url'] as String?, + urlbase: json['urlbase'] as String?, + copyright: json['copyright'] as String?, + copyrightlink: json['copyrightlink'] as String?, + title: json['title'] as String?, + quiz: json['quiz'] as String?, + wp: json['wp'] as bool?, + hsh: json['hsh'] as String?, + drk: (json['drk'] as num?)?.toInt(), + top: (json['top'] as num?)?.toInt(), + bot: (json['bot'] as num?)?.toInt(), + hs: json['hs'] as List?, +); + +Map _$ImagesToJson(_Images instance) => { + if (instance.startdate case final value?) 'startdate': value, + if (instance.fullstartdate case final value?) 'fullstartdate': value, + if (instance.enddate case final value?) 'enddate': value, + if (instance.url case final value?) 'url': value, + if (instance.urlbase case final value?) 'urlbase': value, + if (instance.copyright case final value?) 'copyright': value, + if (instance.copyrightlink case final value?) 'copyrightlink': value, + if (instance.title case final value?) 'title': value, + if (instance.quiz case final value?) 'quiz': value, + if (instance.wp case final value?) 'wp': value, + if (instance.hsh case final value?) 'hsh': value, + if (instance.drk case final value?) 'drk': value, + if (instance.top case final value?) 'top': value, + if (instance.bot case final value?) 'bot': value, + if (instance.hs case final value?) 'hs': value, +}; diff --git a/lib/common/models/weather.dart b/lib/common/models/weather.dart index cbf0cea..63b6710 100644 --- a/lib/common/models/weather.dart +++ b/lib/common/models/weather.dart @@ -1,136 +1,48 @@ -class WeatherResponse { - String? code; - String? updateTime; - String? fxLink; - Now? now; - Refer? refer; +import 'package:freezed_annotation/freezed_annotation.dart'; - WeatherResponse({ - this.code, - this.updateTime, - this.fxLink, - this.now, - this.refer, - }); +part 'weather.freezed.dart'; +part 'weather.g.dart'; - WeatherResponse.fromJson(Map json) { - code = json["code"]; - updateTime = json["updateTime"]; - fxLink = json["fxLink"]; - now = json["now"] == null ? null : Now.fromJson(json["now"]); - refer = json["refer"] == null ? null : Refer.fromJson(json["refer"]); - } +@freezed +abstract class WeatherResponse with _$WeatherResponse { + const factory WeatherResponse({ + String? code, + String? updateTime, + String? fxLink, + Now? now, + Refer? refer, + }) = _WeatherResponse; - Map toJson() { - final Map data = {}; - data["code"] = code; - data["updateTime"] = updateTime; - data["fxLink"] = fxLink; - if (now != null) { - data["now"] = now?.toJson(); - } - if (refer != null) { - data["refer"] = refer?.toJson(); - } - return data; - } + factory WeatherResponse.fromJson(Map json) => + _$WeatherResponseFromJson(json); } -class Refer { - List? sources; - List? license; +@freezed +abstract class Refer with _$Refer { + const factory Refer({List? sources, List? license}) = _Refer; - Refer({this.sources, this.license}); - - Refer.fromJson(Map json) { - sources = - json["sources"] == null ? null : List.from(json["sources"]); - license = - json["license"] == null ? null : List.from(json["license"]); - } - - Map toJson() { - final Map data = {}; - if (sources != null) { - data["sources"] = sources; - } - if (license != null) { - data["license"] = license; - } - return data; - } + factory Refer.fromJson(Map json) => _$ReferFromJson(json); } -class Now { - String? obsTime; - String? temp; - String? feelsLike; - String? icon; - String? text; - String? wind360; - String? windDir; - String? windScale; - String? windSpeed; - String? humidity; - String? precip; - String? pressure; - String? vis; - String? cloud; - String? dew; +@freezed +abstract class Now with _$Now { + const factory Now({ + String? obsTime, + String? temp, + String? feelsLike, + String? icon, + String? text, + String? wind360, + String? windDir, + String? windScale, + String? windSpeed, + String? humidity, + String? precip, + String? pressure, + String? vis, + String? cloud, + String? dew, + }) = _Now; - Now({ - this.obsTime, - this.temp, - this.feelsLike, - this.icon, - this.text, - this.wind360, - this.windDir, - this.windScale, - this.windSpeed, - this.humidity, - this.precip, - this.pressure, - this.vis, - this.cloud, - this.dew, - }); - - Now.fromJson(Map json) { - obsTime = json["obsTime"]; - temp = json["temp"]; - feelsLike = json["feelsLike"]; - icon = json["icon"]; - text = json["text"]; - wind360 = json["wind360"]; - windDir = json["windDir"]; - windScale = json["windScale"]; - windSpeed = json["windSpeed"]; - humidity = json["humidity"]; - precip = json["precip"]; - pressure = json["pressure"]; - vis = json["vis"]; - cloud = json["cloud"]; - dew = json["dew"]; - } - - Map toJson() { - final Map data = {}; - data["obsTime"] = obsTime; - data["temp"] = temp; - data["feelsLike"] = feelsLike; - data["icon"] = icon; - data["text"] = text; - data["wind360"] = wind360; - data["windDir"] = windDir; - data["windScale"] = windScale; - data["windSpeed"] = windSpeed; - data["humidity"] = humidity; - data["precip"] = precip; - data["pressure"] = pressure; - data["vis"] = vis; - data["cloud"] = cloud; - data["dew"] = dew; - return data; - } + factory Now.fromJson(Map json) => _$NowFromJson(json); } diff --git a/lib/common/models/weather.freezed.dart b/lib/common/models/weather.freezed.dart new file mode 100644 index 0000000..7327adb --- /dev/null +++ b/lib/common/models/weather.freezed.dart @@ -0,0 +1,861 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'weather.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$WeatherResponse { + + String? get code; + + String? get updateTime; + + String? get fxLink; + + Now? get now; + + Refer? get refer; + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $WeatherResponseCopyWith get copyWith => + _$WeatherResponseCopyWithImpl( + this as WeatherResponse, _$identity); + + /// Serializes this WeatherResponse to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is WeatherResponse && + (identical(other.code, code) || other.code == code) && + (identical(other.updateTime, updateTime) || + other.updateTime == updateTime) && + (identical(other.fxLink, fxLink) || other.fxLink == fxLink) && + (identical(other.now, now) || other.now == now) && + (identical(other.refer, refer) || other.refer == refer)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, code, updateTime, fxLink, now, refer); + + @override + String toString() { + return 'WeatherResponse(code: $code, updateTime: $updateTime, fxLink: $fxLink, now: $now, refer: $refer)'; + } + + +} + +/// @nodoc +abstract mixin class $WeatherResponseCopyWith<$Res> { + factory $WeatherResponseCopyWith(WeatherResponse value, + $Res Function(WeatherResponse) _then) = _$WeatherResponseCopyWithImpl; + + @useResult + $Res call({ + String? code, String? updateTime, String? fxLink, Now? now, Refer? refer + }); + + + $NowCopyWith<$Res>? get now; + + $ReferCopyWith<$Res>? get refer; + +} + +/// @nodoc +class _$WeatherResponseCopyWithImpl<$Res> + implements $WeatherResponseCopyWith<$Res> { + _$WeatherResponseCopyWithImpl(this._self, this._then); + + final WeatherResponse _self; + final $Res Function(WeatherResponse) _then; + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? code = freezed, Object? updateTime = freezed, Object? fxLink = freezed, Object? now = freezed, Object? refer = freezed,}) { + return _then(_self.copyWith( + code: freezed == code + ? _self.code + : code // ignore: cast_nullable_to_non_nullable + as String?, + updateTime: freezed == updateTime + ? _self.updateTime + : updateTime // ignore: cast_nullable_to_non_nullable + as String?, + fxLink: freezed == fxLink + ? _self.fxLink + : fxLink // ignore: cast_nullable_to_non_nullable + as String?, + now: freezed == now + ? _self.now + : now // ignore: cast_nullable_to_non_nullable + as Now?, + refer: freezed == refer + ? _self.refer + : refer // ignore: cast_nullable_to_non_nullable + as Refer?, + )); + } + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $NowCopyWith<$Res>? get now { + if (_self.now == null) { + return null; + } + + return $NowCopyWith<$Res>(_self.now!, (value) { + return _then(_self.copyWith(now: value)); + }); + } + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ReferCopyWith<$Res>? get refer { + if (_self.refer == null) { + return null; + } + + return $ReferCopyWith<$Res>(_self.refer!, (value) { + return _then(_self.copyWith(refer: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _WeatherResponse implements WeatherResponse { + const _WeatherResponse( + {this.code, this.updateTime, this.fxLink, this.now, this.refer}); + + factory _WeatherResponse.fromJson(Map json) => + _$WeatherResponseFromJson(json); + + @override final String? code; + @override final String? updateTime; + @override final String? fxLink; + @override final Now? now; + @override final Refer? refer; + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$WeatherResponseCopyWith<_WeatherResponse> get copyWith => + __$WeatherResponseCopyWithImpl<_WeatherResponse>(this, _$identity); + + @override + Map toJson() { + return _$WeatherResponseToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _WeatherResponse && + (identical(other.code, code) || other.code == code) && + (identical(other.updateTime, updateTime) || + other.updateTime == updateTime) && + (identical(other.fxLink, fxLink) || other.fxLink == fxLink) && + (identical(other.now, now) || other.now == now) && + (identical(other.refer, refer) || other.refer == refer)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, code, updateTime, fxLink, now, refer); + + @override + String toString() { + return 'WeatherResponse(code: $code, updateTime: $updateTime, fxLink: $fxLink, now: $now, refer: $refer)'; + } + + +} + +/// @nodoc +abstract mixin class _$WeatherResponseCopyWith<$Res> + implements $WeatherResponseCopyWith<$Res> { + factory _$WeatherResponseCopyWith(_WeatherResponse value, + $Res Function(_WeatherResponse) _then) = __$WeatherResponseCopyWithImpl; + + @override + @useResult + $Res call({ + String? code, String? updateTime, String? fxLink, Now? now, Refer? refer + }); + + + @override $NowCopyWith<$Res>? get now; + + @override $ReferCopyWith<$Res>? get refer; + +} + +/// @nodoc +class __$WeatherResponseCopyWithImpl<$Res> + implements _$WeatherResponseCopyWith<$Res> { + __$WeatherResponseCopyWithImpl(this._self, this._then); + + final _WeatherResponse _self; + final $Res Function(_WeatherResponse) _then; + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? code = freezed, Object? updateTime = freezed, Object? fxLink = freezed, Object? now = freezed, Object? refer = freezed,}) { + return _then(_WeatherResponse( + code: freezed == code + ? _self.code + : code // ignore: cast_nullable_to_non_nullable + as String?, + updateTime: freezed == updateTime + ? _self.updateTime + : updateTime // ignore: cast_nullable_to_non_nullable + as String?, + fxLink: freezed == fxLink + ? _self.fxLink + : fxLink // ignore: cast_nullable_to_non_nullable + as String?, + now: freezed == now + ? _self.now + : now // ignore: cast_nullable_to_non_nullable + as Now?, + refer: freezed == refer + ? _self.refer + : refer // ignore: cast_nullable_to_non_nullable + as Refer?, + )); + } + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $NowCopyWith<$Res>? get now { + if (_self.now == null) { + return null; + } + + return $NowCopyWith<$Res>(_self.now!, (value) { + return _then(_self.copyWith(now: value)); + }); + } + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ReferCopyWith<$Res>? get refer { + if (_self.refer == null) { + return null; + } + + return $ReferCopyWith<$Res>(_self.refer!, (value) { + return _then(_self.copyWith(refer: value)); + }); + } +} + + +/// @nodoc +mixin _$Refer { + + List? get sources; + + List? get license; + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReferCopyWith get copyWith => + _$ReferCopyWithImpl(this as Refer, _$identity); + + /// Serializes this Refer to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Refer && + const DeepCollectionEquality().equals(other.sources, sources) && + const DeepCollectionEquality().equals(other.license, license)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, const DeepCollectionEquality().hash(sources), + const DeepCollectionEquality().hash(license)); + + @override + String toString() { + return 'Refer(sources: $sources, license: $license)'; + } + + +} + +/// @nodoc +abstract mixin class $ReferCopyWith<$Res> { + factory $ReferCopyWith(Refer value, + $Res Function(Refer) _then) = _$ReferCopyWithImpl; + + @useResult + $Res call({ + List? sources, List? license + }); + + +} + +/// @nodoc +class _$ReferCopyWithImpl<$Res> + implements $ReferCopyWith<$Res> { + _$ReferCopyWithImpl(this._self, this._then); + + final Refer _self; + final $Res Function(Refer) _then; + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? sources = freezed, Object? license = freezed,}) { + return _then(_self.copyWith( + sources: freezed == sources + ? _self.sources + : sources // ignore: cast_nullable_to_non_nullable + as List?, + license: freezed == license + ? _self.license + : license // ignore: cast_nullable_to_non_nullable + as List?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Refer implements Refer { + const _Refer({final List? sources, final List? license}) + : _sources = sources, + _license = license; + + factory _Refer.fromJson(Map json) => _$ReferFromJson(json); + + final List? _sources; + + @override List? get sources { + final value = _sources; + if (value == null) return null; + if (_sources is EqualUnmodifiableListView) return _sources; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + final List? _license; + + @override List? get license { + final value = _license; + if (value == null) return null; + if (_license is EqualUnmodifiableListView) return _license; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ReferCopyWith<_Refer> get copyWith => + __$ReferCopyWithImpl<_Refer>(this, _$identity); + + @override + Map toJson() { + return _$ReferToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Refer && + const DeepCollectionEquality().equals(other._sources, _sources) && + const DeepCollectionEquality().equals(other._license, _license)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, const DeepCollectionEquality().hash(_sources), + const DeepCollectionEquality().hash(_license)); + + @override + String toString() { + return 'Refer(sources: $sources, license: $license)'; + } + + +} + +/// @nodoc +abstract mixin class _$ReferCopyWith<$Res> implements $ReferCopyWith<$Res> { + factory _$ReferCopyWith(_Refer value, + $Res Function(_Refer) _then) = __$ReferCopyWithImpl; + + @override + @useResult + $Res call({ + List? sources, List? license + }); + + +} + +/// @nodoc +class __$ReferCopyWithImpl<$Res> + implements _$ReferCopyWith<$Res> { + __$ReferCopyWithImpl(this._self, this._then); + + final _Refer _self; + final $Res Function(_Refer) _then; + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({Object? sources = freezed, Object? license = freezed,}) { + return _then(_Refer( + sources: freezed == sources + ? _self._sources + : sources // ignore: cast_nullable_to_non_nullable + as List?, + license: freezed == license + ? _self._license + : license // ignore: cast_nullable_to_non_nullable + as List?, + )); + } + + +} + + +/// @nodoc +mixin _$Now { + + String? get obsTime; + + String? get temp; + + String? get feelsLike; + + String? get icon; + + String? get text; + + String? get wind360; + + String? get windDir; + + String? get windScale; + + String? get windSpeed; + + String? get humidity; + + String? get precip; + + String? get pressure; + + String? get vis; + + String? get cloud; + + String? get dew; + + /// Create a copy of Now + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NowCopyWith get copyWith => + _$NowCopyWithImpl(this as Now, _$identity); + + /// Serializes this Now to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Now && + (identical(other.obsTime, obsTime) || other.obsTime == obsTime) && + (identical(other.temp, temp) || other.temp == temp) && + (identical(other.feelsLike, feelsLike) || + other.feelsLike == feelsLike) && + (identical(other.icon, icon) || other.icon == icon) && + (identical(other.text, text) || other.text == text) && + (identical(other.wind360, wind360) || other.wind360 == wind360) && + (identical(other.windDir, windDir) || other.windDir == windDir) && + (identical(other.windScale, windScale) || + other.windScale == windScale) && + (identical(other.windSpeed, windSpeed) || + other.windSpeed == windSpeed) && + (identical(other.humidity, humidity) || + other.humidity == humidity) && + (identical(other.precip, precip) || other.precip == precip) && + (identical(other.pressure, pressure) || + other.pressure == pressure) && + (identical(other.vis, vis) || other.vis == vis) && + (identical(other.cloud, cloud) || other.cloud == cloud) && + (identical(other.dew, dew) || other.dew == dew)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + obsTime, + temp, + feelsLike, + icon, + text, + wind360, + windDir, + windScale, + windSpeed, + humidity, + precip, + pressure, + vis, + cloud, + dew); + + @override + String toString() { + return 'Now(obsTime: $obsTime, temp: $temp, feelsLike: $feelsLike, icon: $icon, text: $text, wind360: $wind360, windDir: $windDir, windScale: $windScale, windSpeed: $windSpeed, humidity: $humidity, precip: $precip, pressure: $pressure, vis: $vis, cloud: $cloud, dew: $dew)'; + } + + +} + +/// @nodoc +abstract mixin class $NowCopyWith<$Res> { + factory $NowCopyWith(Now value, $Res Function(Now) _then) = _$NowCopyWithImpl; + + @useResult + $Res call({ + String? obsTime, String? temp, String? feelsLike, String? icon, String? text, String? wind360, String? windDir, String? windScale, String? windSpeed, String? humidity, String? precip, String? pressure, String? vis, String? cloud, String? dew + }); + + +} + +/// @nodoc +class _$NowCopyWithImpl<$Res> + implements $NowCopyWith<$Res> { + _$NowCopyWithImpl(this._self, this._then); + + final Now _self; + final $Res Function(Now) _then; + + /// Create a copy of Now + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? obsTime = freezed, Object? temp = freezed, Object? feelsLike = freezed, Object? icon = freezed, Object? text = freezed, Object? wind360 = freezed, Object? windDir = freezed, Object? windScale = freezed, Object? windSpeed = freezed, Object? humidity = freezed, Object? precip = freezed, Object? pressure = freezed, Object? vis = freezed, Object? cloud = freezed, Object? dew = freezed,}) { + return _then(_self.copyWith( + obsTime: freezed == obsTime + ? _self.obsTime + : obsTime // ignore: cast_nullable_to_non_nullable + as String?, + temp: freezed == temp + ? _self.temp + : temp // ignore: cast_nullable_to_non_nullable + as String?, + feelsLike: freezed == feelsLike + ? _self.feelsLike + : feelsLike // ignore: cast_nullable_to_non_nullable + as String?, + icon: freezed == icon + ? _self.icon + : icon // ignore: cast_nullable_to_non_nullable + as String?, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + wind360: freezed == wind360 + ? _self.wind360 + : wind360 // ignore: cast_nullable_to_non_nullable + as String?, + windDir: freezed == windDir + ? _self.windDir + : windDir // ignore: cast_nullable_to_non_nullable + as String?, + windScale: freezed == windScale + ? _self.windScale + : windScale // ignore: cast_nullable_to_non_nullable + as String?, + windSpeed: freezed == windSpeed + ? _self.windSpeed + : windSpeed // ignore: cast_nullable_to_non_nullable + as String?, + humidity: freezed == humidity + ? _self.humidity + : humidity // ignore: cast_nullable_to_non_nullable + as String?, + precip: freezed == precip + ? _self.precip + : precip // ignore: cast_nullable_to_non_nullable + as String?, + pressure: freezed == pressure + ? _self.pressure + : pressure // ignore: cast_nullable_to_non_nullable + as String?, + vis: freezed == vis + ? _self.vis + : vis // ignore: cast_nullable_to_non_nullable + as String?, + cloud: freezed == cloud + ? _self.cloud + : cloud // ignore: cast_nullable_to_non_nullable + as String?, + dew: freezed == dew + ? _self.dew + : dew // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Now implements Now { + const _Now( + {this.obsTime, this.temp, this.feelsLike, this.icon, this.text, this.wind360, this.windDir, this.windScale, this.windSpeed, this.humidity, this.precip, this.pressure, this.vis, this.cloud, this.dew}); + + factory _Now.fromJson(Map json) => _$NowFromJson(json); + + @override final String? obsTime; + @override final String? temp; + @override final String? feelsLike; + @override final String? icon; + @override final String? text; + @override final String? wind360; + @override final String? windDir; + @override final String? windScale; + @override final String? windSpeed; + @override final String? humidity; + @override final String? precip; + @override final String? pressure; + @override final String? vis; + @override final String? cloud; + @override final String? dew; + + /// Create a copy of Now + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$NowCopyWith<_Now> get copyWith => + __$NowCopyWithImpl<_Now>(this, _$identity); + + @override + Map toJson() { + return _$NowToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Now && + (identical(other.obsTime, obsTime) || other.obsTime == obsTime) && + (identical(other.temp, temp) || other.temp == temp) && + (identical(other.feelsLike, feelsLike) || + other.feelsLike == feelsLike) && + (identical(other.icon, icon) || other.icon == icon) && + (identical(other.text, text) || other.text == text) && + (identical(other.wind360, wind360) || other.wind360 == wind360) && + (identical(other.windDir, windDir) || other.windDir == windDir) && + (identical(other.windScale, windScale) || + other.windScale == windScale) && + (identical(other.windSpeed, windSpeed) || + other.windSpeed == windSpeed) && + (identical(other.humidity, humidity) || + other.humidity == humidity) && + (identical(other.precip, precip) || other.precip == precip) && + (identical(other.pressure, pressure) || + other.pressure == pressure) && + (identical(other.vis, vis) || other.vis == vis) && + (identical(other.cloud, cloud) || other.cloud == cloud) && + (identical(other.dew, dew) || other.dew == dew)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + obsTime, + temp, + feelsLike, + icon, + text, + wind360, + windDir, + windScale, + windSpeed, + humidity, + precip, + pressure, + vis, + cloud, + dew); + + @override + String toString() { + return 'Now(obsTime: $obsTime, temp: $temp, feelsLike: $feelsLike, icon: $icon, text: $text, wind360: $wind360, windDir: $windDir, windScale: $windScale, windSpeed: $windSpeed, humidity: $humidity, precip: $precip, pressure: $pressure, vis: $vis, cloud: $cloud, dew: $dew)'; + } + + +} + +/// @nodoc +abstract mixin class _$NowCopyWith<$Res> implements $NowCopyWith<$Res> { + factory _$NowCopyWith(_Now value, + $Res Function(_Now) _then) = __$NowCopyWithImpl; + + @override + @useResult + $Res call({ + String? obsTime, String? temp, String? feelsLike, String? icon, String? text, String? wind360, String? windDir, String? windScale, String? windSpeed, String? humidity, String? precip, String? pressure, String? vis, String? cloud, String? dew + }); + + +} + +/// @nodoc +class __$NowCopyWithImpl<$Res> + implements _$NowCopyWith<$Res> { + __$NowCopyWithImpl(this._self, this._then); + + final _Now _self; + final $Res Function(_Now) _then; + + /// Create a copy of Now + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? obsTime = freezed, Object? temp = freezed, Object? feelsLike = freezed, Object? icon = freezed, Object? text = freezed, Object? wind360 = freezed, Object? windDir = freezed, Object? windScale = freezed, Object? windSpeed = freezed, Object? humidity = freezed, Object? precip = freezed, Object? pressure = freezed, Object? vis = freezed, Object? cloud = freezed, Object? dew = freezed,}) { + return _then(_Now( + obsTime: freezed == obsTime + ? _self.obsTime + : obsTime // ignore: cast_nullable_to_non_nullable + as String?, + temp: freezed == temp + ? _self.temp + : temp // ignore: cast_nullable_to_non_nullable + as String?, + feelsLike: freezed == feelsLike + ? _self.feelsLike + : feelsLike // ignore: cast_nullable_to_non_nullable + as String?, + icon: freezed == icon + ? _self.icon + : icon // ignore: cast_nullable_to_non_nullable + as String?, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + wind360: freezed == wind360 + ? _self.wind360 + : wind360 // ignore: cast_nullable_to_non_nullable + as String?, + windDir: freezed == windDir + ? _self.windDir + : windDir // ignore: cast_nullable_to_non_nullable + as String?, + windScale: freezed == windScale + ? _self.windScale + : windScale // ignore: cast_nullable_to_non_nullable + as String?, + windSpeed: freezed == windSpeed + ? _self.windSpeed + : windSpeed // ignore: cast_nullable_to_non_nullable + as String?, + humidity: freezed == humidity + ? _self.humidity + : humidity // ignore: cast_nullable_to_non_nullable + as String?, + precip: freezed == precip + ? _self.precip + : precip // ignore: cast_nullable_to_non_nullable + as String?, + pressure: freezed == pressure + ? _self.pressure + : pressure // ignore: cast_nullable_to_non_nullable + as String?, + vis: freezed == vis + ? _self.vis + : vis // ignore: cast_nullable_to_non_nullable + as String?, + cloud: freezed == cloud + ? _self.cloud + : cloud // ignore: cast_nullable_to_non_nullable + as String?, + dew: freezed == dew + ? _self.dew + : dew // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + +} + +// dart format on diff --git a/lib/common/models/weather.g.dart b/lib/common/models/weather.g.dart new file mode 100644 index 0000000..84f8dc4 --- /dev/null +++ b/lib/common/models/weather.g.dart @@ -0,0 +1,79 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'weather.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_WeatherResponse _$WeatherResponseFromJson(Map json) => + _WeatherResponse( + code: json['code'] as String?, + updateTime: json['updateTime'] as String?, + fxLink: json['fxLink'] as String?, + now: + json['now'] == null + ? null + : Now.fromJson(json['now'] as Map), + refer: + json['refer'] == null + ? null + : Refer.fromJson(json['refer'] as Map), + ); + +Map _$WeatherResponseToJson(_WeatherResponse instance) => + { + if (instance.code case final value?) 'code': value, + if (instance.updateTime case final value?) 'updateTime': value, + if (instance.fxLink case final value?) 'fxLink': value, + if (instance.now case final value?) 'now': value, + if (instance.refer case final value?) 'refer': value, + }; + +_Refer _$ReferFromJson(Map json) => _Refer( + sources: + (json['sources'] as List?)?.map((e) => e as String).toList(), + license: + (json['license'] as List?)?.map((e) => e as String).toList(), +); + +Map _$ReferToJson(_Refer instance) => { + if (instance.sources case final value?) 'sources': value, + if (instance.license case final value?) 'license': value, +}; + +_Now _$NowFromJson(Map json) => _Now( + obsTime: json['obsTime'] as String?, + temp: json['temp'] as String?, + feelsLike: json['feelsLike'] as String?, + icon: json['icon'] as String?, + text: json['text'] as String?, + wind360: json['wind360'] as String?, + windDir: json['windDir'] as String?, + windScale: json['windScale'] as String?, + windSpeed: json['windSpeed'] as String?, + humidity: json['humidity'] as String?, + precip: json['precip'] as String?, + pressure: json['pressure'] as String?, + vis: json['vis'] as String?, + cloud: json['cloud'] as String?, + dew: json['dew'] as String?, +); + +Map _$NowToJson(_Now instance) => { + if (instance.obsTime case final value?) 'obsTime': value, + if (instance.temp case final value?) 'temp': value, + if (instance.feelsLike case final value?) 'feelsLike': value, + if (instance.icon case final value?) 'icon': value, + if (instance.text case final value?) 'text': value, + if (instance.wind360 case final value?) 'wind360': value, + if (instance.windDir case final value?) 'windDir': value, + if (instance.windScale case final value?) 'windScale': value, + if (instance.windSpeed case final value?) 'windSpeed': value, + if (instance.humidity case final value?) 'humidity': value, + if (instance.precip case final value?) 'precip': value, + if (instance.pressure case final value?) 'pressure': value, + if (instance.vis case final value?) 'vis': value, + if (instance.cloud case final value?) 'cloud': value, + if (instance.dew case final value?) 'dew': value, +}; diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 9e70cdc..5fea45e 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -62,8 +62,7 @@ import 'app_localizations_zh.dart'; /// be consistent with the languages listed in the AppLocalizations.supportedLocales /// property. abstract class AppLocalizations { - AppLocalizations(String locale) - : localeName = intl.Intl.canonicalizedLocale(locale.toString()); + AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString()); final String localeName; @@ -71,8 +70,7 @@ abstract class AppLocalizations { return Localizations.of(context, AppLocalizations); } - static const LocalizationsDelegate delegate = - _AppLocalizationsDelegate(); + static const LocalizationsDelegate delegate = _AppLocalizationsDelegate(); /// A list of this localizations delegate along with the default localizations /// delegates. @@ -84,18 +82,17 @@ abstract class AppLocalizations { /// Additional delegates can be added by appending to this list in /// MaterialApp. This list does not have to be used at all if a custom list /// of delegates is preferred or required. - static const List> localizationsDelegates = - >[ - delegate, - GlobalMaterialLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - ]; + static const List> localizationsDelegates = >[ + delegate, + GlobalMaterialLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ]; /// A list of this localizations delegate's supported locales. static const List supportedLocales = [ Locale('en'), - Locale('zh'), + Locale('zh') ]; /// No description provided for @ok. @@ -1833,8 +1830,7 @@ abstract class AppLocalizations { String get labTencentCloud; } -class _AppLocalizationsDelegate - extends LocalizationsDelegate { +class _AppLocalizationsDelegate extends LocalizationsDelegate { const _AppLocalizationsDelegate(); @override @@ -1843,26 +1839,25 @@ class _AppLocalizationsDelegate } @override - bool isSupported(Locale locale) => - ['en', 'zh'].contains(locale.languageCode); + bool isSupported(Locale locale) => ['en', 'zh'].contains(locale.languageCode); @override bool shouldReload(_AppLocalizationsDelegate old) => false; } AppLocalizations lookupAppLocalizations(Locale locale) { + + // Lookup logic when only language code is specified. switch (locale.languageCode) { - case 'en': - return AppLocalizationsEn(); - case 'zh': - return AppLocalizationsZh(); + case 'en': return AppLocalizationsEn(); + case 'zh': return AppLocalizationsZh(); } throw FlutterError( 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' 'an issue with the localizations generation tool. Please file an issue ' 'on GitHub with a reproducible sample app and the gen-l10n configuration ' - 'that was used.', + 'that was used.' ); } diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 93a7f8a..428d08c 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -1,6 +1,5 @@ // ignore: unused_import import 'package:intl/intl.dart' as intl; - import 'app_localizations.dart'; // ignore_for_file: type=lint @@ -46,8 +45,7 @@ class AppLocalizationsEn extends AppLocalizations { String get startTitle3 => 'An ad-free, social-free, intimate diary'; @override - String get welcome1 => - 'Thanks for downloading this product! Before use, we hope you can read and understand our '; + String get welcome1 => 'Thanks for downloading this product! Before use, we hope you can read and understand our '; @override String get welcome2 => 'Privacy Policy '; @@ -59,8 +57,7 @@ class AppLocalizationsEn extends AppLocalizations { String get welcome4 => 'User Agreement'; @override - String get welcome5 => - '. We always respect and will strictly protect your legitimate rights and interests when using this product from any infringement. If you begin to use this product, you will be deemed to have accepted this Agreement. If you do not accept all the terms of this Agreement, do not begin to use this Product.'; + String get welcome5 => '. We always respect and will strictly protect your legitimate rights and interests when using this product from any infringement. If you begin to use this product, you will be deemed to have accepted this Agreement. If you do not accept all the terms of this Agreement, do not begin to use this Product.'; @override String get startChoice1 => 'Exit'; @@ -72,8 +69,7 @@ class AppLocalizationsEn extends AppLocalizations { String get permission1 => 'Permission grant'; @override - String get permission2 => - 'In order to better use the experience, we need the following permissions'; + String get permission2 => 'In order to better use the experience, we need the following permissions'; @override String get permission3 => '• Location permission (for getting the weather)'; @@ -118,8 +114,7 @@ class AppLocalizationsEn extends AppLocalizations { String get settingExportDialogTitle => 'Data Export'; @override - String get settingExportDialogContent => - 'After confirmation, the current application\'s data will be exported as a ZIP file, which can be used for intra application import.'; + String get settingExportDialogContent => 'After confirmation, the current application\'s data will be exported as a ZIP file, which can be used for intra application import.'; @override String get settingImport => 'Import'; @@ -128,8 +123,7 @@ class AppLocalizationsEn extends AppLocalizations { String get settingImportDialogTitle => 'Data Import'; @override - String get settingImportDialogContent => - 'Importing data will overwrite the existing data and the original data cannot be restored! Please confirm that the original data has been backed up.'; + String get settingImportDialogContent => 'Importing data will overwrite the existing data and the original data cannot be restored! Please confirm that the original data has been backed up.'; @override String get settingImportSelectFile => 'Select File'; @@ -195,8 +189,7 @@ class AppLocalizationsEn extends AppLocalizations { String get settingLockSupportBiometricsDes => 'System supports biometrics'; @override - String get settingLockNotSupportBiometricsDes => - 'System does not support biometrics'; + String get settingLockNotSupportBiometricsDes => 'System does not support biometrics'; @override String get settingLockOpen => 'Open'; @@ -214,15 +207,13 @@ class AppLocalizationsEn extends AppLocalizations { String get settingLockChooseLockType => 'Please select a password type'; @override - String get settingLockResetLock => - 'Password has been enabled, reset please close first'; + String get settingLockResetLock => 'Password has been enabled, reset please close first'; @override String get settingBackendPrivacyProtection => 'Background Privacy Protection'; @override - String get settingBackendPrivacyProtectionDes => - 'When the application is in the background, hide the application content'; + String get settingBackendPrivacyProtectionDes => 'When the application is in the background, hide the application content'; @override String get settingUserKey => 'Private Key'; @@ -234,15 +225,13 @@ class AppLocalizationsEn extends AppLocalizations { String get settingUserKeySet => 'Setting key'; @override - String get settingUserKeySetDes => - '⚠️ The key cannot be obtained after setting it, please keep it properly. If you need to use encrypted data on other devices, please make sure to use the same key.'; + String get settingUserKeySetDes => '⚠️ The key cannot be obtained after setting it, please keep it properly. If you need to use encrypted data on other devices, please make sure to use the same key.'; @override String get settingUserKeyReset => 'Reset key'; @override - String get settingUserKeyResetDes => - 'Are you sure you want to reset the key?'; + String get settingUserKeyResetDes => 'Are you sure you want to reset the key?'; @override String get settingUserKeyHasSet => 'Set'; @@ -515,19 +504,16 @@ class AppLocalizationsEn extends AppLocalizations { String get lanTransferChangeTransferPort => 'Change transfer port'; @override - String get lanTransferChangePortDes => - 'Please ensure that the ports of the two devices are consistent. You need to rescan after changing'; + String get lanTransferChangePortDes => 'Please ensure that the ports of the two devices are consistent. You need to rescan after changing'; @override - String get lanTransferChangePortError1 => - 'Please enter the temporary port number (49152-65535)'; + String get lanTransferChangePortError1 => 'Please enter the temporary port number (49152-65535)'; @override String get lanTransferChangePortError2 => 'Please enter the port number'; @override - String get lanTransferReceiveDes => - 'Do not close the application during the receiving process'; + String get lanTransferReceiveDes => 'Do not close the application during the receiving process'; @override String get lanTransferReceiveServerStart => 'The server has started'; @@ -539,22 +525,19 @@ class AppLocalizationsEn extends AppLocalizations { String get webdavSyncWhenStartUp => 'Sync on startup'; @override - String get webdavSyncWhenStartUpDes => - 'Automatically synchronize when starting the application'; + String get webdavSyncWhenStartUpDes => 'Automatically synchronize when starting the application'; @override String get webdavSyncAfterChange => 'Sync after change'; @override - String get webdavSyncAfterChangeDes => - 'Automatically synchronize after changing data'; + String get webdavSyncAfterChangeDes => 'Automatically synchronize after changing data'; @override String get webdavSyncEncryption => 'Encryption'; @override - String get webdavSyncEncryptionDes => - 'Encrypting synchronous data, you need to set a private key'; + String get webdavSyncEncryptionDes => 'Encrypting synchronous data, you need to set a private key'; @override String get webdavOptionServer => 'Server address'; @@ -587,8 +570,7 @@ class AppLocalizationsEn extends AppLocalizations { String get diarySettingRichText => 'Rich text'; @override - String get diarySettingRichTextDes => - 'Supports more styles and attachments to make content presentation richer'; + String get diarySettingRichTextDes => 'Supports more styles and attachments to make content presentation richer'; @override String get diarySettingShowHeaderImage => 'Diary page display header image'; @@ -597,8 +579,7 @@ class AppLocalizationsEn extends AppLocalizations { String get diarySettingPlainText => 'Plain text'; @override - String get diarySettingPlainTextDes => - 'Remove redundant styles and enjoy a purer writing experience'; + String get diarySettingPlainTextDes => 'Remove redundant styles and enjoy a purer writing experience'; @override String get diarySettingFirstLineIndent => 'Automatic first line indent'; @@ -657,8 +638,7 @@ class AppLocalizationsEn extends AppLocalizations { String get noticeEnableLocation => 'Please enable location permission'; @override - String get noticeEnableLocation2 => - 'Please go to settings to enable location permissions'; + String get noticeEnableLocation2 => 'Please go to settings to enable location permissions'; @override String get diarySearch => 'Search'; @@ -910,8 +890,7 @@ class AppLocalizationsEn extends AppLocalizations { String get inputMethodHandelInput => 'Manual input'; @override - String get getKeyFromConsole => - 'Please get the key from the corresponding console'; + String get getKeyFromConsole => 'Please get the key from the corresponding console'; @override String get hasOption => 'Configured'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index ffdb6a9..db44080 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -1,6 +1,5 @@ // ignore: unused_import import 'package:intl/intl.dart' as intl; - import 'app_localizations.dart'; // ignore_for_file: type=lint @@ -58,8 +57,7 @@ class AppLocalizationsZh extends AppLocalizations { String get welcome4 => '《用户协议》'; @override - String get welcome5 => - '。我们一向尊重并会严格保护您在使用本产品时的合法权益不受到任何侵犯。用户开始使用本产品将视为已经接受本协议,如果您不能接受本协议中的全部条款,请勿开始使用本产品。'; + String get welcome5 => '。我们一向尊重并会严格保护您在使用本产品时的合法权益不受到任何侵犯。用户开始使用本产品将视为已经接受本协议,如果您不能接受本协议中的全部条款,请勿开始使用本产品。'; @override String get startChoice1 => '退出'; @@ -116,8 +114,7 @@ class AppLocalizationsZh extends AppLocalizations { String get settingExportDialogTitle => '数据导出'; @override - String get settingExportDialogContent => - '确认后会将当前应用的数据导出为 ZIP 文件,文件可用于应用内导入使用。'; + String get settingExportDialogContent => '确认后会将当前应用的数据导出为 ZIP 文件,文件可用于应用内导入使用。'; @override String get settingImport => '导入'; @@ -126,8 +123,7 @@ class AppLocalizationsZh extends AppLocalizations { String get settingImportDialogTitle => '数据导入'; @override - String get settingImportDialogContent => - '导入数据会覆盖当前已经有的数据,且原有数据无法恢复!请确认备份好原有数据。'; + String get settingImportDialogContent => '导入数据会覆盖当前已经有的数据,且原有数据无法恢复!请确认备份好原有数据。'; @override String get settingImportSelectFile => '选择文件'; @@ -229,8 +225,7 @@ class AppLocalizationsZh extends AppLocalizations { String get settingUserKeySet => '设置密钥'; @override - String get settingUserKeySetDes => - '⚠️ 密钥设置后无法获取,请妥善保管,如果您需要在其他设备上使用加密数据,请确保使用相同的密钥。'; + String get settingUserKeySetDes => '⚠️ 密钥设置后无法获取,请妥善保管,如果您需要在其他设备上使用加密数据,请确保使用相同的密钥。'; @override String get settingUserKeyReset => '重置密钥'; diff --git a/lib/pages/analyse/analyse_logic.dart b/lib/pages/analyse/analyse_logic.dart index 5a19174..813d0a9 100644 --- a/lib/pages/analyse/analyse_logic.dart +++ b/lib/pages/analyse/analyse_logic.dart @@ -81,11 +81,12 @@ class AnalyseLogic extends GetxController { state.reply = ''; update(); final stream = await Api.getHunYuan(check['id']!, check['key']!, [ - Message( - 'system', - '我会给你一组来自一款日记APP的数据,其中包含了在某一段时间内,日记所记录的心情情况,根据这些数据,分析用户最近的心情状况,并给出合理的建议,心情的值是一个从0.0到1.0的浮点数,从小到大表示心情从坏到好,给你的值是一个Map,其中的Key是心情指数,Value是对应心情指数出现的次数。给出的输出应当是结论,不需要给出分析过程,不需要其他反馈。', + const Message( + role: 'system', + content: + '我会给你一组来自一款日记APP的数据,其中包含了在某一段时间内,日记所记录的心情情况,根据这些数据,分析用户最近的心情状况,并给出合理的建议,心情的值是一个从0.0到1.0的浮点数,从小到大表示心情从坏到好,给你的值是一个Map,其中的Key是心情指数,Value是对应心情指数出现的次数。给出的输出应当是结论,不需要给出分析过程,不需要其他反馈。', ), - Message('user', '心情:${state.moodMap.toString()}'), + Message(role: 'user', content: '心情:${state.moodMap.toString()}'), ], 0); stream?.listen((content) { if (content != '' && content.contains('data')) { diff --git a/lib/pages/assistant/assistant_logic.dart b/lib/pages/assistant/assistant_logic.dart index d314388..9121192 100644 --- a/lib/pages/assistant/assistant_logic.dart +++ b/lib/pages/assistant/assistant_logic.dart @@ -91,7 +91,7 @@ class AssistantLogic extends GetxController { unFocus(); //拿到用户提问后,对话上下文中增加一项用户提问 final askTime = DateTime.now(); - state.messages[askTime] = Message('user', ask); + state.messages[askTime] = Message(role: 'user', content: ask); update(); toBottom(); //带着上下文请求 @@ -103,7 +103,7 @@ class AssistantLogic extends GetxController { ); //如果收到了请求,添加一个回答上下文 final replyTime = DateTime.now(); - state.messages[replyTime] = Message('assistant', ''); + state.messages[replyTime] = const Message(role: 'assistant', content: ''); update(); //接收stream stream?.listen((content) { @@ -111,8 +111,11 @@ class AssistantLogic extends GetxController { final HunyuanResponse result = HunyuanResponse.fromJson( jsonDecode(content.split('data: ')[1]), ); - state.messages[replyTime]!.content += - result.choices!.first.delta!.content!; + final currentMessage = state.messages[replyTime]!; + state.messages[replyTime] = currentMessage.copyWith( + content: + currentMessage.content + result.choices!.first.delta!.content!, + ); HapticFeedback.vibrate(); update(); toBottom(); diff --git a/lib/pages/edit/edit_logic.dart b/lib/pages/edit/edit_logic.dart index 2edda62..6ae7f3e 100644 --- a/lib/pages/edit/edit_logic.dart +++ b/lib/pages/edit/edit_logic.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; +import 'package:dartx/dartx.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -540,44 +541,51 @@ class EditLogic extends GetxController { //获取天气,同时获取定位 Future getPositionAndWeather({required BuildContext context}) async { final key = PrefUtil.getValue('qweatherKey'); - if (key == null) return; + final apiHost = PrefUtil.getValue('qweatherApiHost'); + if (key.isNullOrBlank || apiHost.isNullOrBlank) return; - state.isProcessing = true; - update(['Weather']); + try { + state.isProcessing = true; + update(['Weather']); - // 获取定位 - final position = await Api.updatePosition(context); - if (position == null && context.mounted) { - _handleError(context.l10n.locationError); - return; + // 获取定位 + final position = await Api.updatePosition(context); + if (position == null && context.mounted) { + _handleError(context, context.l10n.locationError); + return; + } + state.currentDiary.position = position!; + if (!context.mounted) return; + // 获取天气 + final weather = await Api.updateWeather( + context: context, + position: LatLng(double.parse(position[0]), double.parse(position[1])), + ); + if (weather == null && context.mounted) { + _handleError(context, context.l10n.weatherError); + return; + } + state.currentDiary.weather = weather!; + state.isProcessing = false; + if (context.mounted) { + toast.success(message: context.l10n.weatherSuccess); + } + update(['Weather']); + } catch (e) { + state.isProcessing = false; + update(['Weather']); + if (context.mounted) { + toast.error(message: context.l10n.weatherError); + } } - - state.currentDiary.position = position!; - - if (!context.mounted) return; - // 获取天气 - final weather = await Api.updateWeather( - context: context, - position: LatLng(double.parse(position[0]), double.parse(position[1])), - ); - - if (weather == null && context.mounted) { - _handleError(context.l10n.weatherError); - return; - } - - state.currentDiary.weather = weather!; - state.isProcessing = false; - if (context.mounted) { - toast.success(message: context.l10n.weatherSuccess); - } - update(['Weather']); } - void _handleError(String message) { + void _handleError(BuildContext context, String message) { state.isProcessing = false; - toast.error(message: message); update(['Weather']); + if (context.mounted) { + toast.error(message: message); + } } Future pickAudio(BuildContext context) async { diff --git a/lib/pages/laboratory/laboratory_logic.dart b/lib/pages/laboratory/laboratory_logic.dart index 91a04ac..d76fd3b 100644 --- a/lib/pages/laboratory/laboratory_logic.dart +++ b/lib/pages/laboratory/laboratory_logic.dart @@ -44,6 +44,17 @@ class LaboratoryLogic extends GetxController { } } + Future setQweatherApiHost({required String host}) async { + try { + await PrefUtil.setValue('qweatherApiHost', host); + return true; + } catch (e) { + return false; + } finally { + update(); + } + } + Future setTiandituKey({required String key}) async { try { await PrefUtil.setValue('tiandituKey', key); diff --git a/lib/pages/laboratory/laboratory_view.dart b/lib/pages/laboratory/laboratory_view.dart index d262245..b80ae12 100644 --- a/lib/pages/laboratory/laboratory_view.dart +++ b/lib/pages/laboratory/laboratory_view.dart @@ -63,6 +63,21 @@ class LaboratoryPage extends StatelessWidget { } }, ), + const Gap(12), + QrInputTile( + title: '${context.l10n.labQweather} API Host', + value: PrefUtil.getValue('qweatherApiHost') ?? '', + prefix: 'qweatherApiHost', + onValue: (value) async { + final res = await logic.setQweatherApiHost(host: value); + if (res) { + toast.success(); + } else { + toast.error(); + } + }, + ), + const Gap(12), QrInputTile( title: '${context.l10n.labTianditu} Key', diff --git a/lib/persistence/pref.dart b/lib/persistence/pref.dart index 3331196..422b591 100644 --- a/lib/persistence/pref.dart +++ b/lib/persistence/pref.dart @@ -42,6 +42,8 @@ class PrefUtil { 'fontTheme', //和风key 'qweatherKey', + // 和风apihost, + 'qweatherApiHost', 'tencentId', 'tencentKey', 'tiandituKey', diff --git a/lib/utils/http_util.dart b/lib/utils/http_util.dart index 0f0088f..2238781 100644 --- a/lib/utils/http_util.dart +++ b/lib/utils/http_util.dart @@ -19,7 +19,10 @@ class HttpUtil { InterceptorsWrapper( onError: (error, handler) { if (error.type != DioExceptionType.cancel) { - toast.error(message: 'Network Error ${error.error}'); + toast.error( + message: + 'Network Error ${error.response?.statusCode} ${error.response?.statusMessage} ${error.message}', + ); } handler.next(error); }, diff --git a/lib/utils/notice_util.dart b/lib/utils/notice_util.dart index 665d2fd..ada08a5 100644 --- a/lib/utils/notice_util.dart +++ b/lib/utils/notice_util.dart @@ -141,7 +141,7 @@ class NoticeUtil { return DecoratedBox( decoration: BoxDecoration( - color: context.theme.colorScheme.surfaceContainerHigh.withValues( + color: context.theme.colorScheme.surfaceContainerHighest.withValues( alpha: 0.9, ), borderRadius: AppBorderRadius.mediumBorderRadius,