From 900ffd66dd6d1309c76e240cdd2b50dcc37f50f9 Mon Sep 17 00:00:00 2001 From: Ryotaro Onoue <73390859+YumNumm@users.noreply.github.com> Date: Tue, 30 Jan 2024 23:33:54 +0900 Subject: [PATCH] =?UTF-8?q?EQAPI=20v1=20=E5=AF=BE=E5=BF=9C=E3=81=B8?= =?UTF-8?q?=E3=81=AE=E4=B8=8B=E3=81=94=E3=81=97=E3=82=89=E3=81=88=20(#547)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add --- ios/Podfile.lock | 2 +- lib/app.dart | 14 + .../jma_forecast_intensity_icon.dart | 2 +- .../jma_forecast_lg_intensity_icon.dart | 1 + lib/core/provider/map/map_config.dart | 22 +- lib/core/provider/map/map_config.freezed.dart | 69 ++- .../model/state/earthquake_history_item.dart | 9 +- .../use_case/earthquake_history_use_case.dart | 2 +- .../earthquake_history_view_model.dart | 9 +- .../estimated_intensity_provider.dart | 2 +- .../home/features/map/view/main_map_view.dart | 10 + .../telegram_ws/model/telegram_ws_model.dart | 2 +- .../provider/telegram_provider.dart | 2 +- .../eqapi_client/lib/src/eqapi_client.dart | 29 + .../eqapi_client/lib/src/eqapi_client.g.dart | 91 +++ .../example/eqapi_schema_example.dart | 28 - .../lib/extension/telegram_v3.dart | 2 +- packages/eqapi_types/lib/lib.dart | 13 +- .../lib/model/components/eew_intensity.dart | 2 +- .../lib/model/components/intensity.dart | 3 +- .../model/components/region_intensity.dart | 2 +- packages/eqapi_types/lib/model/model.dart | 24 + .../eqapi_types/lib/model/v1/earthquake.dart | 30 + .../lib/model/v1/earthquake.freezed.dart | 493 ++++++++++++++++ .../lib/model/v1/earthquake.g.dart | 87 +++ packages/eqapi_types/lib/model/v1/eew.dart | 31 ++ .../eqapi_types/lib/model/v1/eew.freezed.dart | 526 ++++++++++++++++++ packages/eqapi_types/lib/model/v1/eew.g.dart | 89 +++ .../lib/model/v1/intensity_sub_division.dart | 19 + .../v1/intensity_sub_division.freezed.dart | 222 ++++++++ .../model/v1/intensity_sub_division.g.dart | 57 ++ .../eqapi_types/lib/model/v1/telegram.dart | 25 + .../lib/model/v1/telegram.freezed.dart | 401 +++++++++++++ .../eqapi_types/lib/model/v1/telegram.g.dart | 51 ++ .../lib/model/{ => v3}/app_information.dart | 0 .../{ => v3}/app_information.freezed.dart | 0 .../lib/model/{ => v3}/app_information.g.dart | 0 .../lib/model/{ => v3}/information_v3.dart | 0 .../{ => v3}/information_v3.freezed.dart | 0 .../lib/model/{ => v3}/information_v3.g.dart | 0 .../lib/model/{ => v3}/telegram_history.dart | 0 .../{ => v3}/telegram_history.freezed.dart | 0 .../model/{ => v3}/telegram_history.g.dart | 0 .../lib/model/{ => v3}/telegram_v3.dart | 14 +- .../model/{ => v3}/telegram_v3.freezed.dart | 0 .../lib/model/{ => v3}/telegram_v3.g.dart | 0 pubspec.lock | 64 +-- pubspec.yaml | 2 +- .../features/eew/eew_alive_provider_test.dart | 7 +- 49 files changed, 2307 insertions(+), 151 deletions(-) delete mode 100644 packages/eqapi_types/example/eqapi_schema_example.dart create mode 100644 packages/eqapi_types/lib/model/model.dart create mode 100644 packages/eqapi_types/lib/model/v1/earthquake.dart create mode 100644 packages/eqapi_types/lib/model/v1/earthquake.freezed.dart create mode 100644 packages/eqapi_types/lib/model/v1/earthquake.g.dart create mode 100644 packages/eqapi_types/lib/model/v1/eew.dart create mode 100644 packages/eqapi_types/lib/model/v1/eew.freezed.dart create mode 100644 packages/eqapi_types/lib/model/v1/eew.g.dart create mode 100644 packages/eqapi_types/lib/model/v1/intensity_sub_division.dart create mode 100644 packages/eqapi_types/lib/model/v1/intensity_sub_division.freezed.dart create mode 100644 packages/eqapi_types/lib/model/v1/intensity_sub_division.g.dart create mode 100644 packages/eqapi_types/lib/model/v1/telegram.dart create mode 100644 packages/eqapi_types/lib/model/v1/telegram.freezed.dart create mode 100644 packages/eqapi_types/lib/model/v1/telegram.g.dart rename packages/eqapi_types/lib/model/{ => v3}/app_information.dart (100%) rename packages/eqapi_types/lib/model/{ => v3}/app_information.freezed.dart (100%) rename packages/eqapi_types/lib/model/{ => v3}/app_information.g.dart (100%) rename packages/eqapi_types/lib/model/{ => v3}/information_v3.dart (100%) rename packages/eqapi_types/lib/model/{ => v3}/information_v3.freezed.dart (100%) rename packages/eqapi_types/lib/model/{ => v3}/information_v3.g.dart (100%) rename packages/eqapi_types/lib/model/{ => v3}/telegram_history.dart (100%) rename packages/eqapi_types/lib/model/{ => v3}/telegram_history.freezed.dart (100%) rename packages/eqapi_types/lib/model/{ => v3}/telegram_history.g.dart (100%) rename packages/eqapi_types/lib/model/{ => v3}/telegram_v3.dart (95%) rename packages/eqapi_types/lib/model/{ => v3}/telegram_v3.freezed.dart (100%) rename packages/eqapi_types/lib/model/{ => v3}/telegram_v3.g.dart (100%) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index e8c13e2c7..6b8b38d0e 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -266,7 +266,7 @@ SPEC CHECKSUMS: FirebaseMessaging: 9bc34a98d2e0237e1b121915120d4d48ddcf301e FirebaseSessions: f90fe9212ee2818641eda051c0835c9c4e30d9ae Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743 + flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086 GoogleAppMeasurement: 70ce9aa438cff1cfb31ea3e660bcc67734cb716e GoogleDataTransport: 57c22343ab29bc686febbf7cbb13bad167c2d8fe GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34 diff --git a/lib/app.dart b/lib/app.dart index 71e413ca9..484e32821 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -1,7 +1,9 @@ import 'package:dynamic_color/dynamic_color.dart'; +import 'package:eqmonitor/core/provider/package_info.dart'; import 'package:eqmonitor/core/router/router.dart'; import 'package:eqmonitor/core/theme/custom_colors.dart'; import 'package:eqmonitor/gen/fonts.gen.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; @@ -67,6 +69,18 @@ class App extends HookConsumerWidget { ); }, ); + if (kDebugMode) { + final packageInfo = ref.watch(packageInfoProvider); + return Directionality( + textDirection: TextDirection.ltr, + child: Banner( + message: 'v${packageInfo.version}-${packageInfo.buildNumber}', + location: BannerLocation.bottomStart, + color: Colors.red.shade900, + child: app, + ), + ); + } return app; } } diff --git a/lib/core/component/intenisty/jma_forecast_intensity_icon.dart b/lib/core/component/intenisty/jma_forecast_intensity_icon.dart index 6dbf4a9d5..b762eabf7 100644 --- a/lib/core/component/intenisty/jma_forecast_intensity_icon.dart +++ b/lib/core/component/intenisty/jma_forecast_intensity_icon.dart @@ -1,4 +1,4 @@ -import 'package:eqapi_types/eqapi_types.dart'; +import 'package:eqapi_types/model/v3/telegram_v3.dart'; import 'package:eqmonitor/core/component/intenisty/intensity_icon_type.dart'; import 'package:eqmonitor/core/provider/config/theme/intensity_color/intensity_color_provider.dart'; import 'package:eqmonitor/core/provider/config/theme/intensity_color/model/intensity_color_model.dart'; diff --git a/lib/core/component/intenisty/jma_forecast_lg_intensity_icon.dart b/lib/core/component/intenisty/jma_forecast_lg_intensity_icon.dart index e0320c417..74ac567e2 100644 --- a/lib/core/component/intenisty/jma_forecast_lg_intensity_icon.dart +++ b/lib/core/component/intenisty/jma_forecast_lg_intensity_icon.dart @@ -1,4 +1,5 @@ import 'package:eqapi_types/eqapi_types.dart'; +import 'package:eqapi_types/model/v3/telegram_v3.dart'; import 'package:eqmonitor/core/component/intenisty/intensity_icon_type.dart'; import 'package:eqmonitor/core/provider/config/theme/intensity_color/intensity_color_provider.dart'; import 'package:eqmonitor/core/provider/config/theme/intensity_color/model/intensity_color_model.dart'; diff --git a/lib/core/provider/map/map_config.dart b/lib/core/provider/map/map_config.dart index 330d64f6d..0973a5518 100644 --- a/lib/core/provider/map/map_config.dart +++ b/lib/core/provider/map/map_config.dart @@ -48,11 +48,27 @@ class MapColorScheme with _$MapColorScheme { ); factory MapColorScheme.dark({required ColorScheme colorScheme}) => + /* MapColorScheme( - backgroundColor: colorScheme.surfaceVariant, - worldLandColor: colorScheme.surface, + backgroundColor: colorScheme.surface, + worldLandColor: Color.lerp( + Colors.blue, + colorScheme.surfaceVariant, + 0.9, + )!, worldLineColor: colorScheme.onSurfaceVariant, - japanLandColor: colorScheme.surface, + japanLandColor: Color.lerp( + Colors.blue.shade700, + colorScheme.surface, + 0.75, + )!, + japanLineColor: colorScheme.onSurfaceVariant, + );*/ + MapColorScheme( + backgroundColor: colorScheme.surface, + worldLandColor: colorScheme.surfaceVariant, + worldLineColor: colorScheme.onSurfaceVariant, + japanLandColor: colorScheme.surfaceVariant, japanLineColor: colorScheme.onSurfaceVariant, ); } diff --git a/lib/core/provider/map/map_config.freezed.dart b/lib/core/provider/map/map_config.freezed.dart index b7fe09a02..a78413b8d 100644 --- a/lib/core/provider/map/map_config.freezed.dart +++ b/lib/core/provider/map/map_config.freezed.dart @@ -258,30 +258,30 @@ class _$MapColorSchemeCopyWithImpl<$Res, $Val extends MapColorScheme> @pragma('vm:prefer-inline') @override $Res call({ - Object? backgroundColor = freezed, - Object? worldLandColor = freezed, - Object? worldLineColor = freezed, - Object? japanLandColor = freezed, - Object? japanLineColor = freezed, + Object? backgroundColor = null, + Object? worldLandColor = null, + Object? worldLineColor = null, + Object? japanLandColor = null, + Object? japanLineColor = null, }) { return _then(_value.copyWith( - backgroundColor: freezed == backgroundColor + backgroundColor: null == backgroundColor ? _value.backgroundColor : backgroundColor // ignore: cast_nullable_to_non_nullable as Color, - worldLandColor: freezed == worldLandColor + worldLandColor: null == worldLandColor ? _value.worldLandColor : worldLandColor // ignore: cast_nullable_to_non_nullable as Color, - worldLineColor: freezed == worldLineColor + worldLineColor: null == worldLineColor ? _value.worldLineColor : worldLineColor // ignore: cast_nullable_to_non_nullable as Color, - japanLandColor: freezed == japanLandColor + japanLandColor: null == japanLandColor ? _value.japanLandColor : japanLandColor // ignore: cast_nullable_to_non_nullable as Color, - japanLineColor: freezed == japanLineColor + japanLineColor: null == japanLineColor ? _value.japanLineColor : japanLineColor // ignore: cast_nullable_to_non_nullable as Color, @@ -321,30 +321,30 @@ class __$$MapColorSchemeImplCopyWithImpl<$Res> @pragma('vm:prefer-inline') @override $Res call({ - Object? backgroundColor = freezed, - Object? worldLandColor = freezed, - Object? worldLineColor = freezed, - Object? japanLandColor = freezed, - Object? japanLineColor = freezed, + Object? backgroundColor = null, + Object? worldLandColor = null, + Object? worldLineColor = null, + Object? japanLandColor = null, + Object? japanLineColor = null, }) { return _then(_$MapColorSchemeImpl( - backgroundColor: freezed == backgroundColor + backgroundColor: null == backgroundColor ? _value.backgroundColor : backgroundColor // ignore: cast_nullable_to_non_nullable as Color, - worldLandColor: freezed == worldLandColor + worldLandColor: null == worldLandColor ? _value.worldLandColor : worldLandColor // ignore: cast_nullable_to_non_nullable as Color, - worldLineColor: freezed == worldLineColor + worldLineColor: null == worldLineColor ? _value.worldLineColor : worldLineColor // ignore: cast_nullable_to_non_nullable as Color, - japanLandColor: freezed == japanLandColor + japanLandColor: null == japanLandColor ? _value.japanLandColor : japanLandColor // ignore: cast_nullable_to_non_nullable as Color, - japanLineColor: freezed == japanLineColor + japanLineColor: null == japanLineColor ? _value.japanLineColor : japanLineColor // ignore: cast_nullable_to_non_nullable as Color, @@ -396,27 +396,22 @@ class _$MapColorSchemeImpl implements _MapColorScheme { return identical(this, other) || (other.runtimeType == runtimeType && other is _$MapColorSchemeImpl && - const DeepCollectionEquality() - .equals(other.backgroundColor, backgroundColor) && - const DeepCollectionEquality() - .equals(other.worldLandColor, worldLandColor) && - const DeepCollectionEquality() - .equals(other.worldLineColor, worldLineColor) && - const DeepCollectionEquality() - .equals(other.japanLandColor, japanLandColor) && - const DeepCollectionEquality() - .equals(other.japanLineColor, japanLineColor)); + (identical(other.backgroundColor, backgroundColor) || + other.backgroundColor == backgroundColor) && + (identical(other.worldLandColor, worldLandColor) || + other.worldLandColor == worldLandColor) && + (identical(other.worldLineColor, worldLineColor) || + other.worldLineColor == worldLineColor) && + (identical(other.japanLandColor, japanLandColor) || + other.japanLandColor == japanLandColor) && + (identical(other.japanLineColor, japanLineColor) || + other.japanLineColor == japanLineColor)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(backgroundColor), - const DeepCollectionEquality().hash(worldLandColor), - const DeepCollectionEquality().hash(worldLineColor), - const DeepCollectionEquality().hash(japanLandColor), - const DeepCollectionEquality().hash(japanLineColor)); + int get hashCode => Object.hash(runtimeType, backgroundColor, worldLandColor, + worldLineColor, japanLandColor, japanLineColor); @JsonKey(ignore: true) @override diff --git a/lib/feature/earthquake_history/model/state/earthquake_history_item.dart b/lib/feature/earthquake_history/model/state/earthquake_history_item.dart index 7450501f8..d0a4fc8f0 100644 --- a/lib/feature/earthquake_history/model/state/earthquake_history_item.dart +++ b/lib/feature/earthquake_history/model/state/earthquake_history_item.dart @@ -1,11 +1,4 @@ -import 'package:eqapi_types/model/components/comments.dart'; -import 'package:eqapi_types/model/components/earthquake.dart'; -import 'package:eqapi_types/model/components/intensity.dart'; -import 'package:eqapi_types/model/components/tsunami-information/comments.dart'; -import 'package:eqapi_types/model/components/tsunami-information/tsunami_estimation.dart'; -import 'package:eqapi_types/model/components/tsunami-information/tsunami_forecast.dart'; -import 'package:eqapi_types/model/components/tsunami-information/tsunami_observations.dart'; -import 'package:eqapi_types/model/telegram_v3.dart'; +import 'package:eqapi_types/eqapi_types.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'earthquake_history_item.freezed.dart'; diff --git a/lib/feature/earthquake_history/use_case/earthquake_history_use_case.dart b/lib/feature/earthquake_history/use_case/earthquake_history_use_case.dart index 3a77231d0..0871608c5 100644 --- a/lib/feature/earthquake_history/use_case/earthquake_history_use_case.dart +++ b/lib/feature/earthquake_history/use_case/earthquake_history_use_case.dart @@ -1,5 +1,5 @@ import 'package:dio/dio.dart'; -import 'package:eqapi_types/model/telegram_v3.dart'; +import 'package:eqapi_types/eqapi_types.dart'; import 'package:eqmonitor/feature/earthquake_history/data/telegram_history_data_source.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; diff --git a/lib/feature/earthquake_history/viewmodel/earthquake_history_view_model.dart b/lib/feature/earthquake_history/viewmodel/earthquake_history_view_model.dart index 18c6849b9..ef077addb 100644 --- a/lib/feature/earthquake_history/viewmodel/earthquake_history_view_model.dart +++ b/lib/feature/earthquake_history/viewmodel/earthquake_history_view_model.dart @@ -1,12 +1,5 @@ import 'package:collection/collection.dart'; -import 'package:eqapi_types/model/components/comments.dart'; -import 'package:eqapi_types/model/components/earthquake.dart'; -import 'package:eqapi_types/model/components/intensity.dart'; -import 'package:eqapi_types/model/components/tsunami-information/comments.dart'; -import 'package:eqapi_types/model/components/tsunami-information/tsunami_estimation.dart'; -import 'package:eqapi_types/model/components/tsunami-information/tsunami_forecast.dart'; -import 'package:eqapi_types/model/components/tsunami-information/tsunami_observations.dart'; -import 'package:eqapi_types/model/telegram_v3.dart'; +import 'package:eqapi_types/eqapi_types.dart'; import 'package:eqmonitor/core/extension/async_value.dart'; import 'package:eqmonitor/core/provider/app_lifecycle.dart'; import 'package:eqmonitor/core/provider/config/earthquake_history/earthquake_history_config_provider.dart'; diff --git a/lib/feature/home/features/estimated_intensity/provider/estimated_intensity_provider.dart b/lib/feature/home/features/estimated_intensity/provider/estimated_intensity_provider.dart index dae26520b..dcf88078f 100644 --- a/lib/feature/home/features/estimated_intensity/provider/estimated_intensity_provider.dart +++ b/lib/feature/home/features/estimated_intensity/provider/estimated_intensity_provider.dart @@ -1,4 +1,4 @@ -import 'package:eqapi_types/model/telegram_v3.dart'; +import 'package:eqapi_types/eqapi_types.dart'; import 'package:eqmonitor/core/provider/log/talker.dart'; import 'package:eqmonitor/feature/earthquake_history/model/state/earthquake_history_item.dart'; import 'package:eqmonitor/feature/home/features/eew/provider/eew_alive_telegram.dart'; diff --git a/lib/feature/home/features/map/view/main_map_view.dart b/lib/feature/home/features/map/view/main_map_view.dart index e306d7aed..fe4470cd1 100644 --- a/lib/feature/home/features/map/view/main_map_view.dart +++ b/lib/feature/home/features/map/view/main_map_view.dart @@ -159,6 +159,16 @@ class MainMapView extends HookConsumerWidget { ), ].wait, ); + Future.delayed( + const Duration( + milliseconds: 100, + ), + () async => notifier.moveCameraToDefaultPosition( + bottom: 100, + left: 10, + right: 10, + ), + ); }, rotateGesturesEnabled: false, tiltGesturesEnabled: false, diff --git a/lib/feature/home/features/telegram_ws/model/telegram_ws_model.dart b/lib/feature/home/features/telegram_ws/model/telegram_ws_model.dart index 5a1e1e658..bf59d2393 100644 --- a/lib/feature/home/features/telegram_ws/model/telegram_ws_model.dart +++ b/lib/feature/home/features/telegram_ws/model/telegram_ws_model.dart @@ -1,6 +1,6 @@ // ignore_for_file: invalid_annotation_target -import 'package:eqapi_types/model/telegram_v3.dart'; +import 'package:eqapi_types/eqapi_types.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'telegram_ws_model.freezed.dart'; diff --git a/lib/feature/home/features/telegram_ws/provider/telegram_provider.dart b/lib/feature/home/features/telegram_ws/provider/telegram_provider.dart index 5c0db901d..da5b0cab4 100644 --- a/lib/feature/home/features/telegram_ws/provider/telegram_provider.dart +++ b/lib/feature/home/features/telegram_ws/provider/telegram_provider.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:eqapi_types/model/telegram_v3.dart'; +import 'package:eqapi_types/eqapi_types.dart'; import 'package:eqmonitor/core/provider/log/talker.dart'; import 'package:eqmonitor/feature/home/features/telegram_ws/model/socket_status.dart'; import 'package:eqmonitor/feature/home/features/telegram_ws/provider/telegram_socket_io.dart'; diff --git a/packages/eqapi_client/lib/src/eqapi_client.dart b/packages/eqapi_client/lib/src/eqapi_client.dart index a93e8c7f9..ccd634186 100644 --- a/packages/eqapi_client/lib/src/eqapi_client.dart +++ b/packages/eqapi_client/lib/src/eqapi_client.dart @@ -1,5 +1,6 @@ import 'package:dio/dio.dart'; import 'package:eqapi_types/eqapi_types.dart'; +import 'package:eqapi_types/lib.dart'; import 'package:retrofit/retrofit.dart'; part 'eqapi_client.g.dart'; @@ -17,6 +18,34 @@ class EqApi { ); } +@RestApi() +abstract class V1 { + factory V1(Dio dio, {String baseUrl}) = _V1; + + @GET('/v1/earthquake') + Future> getEarthquake({ + /// 1~100 + @Query('limit') int limit = 100, + + /// 0~100000 + @Query('offset') int offset = 0, + + /// 0~10 + @Query('magnitudeLte') double? magnitudeLte, + + /// 0~10 + @Query('magnitudeGte') double? magnitudeGte, + + /// 0~1000 + @Query('depthLte') double? depthLte, + + /// 0~1000 + @Query('depthGte') double? depthGte, + @Query('intensityLte') JmaIntensity? intensityLte, + @Query('intensityGte') JmaIntensity? intensityGte, + }); +} + @RestApi() abstract class V3 { factory V3(Dio dio, {String baseUrl}) = _V3; diff --git a/packages/eqapi_client/lib/src/eqapi_client.g.dart b/packages/eqapi_client/lib/src/eqapi_client.g.dart index dd06c09c8..b6f5cd064 100644 --- a/packages/eqapi_client/lib/src/eqapi_client.g.dart +++ b/packages/eqapi_client/lib/src/eqapi_client.g.dart @@ -10,6 +10,97 @@ part of 'eqapi_client.dart'; // ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers +class _V1 implements V1 { + _V1( + this._dio, { + this.baseUrl, + }); + + final Dio _dio; + + String? baseUrl; + + @override + Future> getEarthquake({ + int limit = 100, + int offset = 0, + double? magnitudeLte, + double? magnitudeGte, + double? depthLte, + double? depthGte, + JmaIntensity? intensityLte, + JmaIntensity? intensityGte, + }) async { + const _extra = {}; + final queryParameters = { + r'limit': limit, + r'offset': offset, + r'magnitudeLte': magnitudeLte, + r'magnitudeGte': magnitudeGte, + r'depthLte': depthLte, + r'depthGte': depthGte, + r'intensityLte': intensityLte?.name, + r'intensityGte': intensityGte?.name, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final Map? _data = null; + final _result = await _dio + .fetch>(_setStreamType>(Options( + method: 'GET', + headers: _headers, + extra: _extra, + ) + .compose( + _dio.options, + '/v1/earthquake', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); + var value = _result.data! + .map((dynamic i) => EarthquakeV1.fromJson(i as Map)) + .toList(); + return value; + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls( + String dioBaseUrl, + String? baseUrl, + ) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers + class _V3 implements V3 { _V3( this._dio, { diff --git a/packages/eqapi_types/example/eqapi_schema_example.dart b/packages/eqapi_types/example/eqapi_schema_example.dart deleted file mode 100644 index 47c754bf5..000000000 --- a/packages/eqapi_types/example/eqapi_schema_example.dart +++ /dev/null @@ -1,28 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:eqapi_types/model/telegram_v3.dart'; - -Future> main() async { - // load file - final file = File('test_resources/eqapi_types_test.json'); - final jsonString = await file.readAsString(); - // parse json - final json = jsonDecode(jsonString) as Map; - final results = []; - (json['results'] as Map).forEach((eventId, value) { - final telegrams = value as List; - for (final e in telegrams) { - final telegram = TelegramV3.fromJsonAndEventID( - e as Map, - int.parse(eventId), - ); - results.add(telegram); - } - }); - for (final e in results) { - // ignore: avoid_print - print('${e.runtimeType}: ${e.body is TelegramVxse53Body}'); - } - return results; -} diff --git a/packages/eqapi_types/lib/extension/telegram_v3.dart b/packages/eqapi_types/lib/extension/telegram_v3.dart index ca7f61594..43fda7b46 100644 --- a/packages/eqapi_types/lib/extension/telegram_v3.dart +++ b/packages/eqapi_types/lib/extension/telegram_v3.dart @@ -1,4 +1,4 @@ -import 'package:eqapi_types/model/telegram_v3.dart'; +import 'package:eqapi_types/eqapi_types.dart'; extension Vxse45BodyExtension on TelegramVxse45Body { bool get isLevelEew => diff --git a/packages/eqapi_types/lib/lib.dart b/packages/eqapi_types/lib/lib.dart index 84703bd58..65f0e6b44 100644 --- a/packages/eqapi_types/lib/lib.dart +++ b/packages/eqapi_types/lib/lib.dart @@ -4,7 +4,6 @@ export 'enum/enum.dart'; export 'eqapi_types.dart'; export 'extension/int_to_string.dart'; export 'extension/telegram_v3.dart'; -export 'model/app_information.dart'; export 'model/components/accuracy.dart'; export 'model/components/comments.dart'; export 'model/components/earthquake-explanation/naming.dart'; @@ -22,6 +21,12 @@ export 'model/components/tsunami-information/tsunami_observations.dart'; export 'model/components/tsunami-information/vtse41.dart'; export 'model/components/tsunami-information/vtse51.dart'; export 'model/components/tsunami-information/vtse52.dart'; -export 'model/information_v3.dart'; -export 'model/telegram_history.dart'; -export 'model/telegram_v3.dart'; +export 'model/model.dart'; +export 'model/v1/earthquake.dart'; +export 'model/v1/eew.dart'; +export 'model/v1/intensity_sub_division.dart'; +export 'model/v1/telegram.dart'; +export 'model/v3/app_information.dart'; +export 'model/v3/information_v3.dart'; +export 'model/v3/telegram_history.dart'; +export 'model/v3/telegram_v3.dart'; diff --git a/packages/eqapi_types/lib/model/components/eew_intensity.dart b/packages/eqapi_types/lib/model/components/eew_intensity.dart index b00c52c2a..ed8a97a75 100644 --- a/packages/eqapi_types/lib/model/components/eew_intensity.dart +++ b/packages/eqapi_types/lib/model/components/eew_intensity.dart @@ -1,4 +1,4 @@ -import 'package:eqapi_types/model/telegram_v3.dart'; +import 'package:eqapi_types/eqapi_types.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'eew_intensity.freezed.dart'; diff --git a/packages/eqapi_types/lib/model/components/intensity.dart b/packages/eqapi_types/lib/model/components/intensity.dart index adbd870d6..b9d902779 100644 --- a/packages/eqapi_types/lib/model/components/intensity.dart +++ b/packages/eqapi_types/lib/model/components/intensity.dart @@ -1,5 +1,4 @@ -import 'package:eqapi_types/model/components/region_intensity.dart'; -import 'package:eqapi_types/model/telegram_v3.dart'; +import 'package:eqapi_types/lib.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'intensity.freezed.dart'; diff --git a/packages/eqapi_types/lib/model/components/region_intensity.dart b/packages/eqapi_types/lib/model/components/region_intensity.dart index 0df513dfe..66a01d0c7 100644 --- a/packages/eqapi_types/lib/model/components/region_intensity.dart +++ b/packages/eqapi_types/lib/model/components/region_intensity.dart @@ -1,4 +1,4 @@ -import 'package:eqapi_types/model/telegram_v3.dart'; +import 'package:eqapi_types/eqapi_types.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'region_intensity.freezed.dart'; diff --git a/packages/eqapi_types/lib/model/model.dart b/packages/eqapi_types/lib/model/model.dart new file mode 100644 index 000000000..83cf24ff5 --- /dev/null +++ b/packages/eqapi_types/lib/model/model.dart @@ -0,0 +1,24 @@ +export 'components/accuracy.dart'; +export 'components/comments.dart'; +export 'components/earthquake-explanation/naming.dart'; +export 'components/earthquake-nankai/earthquake_info.dart'; +export 'components/earthquake.dart'; +export 'components/eew_hypocenter.dart'; +export 'components/eew_intensity.dart'; +export 'components/eew_region.dart'; +export 'components/intensity.dart'; +export 'components/region_intensity.dart'; +export 'components/tsunami-information/comments.dart'; +export 'components/tsunami-information/tsunami_estimation.dart'; +export 'components/tsunami-information/tsunami_forecast.dart'; +export 'components/tsunami-information/tsunami_observations.dart'; +export 'components/tsunami-information/vtse41.dart'; +export 'components/tsunami-information/vtse51.dart'; +export 'components/tsunami-information/vtse52.dart'; +export 'v1/earthquake.dart'; +export 'v1/eew.dart'; +export 'v1/telegram.dart'; +export 'v3/app_information.dart'; +export 'v3/information_v3.dart'; +export 'v3/telegram_history.dart'; +export 'v3/telegram_v3.dart'; diff --git a/packages/eqapi_types/lib/model/v1/earthquake.dart b/packages/eqapi_types/lib/model/v1/earthquake.dart new file mode 100644 index 000000000..97b82da20 --- /dev/null +++ b/packages/eqapi_types/lib/model/v1/earthquake.dart @@ -0,0 +1,30 @@ +import 'package:eqapi_types/lib.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'earthquake.freezed.dart'; +part 'earthquake.g.dart'; + +@freezed +class EarthquakeV1 with _$EarthquakeV1 { + const factory EarthquakeV1({ + required int id, + required int eventId, + required String status, + double? magnitude, + String? magnitudeCondition, + JmaIntensity? maxIntensity, + JmaLgIntensity? maxLpgmIntensity, + int? depth, + double? latitude, + double? longitude, + int? epicenterCode, + int? epicenterDetailCode, + DateTime? arrivalTime, + DateTime? originTime, + String? latestHeadline, + List? maxIntensityREgionIds, + }) = _EarthquakeV1; + + factory EarthquakeV1.fromJson(Map json) => + _$EarthquakeV1FromJson(json); +} diff --git a/packages/eqapi_types/lib/model/v1/earthquake.freezed.dart b/packages/eqapi_types/lib/model/v1/earthquake.freezed.dart new file mode 100644 index 000000000..6bf9bb9f2 --- /dev/null +++ b/packages/eqapi_types/lib/model/v1/earthquake.freezed.dart @@ -0,0 +1,493 @@ +// 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 'earthquake.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +EarthquakeV1 _$EarthquakeV1FromJson(Map json) { + return _EarthquakeV1.fromJson(json); +} + +/// @nodoc +mixin _$EarthquakeV1 { + int get id => throw _privateConstructorUsedError; + int get eventId => throw _privateConstructorUsedError; + String get status => throw _privateConstructorUsedError; + double? get magnitude => throw _privateConstructorUsedError; + String? get magnitudeCondition => throw _privateConstructorUsedError; + JmaIntensity? get maxIntensity => throw _privateConstructorUsedError; + JmaLgIntensity? get maxLpgmIntensity => throw _privateConstructorUsedError; + int? get depth => throw _privateConstructorUsedError; + double? get latitude => throw _privateConstructorUsedError; + double? get longitude => throw _privateConstructorUsedError; + int? get epicenterCode => throw _privateConstructorUsedError; + int? get epicenterDetailCode => throw _privateConstructorUsedError; + DateTime? get arrivalTime => throw _privateConstructorUsedError; + DateTime? get originTime => throw _privateConstructorUsedError; + String? get latestHeadline => throw _privateConstructorUsedError; + List? get maxIntensityREgionIds => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $EarthquakeV1CopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $EarthquakeV1CopyWith<$Res> { + factory $EarthquakeV1CopyWith( + EarthquakeV1 value, $Res Function(EarthquakeV1) then) = + _$EarthquakeV1CopyWithImpl<$Res, EarthquakeV1>; + @useResult + $Res call( + {int id, + int eventId, + String status, + double? magnitude, + String? magnitudeCondition, + JmaIntensity? maxIntensity, + JmaLgIntensity? maxLpgmIntensity, + int? depth, + double? latitude, + double? longitude, + int? epicenterCode, + int? epicenterDetailCode, + DateTime? arrivalTime, + DateTime? originTime, + String? latestHeadline, + List? maxIntensityREgionIds}); +} + +/// @nodoc +class _$EarthquakeV1CopyWithImpl<$Res, $Val extends EarthquakeV1> + implements $EarthquakeV1CopyWith<$Res> { + _$EarthquakeV1CopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? eventId = null, + Object? status = null, + Object? magnitude = freezed, + Object? magnitudeCondition = freezed, + Object? maxIntensity = freezed, + Object? maxLpgmIntensity = freezed, + Object? depth = freezed, + Object? latitude = freezed, + Object? longitude = freezed, + Object? epicenterCode = freezed, + Object? epicenterDetailCode = freezed, + Object? arrivalTime = freezed, + Object? originTime = freezed, + Object? latestHeadline = freezed, + Object? maxIntensityREgionIds = freezed, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as int, + status: null == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as String, + magnitude: freezed == magnitude + ? _value.magnitude + : magnitude // ignore: cast_nullable_to_non_nullable + as double?, + magnitudeCondition: freezed == magnitudeCondition + ? _value.magnitudeCondition + : magnitudeCondition // ignore: cast_nullable_to_non_nullable + as String?, + maxIntensity: freezed == maxIntensity + ? _value.maxIntensity + : maxIntensity // ignore: cast_nullable_to_non_nullable + as JmaIntensity?, + maxLpgmIntensity: freezed == maxLpgmIntensity + ? _value.maxLpgmIntensity + : maxLpgmIntensity // ignore: cast_nullable_to_non_nullable + as JmaLgIntensity?, + depth: freezed == depth + ? _value.depth + : depth // ignore: cast_nullable_to_non_nullable + as int?, + latitude: freezed == latitude + ? _value.latitude + : latitude // ignore: cast_nullable_to_non_nullable + as double?, + longitude: freezed == longitude + ? _value.longitude + : longitude // ignore: cast_nullable_to_non_nullable + as double?, + epicenterCode: freezed == epicenterCode + ? _value.epicenterCode + : epicenterCode // ignore: cast_nullable_to_non_nullable + as int?, + epicenterDetailCode: freezed == epicenterDetailCode + ? _value.epicenterDetailCode + : epicenterDetailCode // ignore: cast_nullable_to_non_nullable + as int?, + arrivalTime: freezed == arrivalTime + ? _value.arrivalTime + : arrivalTime // ignore: cast_nullable_to_non_nullable + as DateTime?, + originTime: freezed == originTime + ? _value.originTime + : originTime // ignore: cast_nullable_to_non_nullable + as DateTime?, + latestHeadline: freezed == latestHeadline + ? _value.latestHeadline + : latestHeadline // ignore: cast_nullable_to_non_nullable + as String?, + maxIntensityREgionIds: freezed == maxIntensityREgionIds + ? _value.maxIntensityREgionIds + : maxIntensityREgionIds // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$EarthquakeV1ImplCopyWith<$Res> + implements $EarthquakeV1CopyWith<$Res> { + factory _$$EarthquakeV1ImplCopyWith( + _$EarthquakeV1Impl value, $Res Function(_$EarthquakeV1Impl) then) = + __$$EarthquakeV1ImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int id, + int eventId, + String status, + double? magnitude, + String? magnitudeCondition, + JmaIntensity? maxIntensity, + JmaLgIntensity? maxLpgmIntensity, + int? depth, + double? latitude, + double? longitude, + int? epicenterCode, + int? epicenterDetailCode, + DateTime? arrivalTime, + DateTime? originTime, + String? latestHeadline, + List? maxIntensityREgionIds}); +} + +/// @nodoc +class __$$EarthquakeV1ImplCopyWithImpl<$Res> + extends _$EarthquakeV1CopyWithImpl<$Res, _$EarthquakeV1Impl> + implements _$$EarthquakeV1ImplCopyWith<$Res> { + __$$EarthquakeV1ImplCopyWithImpl( + _$EarthquakeV1Impl _value, $Res Function(_$EarthquakeV1Impl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? eventId = null, + Object? status = null, + Object? magnitude = freezed, + Object? magnitudeCondition = freezed, + Object? maxIntensity = freezed, + Object? maxLpgmIntensity = freezed, + Object? depth = freezed, + Object? latitude = freezed, + Object? longitude = freezed, + Object? epicenterCode = freezed, + Object? epicenterDetailCode = freezed, + Object? arrivalTime = freezed, + Object? originTime = freezed, + Object? latestHeadline = freezed, + Object? maxIntensityREgionIds = freezed, + }) { + return _then(_$EarthquakeV1Impl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as int, + status: null == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as String, + magnitude: freezed == magnitude + ? _value.magnitude + : magnitude // ignore: cast_nullable_to_non_nullable + as double?, + magnitudeCondition: freezed == magnitudeCondition + ? _value.magnitudeCondition + : magnitudeCondition // ignore: cast_nullable_to_non_nullable + as String?, + maxIntensity: freezed == maxIntensity + ? _value.maxIntensity + : maxIntensity // ignore: cast_nullable_to_non_nullable + as JmaIntensity?, + maxLpgmIntensity: freezed == maxLpgmIntensity + ? _value.maxLpgmIntensity + : maxLpgmIntensity // ignore: cast_nullable_to_non_nullable + as JmaLgIntensity?, + depth: freezed == depth + ? _value.depth + : depth // ignore: cast_nullable_to_non_nullable + as int?, + latitude: freezed == latitude + ? _value.latitude + : latitude // ignore: cast_nullable_to_non_nullable + as double?, + longitude: freezed == longitude + ? _value.longitude + : longitude // ignore: cast_nullable_to_non_nullable + as double?, + epicenterCode: freezed == epicenterCode + ? _value.epicenterCode + : epicenterCode // ignore: cast_nullable_to_non_nullable + as int?, + epicenterDetailCode: freezed == epicenterDetailCode + ? _value.epicenterDetailCode + : epicenterDetailCode // ignore: cast_nullable_to_non_nullable + as int?, + arrivalTime: freezed == arrivalTime + ? _value.arrivalTime + : arrivalTime // ignore: cast_nullable_to_non_nullable + as DateTime?, + originTime: freezed == originTime + ? _value.originTime + : originTime // ignore: cast_nullable_to_non_nullable + as DateTime?, + latestHeadline: freezed == latestHeadline + ? _value.latestHeadline + : latestHeadline // ignore: cast_nullable_to_non_nullable + as String?, + maxIntensityREgionIds: freezed == maxIntensityREgionIds + ? _value._maxIntensityREgionIds + : maxIntensityREgionIds // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$EarthquakeV1Impl implements _EarthquakeV1 { + const _$EarthquakeV1Impl( + {required this.id, + required this.eventId, + required this.status, + this.magnitude, + this.magnitudeCondition, + this.maxIntensity, + this.maxLpgmIntensity, + this.depth, + this.latitude, + this.longitude, + this.epicenterCode, + this.epicenterDetailCode, + this.arrivalTime, + this.originTime, + this.latestHeadline, + final List? maxIntensityREgionIds}) + : _maxIntensityREgionIds = maxIntensityREgionIds; + + factory _$EarthquakeV1Impl.fromJson(Map json) => + _$$EarthquakeV1ImplFromJson(json); + + @override + final int id; + @override + final int eventId; + @override + final String status; + @override + final double? magnitude; + @override + final String? magnitudeCondition; + @override + final JmaIntensity? maxIntensity; + @override + final JmaLgIntensity? maxLpgmIntensity; + @override + final int? depth; + @override + final double? latitude; + @override + final double? longitude; + @override + final int? epicenterCode; + @override + final int? epicenterDetailCode; + @override + final DateTime? arrivalTime; + @override + final DateTime? originTime; + @override + final String? latestHeadline; + final List? _maxIntensityREgionIds; + @override + List? get maxIntensityREgionIds { + final value = _maxIntensityREgionIds; + if (value == null) return null; + if (_maxIntensityREgionIds is EqualUnmodifiableListView) + return _maxIntensityREgionIds; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + String toString() { + return 'EarthquakeV1(id: $id, eventId: $eventId, status: $status, magnitude: $magnitude, magnitudeCondition: $magnitudeCondition, maxIntensity: $maxIntensity, maxLpgmIntensity: $maxLpgmIntensity, depth: $depth, latitude: $latitude, longitude: $longitude, epicenterCode: $epicenterCode, epicenterDetailCode: $epicenterDetailCode, arrivalTime: $arrivalTime, originTime: $originTime, latestHeadline: $latestHeadline, maxIntensityREgionIds: $maxIntensityREgionIds)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$EarthquakeV1Impl && + (identical(other.id, id) || other.id == id) && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.status, status) || other.status == status) && + (identical(other.magnitude, magnitude) || + other.magnitude == magnitude) && + (identical(other.magnitudeCondition, magnitudeCondition) || + other.magnitudeCondition == magnitudeCondition) && + (identical(other.maxIntensity, maxIntensity) || + other.maxIntensity == maxIntensity) && + (identical(other.maxLpgmIntensity, maxLpgmIntensity) || + other.maxLpgmIntensity == maxLpgmIntensity) && + (identical(other.depth, depth) || other.depth == depth) && + (identical(other.latitude, latitude) || + other.latitude == latitude) && + (identical(other.longitude, longitude) || + other.longitude == longitude) && + (identical(other.epicenterCode, epicenterCode) || + other.epicenterCode == epicenterCode) && + (identical(other.epicenterDetailCode, epicenterDetailCode) || + other.epicenterDetailCode == epicenterDetailCode) && + (identical(other.arrivalTime, arrivalTime) || + other.arrivalTime == arrivalTime) && + (identical(other.originTime, originTime) || + other.originTime == originTime) && + (identical(other.latestHeadline, latestHeadline) || + other.latestHeadline == latestHeadline) && + const DeepCollectionEquality() + .equals(other._maxIntensityREgionIds, _maxIntensityREgionIds)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + id, + eventId, + status, + magnitude, + magnitudeCondition, + maxIntensity, + maxLpgmIntensity, + depth, + latitude, + longitude, + epicenterCode, + epicenterDetailCode, + arrivalTime, + originTime, + latestHeadline, + const DeepCollectionEquality().hash(_maxIntensityREgionIds)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$EarthquakeV1ImplCopyWith<_$EarthquakeV1Impl> get copyWith => + __$$EarthquakeV1ImplCopyWithImpl<_$EarthquakeV1Impl>(this, _$identity); + + @override + Map toJson() { + return _$$EarthquakeV1ImplToJson( + this, + ); + } +} + +abstract class _EarthquakeV1 implements EarthquakeV1 { + const factory _EarthquakeV1( + {required final int id, + required final int eventId, + required final String status, + final double? magnitude, + final String? magnitudeCondition, + final JmaIntensity? maxIntensity, + final JmaLgIntensity? maxLpgmIntensity, + final int? depth, + final double? latitude, + final double? longitude, + final int? epicenterCode, + final int? epicenterDetailCode, + final DateTime? arrivalTime, + final DateTime? originTime, + final String? latestHeadline, + final List? maxIntensityREgionIds}) = _$EarthquakeV1Impl; + + factory _EarthquakeV1.fromJson(Map json) = + _$EarthquakeV1Impl.fromJson; + + @override + int get id; + @override + int get eventId; + @override + String get status; + @override + double? get magnitude; + @override + String? get magnitudeCondition; + @override + JmaIntensity? get maxIntensity; + @override + JmaLgIntensity? get maxLpgmIntensity; + @override + int? get depth; + @override + double? get latitude; + @override + double? get longitude; + @override + int? get epicenterCode; + @override + int? get epicenterDetailCode; + @override + DateTime? get arrivalTime; + @override + DateTime? get originTime; + @override + String? get latestHeadline; + @override + List? get maxIntensityREgionIds; + @override + @JsonKey(ignore: true) + _$$EarthquakeV1ImplCopyWith<_$EarthquakeV1Impl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/eqapi_types/lib/model/v1/earthquake.g.dart b/packages/eqapi_types/lib/model/v1/earthquake.g.dart new file mode 100644 index 000000000..c66237300 --- /dev/null +++ b/packages/eqapi_types/lib/model/v1/earthquake.g.dart @@ -0,0 +1,87 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: type=lint + +part of 'earthquake.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$EarthquakeV1Impl _$$EarthquakeV1ImplFromJson(Map json) => + $checkedCreate( + r'_$EarthquakeV1Impl', + json, + ($checkedConvert) { + final val = _$EarthquakeV1Impl( + id: $checkedConvert('id', (v) => v as int), + eventId: $checkedConvert('eventId', (v) => v as int), + status: $checkedConvert('status', (v) => v as String), + magnitude: + $checkedConvert('magnitude', (v) => (v as num?)?.toDouble()), + magnitudeCondition: + $checkedConvert('magnitudeCondition', (v) => v as String?), + maxIntensity: $checkedConvert('maxIntensity', + (v) => $enumDecodeNullable(_$JmaIntensityEnumMap, v)), + maxLpgmIntensity: $checkedConvert('maxLpgmIntensity', + (v) => $enumDecodeNullable(_$JmaLgIntensityEnumMap, v)), + depth: $checkedConvert('depth', (v) => v as int?), + latitude: $checkedConvert('latitude', (v) => (v as num?)?.toDouble()), + longitude: + $checkedConvert('longitude', (v) => (v as num?)?.toDouble()), + epicenterCode: $checkedConvert('epicenterCode', (v) => v as int?), + epicenterDetailCode: + $checkedConvert('epicenterDetailCode', (v) => v as int?), + arrivalTime: $checkedConvert('arrivalTime', + (v) => v == null ? null : DateTime.parse(v as String)), + originTime: $checkedConvert('originTime', + (v) => v == null ? null : DateTime.parse(v as String)), + latestHeadline: + $checkedConvert('latestHeadline', (v) => v as String?), + maxIntensityREgionIds: $checkedConvert('maxIntensityREgionIds', + (v) => (v as List?)?.map((e) => e as int).toList()), + ); + return val; + }, + ); + +Map _$$EarthquakeV1ImplToJson(_$EarthquakeV1Impl instance) => + { + 'id': instance.id, + 'eventId': instance.eventId, + 'status': instance.status, + 'magnitude': instance.magnitude, + 'magnitudeCondition': instance.magnitudeCondition, + 'maxIntensity': _$JmaIntensityEnumMap[instance.maxIntensity], + 'maxLpgmIntensity': _$JmaLgIntensityEnumMap[instance.maxLpgmIntensity], + 'depth': instance.depth, + 'latitude': instance.latitude, + 'longitude': instance.longitude, + 'epicenterCode': instance.epicenterCode, + 'epicenterDetailCode': instance.epicenterDetailCode, + 'arrivalTime': instance.arrivalTime?.toIso8601String(), + 'originTime': instance.originTime?.toIso8601String(), + 'latestHeadline': instance.latestHeadline, + 'maxIntensityREgionIds': instance.maxIntensityREgionIds, + }; + +const _$JmaIntensityEnumMap = { + JmaIntensity.one: '1', + JmaIntensity.two: '2', + JmaIntensity.three: '3', + JmaIntensity.four: '4', + JmaIntensity.fiveLower: '5-', + JmaIntensity.fiveUpper: '5+', + JmaIntensity.sixLower: '6-', + JmaIntensity.sixUpper: '6+', + JmaIntensity.seven: '7', + JmaIntensity.fiveUpperNoInput: '!5-', +}; + +const _$JmaLgIntensityEnumMap = { + JmaLgIntensity.zero: '0', + JmaLgIntensity.one: '1', + JmaLgIntensity.two: '2', + JmaLgIntensity.three: '3', + JmaLgIntensity.four: '4', +}; diff --git a/packages/eqapi_types/lib/model/v1/eew.dart b/packages/eqapi_types/lib/model/v1/eew.dart new file mode 100644 index 000000000..e628be00c --- /dev/null +++ b/packages/eqapi_types/lib/model/v1/eew.dart @@ -0,0 +1,31 @@ +import 'package:eqapi_types/lib.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'eew.freezed.dart'; +part 'eew.g.dart'; + +@freezed +class EewV1 with _$EewV1 { + const factory EewV1({ + required int id, + required int eventId, + required String type, + required String schemaType, + required String status, + required String infoType, + int? serialno, + String? headline, + required bool isCanceled, + bool? isWarning, + required bool isLastInfo, + DateTime? originTime, + DateTime? arrivalTime, + String? hypoName, + int? depth, + double? magnitude, + JmaForecastIntensity? forecastMaxIntensity, + JmaForecastLgIntensity? forecastMaxLpgmIntensity, + }) = _EewV1; + + factory EewV1.fromJson(Map json) => _$EewV1FromJson(json); +} diff --git a/packages/eqapi_types/lib/model/v1/eew.freezed.dart b/packages/eqapi_types/lib/model/v1/eew.freezed.dart new file mode 100644 index 000000000..dd1879e40 --- /dev/null +++ b/packages/eqapi_types/lib/model/v1/eew.freezed.dart @@ -0,0 +1,526 @@ +// 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 'eew.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +EewV1 _$EewV1FromJson(Map json) { + return _EewV1.fromJson(json); +} + +/// @nodoc +mixin _$EewV1 { + int get id => throw _privateConstructorUsedError; + int get eventId => throw _privateConstructorUsedError; + String get type => throw _privateConstructorUsedError; + String get schemaType => throw _privateConstructorUsedError; + String get status => throw _privateConstructorUsedError; + String get infoType => throw _privateConstructorUsedError; + int? get serialno => throw _privateConstructorUsedError; + String? get headline => throw _privateConstructorUsedError; + bool get isCanceled => throw _privateConstructorUsedError; + bool? get isWarning => throw _privateConstructorUsedError; + bool get isLastInfo => throw _privateConstructorUsedError; + DateTime? get originTime => throw _privateConstructorUsedError; + DateTime? get arrivalTime => throw _privateConstructorUsedError; + String? get hypoName => throw _privateConstructorUsedError; + int? get depth => throw _privateConstructorUsedError; + double? get magnitude => throw _privateConstructorUsedError; + JmaForecastIntensity? get forecastMaxIntensity => + throw _privateConstructorUsedError; + JmaForecastLgIntensity? get forecastMaxLpgmIntensity => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $EewV1CopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $EewV1CopyWith<$Res> { + factory $EewV1CopyWith(EewV1 value, $Res Function(EewV1) then) = + _$EewV1CopyWithImpl<$Res, EewV1>; + @useResult + $Res call( + {int id, + int eventId, + String type, + String schemaType, + String status, + String infoType, + int? serialno, + String? headline, + bool isCanceled, + bool? isWarning, + bool isLastInfo, + DateTime? originTime, + DateTime? arrivalTime, + String? hypoName, + int? depth, + double? magnitude, + JmaForecastIntensity? forecastMaxIntensity, + JmaForecastLgIntensity? forecastMaxLpgmIntensity}); +} + +/// @nodoc +class _$EewV1CopyWithImpl<$Res, $Val extends EewV1> + implements $EewV1CopyWith<$Res> { + _$EewV1CopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? eventId = null, + Object? type = null, + Object? schemaType = null, + Object? status = null, + Object? infoType = null, + Object? serialno = freezed, + Object? headline = freezed, + Object? isCanceled = null, + Object? isWarning = freezed, + Object? isLastInfo = null, + Object? originTime = freezed, + Object? arrivalTime = freezed, + Object? hypoName = freezed, + Object? depth = freezed, + Object? magnitude = freezed, + Object? forecastMaxIntensity = freezed, + Object? forecastMaxLpgmIntensity = freezed, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as int, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + schemaType: null == schemaType + ? _value.schemaType + : schemaType // ignore: cast_nullable_to_non_nullable + as String, + status: null == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as String, + infoType: null == infoType + ? _value.infoType + : infoType // ignore: cast_nullable_to_non_nullable + as String, + serialno: freezed == serialno + ? _value.serialno + : serialno // ignore: cast_nullable_to_non_nullable + as int?, + headline: freezed == headline + ? _value.headline + : headline // ignore: cast_nullable_to_non_nullable + as String?, + isCanceled: null == isCanceled + ? _value.isCanceled + : isCanceled // ignore: cast_nullable_to_non_nullable + as bool, + isWarning: freezed == isWarning + ? _value.isWarning + : isWarning // ignore: cast_nullable_to_non_nullable + as bool?, + isLastInfo: null == isLastInfo + ? _value.isLastInfo + : isLastInfo // ignore: cast_nullable_to_non_nullable + as bool, + originTime: freezed == originTime + ? _value.originTime + : originTime // ignore: cast_nullable_to_non_nullable + as DateTime?, + arrivalTime: freezed == arrivalTime + ? _value.arrivalTime + : arrivalTime // ignore: cast_nullable_to_non_nullable + as DateTime?, + hypoName: freezed == hypoName + ? _value.hypoName + : hypoName // ignore: cast_nullable_to_non_nullable + as String?, + depth: freezed == depth + ? _value.depth + : depth // ignore: cast_nullable_to_non_nullable + as int?, + magnitude: freezed == magnitude + ? _value.magnitude + : magnitude // ignore: cast_nullable_to_non_nullable + as double?, + forecastMaxIntensity: freezed == forecastMaxIntensity + ? _value.forecastMaxIntensity + : forecastMaxIntensity // ignore: cast_nullable_to_non_nullable + as JmaForecastIntensity?, + forecastMaxLpgmIntensity: freezed == forecastMaxLpgmIntensity + ? _value.forecastMaxLpgmIntensity + : forecastMaxLpgmIntensity // ignore: cast_nullable_to_non_nullable + as JmaForecastLgIntensity?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$EewV1ImplCopyWith<$Res> implements $EewV1CopyWith<$Res> { + factory _$$EewV1ImplCopyWith( + _$EewV1Impl value, $Res Function(_$EewV1Impl) then) = + __$$EewV1ImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int id, + int eventId, + String type, + String schemaType, + String status, + String infoType, + int? serialno, + String? headline, + bool isCanceled, + bool? isWarning, + bool isLastInfo, + DateTime? originTime, + DateTime? arrivalTime, + String? hypoName, + int? depth, + double? magnitude, + JmaForecastIntensity? forecastMaxIntensity, + JmaForecastLgIntensity? forecastMaxLpgmIntensity}); +} + +/// @nodoc +class __$$EewV1ImplCopyWithImpl<$Res> + extends _$EewV1CopyWithImpl<$Res, _$EewV1Impl> + implements _$$EewV1ImplCopyWith<$Res> { + __$$EewV1ImplCopyWithImpl( + _$EewV1Impl _value, $Res Function(_$EewV1Impl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? eventId = null, + Object? type = null, + Object? schemaType = null, + Object? status = null, + Object? infoType = null, + Object? serialno = freezed, + Object? headline = freezed, + Object? isCanceled = null, + Object? isWarning = freezed, + Object? isLastInfo = null, + Object? originTime = freezed, + Object? arrivalTime = freezed, + Object? hypoName = freezed, + Object? depth = freezed, + Object? magnitude = freezed, + Object? forecastMaxIntensity = freezed, + Object? forecastMaxLpgmIntensity = freezed, + }) { + return _then(_$EewV1Impl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as int, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + schemaType: null == schemaType + ? _value.schemaType + : schemaType // ignore: cast_nullable_to_non_nullable + as String, + status: null == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as String, + infoType: null == infoType + ? _value.infoType + : infoType // ignore: cast_nullable_to_non_nullable + as String, + serialno: freezed == serialno + ? _value.serialno + : serialno // ignore: cast_nullable_to_non_nullable + as int?, + headline: freezed == headline + ? _value.headline + : headline // ignore: cast_nullable_to_non_nullable + as String?, + isCanceled: null == isCanceled + ? _value.isCanceled + : isCanceled // ignore: cast_nullable_to_non_nullable + as bool, + isWarning: freezed == isWarning + ? _value.isWarning + : isWarning // ignore: cast_nullable_to_non_nullable + as bool?, + isLastInfo: null == isLastInfo + ? _value.isLastInfo + : isLastInfo // ignore: cast_nullable_to_non_nullable + as bool, + originTime: freezed == originTime + ? _value.originTime + : originTime // ignore: cast_nullable_to_non_nullable + as DateTime?, + arrivalTime: freezed == arrivalTime + ? _value.arrivalTime + : arrivalTime // ignore: cast_nullable_to_non_nullable + as DateTime?, + hypoName: freezed == hypoName + ? _value.hypoName + : hypoName // ignore: cast_nullable_to_non_nullable + as String?, + depth: freezed == depth + ? _value.depth + : depth // ignore: cast_nullable_to_non_nullable + as int?, + magnitude: freezed == magnitude + ? _value.magnitude + : magnitude // ignore: cast_nullable_to_non_nullable + as double?, + forecastMaxIntensity: freezed == forecastMaxIntensity + ? _value.forecastMaxIntensity + : forecastMaxIntensity // ignore: cast_nullable_to_non_nullable + as JmaForecastIntensity?, + forecastMaxLpgmIntensity: freezed == forecastMaxLpgmIntensity + ? _value.forecastMaxLpgmIntensity + : forecastMaxLpgmIntensity // ignore: cast_nullable_to_non_nullable + as JmaForecastLgIntensity?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$EewV1Impl implements _EewV1 { + const _$EewV1Impl( + {required this.id, + required this.eventId, + required this.type, + required this.schemaType, + required this.status, + required this.infoType, + this.serialno, + this.headline, + required this.isCanceled, + this.isWarning, + required this.isLastInfo, + this.originTime, + this.arrivalTime, + this.hypoName, + this.depth, + this.magnitude, + this.forecastMaxIntensity, + this.forecastMaxLpgmIntensity}); + + factory _$EewV1Impl.fromJson(Map json) => + _$$EewV1ImplFromJson(json); + + @override + final int id; + @override + final int eventId; + @override + final String type; + @override + final String schemaType; + @override + final String status; + @override + final String infoType; + @override + final int? serialno; + @override + final String? headline; + @override + final bool isCanceled; + @override + final bool? isWarning; + @override + final bool isLastInfo; + @override + final DateTime? originTime; + @override + final DateTime? arrivalTime; + @override + final String? hypoName; + @override + final int? depth; + @override + final double? magnitude; + @override + final JmaForecastIntensity? forecastMaxIntensity; + @override + final JmaForecastLgIntensity? forecastMaxLpgmIntensity; + + @override + String toString() { + return 'EewV1(id: $id, eventId: $eventId, type: $type, schemaType: $schemaType, status: $status, infoType: $infoType, serialno: $serialno, headline: $headline, isCanceled: $isCanceled, isWarning: $isWarning, isLastInfo: $isLastInfo, originTime: $originTime, arrivalTime: $arrivalTime, hypoName: $hypoName, depth: $depth, magnitude: $magnitude, forecastMaxIntensity: $forecastMaxIntensity, forecastMaxLpgmIntensity: $forecastMaxLpgmIntensity)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$EewV1Impl && + (identical(other.id, id) || other.id == id) && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.schemaType, schemaType) || + other.schemaType == schemaType) && + (identical(other.status, status) || other.status == status) && + (identical(other.infoType, infoType) || + other.infoType == infoType) && + (identical(other.serialno, serialno) || + other.serialno == serialno) && + (identical(other.headline, headline) || + other.headline == headline) && + (identical(other.isCanceled, isCanceled) || + other.isCanceled == isCanceled) && + (identical(other.isWarning, isWarning) || + other.isWarning == isWarning) && + (identical(other.isLastInfo, isLastInfo) || + other.isLastInfo == isLastInfo) && + (identical(other.originTime, originTime) || + other.originTime == originTime) && + (identical(other.arrivalTime, arrivalTime) || + other.arrivalTime == arrivalTime) && + (identical(other.hypoName, hypoName) || + other.hypoName == hypoName) && + (identical(other.depth, depth) || other.depth == depth) && + (identical(other.magnitude, magnitude) || + other.magnitude == magnitude) && + (identical(other.forecastMaxIntensity, forecastMaxIntensity) || + other.forecastMaxIntensity == forecastMaxIntensity) && + (identical( + other.forecastMaxLpgmIntensity, forecastMaxLpgmIntensity) || + other.forecastMaxLpgmIntensity == forecastMaxLpgmIntensity)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + id, + eventId, + type, + schemaType, + status, + infoType, + serialno, + headline, + isCanceled, + isWarning, + isLastInfo, + originTime, + arrivalTime, + hypoName, + depth, + magnitude, + forecastMaxIntensity, + forecastMaxLpgmIntensity); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$EewV1ImplCopyWith<_$EewV1Impl> get copyWith => + __$$EewV1ImplCopyWithImpl<_$EewV1Impl>(this, _$identity); + + @override + Map toJson() { + return _$$EewV1ImplToJson( + this, + ); + } +} + +abstract class _EewV1 implements EewV1 { + const factory _EewV1( + {required final int id, + required final int eventId, + required final String type, + required final String schemaType, + required final String status, + required final String infoType, + final int? serialno, + final String? headline, + required final bool isCanceled, + final bool? isWarning, + required final bool isLastInfo, + final DateTime? originTime, + final DateTime? arrivalTime, + final String? hypoName, + final int? depth, + final double? magnitude, + final JmaForecastIntensity? forecastMaxIntensity, + final JmaForecastLgIntensity? forecastMaxLpgmIntensity}) = _$EewV1Impl; + + factory _EewV1.fromJson(Map json) = _$EewV1Impl.fromJson; + + @override + int get id; + @override + int get eventId; + @override + String get type; + @override + String get schemaType; + @override + String get status; + @override + String get infoType; + @override + int? get serialno; + @override + String? get headline; + @override + bool get isCanceled; + @override + bool? get isWarning; + @override + bool get isLastInfo; + @override + DateTime? get originTime; + @override + DateTime? get arrivalTime; + @override + String? get hypoName; + @override + int? get depth; + @override + double? get magnitude; + @override + JmaForecastIntensity? get forecastMaxIntensity; + @override + JmaForecastLgIntensity? get forecastMaxLpgmIntensity; + @override + @JsonKey(ignore: true) + _$$EewV1ImplCopyWith<_$EewV1Impl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/eqapi_types/lib/model/v1/eew.g.dart b/packages/eqapi_types/lib/model/v1/eew.g.dart new file mode 100644 index 000000000..760ccfe56 --- /dev/null +++ b/packages/eqapi_types/lib/model/v1/eew.g.dart @@ -0,0 +1,89 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: type=lint + +part of 'eew.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$EewV1Impl _$$EewV1ImplFromJson(Map json) => $checkedCreate( + r'_$EewV1Impl', + json, + ($checkedConvert) { + final val = _$EewV1Impl( + id: $checkedConvert('id', (v) => v as int), + eventId: $checkedConvert('eventId', (v) => v as int), + type: $checkedConvert('type', (v) => v as String), + schemaType: $checkedConvert('schemaType', (v) => v as String), + status: $checkedConvert('status', (v) => v as String), + infoType: $checkedConvert('infoType', (v) => v as String), + serialno: $checkedConvert('serialno', (v) => v as int?), + headline: $checkedConvert('headline', (v) => v as String?), + isCanceled: $checkedConvert('isCanceled', (v) => v as bool), + isWarning: $checkedConvert('isWarning', (v) => v as bool?), + isLastInfo: $checkedConvert('isLastInfo', (v) => v as bool), + originTime: $checkedConvert('originTime', + (v) => v == null ? null : DateTime.parse(v as String)), + arrivalTime: $checkedConvert('arrivalTime', + (v) => v == null ? null : DateTime.parse(v as String)), + hypoName: $checkedConvert('hypoName', (v) => v as String?), + depth: $checkedConvert('depth', (v) => v as int?), + magnitude: + $checkedConvert('magnitude', (v) => (v as num?)?.toDouble()), + forecastMaxIntensity: $checkedConvert('forecastMaxIntensity', + (v) => $enumDecodeNullable(_$JmaForecastIntensityEnumMap, v)), + forecastMaxLpgmIntensity: $checkedConvert('forecastMaxLpgmIntensity', + (v) => $enumDecodeNullable(_$JmaForecastLgIntensityEnumMap, v)), + ); + return val; + }, + ); + +Map _$$EewV1ImplToJson(_$EewV1Impl instance) => + { + 'id': instance.id, + 'eventId': instance.eventId, + 'type': instance.type, + 'schemaType': instance.schemaType, + 'status': instance.status, + 'infoType': instance.infoType, + 'serialno': instance.serialno, + 'headline': instance.headline, + 'isCanceled': instance.isCanceled, + 'isWarning': instance.isWarning, + 'isLastInfo': instance.isLastInfo, + 'originTime': instance.originTime?.toIso8601String(), + 'arrivalTime': instance.arrivalTime?.toIso8601String(), + 'hypoName': instance.hypoName, + 'depth': instance.depth, + 'magnitude': instance.magnitude, + 'forecastMaxIntensity': + _$JmaForecastIntensityEnumMap[instance.forecastMaxIntensity], + 'forecastMaxLpgmIntensity': + _$JmaForecastLgIntensityEnumMap[instance.forecastMaxLpgmIntensity], + }; + +const _$JmaForecastIntensityEnumMap = { + JmaForecastIntensity.zero: '0', + JmaForecastIntensity.one: '1', + JmaForecastIntensity.two: '2', + JmaForecastIntensity.three: '3', + JmaForecastIntensity.four: '4', + JmaForecastIntensity.fiveLower: '5-', + JmaForecastIntensity.fiveUpper: '5+', + JmaForecastIntensity.sixLower: '6-', + JmaForecastIntensity.sixUpper: '6+', + JmaForecastIntensity.seven: '7', + JmaForecastIntensity.unknown: '不明', +}; + +const _$JmaForecastLgIntensityEnumMap = { + JmaForecastLgIntensity.zero: '0', + JmaForecastLgIntensity.one: '1', + JmaForecastLgIntensity.two: '2', + JmaForecastLgIntensity.three: '3', + JmaForecastLgIntensity.four: '4', + JmaForecastLgIntensity.unknown: '不明', +}; diff --git a/packages/eqapi_types/lib/model/v1/intensity_sub_division.dart b/packages/eqapi_types/lib/model/v1/intensity_sub_division.dart new file mode 100644 index 000000000..66ba609ac --- /dev/null +++ b/packages/eqapi_types/lib/model/v1/intensity_sub_division.dart @@ -0,0 +1,19 @@ +import 'package:eqapi_types/model/model.dart'; +import 'package:eqapi_types/model/v3/telegram_v3.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'intensity_sub_division.freezed.dart'; +part 'intensity_sub_division.g.dart'; + +@freezed +class IntensitySubDivision with _$IntensitySubDivision { + const factory IntensitySubDivision({ + required int id, + required int eventId, + required JmaIntensity maxIntensity, + required JmaLgIntensity? maxLpgmIntensity, + }) = _IntensitySubDivision; + + factory IntensitySubDivision.fromJson(Map json) => + _$IntensitySubDivisionFromJson(json); +} diff --git a/packages/eqapi_types/lib/model/v1/intensity_sub_division.freezed.dart b/packages/eqapi_types/lib/model/v1/intensity_sub_division.freezed.dart new file mode 100644 index 000000000..99a83aebd --- /dev/null +++ b/packages/eqapi_types/lib/model/v1/intensity_sub_division.freezed.dart @@ -0,0 +1,222 @@ +// 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 'intensity_sub_division.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +IntensitySubDivision _$IntensitySubDivisionFromJson(Map json) { + return _IntensitySubDivision.fromJson(json); +} + +/// @nodoc +mixin _$IntensitySubDivision { + int get id => throw _privateConstructorUsedError; + int get eventId => throw _privateConstructorUsedError; + JmaIntensity get maxIntensity => throw _privateConstructorUsedError; + JmaLgIntensity? get maxLpgmIntensity => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $IntensitySubDivisionCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $IntensitySubDivisionCopyWith<$Res> { + factory $IntensitySubDivisionCopyWith(IntensitySubDivision value, + $Res Function(IntensitySubDivision) then) = + _$IntensitySubDivisionCopyWithImpl<$Res, IntensitySubDivision>; + @useResult + $Res call( + {int id, + int eventId, + JmaIntensity maxIntensity, + JmaLgIntensity? maxLpgmIntensity}); +} + +/// @nodoc +class _$IntensitySubDivisionCopyWithImpl<$Res, + $Val extends IntensitySubDivision> + implements $IntensitySubDivisionCopyWith<$Res> { + _$IntensitySubDivisionCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? eventId = null, + Object? maxIntensity = null, + Object? maxLpgmIntensity = freezed, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as int, + maxIntensity: null == maxIntensity + ? _value.maxIntensity + : maxIntensity // ignore: cast_nullable_to_non_nullable + as JmaIntensity, + maxLpgmIntensity: freezed == maxLpgmIntensity + ? _value.maxLpgmIntensity + : maxLpgmIntensity // ignore: cast_nullable_to_non_nullable + as JmaLgIntensity?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$IntensitySubDivisionImplCopyWith<$Res> + implements $IntensitySubDivisionCopyWith<$Res> { + factory _$$IntensitySubDivisionImplCopyWith(_$IntensitySubDivisionImpl value, + $Res Function(_$IntensitySubDivisionImpl) then) = + __$$IntensitySubDivisionImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int id, + int eventId, + JmaIntensity maxIntensity, + JmaLgIntensity? maxLpgmIntensity}); +} + +/// @nodoc +class __$$IntensitySubDivisionImplCopyWithImpl<$Res> + extends _$IntensitySubDivisionCopyWithImpl<$Res, _$IntensitySubDivisionImpl> + implements _$$IntensitySubDivisionImplCopyWith<$Res> { + __$$IntensitySubDivisionImplCopyWithImpl(_$IntensitySubDivisionImpl _value, + $Res Function(_$IntensitySubDivisionImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? eventId = null, + Object? maxIntensity = null, + Object? maxLpgmIntensity = freezed, + }) { + return _then(_$IntensitySubDivisionImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as int, + maxIntensity: null == maxIntensity + ? _value.maxIntensity + : maxIntensity // ignore: cast_nullable_to_non_nullable + as JmaIntensity, + maxLpgmIntensity: freezed == maxLpgmIntensity + ? _value.maxLpgmIntensity + : maxLpgmIntensity // ignore: cast_nullable_to_non_nullable + as JmaLgIntensity?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$IntensitySubDivisionImpl implements _IntensitySubDivision { + const _$IntensitySubDivisionImpl( + {required this.id, + required this.eventId, + required this.maxIntensity, + required this.maxLpgmIntensity}); + + factory _$IntensitySubDivisionImpl.fromJson(Map json) => + _$$IntensitySubDivisionImplFromJson(json); + + @override + final int id; + @override + final int eventId; + @override + final JmaIntensity maxIntensity; + @override + final JmaLgIntensity? maxLpgmIntensity; + + @override + String toString() { + return 'IntensitySubDivision(id: $id, eventId: $eventId, maxIntensity: $maxIntensity, maxLpgmIntensity: $maxLpgmIntensity)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$IntensitySubDivisionImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.maxIntensity, maxIntensity) || + other.maxIntensity == maxIntensity) && + (identical(other.maxLpgmIntensity, maxLpgmIntensity) || + other.maxLpgmIntensity == maxLpgmIntensity)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, id, eventId, maxIntensity, maxLpgmIntensity); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$IntensitySubDivisionImplCopyWith<_$IntensitySubDivisionImpl> + get copyWith => + __$$IntensitySubDivisionImplCopyWithImpl<_$IntensitySubDivisionImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$IntensitySubDivisionImplToJson( + this, + ); + } +} + +abstract class _IntensitySubDivision implements IntensitySubDivision { + const factory _IntensitySubDivision( + {required final int id, + required final int eventId, + required final JmaIntensity maxIntensity, + required final JmaLgIntensity? maxLpgmIntensity}) = + _$IntensitySubDivisionImpl; + + factory _IntensitySubDivision.fromJson(Map json) = + _$IntensitySubDivisionImpl.fromJson; + + @override + int get id; + @override + int get eventId; + @override + JmaIntensity get maxIntensity; + @override + JmaLgIntensity? get maxLpgmIntensity; + @override + @JsonKey(ignore: true) + _$$IntensitySubDivisionImplCopyWith<_$IntensitySubDivisionImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/packages/eqapi_types/lib/model/v1/intensity_sub_division.g.dart b/packages/eqapi_types/lib/model/v1/intensity_sub_division.g.dart new file mode 100644 index 000000000..d1f47ab9f --- /dev/null +++ b/packages/eqapi_types/lib/model/v1/intensity_sub_division.g.dart @@ -0,0 +1,57 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: type=lint + +part of 'intensity_sub_division.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$IntensitySubDivisionImpl _$$IntensitySubDivisionImplFromJson( + Map json) => + $checkedCreate( + r'_$IntensitySubDivisionImpl', + json, + ($checkedConvert) { + final val = _$IntensitySubDivisionImpl( + id: $checkedConvert('id', (v) => v as int), + eventId: $checkedConvert('eventId', (v) => v as int), + maxIntensity: $checkedConvert( + 'maxIntensity', (v) => $enumDecode(_$JmaIntensityEnumMap, v)), + maxLpgmIntensity: $checkedConvert('maxLpgmIntensity', + (v) => $enumDecodeNullable(_$JmaLgIntensityEnumMap, v)), + ); + return val; + }, + ); + +Map _$$IntensitySubDivisionImplToJson( + _$IntensitySubDivisionImpl instance) => + { + 'id': instance.id, + 'eventId': instance.eventId, + 'maxIntensity': _$JmaIntensityEnumMap[instance.maxIntensity]!, + 'maxLpgmIntensity': _$JmaLgIntensityEnumMap[instance.maxLpgmIntensity], + }; + +const _$JmaIntensityEnumMap = { + JmaIntensity.one: '1', + JmaIntensity.two: '2', + JmaIntensity.three: '3', + JmaIntensity.four: '4', + JmaIntensity.fiveLower: '5-', + JmaIntensity.fiveUpper: '5+', + JmaIntensity.sixLower: '6-', + JmaIntensity.sixUpper: '6+', + JmaIntensity.seven: '7', + JmaIntensity.fiveUpperNoInput: '!5-', +}; + +const _$JmaLgIntensityEnumMap = { + JmaLgIntensity.zero: '0', + JmaLgIntensity.one: '1', + JmaLgIntensity.two: '2', + JmaLgIntensity.three: '3', + JmaLgIntensity.four: '4', +}; diff --git a/packages/eqapi_types/lib/model/v1/telegram.dart b/packages/eqapi_types/lib/model/v1/telegram.dart new file mode 100644 index 000000000..10a0ddc74 --- /dev/null +++ b/packages/eqapi_types/lib/model/v1/telegram.dart @@ -0,0 +1,25 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'telegram.freezed.dart'; +part 'telegram.g.dart'; + +@freezed +class TelegramV1 with _$TelegramV1 { + const factory TelegramV1({ + required int id, + required int eventId, + required String type, + required String schemaType, + required String status, + required String infoType, + required DateTime pressTime, + required DateTime reportTime, + DateTime? validTime, + int? serialNo, + String? headline, + required Map body, + }) = _TelegramV1; + + factory TelegramV1.fromJson(Map json) => + _$TelegramV1FromJson(json); +} diff --git a/packages/eqapi_types/lib/model/v1/telegram.freezed.dart b/packages/eqapi_types/lib/model/v1/telegram.freezed.dart new file mode 100644 index 000000000..26f7ffb9f --- /dev/null +++ b/packages/eqapi_types/lib/model/v1/telegram.freezed.dart @@ -0,0 +1,401 @@ +// 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 'telegram.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +TelegramV1 _$TelegramV1FromJson(Map json) { + return _TelegramV1.fromJson(json); +} + +/// @nodoc +mixin _$TelegramV1 { + int get id => throw _privateConstructorUsedError; + int get eventId => throw _privateConstructorUsedError; + String get type => throw _privateConstructorUsedError; + String get schemaType => throw _privateConstructorUsedError; + String get status => throw _privateConstructorUsedError; + String get infoType => throw _privateConstructorUsedError; + DateTime get pressTime => throw _privateConstructorUsedError; + DateTime get reportTime => throw _privateConstructorUsedError; + DateTime? get validTime => throw _privateConstructorUsedError; + int? get serialNo => throw _privateConstructorUsedError; + String? get headline => throw _privateConstructorUsedError; + Map get body => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $TelegramV1CopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $TelegramV1CopyWith<$Res> { + factory $TelegramV1CopyWith( + TelegramV1 value, $Res Function(TelegramV1) then) = + _$TelegramV1CopyWithImpl<$Res, TelegramV1>; + @useResult + $Res call( + {int id, + int eventId, + String type, + String schemaType, + String status, + String infoType, + DateTime pressTime, + DateTime reportTime, + DateTime? validTime, + int? serialNo, + String? headline, + Map body}); +} + +/// @nodoc +class _$TelegramV1CopyWithImpl<$Res, $Val extends TelegramV1> + implements $TelegramV1CopyWith<$Res> { + _$TelegramV1CopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? eventId = null, + Object? type = null, + Object? schemaType = null, + Object? status = null, + Object? infoType = null, + Object? pressTime = null, + Object? reportTime = null, + Object? validTime = freezed, + Object? serialNo = freezed, + Object? headline = freezed, + Object? body = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as int, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + schemaType: null == schemaType + ? _value.schemaType + : schemaType // ignore: cast_nullable_to_non_nullable + as String, + status: null == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as String, + infoType: null == infoType + ? _value.infoType + : infoType // ignore: cast_nullable_to_non_nullable + as String, + pressTime: null == pressTime + ? _value.pressTime + : pressTime // ignore: cast_nullable_to_non_nullable + as DateTime, + reportTime: null == reportTime + ? _value.reportTime + : reportTime // ignore: cast_nullable_to_non_nullable + as DateTime, + validTime: freezed == validTime + ? _value.validTime + : validTime // ignore: cast_nullable_to_non_nullable + as DateTime?, + serialNo: freezed == serialNo + ? _value.serialNo + : serialNo // ignore: cast_nullable_to_non_nullable + as int?, + headline: freezed == headline + ? _value.headline + : headline // ignore: cast_nullable_to_non_nullable + as String?, + body: null == body + ? _value.body + : body // ignore: cast_nullable_to_non_nullable + as Map, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$TelegramV1ImplCopyWith<$Res> + implements $TelegramV1CopyWith<$Res> { + factory _$$TelegramV1ImplCopyWith( + _$TelegramV1Impl value, $Res Function(_$TelegramV1Impl) then) = + __$$TelegramV1ImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int id, + int eventId, + String type, + String schemaType, + String status, + String infoType, + DateTime pressTime, + DateTime reportTime, + DateTime? validTime, + int? serialNo, + String? headline, + Map body}); +} + +/// @nodoc +class __$$TelegramV1ImplCopyWithImpl<$Res> + extends _$TelegramV1CopyWithImpl<$Res, _$TelegramV1Impl> + implements _$$TelegramV1ImplCopyWith<$Res> { + __$$TelegramV1ImplCopyWithImpl( + _$TelegramV1Impl _value, $Res Function(_$TelegramV1Impl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? eventId = null, + Object? type = null, + Object? schemaType = null, + Object? status = null, + Object? infoType = null, + Object? pressTime = null, + Object? reportTime = null, + Object? validTime = freezed, + Object? serialNo = freezed, + Object? headline = freezed, + Object? body = null, + }) { + return _then(_$TelegramV1Impl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as int, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + schemaType: null == schemaType + ? _value.schemaType + : schemaType // ignore: cast_nullable_to_non_nullable + as String, + status: null == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as String, + infoType: null == infoType + ? _value.infoType + : infoType // ignore: cast_nullable_to_non_nullable + as String, + pressTime: null == pressTime + ? _value.pressTime + : pressTime // ignore: cast_nullable_to_non_nullable + as DateTime, + reportTime: null == reportTime + ? _value.reportTime + : reportTime // ignore: cast_nullable_to_non_nullable + as DateTime, + validTime: freezed == validTime + ? _value.validTime + : validTime // ignore: cast_nullable_to_non_nullable + as DateTime?, + serialNo: freezed == serialNo + ? _value.serialNo + : serialNo // ignore: cast_nullable_to_non_nullable + as int?, + headline: freezed == headline + ? _value.headline + : headline // ignore: cast_nullable_to_non_nullable + as String?, + body: null == body + ? _value._body + : body // ignore: cast_nullable_to_non_nullable + as Map, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$TelegramV1Impl implements _TelegramV1 { + const _$TelegramV1Impl( + {required this.id, + required this.eventId, + required this.type, + required this.schemaType, + required this.status, + required this.infoType, + required this.pressTime, + required this.reportTime, + this.validTime, + this.serialNo, + this.headline, + required final Map body}) + : _body = body; + + factory _$TelegramV1Impl.fromJson(Map json) => + _$$TelegramV1ImplFromJson(json); + + @override + final int id; + @override + final int eventId; + @override + final String type; + @override + final String schemaType; + @override + final String status; + @override + final String infoType; + @override + final DateTime pressTime; + @override + final DateTime reportTime; + @override + final DateTime? validTime; + @override + final int? serialNo; + @override + final String? headline; + final Map _body; + @override + Map get body { + if (_body is EqualUnmodifiableMapView) return _body; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_body); + } + + @override + String toString() { + return 'TelegramV1(id: $id, eventId: $eventId, type: $type, schemaType: $schemaType, status: $status, infoType: $infoType, pressTime: $pressTime, reportTime: $reportTime, validTime: $validTime, serialNo: $serialNo, headline: $headline, body: $body)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$TelegramV1Impl && + (identical(other.id, id) || other.id == id) && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.schemaType, schemaType) || + other.schemaType == schemaType) && + (identical(other.status, status) || other.status == status) && + (identical(other.infoType, infoType) || + other.infoType == infoType) && + (identical(other.pressTime, pressTime) || + other.pressTime == pressTime) && + (identical(other.reportTime, reportTime) || + other.reportTime == reportTime) && + (identical(other.validTime, validTime) || + other.validTime == validTime) && + (identical(other.serialNo, serialNo) || + other.serialNo == serialNo) && + (identical(other.headline, headline) || + other.headline == headline) && + const DeepCollectionEquality().equals(other._body, _body)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + id, + eventId, + type, + schemaType, + status, + infoType, + pressTime, + reportTime, + validTime, + serialNo, + headline, + const DeepCollectionEquality().hash(_body)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$TelegramV1ImplCopyWith<_$TelegramV1Impl> get copyWith => + __$$TelegramV1ImplCopyWithImpl<_$TelegramV1Impl>(this, _$identity); + + @override + Map toJson() { + return _$$TelegramV1ImplToJson( + this, + ); + } +} + +abstract class _TelegramV1 implements TelegramV1 { + const factory _TelegramV1( + {required final int id, + required final int eventId, + required final String type, + required final String schemaType, + required final String status, + required final String infoType, + required final DateTime pressTime, + required final DateTime reportTime, + final DateTime? validTime, + final int? serialNo, + final String? headline, + required final Map body}) = _$TelegramV1Impl; + + factory _TelegramV1.fromJson(Map json) = + _$TelegramV1Impl.fromJson; + + @override + int get id; + @override + int get eventId; + @override + String get type; + @override + String get schemaType; + @override + String get status; + @override + String get infoType; + @override + DateTime get pressTime; + @override + DateTime get reportTime; + @override + DateTime? get validTime; + @override + int? get serialNo; + @override + String? get headline; + @override + Map get body; + @override + @JsonKey(ignore: true) + _$$TelegramV1ImplCopyWith<_$TelegramV1Impl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/eqapi_types/lib/model/v1/telegram.g.dart b/packages/eqapi_types/lib/model/v1/telegram.g.dart new file mode 100644 index 000000000..7f4c7b44f --- /dev/null +++ b/packages/eqapi_types/lib/model/v1/telegram.g.dart @@ -0,0 +1,51 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: type=lint + +part of 'telegram.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$TelegramV1Impl _$$TelegramV1ImplFromJson(Map json) => + $checkedCreate( + r'_$TelegramV1Impl', + json, + ($checkedConvert) { + final val = _$TelegramV1Impl( + id: $checkedConvert('id', (v) => v as int), + eventId: $checkedConvert('eventId', (v) => v as int), + type: $checkedConvert('type', (v) => v as String), + schemaType: $checkedConvert('schemaType', (v) => v as String), + status: $checkedConvert('status', (v) => v as String), + infoType: $checkedConvert('infoType', (v) => v as String), + pressTime: + $checkedConvert('pressTime', (v) => DateTime.parse(v as String)), + reportTime: + $checkedConvert('reportTime', (v) => DateTime.parse(v as String)), + validTime: $checkedConvert('validTime', + (v) => v == null ? null : DateTime.parse(v as String)), + serialNo: $checkedConvert('serialNo', (v) => v as int?), + headline: $checkedConvert('headline', (v) => v as String?), + body: $checkedConvert('body', (v) => v as Map), + ); + return val; + }, + ); + +Map _$$TelegramV1ImplToJson(_$TelegramV1Impl instance) => + { + 'id': instance.id, + 'eventId': instance.eventId, + 'type': instance.type, + 'schemaType': instance.schemaType, + 'status': instance.status, + 'infoType': instance.infoType, + 'pressTime': instance.pressTime.toIso8601String(), + 'reportTime': instance.reportTime.toIso8601String(), + 'validTime': instance.validTime?.toIso8601String(), + 'serialNo': instance.serialNo, + 'headline': instance.headline, + 'body': instance.body, + }; diff --git a/packages/eqapi_types/lib/model/app_information.dart b/packages/eqapi_types/lib/model/v3/app_information.dart similarity index 100% rename from packages/eqapi_types/lib/model/app_information.dart rename to packages/eqapi_types/lib/model/v3/app_information.dart diff --git a/packages/eqapi_types/lib/model/app_information.freezed.dart b/packages/eqapi_types/lib/model/v3/app_information.freezed.dart similarity index 100% rename from packages/eqapi_types/lib/model/app_information.freezed.dart rename to packages/eqapi_types/lib/model/v3/app_information.freezed.dart diff --git a/packages/eqapi_types/lib/model/app_information.g.dart b/packages/eqapi_types/lib/model/v3/app_information.g.dart similarity index 100% rename from packages/eqapi_types/lib/model/app_information.g.dart rename to packages/eqapi_types/lib/model/v3/app_information.g.dart diff --git a/packages/eqapi_types/lib/model/information_v3.dart b/packages/eqapi_types/lib/model/v3/information_v3.dart similarity index 100% rename from packages/eqapi_types/lib/model/information_v3.dart rename to packages/eqapi_types/lib/model/v3/information_v3.dart diff --git a/packages/eqapi_types/lib/model/information_v3.freezed.dart b/packages/eqapi_types/lib/model/v3/information_v3.freezed.dart similarity index 100% rename from packages/eqapi_types/lib/model/information_v3.freezed.dart rename to packages/eqapi_types/lib/model/v3/information_v3.freezed.dart diff --git a/packages/eqapi_types/lib/model/information_v3.g.dart b/packages/eqapi_types/lib/model/v3/information_v3.g.dart similarity index 100% rename from packages/eqapi_types/lib/model/information_v3.g.dart rename to packages/eqapi_types/lib/model/v3/information_v3.g.dart diff --git a/packages/eqapi_types/lib/model/telegram_history.dart b/packages/eqapi_types/lib/model/v3/telegram_history.dart similarity index 100% rename from packages/eqapi_types/lib/model/telegram_history.dart rename to packages/eqapi_types/lib/model/v3/telegram_history.dart diff --git a/packages/eqapi_types/lib/model/telegram_history.freezed.dart b/packages/eqapi_types/lib/model/v3/telegram_history.freezed.dart similarity index 100% rename from packages/eqapi_types/lib/model/telegram_history.freezed.dart rename to packages/eqapi_types/lib/model/v3/telegram_history.freezed.dart diff --git a/packages/eqapi_types/lib/model/telegram_history.g.dart b/packages/eqapi_types/lib/model/v3/telegram_history.g.dart similarity index 100% rename from packages/eqapi_types/lib/model/telegram_history.g.dart rename to packages/eqapi_types/lib/model/v3/telegram_history.g.dart diff --git a/packages/eqapi_types/lib/model/telegram_v3.dart b/packages/eqapi_types/lib/model/v3/telegram_v3.dart similarity index 95% rename from packages/eqapi_types/lib/model/telegram_v3.dart rename to packages/eqapi_types/lib/model/v3/telegram_v3.dart index f2b3beb6e..4f6d46e30 100644 --- a/packages/eqapi_types/lib/model/telegram_v3.dart +++ b/packages/eqapi_types/lib/model/v3/telegram_v3.dart @@ -1,16 +1,4 @@ -import 'package:eqapi_types/model/components/accuracy.dart'; -import 'package:eqapi_types/model/components/comments.dart'; -import 'package:eqapi_types/model/components/earthquake-explanation/naming.dart'; -import 'package:eqapi_types/model/components/earthquake-nankai/earthquake_info.dart'; -import 'package:eqapi_types/model/components/earthquake.dart'; -import 'package:eqapi_types/model/components/eew_hypocenter.dart'; -import 'package:eqapi_types/model/components/eew_intensity.dart'; -import 'package:eqapi_types/model/components/eew_region.dart'; -import 'package:eqapi_types/model/components/intensity.dart'; -import 'package:eqapi_types/model/components/tsunami-information/comments.dart'; -import 'package:eqapi_types/model/components/tsunami-information/vtse41.dart'; -import 'package:eqapi_types/model/components/tsunami-information/vtse51.dart'; -import 'package:eqapi_types/model/components/tsunami-information/vtse52.dart'; +import 'package:eqapi_types/eqapi_types.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'telegram_v3.freezed.dart'; diff --git a/packages/eqapi_types/lib/model/telegram_v3.freezed.dart b/packages/eqapi_types/lib/model/v3/telegram_v3.freezed.dart similarity index 100% rename from packages/eqapi_types/lib/model/telegram_v3.freezed.dart rename to packages/eqapi_types/lib/model/v3/telegram_v3.freezed.dart diff --git a/packages/eqapi_types/lib/model/telegram_v3.g.dart b/packages/eqapi_types/lib/model/v3/telegram_v3.g.dart similarity index 100% rename from packages/eqapi_types/lib/model/telegram_v3.g.dart rename to packages/eqapi_types/lib/model/v3/telegram_v3.g.dart diff --git a/pubspec.lock b/pubspec.lock index 32ebb28da..114880360 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + sha256: "36a321c3d2cbe01cbcb3540a87b8843846e0206df3e691fa7b23e19e78de6d49" url: "https://pub.dev" source: hosted - version: "64.0.0" + version: "65.0.0" _flutterfire_internals: dependency: transitive description: @@ -29,10 +29,10 @@ packages: dependency: transitive description: name: analyzer - sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + sha256: dfe03b90ec022450e22513b5e5ca1f01c0c01de9c3fba2f7fd233cb57a6b9a07 url: "https://pub.dev" source: hosted - version: "6.2.0" + version: "6.3.0" analyzer_plugin: dependency: transitive description: @@ -466,10 +466,10 @@ packages: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.0" firebase_analytics: dependency: "direct main" description: @@ -615,10 +615,10 @@ packages: dependency: "direct main" description: name: flutter_local_notifications - sha256: "892ada16046d641263f30c72e7432397088810a84f34479f6677494802a2b535" + sha256: "66cc2fe16bf4bca71d795939763ad3f1830ad85772dc3b1561613c501859826d" url: "https://pub.dev" source: hosted - version: "16.3.0" + version: "16.3.1+1" flutter_local_notifications_linux: dependency: transitive description: @@ -941,10 +941,10 @@ packages: dependency: transitive description: name: macos_ui - sha256: cc499122655c61728185561e9006af4b239f9526f98d7b2cbf42124e9044a0ff + sha256: d351f0bada7e5b0cee8cf394299878a6c04e5cfcd784fa1d40e44299501124d8 url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.0.5" macos_window_utils: dependency: transitive description: @@ -984,10 +984,10 @@ packages: dependency: transitive description: name: markdown - sha256: "4e304b422905967f1f7e35a03cd2a3f8f34306b3e1b0cc7a8677d7a306471a0e" + sha256: "1b134d9f8ff2da15cb298efe6cd8b7d2a78958c1b00384ebcbdf13fe340a6c90" url: "https://pub.dev" source: hosted - version: "7.2.0" + version: "7.2.1" matcher: dependency: transitive description: @@ -1008,10 +1008,10 @@ packages: dependency: "direct dev" description: name: melos - sha256: "96e64bbade5712c3f010137e195bca9f1b351fac34ab1f322af492ae34032067" + sha256: ddd8e0871f02ba1eaa3fdc007e306d05801a5ef595d1637083d6654b272ade68 url: "https://pub.dev" source: hosted - version: "3.4.0" + version: "4.0.0" meta: dependency: transitive description: @@ -1032,10 +1032,10 @@ packages: dependency: "direct main" description: name: mocktail - sha256: f603ebd85a576e5914870b02e5839fc5d0243b867bf710651cf239a28ebb365e + sha256: c4b5007d91ca4f67256e720cb1b6d704e79a510183a12fa551021f652577dce6 url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.0.3" mustache_template: dependency: transitive description: @@ -1048,10 +1048,10 @@ packages: dependency: "direct main" description: name: native_shared_preferences - sha256: "53f88376be88abe24a3cec15cbc2ba69c3a62d1b2616679d14f2821f4fd04827" + sha256: "628e345f79b535138223a32dc8674920f1e828c3917b75c2f60014f8a3e6adc9" url: "https://pub.dev" source: hosted - version: "2.0.8" + version: "2.0.9" node_preamble: dependency: transitive description: @@ -1248,10 +1248,10 @@ packages: dependency: transitive description: name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" url: "https://pub.dev" source: hosted - version: "4.2.4" + version: "5.0.2" prompts: dependency: transitive description: @@ -1280,10 +1280,10 @@ packages: dependency: transitive description: name: pub_updater - sha256: b06600619c8c219065a548f8f7c192b3e080beff95488ed692780f48f69c0625 + sha256: "54e8dc865349059ebe7f163d6acce7c89eb958b8047e6d6e80ce93b13d7c9e60" url: "https://pub.dev" source: hosted - version: "0.3.1" + version: "0.4.0" pubspec: dependency: transitive description: @@ -1688,10 +1688,10 @@ packages: dependency: transitive description: name: time - sha256: "83427e11d9072e038364a5e4da559e85869b227cf699a541be0da74f14140124" + sha256: ad8e018a6c9db36cb917a031853a1aae49467a93e0d464683e029537d848c221 url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" timezone: dependency: transitive description: @@ -1720,10 +1720,10 @@ packages: dependency: "direct main" description: name: two_dimensional_scrollables - sha256: "3aa17c75bd4932e5e44ced27af72e8cff0b5f40bb6ef2a96c7427613970b54de" + sha256: f63c7bd4675cc9ceac22485a5b5eddda61a7afe6edf9df8552e8c021b93ddea9 url: "https://pub.dev" source: hosted - version: "0.0.5+1" + version: "0.0.5+2" typed_data: dependency: transitive description: @@ -1856,26 +1856,26 @@ packages: dependency: transitive description: name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05" url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "0.4.2" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + sha256: "939ab60734a4f8fa95feacb55804fa278de28bdeef38e616dc08e44a84adea23" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.3" web_socket_client: dependency: "direct main" description: name: web_socket_client - sha256: de52c9b3acf1f9fafb2951aa2764dd67c7d99d70be70c7c1fd791fae8f632f98 + sha256: "64c703569a5a274b4e6303de4797264051b042821b44ff516ccef354ba8b108a" url: "https://pub.dev" source: hosted - version: "0.1.0" + version: "0.1.1" webkit_inspection_protocol: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 29b937639..5e3692910 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -110,7 +110,7 @@ dev_dependencies: freezed: ^2.4.5 go_router_builder: ^2.3.4 json_serializable: ^6.7.1 - melos: ^3.4.0 + melos: ^4.0.0 pedantic_mono: ^1.24.0+1 retrofit_generator: ^8.0.4 riverpod_generator: ^2.3.7 diff --git a/test/feature/home/features/eew/eew_alive_provider_test.dart b/test/feature/home/features/eew/eew_alive_provider_test.dart index 842c54eae..df286f765 100644 --- a/test/feature/home/features/eew/eew_alive_provider_test.dart +++ b/test/feature/home/features/eew/eew_alive_provider_test.dart @@ -1,9 +1,4 @@ -import 'package:eqapi_types/model/components/accuracy.dart'; -import 'package:eqapi_types/model/components/comments.dart'; -import 'package:eqapi_types/model/components/earthquake.dart'; -import 'package:eqapi_types/model/components/eew_hypocenter.dart'; -import 'package:eqapi_types/model/components/eew_intensity.dart'; -import 'package:eqapi_types/model/telegram_v3.dart'; +import 'package:eqapi_types/eqapi_types.dart'; import 'package:eqmonitor/feature/earthquake_history/model/state/earthquake_history_item.dart'; import 'package:eqmonitor/feature/home/features/eew/provider/eew_alive_telegram.dart'; import 'package:eqmonitor/feature/home/features/eew/provider/eew_telegram.dart';