From 649955044f5db7d3569679a261760a5a4b8a6dc4 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Wed, 10 Apr 2024 10:43:09 +0200 Subject: [PATCH] Service generation + init new version + Add weather as a section + download resource + filter geoPoint + added new config params --- lib/Components/fetch_section_icon.dart | 2 + lib/Components/multi_select_container.dart | 50 +++++-- .../Section/SubSection/Map/map_config.dart | 72 +++++++++- .../SubSection/Map/new_update_categorie.dart | 4 +- .../Map/showNewOrUpdateGeoPoint.dart | 2 +- .../SubSection/Menu/showEditSubSection.dart | 8 ++ .../SubSection/Weather/weather_config.dart | 44 ++++++ .../Section/section_detail_screen.dart | 10 ++ .../configuration_detail_screen.dart | 49 ++++++- .../Resources/show_resource_popup.dart | 25 ++++ lib/api/swagger.yaml | 66 +++++++++ lib/constants.dart | 2 +- manager_api_new/.openapi-generator/FILES | 3 + manager_api_new/README.md | 2 + manager_api_new/doc/ConfigurationDTO.md | 3 + manager_api_new/doc/ExportConfigurationDTO.md | 3 + manager_api_new/doc/GeoPointDTO.md | 5 + manager_api_new/doc/SectionApi.md | 40 ++++++ manager_api_new/doc/WeatherDTO.md | 17 +++ manager_api_new/lib/api.dart | 1 + manager_api_new/lib/api/section_api.dart | 41 ++++++ manager_api_new/lib/api_client.dart | 2 + .../lib/model/configuration_dto.dart | 45 +++++- .../lib/model/export_configuration_dto.dart | 41 +++++- manager_api_new/lib/model/geo_point_dto.dart | 67 +++++++-- manager_api_new/lib/model/section_type.dart | 6 +- manager_api_new/lib/model/weather_dto.dart | 134 ++++++++++++++++++ manager_api_new/test/weather_dto_test.dart | 37 +++++ pubspec.yaml | 2 +- 29 files changed, 743 insertions(+), 40 deletions(-) create mode 100644 lib/Screens/Configurations/Section/SubSection/Weather/weather_config.dart create mode 100644 manager_api_new/doc/WeatherDTO.md create mode 100644 manager_api_new/lib/model/weather_dto.dart create mode 100644 manager_api_new/test/weather_dto_test.dart diff --git a/lib/Components/fetch_section_icon.dart b/lib/Components/fetch_section_icon.dart index 8eeb996..658b2ef 100644 --- a/lib/Components/fetch_section_icon.dart +++ b/lib/Components/fetch_section_icon.dart @@ -23,6 +23,8 @@ IconData getSectionIcon(elementType) { return Icons.extension; case SectionType.Agenda: return Icons.calendar_month_outlined; + case SectionType.Weather: + return Icons.sunny; } return Icons.question_mark; } \ No newline at end of file diff --git a/lib/Components/multi_select_container.dart b/lib/Components/multi_select_container.dart index 6097b8b..82b4136 100644 --- a/lib/Components/multi_select_container.dart +++ b/lib/Components/multi_select_container.dart @@ -1,15 +1,19 @@ import 'package:flutter/material.dart'; import 'package:manager_app/constants.dart'; +import 'package:html/parser.dart' show parse; import 'message_notification.dart'; class MultiSelectContainer extends StatelessWidget { final Color color; - final String label; + final String? label; final List values; final List initialValue; final bool isMultiple; final bool isAtLeastOne; + final bool isHTMLLabel; + final double? width; + final int maxLines; final ValueChanged> onChanged; const MultiSelectContainer({ Key? key, @@ -19,28 +23,37 @@ class MultiSelectContainer extends StatelessWidget { required this.initialValue, required this.isMultiple, this.isAtLeastOne = false, + this.isHTMLLabel = false, + this.width, + this.maxLines = 2, required this.onChanged, }) : super(key: key); @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; - return Container( + return SingleChildScrollView( + scrollDirection: Axis.horizontal, child: Row( + mainAxisSize: MainAxisSize.min, children: [ - Align( - alignment: AlignmentDirectional.centerStart, - child: Text(label, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300)) - ), + if(label != null) + Align( + alignment: AlignmentDirectional.centerStart, + child: Text(label!, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300)) + ), Padding( padding: const EdgeInsets.all(10.0), child: Container( - width: size.width *0.25, + width: width ?? size.width *0.25, + //color: Colors.yellow, child: MultiSelectChip( values, initialValue, isMultiple, isAtLeastOne, + isHTMLLabel, + maxLines, onSelectionChanged: (selectedList) { onChanged(selectedList); }, @@ -59,30 +72,36 @@ class MultiSelectChip extends StatefulWidget { final Function(List) onSelectionChanged; // +added final bool isMultiple; final bool isAtLeastOne; + final bool isHTMLLabel; + final int maxLines; MultiSelectChip( this.values, this.selectedValues, this.isMultiple, this.isAtLeastOne, + this.isHTMLLabel, + this.maxLines, {required this.onSelectionChanged} // +added ); @override _MultiSelectChipState createState() => _MultiSelectChipState(); } class _MultiSelectChipState extends State { + int maxLines = 1; // Définir le nombre maximum de lignes + _buildChoiceList() { List choices = []; widget.values.forEach((item) { choices.add(Container( padding: const EdgeInsets.all(2.0), child: ChoiceChip( - label: Text(item, style: TextStyle(color: kBlack)), + label: Text(widget.isHTMLLabel ? parse(item).documentElement!.text : item, style: TextStyle(color: kBlack)), selected: widget.selectedValues.contains(item), selectedColor: kPrimaryColor, onSelected: (selected) { setState(() { if (widget.isAtLeastOne && widget.selectedValues.length == 1 && widget.selectedValues[0] == item) { - showNotification(Colors.orange, kWhite, 'Au moins une valeur doit être sélectionnée', context, null); + showNotification(Colors.orange, kWhite, 'Au moins une valeur doit être sélectionnée', context, null); } else { if (widget.isMultiple) { widget.selectedValues.contains(item) @@ -102,10 +121,17 @@ class _MultiSelectChipState extends State { }); return choices; } + @override Widget build(BuildContext context) { - return Wrap( - children: _buildChoiceList(), + return Container( + height: maxLines * 48.0, // Assuming each ChoiceChip is 48.0 height + child: ListView( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + children: _buildChoiceList(), + ), ); } -} \ No newline at end of file +} + diff --git a/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart b/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart index c333a35..d1f2f25 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/map_config.dart @@ -1,3 +1,4 @@ +import 'package:diacritic/diacritic.dart'; import 'package:flutter/material.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:manager_app/Components/category_input_container.dart'; @@ -6,7 +7,9 @@ import 'package:manager_app/Components/resource_input_container.dart'; import 'package:manager_app/Components/multi_select_container.dart'; import 'package:manager_app/Components/single_select_container.dart'; import 'package:manager_app/Components/slider_input_container.dart'; +import 'package:manager_app/Components/string_input_container.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart'; +import 'package:html/parser.dart' show parse; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:manager_api_new/api.dart'; @@ -33,16 +36,22 @@ class MapConfig extends StatefulWidget { class _MapConfigState extends State { late MapDTO mapDTO; - + late List pointsToShow; + List? selectedCategories = []; String mapType= "hybrid"; String mapTypeMapBox= "standard"; + String filterSearch = ''; + @override void initState() { super.initState(); mapDTO = MapDTO.fromJson(json.decode(widget.initialValue))!; - List test = new List.from(mapDTO.points!); - mapDTO.points = test; + pointsToShow = new List.from(mapDTO.points!); + mapDTO.points = pointsToShow; + pointsToShow.sort((a, b) => a.title!.firstWhere((t) => t.language == 'FR').value!.toLowerCase().compareTo(b.title!.firstWhere((t) => t.language == 'FR').value!.toLowerCase())); + + selectedCategories = mapDTO.categories!.map((categorie) => categorie.label!.firstWhere((element) => element.language == 'FR').value!).toList(); if(mapDTO.mapType != null) { switch(mapDTO.mapType!.value) { @@ -239,18 +248,18 @@ class _MapConfigState extends State { Container( constraints: BoxConstraints(minHeight: 100), child: Padding( - padding: const EdgeInsets.only(top: 40, left: 10, right: 10, bottom: 10), + padding: const EdgeInsets.only(top: 95, left: 10, right: 10, bottom: 10), child: GridView.builder( shrinkWrap: true, gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 8), - itemCount: mapDTO.points!.length, + itemCount: pointsToShow.length, itemBuilder: (BuildContext context, int index) { return Container( - decoration: boxDecoration(mapDTO.points![index], appContext), + decoration: boxDecoration(pointsToShow[index], appContext), padding: const EdgeInsets.all(5), margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10), - child: getElement(index, mapDTO.points![index], size, appContext), + child: getElement(index, pointsToShow[index], size, appContext), ); } ), @@ -264,6 +273,49 @@ class _MapConfigState extends State { style: TextStyle(fontSize: 15), ), ), + Positioned( + top: 10, + left: 175, + child: MultiSelectContainer( + label: null, + color: kSecond, + width: size.width * 0.45, + initialValue: selectedCategories!, + isMultiple: true, + isHTMLLabel : true, + values: mapDTO.categories!.map((categorie) => categorie.label!.firstWhere((element) => element.language == 'FR').value!).toList(), + onChanged: (value) { + var tempOutput = new List.from(value); + setState(() { + selectedCategories = tempOutput; + if(selectedCategories == null || selectedCategories!.length == 0) { + pointsToShow = mapDTO.points!.where((point) => point.categorie == null).toList(); + } else { + pointsToShow = mapDTO.points!.where((point) => tempOutput.any((tps) => point.categorie == null || point.categorie?.label?.firstWhere((lab) => lab.language == 'FR').value == tps)).toList(); + } + }); + }, + )), + Positioned( + top: 0, + right: 150, + child: Container( + height: size.height*0.1, + constraints: BoxConstraints(minHeight: 85), + child: StringInputContainer( + label: "Recherche:", + isSmall: true, + fontSize: 15, + fontSizeText: 15, + onChanged: (String value) { + setState(() { + filterSearch = value; + filterPoints(); + }); + }, + ), + ), + ), Positioned( top: 10, right: 10, @@ -275,6 +327,7 @@ class _MapConfigState extends State { (GeoPointDTO geoPoint) { setState(() { mapDTO.points!.add(geoPoint); + mapDTO.points!.sort((a, b) => a.title!.firstWhere((t) => t.language == 'FR').value!.toLowerCase().compareTo(b.title!.firstWhere((t) => t.language == 'FR').value!.toLowerCase())); widget.onChanged(jsonEncode(mapDTO).toString()); }); }, @@ -352,6 +405,7 @@ class _MapConfigState extends State { (GeoPointDTO geoPoint) { setState(() { mapDTO.points![index] = geoPoint; + mapDTO.points!.sort((a, b) => a.title!.firstWhere((t) => t.language == 'FR').value!.toLowerCase().compareTo(b.title!.firstWhere((t) => t.language == 'FR').value!.toLowerCase())); widget.onChanged(jsonEncode(mapDTO).toString()); }); }, @@ -386,6 +440,10 @@ class _MapConfigState extends State { ), ); } + + void filterPoints() { + pointsToShow = filterSearch.isEmpty ? mapDTO.points! : mapDTO.points!.where((GeoPointDTO pointGeo) => removeDiacritics(pointGeo.title!.firstWhere((t) => t.language == "FR").value!.toUpperCase()).contains(removeDiacritics(filterSearch.toUpperCase()))).toList(); + } } diff --git a/lib/Screens/Configurations/Section/SubSection/Map/new_update_categorie.dart b/lib/Screens/Configurations/Section/SubSection/Map/new_update_categorie.dart index 903c90d..2442189 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/new_update_categorie.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/new_update_categorie.dart @@ -75,7 +75,7 @@ Future showNewOrUpdateCategory(CategorieDTO? inputCategorieDTO, A isHTML: true, ) ), - /*Container( + Container( height: size.height * 0.2, constraints: BoxConstraints(minHeight: 50, maxHeight: 80), child: ResourceInputContainer( @@ -95,7 +95,7 @@ Future showNewOrUpdateCategory(CategorieDTO? inputCategorieDTO, A }, isSmall: true ), - ),*/ + ), ], ), ], diff --git a/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart index 9106331..2d8340b 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart @@ -51,7 +51,7 @@ void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Funct child: FlutterLocationPicker( initZoom: 14, initPosition: geoPointDTO.latitude == null && geoPointDTO.longitude == null ? LatLong(50.429333, 4.891434) : LatLong(double.parse(geoPointDTO.latitude!), double.parse(geoPointDTO.longitude!)), - minZoomLevel: 5, + minZoomLevel: 0, maxZoomLevel: 17, markerIcon: const Icon( Icons.location_pin, diff --git a/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart b/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart index 01346ea..ee84c71 100644 --- a/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart +++ b/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart @@ -8,6 +8,7 @@ import 'package:manager_app/Screens/Configurations/Section/SubSection/PDF/PDF_co import 'package:manager_app/Screens/Configurations/Section/SubSection/Puzzle/puzzle_config.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Quizz/quizz_config.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Slider/slider_config.dart'; +import 'package:manager_app/Screens/Configurations/Section/SubSection/Weather/weather_config.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/WebOrVideo/web_video_config.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; @@ -244,5 +245,12 @@ getSpecificData(SectionDTO sectionDTO, BuildContext context, AppContext appConte sectionDTO.data = data; }, ); + case SectionType.Weather: + return WeatherConfig( + initialValue: sectionDTO.data!, + onChanged: (String data) { + sectionDTO.data = data; + }, + ); } } diff --git a/lib/Screens/Configurations/Section/SubSection/Weather/weather_config.dart b/lib/Screens/Configurations/Section/SubSection/Weather/weather_config.dart new file mode 100644 index 0000000..7049def --- /dev/null +++ b/lib/Screens/Configurations/Section/SubSection/Weather/weather_config.dart @@ -0,0 +1,44 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:manager_app/Components/string_input_container.dart'; +import 'package:manager_api_new/api.dart'; +import 'dart:convert'; + +class WeatherConfig extends StatefulWidget { + final String? color; + final String initialValue; + final ValueChanged onChanged; // To return video or web url + const WeatherConfig({ + Key? key, + this.color, + required this.initialValue, + required this.onChanged, + }) : super(key: key); + + @override + _WeatherConfigState createState() => _WeatherConfigState(); +} + +class _WeatherConfigState extends State { + late WeatherDTO resourceSource; + + @override + void initState() { + WeatherDTO test = WeatherDTO.fromJson(json.decode(widget.initialValue))!; + resourceSource = test; + super.initState(); + } + + @override + Widget build(BuildContext context) { + return StringInputContainer( + label: "Ville:", + initialValue: resourceSource.city == null ? '': resourceSource.city, + onChanged: (String city) { + resourceSource.city = city; + widget.onChanged(jsonEncode(resourceSource).toString()); + }, + isUrl: true, + ); + } +} diff --git a/lib/Screens/Configurations/Section/section_detail_screen.dart b/lib/Screens/Configurations/Section/section_detail_screen.dart index 295ed1c..5938428 100644 --- a/lib/Screens/Configurations/Section/section_detail_screen.dart +++ b/lib/Screens/Configurations/Section/section_detail_screen.dart @@ -37,6 +37,8 @@ import 'package:pasteboard/pasteboard.dart'; import 'dart:html' as html; +import 'SubSection/Weather/weather_config.dart'; + class SectionDetailScreen extends StatefulWidget { final String id; SectionDetailScreen({Key? key, required this.id}) : super(key: key); @@ -472,6 +474,14 @@ class _SectionDetailScreenState extends State { save(false, sectionDTO, appContext); }, ); + case SectionType.Weather: + return WeatherConfig( + initialValue: sectionDTO.data!, + onChanged: (String data) { + sectionDTO.data = data; + save(false, sectionDTO, appContext); + }, + ); } } } diff --git a/lib/Screens/Configurations/configuration_detail_screen.dart b/lib/Screens/Configurations/configuration_detail_screen.dart index f924d5a..ca04f65 100644 --- a/lib/Screens/Configurations/configuration_detail_screen.dart +++ b/lib/Screens/Configurations/configuration_detail_screen.dart @@ -7,6 +7,7 @@ import 'package:flutter/material.dart'; import 'package:manager_app/Components/check_input_container.dart'; import 'package:manager_app/Components/color_picker_input_container.dart'; import 'package:manager_app/Components/confirmation_dialog.dart'; +import 'package:manager_app/Components/number_input_container.dart'; import 'package:manager_app/Components/resource_input_container.dart'; import 'package:manager_app/Components/loading_common.dart'; import 'package:manager_app/Components/message_notification.dart'; @@ -204,6 +205,15 @@ class _ConfigurationDetailScreenState extends State { } }, ), + CheckInputContainer( + icon: Icons.image_not_supported_outlined, + label: "Background sur les images :", + fontSize: 20, + isChecked: configurationDTO.isSectionImageBackground, + onChanged: (value) { + configurationDTO.isSectionImageBackground = value; + }, + ), ], ), Column( @@ -324,7 +334,42 @@ class _ConfigurationDetailScreenState extends State { } }, ), - SizedBox( + Container( + height: 100, + child: NumberInputContainer( + label: "Pourcentage place des sections :", + initialValue: configurationDTO.screenPercentageSectionsMainPage ?? 0, + isSmall: true, + maxLength: 2, + onChanged: (value) { + try { + configurationDTO.screenPercentageSectionsMainPage = int.parse(value); + } catch (e) { + print('Screen percentage value not a number'); + showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null); + } + }, + ), + ), + Container( + height: 100, + child: NumberInputContainer( + label: "Pourcentage des arrondis (0-50) :", + initialValue: configurationDTO.roundedValue ?? 0, + isSmall: true, + maxLength: 2, + onChanged: (value) { + try { + configurationDTO.roundedValue = int.parse(value); + } catch (e) { + print('Rounded value not a number'); + showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null); + } + }, + ), + ), + // It's a section now + /*SizedBox( height: 100, child: StringInputContainer( label: "Ville météo :", @@ -334,7 +379,7 @@ class _ConfigurationDetailScreenState extends State { configurationDTO.weatherCity = value; }, ), - ), + ),*/ ]) ], ), diff --git a/lib/Screens/Resources/show_resource_popup.dart b/lib/Screens/Resources/show_resource_popup.dart index d64f44e..d19c32b 100644 --- a/lib/Screens/Resources/show_resource_popup.dart +++ b/lib/Screens/Resources/show_resource_popup.dart @@ -8,6 +8,7 @@ import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:manager_api_new/api.dart'; +import 'dart:html' as html; import 'get_element_for_resource.dart'; @@ -101,6 +102,30 @@ Future showResource(ResourceDTO resourceDTO, AppContext appContext ), ), ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Align( + alignment: AlignmentDirectional.bottomEnd, + child: Container( + width: 220, + height: 70, + child: RoundedButton( + text: "Télécharger", + icon: Icons.download, + color: kPrimaryColor, + press: () { + if(resourceDTO.url != null) { + html.AnchorElement anchorElement = html.AnchorElement(href: resourceDTO.url!); + anchorElement.download = '${resourceDTO.label}.json'; + anchorElement.target = '_blank'; + anchorElement.click(); + } + }, + fontSize: 20, + ), + ), + ), + ), Padding( padding: const EdgeInsets.all(8.0), child: Align( diff --git a/lib/api/swagger.yaml b/lib/api/swagger.yaml index c6fe041..7c6aaf9 100644 --- a/lib/api/swagger.yaml +++ b/lib/api/swagger.yaml @@ -1505,6 +1505,20 @@ paths: $ref: '#/components/schemas/AgendaDTO' security: - bearer: [] + /api/Section/WeatherDTO: + get: + tags: + - Section + operationId: Section_GetWeatherDTO + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/WeatherDTO' + security: + - bearer: [] /api/User: get: tags: @@ -1827,6 +1841,16 @@ components: type: boolean isHour: type: boolean + isSectionImageBackground: + type: boolean + roundedValue: + type: integer + format: int32 + nullable: true + screenPercentageSectionsMainPage: + type: integer + format: int32 + nullable: true TranslationDTO: type: object additionalProperties: false @@ -1931,6 +1955,7 @@ components: 7 = PDF 8 = Puzzle 9 = Agenda + 10 = Weather x-enumNames: - Map - Slider @@ -1942,6 +1967,7 @@ components: - PDF - Puzzle - Agenda + - Weather enum: - 0 - 1 @@ -1953,6 +1979,7 @@ components: - 7 - 8 - 9 + - 10 ResourceDTO: type: object additionalProperties: false @@ -2216,6 +2243,31 @@ components: longitude: type: string nullable: true + schedules: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' + prices: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' + phone: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' + email: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' + site: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' ContentGeoPoint: type: object additionalProperties: false @@ -2495,6 +2547,20 @@ components: nullable: true oneOf: - $ref: '#/components/schemas/MapProvider' + WeatherDTO: + type: object + additionalProperties: false + properties: + city: + type: string + nullable: true + updatedDate: + type: string + format: date-time + nullable: true + result: + type: string + nullable: true User: type: object additionalProperties: false diff --git a/lib/constants.dart b/lib/constants.dart index bda62f7..f1ac501 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -16,7 +16,7 @@ const kWhite = Color(0xFFFFFFFF); const kBlack = Color(0xFF000000); const kSuccess = Color(0xFF8bc34a); -const List section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz", "Article", "PDF", "Puzzle", "Agenda"]; +const List section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz", "Article", "PDF", "Puzzle", "Agenda", "Weather"]; const List map_types = ["none", "normal", "satellite", "terrain", "hybrid"]; const List languages = ["FR", "NL", "EN", "DE", "IT", "ES", "CN", "PL", "AR", "UK"]; const List map_types_mapBox = ["standard", "streets", "outdoors", "light", "dark", "satellite", "satellite_streets"]; diff --git a/manager_api_new/.openapi-generator/FILES b/manager_api_new/.openapi-generator/FILES index 7d78126..7849567 100644 --- a/manager_api_new/.openapi-generator/FILES +++ b/manager_api_new/.openapi-generator/FILES @@ -54,6 +54,7 @@ doc/User.md doc/UserApi.md doc/UserDetailDTO.md doc/VideoDTO.md +doc/WeatherDTO.md doc/WebDTO.md git_push.sh lib/api.dart @@ -117,6 +118,8 @@ lib/model/translation_dto.dart lib/model/user.dart lib/model/user_detail_dto.dart lib/model/video_dto.dart +lib/model/weather_dto.dart lib/model/web_dto.dart pubspec.yaml test/pdf_file_dto_test.dart +test/weather_dto_test.dart diff --git a/manager_api_new/README.md b/manager_api_new/README.md index 4913527..8cf1095 100644 --- a/manager_api_new/README.md +++ b/manager_api_new/README.md @@ -110,6 +110,7 @@ Class | Method | HTTP request | Description *SectionApi* | [**sectionGetQuizzDTO**](doc\/SectionApi.md#sectiongetquizzdto) | **GET** /api/Section/QuizzDTO | *SectionApi* | [**sectionGetSliderDTO**](doc\/SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO | *SectionApi* | [**sectionGetVideoDTO**](doc\/SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO | +*SectionApi* | [**sectionGetWeatherDTO**](doc\/SectionApi.md#sectiongetweatherdto) | **GET** /api/Section/WeatherDTO | *SectionApi* | [**sectionGetWebDTO**](doc\/SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO | *SectionApi* | [**sectionPlayerMessageDTO**](doc\/SectionApi.md#sectionplayermessagedto) | **GET** /api/Section/PlayerMessageDTO | *SectionApi* | [**sectionUpdate**](doc\/SectionApi.md#sectionupdate) | **PUT** /api/Section | @@ -168,6 +169,7 @@ Class | Method | HTTP request | Description - [User](doc\/User.md) - [UserDetailDTO](doc\/UserDetailDTO.md) - [VideoDTO](doc\/VideoDTO.md) + - [WeatherDTO](doc\/WeatherDTO.md) - [WebDTO](doc\/WebDTO.md) diff --git a/manager_api_new/doc/ConfigurationDTO.md b/manager_api_new/doc/ConfigurationDTO.md index 7aeb23e..a810fdc 100644 --- a/manager_api_new/doc/ConfigurationDTO.md +++ b/manager_api_new/doc/ConfigurationDTO.md @@ -30,6 +30,9 @@ Name | Type | Description | Notes **isWeather** | **bool** | | [optional] **isDate** | **bool** | | [optional] **isHour** | **bool** | | [optional] +**isSectionImageBackground** | **bool** | | [optional] +**roundedValue** | **int** | | [optional] +**screenPercentageSectionsMainPage** | **int** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/manager_api_new/doc/ExportConfigurationDTO.md b/manager_api_new/doc/ExportConfigurationDTO.md index d71c385..6e5c89c 100644 --- a/manager_api_new/doc/ExportConfigurationDTO.md +++ b/manager_api_new/doc/ExportConfigurationDTO.md @@ -30,6 +30,9 @@ Name | Type | Description | Notes **isWeather** | **bool** | | [optional] **isDate** | **bool** | | [optional] **isHour** | **bool** | | [optional] +**isSectionImageBackground** | **bool** | | [optional] +**roundedValue** | **int** | | [optional] +**screenPercentageSectionsMainPage** | **int** | | [optional] **sections** | [**List**](SectionDTO.md) | | [optional] [default to const []] **resources** | [**List**](ResourceDTO.md) | | [optional] [default to const []] diff --git a/manager_api_new/doc/GeoPointDTO.md b/manager_api_new/doc/GeoPointDTO.md index 006bc69..bdf4ca0 100644 --- a/manager_api_new/doc/GeoPointDTO.md +++ b/manager_api_new/doc/GeoPointDTO.md @@ -15,6 +15,11 @@ Name | Type | Description | Notes **categorie** | [**GeoPointDTOCategorie**](GeoPointDTOCategorie.md) | | [optional] **latitude** | **String** | | [optional] **longitude** | **String** | | [optional] +**schedules** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**prices** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**phone** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**email** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**site** | [**List**](TranslationDTO.md) | | [optional] [default to const []] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/manager_api_new/doc/SectionApi.md b/manager_api_new/doc/SectionApi.md index 1d77bc1..2989293 100644 --- a/manager_api_new/doc/SectionApi.md +++ b/manager_api_new/doc/SectionApi.md @@ -26,6 +26,7 @@ Method | HTTP request | Description [**sectionGetQuizzDTO**](SectionApi.md#sectiongetquizzdto) | **GET** /api/Section/QuizzDTO | [**sectionGetSliderDTO**](SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO | [**sectionGetVideoDTO**](SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO | +[**sectionGetWeatherDTO**](SectionApi.md#sectiongetweatherdto) | **GET** /api/Section/WeatherDTO | [**sectionGetWebDTO**](SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO | [**sectionPlayerMessageDTO**](SectionApi.md#sectionplayermessagedto) | **GET** /api/Section/PlayerMessageDTO | [**sectionUpdate**](SectionApi.md#sectionupdate) | **PUT** /api/Section | @@ -727,6 +728,45 @@ This endpoint does not need any parameter. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **sectionGetWeatherDTO** +> WeatherDTO sectionGetWeatherDTO() + + + +### Example +```dart +import 'package:manager_api_new/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = SectionApi(); + +try { + final result = api_instance.sectionGetWeatherDTO(); + print(result); +} catch (e) { + print('Exception when calling SectionApi->sectionGetWeatherDTO: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**WeatherDTO**](WeatherDTO.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **sectionGetWebDTO** > WebDTO sectionGetWebDTO() diff --git a/manager_api_new/doc/WeatherDTO.md b/manager_api_new/doc/WeatherDTO.md new file mode 100644 index 0000000..75120ab --- /dev/null +++ b/manager_api_new/doc/WeatherDTO.md @@ -0,0 +1,17 @@ +# manager_api_new.model.WeatherDTO + +## Load the model package +```dart +import 'package:manager_api_new/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **String** | | [optional] +**updatedDate** | [**DateTime**](DateTime.md) | | [optional] +**result** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/manager_api_new/lib/api.dart b/manager_api_new/lib/api.dart index f8ec430..078b45c 100644 --- a/manager_api_new/lib/api.dart +++ b/manager_api_new/lib/api.dart @@ -80,6 +80,7 @@ part 'model/translation_dto.dart'; part 'model/user.dart'; part 'model/user_detail_dto.dart'; part 'model/video_dto.dart'; +part 'model/weather_dto.dart'; part 'model/web_dto.dart'; diff --git a/manager_api_new/lib/api/section_api.dart b/manager_api_new/lib/api/section_api.dart index 5f94765..5dfcc5d 100644 --- a/manager_api_new/lib/api/section_api.dart +++ b/manager_api_new/lib/api/section_api.dart @@ -783,6 +783,47 @@ class SectionApi { return null; } + /// Performs an HTTP 'GET /api/Section/WeatherDTO' operation and returns the [Response]. + Future sectionGetWeatherDTOWithHttpInfo() async { + // ignore: prefer_const_declarations + final path = r'/api/Section/WeatherDTO'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + Future sectionGetWeatherDTO() async { + final response = await sectionGetWeatherDTOWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'WeatherDTO',) as WeatherDTO; + + } + return null; + } + /// Performs an HTTP 'GET /api/Section/WebDTO' operation and returns the [Response]. Future sectionGetWebDTOWithHttpInfo() async { // ignore: prefer_const_declarations diff --git a/manager_api_new/lib/api_client.dart b/manager_api_new/lib/api_client.dart index 6ffed59..2fb099d 100644 --- a/manager_api_new/lib/api_client.dart +++ b/manager_api_new/lib/api_client.dart @@ -271,6 +271,8 @@ class ApiClient { return UserDetailDTO.fromJson(value); case 'VideoDTO': return VideoDTO.fromJson(value); + case 'WeatherDTO': + return WeatherDTO.fromJson(value); case 'WebDTO': return WebDTO.fromJson(value); default: diff --git a/manager_api_new/lib/model/configuration_dto.dart b/manager_api_new/lib/model/configuration_dto.dart index 810ef02..3d642fc 100644 --- a/manager_api_new/lib/model/configuration_dto.dart +++ b/manager_api_new/lib/model/configuration_dto.dart @@ -35,6 +35,9 @@ class ConfigurationDTO { this.isWeather, this.isDate, this.isHour, + this.isSectionImageBackground, + this.roundedValue, + this.screenPercentageSectionsMainPage, }); String? id; @@ -123,6 +126,18 @@ class ConfigurationDTO { /// bool? isHour; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isSectionImageBackground; + + int? roundedValue; + + int? screenPercentageSectionsMainPage; + @override bool operator ==(Object other) => identical(this, other) || other is ConfigurationDTO && other.id == id && @@ -146,7 +161,10 @@ class ConfigurationDTO { other.weatherResult == weatherResult && other.isWeather == isWeather && other.isDate == isDate && - other.isHour == isHour; + other.isHour == isHour && + other.isSectionImageBackground == isSectionImageBackground && + other.roundedValue == roundedValue && + other.screenPercentageSectionsMainPage == screenPercentageSectionsMainPage; @override int get hashCode => @@ -172,10 +190,13 @@ class ConfigurationDTO { (weatherResult == null ? 0 : weatherResult!.hashCode) + (isWeather == null ? 0 : isWeather!.hashCode) + (isDate == null ? 0 : isDate!.hashCode) + - (isHour == null ? 0 : isHour!.hashCode); + (isHour == null ? 0 : isHour!.hashCode) + + (isSectionImageBackground == null ? 0 : isSectionImageBackground!.hashCode) + + (roundedValue == null ? 0 : roundedValue!.hashCode) + + (screenPercentageSectionsMainPage == null ? 0 : screenPercentageSectionsMainPage!.hashCode); @override - String toString() => 'ConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, weatherUpdatedDate=$weatherUpdatedDate, weatherResult=$weatherResult, isWeather=$isWeather, isDate=$isDate, isHour=$isHour]'; + String toString() => 'ConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, weatherUpdatedDate=$weatherUpdatedDate, weatherResult=$weatherResult, isWeather=$isWeather, isDate=$isDate, isHour=$isHour, isSectionImageBackground=$isSectionImageBackground, roundedValue=$roundedValue, screenPercentageSectionsMainPage=$screenPercentageSectionsMainPage]'; Map toJson() { final json = {}; @@ -289,6 +310,21 @@ class ConfigurationDTO { } else { json[r'isHour'] = null; } + if (this.isSectionImageBackground != null) { + json[r'isSectionImageBackground'] = this.isSectionImageBackground; + } else { + json[r'isSectionImageBackground'] = null; + } + if (this.roundedValue != null) { + json[r'roundedValue'] = this.roundedValue; + } else { + json[r'roundedValue'] = null; + } + if (this.screenPercentageSectionsMainPage != null) { + json[r'screenPercentageSectionsMainPage'] = this.screenPercentageSectionsMainPage; + } else { + json[r'screenPercentageSectionsMainPage'] = null; + } return json; } @@ -337,6 +373,9 @@ class ConfigurationDTO { isWeather: mapValueOfType(json, r'isWeather'), isDate: mapValueOfType(json, r'isDate'), isHour: mapValueOfType(json, r'isHour'), + isSectionImageBackground: mapValueOfType(json, r'isSectionImageBackground'), + roundedValue: mapValueOfType(json, r'roundedValue'), + screenPercentageSectionsMainPage: mapValueOfType(json, r'screenPercentageSectionsMainPage'), ); } return null; diff --git a/manager_api_new/lib/model/export_configuration_dto.dart b/manager_api_new/lib/model/export_configuration_dto.dart index 34ffbc1..e1f7cad 100644 --- a/manager_api_new/lib/model/export_configuration_dto.dart +++ b/manager_api_new/lib/model/export_configuration_dto.dart @@ -35,6 +35,9 @@ class ExportConfigurationDTO { this.isWeather, this.isDate, this.isHour, + this.isSectionImageBackground, + this.roundedValue, + this.screenPercentageSectionsMainPage, this.sections = const [], this.resources = const [], }); @@ -125,6 +128,18 @@ class ExportConfigurationDTO { /// bool? isHour; + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isSectionImageBackground; + + int? roundedValue; + + int? screenPercentageSectionsMainPage; + List? sections; List? resources; @@ -153,6 +168,9 @@ class ExportConfigurationDTO { other.isWeather == isWeather && other.isDate == isDate && other.isHour == isHour && + other.isSectionImageBackground == isSectionImageBackground && + other.roundedValue == roundedValue && + other.screenPercentageSectionsMainPage == screenPercentageSectionsMainPage && other.sections == sections && other.resources == resources; @@ -181,11 +199,14 @@ class ExportConfigurationDTO { (isWeather == null ? 0 : isWeather!.hashCode) + (isDate == null ? 0 : isDate!.hashCode) + (isHour == null ? 0 : isHour!.hashCode) + + (isSectionImageBackground == null ? 0 : isSectionImageBackground!.hashCode) + + (roundedValue == null ? 0 : roundedValue!.hashCode) + + (screenPercentageSectionsMainPage == null ? 0 : screenPercentageSectionsMainPage!.hashCode) + (sections == null ? 0 : sections!.hashCode) + (resources == null ? 0 : resources!.hashCode); @override - String toString() => 'ExportConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, weatherUpdatedDate=$weatherUpdatedDate, weatherResult=$weatherResult, isWeather=$isWeather, isDate=$isDate, isHour=$isHour, sections=$sections, resources=$resources]'; + String toString() => 'ExportConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, weatherUpdatedDate=$weatherUpdatedDate, weatherResult=$weatherResult, isWeather=$isWeather, isDate=$isDate, isHour=$isHour, isSectionImageBackground=$isSectionImageBackground, roundedValue=$roundedValue, screenPercentageSectionsMainPage=$screenPercentageSectionsMainPage, sections=$sections, resources=$resources]'; Map toJson() { final json = {}; @@ -299,6 +320,21 @@ class ExportConfigurationDTO { } else { json[r'isHour'] = null; } + if (this.isSectionImageBackground != null) { + json[r'isSectionImageBackground'] = this.isSectionImageBackground; + } else { + json[r'isSectionImageBackground'] = null; + } + if (this.roundedValue != null) { + json[r'roundedValue'] = this.roundedValue; + } else { + json[r'roundedValue'] = null; + } + if (this.screenPercentageSectionsMainPage != null) { + json[r'screenPercentageSectionsMainPage'] = this.screenPercentageSectionsMainPage; + } else { + json[r'screenPercentageSectionsMainPage'] = null; + } if (this.sections != null) { json[r'sections'] = this.sections; } else { @@ -357,6 +393,9 @@ class ExportConfigurationDTO { isWeather: mapValueOfType(json, r'isWeather'), isDate: mapValueOfType(json, r'isDate'), isHour: mapValueOfType(json, r'isHour'), + isSectionImageBackground: mapValueOfType(json, r'isSectionImageBackground'), + roundedValue: mapValueOfType(json, r'roundedValue'), + screenPercentageSectionsMainPage: mapValueOfType(json, r'screenPercentageSectionsMainPage'), sections: SectionDTO.listFromJson(json[r'sections']), resources: ResourceDTO.listFromJson(json[r'resources']), ); diff --git a/manager_api_new/lib/model/geo_point_dto.dart b/manager_api_new/lib/model/geo_point_dto.dart index 38be1f2..721c8fc 100644 --- a/manager_api_new/lib/model/geo_point_dto.dart +++ b/manager_api_new/lib/model/geo_point_dto.dart @@ -20,14 +20,13 @@ class GeoPointDTO { this.categorie, this.latitude, this.longitude, + this.schedules = const [], + this.prices = const [], + this.phone = const [], + this.email = const [], + this.site = const [], }); - /// - /// Please note: This property should have been non-nullable! Since the specification file - /// does not include a default value (using the "default:" property), however, the generated - /// source code must fall back to having a nullable type. - /// Consider adding a "default:" property in the specification file to hide this note. - /// int? id; List? title; @@ -42,6 +41,16 @@ class GeoPointDTO { String? longitude; + List? schedules; + + List? prices; + + List? phone; + + List? email; + + List? site; + @override bool operator ==(Object other) => identical(this, other) || other is GeoPointDTO && other.id == id && @@ -50,7 +59,12 @@ class GeoPointDTO { other.contents == contents && other.categorie == categorie && other.latitude == latitude && - other.longitude == longitude; + other.longitude == longitude && + other.schedules == schedules && + other.prices == prices && + other.phone == phone && + other.email == email && + other.site == site; @override int get hashCode => @@ -61,10 +75,15 @@ class GeoPointDTO { (contents == null ? 0 : contents!.hashCode) + (categorie == null ? 0 : categorie!.hashCode) + (latitude == null ? 0 : latitude!.hashCode) + - (longitude == null ? 0 : longitude!.hashCode); + (longitude == null ? 0 : longitude!.hashCode) + + (schedules == null ? 0 : schedules!.hashCode) + + (prices == null ? 0 : prices!.hashCode) + + (phone == null ? 0 : phone!.hashCode) + + (email == null ? 0 : email!.hashCode) + + (site == null ? 0 : site!.hashCode); @override - String toString() => 'GeoPointDTO[id=$id, title=$title, description=$description, contents=$contents, categorie=$categorie, latitude=$latitude, longitude=$longitude]'; + String toString() => 'GeoPointDTO[id=$id, title=$title, description=$description, contents=$contents, categorie=$categorie, latitude=$latitude, longitude=$longitude, schedules=$schedules, prices=$prices, phone=$phone, email=$email, site=$site]'; Map toJson() { final json = {}; @@ -103,6 +122,31 @@ class GeoPointDTO { } else { json[r'longitude'] = null; } + if (this.schedules != null) { + json[r'schedules'] = this.schedules; + } else { + json[r'schedules'] = null; + } + if (this.prices != null) { + json[r'prices'] = this.prices; + } else { + json[r'prices'] = null; + } + if (this.phone != null) { + json[r'phone'] = this.phone; + } else { + json[r'phone'] = null; + } + if (this.email != null) { + json[r'email'] = this.email; + } else { + json[r'email'] = null; + } + if (this.site != null) { + json[r'site'] = this.site; + } else { + json[r'site'] = null; + } return json; } @@ -132,6 +176,11 @@ class GeoPointDTO { categorie: CategorieDTO.fromJson(json[r'categorie']), latitude: mapValueOfType(json, r'latitude'), longitude: mapValueOfType(json, r'longitude'), + schedules: TranslationDTO.listFromJson(json[r'schedules']), + prices: TranslationDTO.listFromJson(json[r'prices']), + phone: TranslationDTO.listFromJson(json[r'phone']), + email: TranslationDTO.listFromJson(json[r'email']), + site: TranslationDTO.listFromJson(json[r'site']), ); } return null; diff --git a/manager_api_new/lib/model/section_type.dart b/manager_api_new/lib/model/section_type.dart index 29523c6..fe65f35 100644 --- a/manager_api_new/lib/model/section_type.dart +++ b/manager_api_new/lib/model/section_type.dart @@ -33,6 +33,7 @@ class SectionType { static const Pdf = SectionType._(7); static const Puzzle = SectionType._(8); static const Agenda = SectionType._(9); + static const Weather = SectionType._(10); /// List of all possible values in this [enum][SectionType]. static const values = [ @@ -45,7 +46,8 @@ class SectionType { Article, Pdf, Puzzle, - Agenda + Agenda, + Weather ]; static SectionType? fromJson(dynamic value) => SectionTypeTypeTransformer().decode(value); @@ -95,6 +97,7 @@ class SectionTypeTypeTransformer { case r'PDF': return SectionType.Pdf; case r'Puzzle': return SectionType.Puzzle; case r'Agenda': return SectionType.Agenda; + case r'Weather': return SectionType.Weather; default: if (!allowNull) { throw ArgumentError('Unknown enum value to decode: $data'); @@ -113,6 +116,7 @@ class SectionTypeTypeTransformer { case 7: return SectionType.Pdf; case 8: return SectionType.Puzzle; case 9: return SectionType.Agenda; + case 10: return SectionType.Weather; default: if (!allowNull) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/manager_api_new/lib/model/weather_dto.dart b/manager_api_new/lib/model/weather_dto.dart new file mode 100644 index 0000000..e2447d0 --- /dev/null +++ b/manager_api_new/lib/model/weather_dto.dart @@ -0,0 +1,134 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class WeatherDTO { + /// Returns a new [WeatherDTO] instance. + WeatherDTO({ + this.city, + this.updatedDate, + this.result, + }); + + String? city; + + DateTime? updatedDate; + + String? result; + + @override + bool operator ==(Object other) => identical(this, other) || other is WeatherDTO && + other.city == city && + other.updatedDate == updatedDate && + other.result == result; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (city == null ? 0 : city!.hashCode) + + (updatedDate == null ? 0 : updatedDate!.hashCode) + + (result == null ? 0 : result!.hashCode); + + @override + String toString() => 'WeatherDTO[city=$city, updatedDate=$updatedDate, result=$result]'; + + Map toJson() { + final json = {}; + if (this.city != null) { + json[r'city'] = this.city; + } else { + json[r'city'] = null; + } + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; + } + if (this.result != null) { + json[r'result'] = this.result; + } else { + json[r'result'] = null; + } + return json; + } + + /// Returns a new [WeatherDTO] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static WeatherDTO? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "WeatherDTO[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "WeatherDTO[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return WeatherDTO( + city: mapValueOfType(json, r'city'), + updatedDate: mapDateTime(json, r'updatedDate', ''), + result: mapValueOfType(json, r'result'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = WeatherDTO.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = WeatherDTO.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of WeatherDTO-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = WeatherDTO.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/manager_api_new/test/weather_dto_test.dart b/manager_api_new/test/weather_dto_test.dart new file mode 100644 index 0000000..e0582e9 --- /dev/null +++ b/manager_api_new/test/weather_dto_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:manager_api_new/api.dart'; +import 'package:test/test.dart'; + +// tests for WeatherDTO +void main() { + // final instance = WeatherDTO(); + + group('test WeatherDTO', () { + // String city + test('to test the property `city`', () async { + // TODO + }); + + // DateTime updatedDate + test('to test the property `updatedDate`', () async { + // TODO + }); + + // String result + test('to test the property `result`', () async { + // TODO + }); + + + }); + +} diff --git a/pubspec.yaml b/pubspec.yaml index e6f61ae..eac8bcc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 2.0.1+5 +version: 2.0.2+6 environment: sdk: ">=3.1.0 <4.0.0"