Service generation + init new version + Add weather as a section + download resource + filter geoPoint + added new config params

This commit is contained in:
Thomas Fransolet 2024-04-10 10:43:09 +02:00
parent fb0a8674d1
commit 649955044f
29 changed files with 743 additions and 40 deletions

View File

@ -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;
}

View File

@ -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<String> values;
final List<String> initialValue;
final bool isMultiple;
final bool isAtLeastOne;
final bool isHTMLLabel;
final double? width;
final int maxLines;
final ValueChanged<List<dynamic>> 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<String>) 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<MultiSelectChip> {
int maxLines = 1; // Définir le nombre maximum de lignes
_buildChoiceList() {
List<Widget> 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<MultiSelectChip> {
});
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(),
),
);
}
}
}

View File

@ -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<MapConfig> {
late MapDTO mapDTO;
late List<GeoPointDTO> pointsToShow;
List<String>? selectedCategories = [];
String mapType= "hybrid";
String mapTypeMapBox= "standard";
String filterSearch = '';
@override
void initState() {
super.initState();
mapDTO = MapDTO.fromJson(json.decode(widget.initialValue))!;
List<GeoPointDTO> test = new List<GeoPointDTO>.from(mapDTO.points!);
mapDTO.points = test;
pointsToShow = new List<GeoPointDTO>.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<MapConfig> {
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<MapConfig> {
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<String>.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<MapConfig> {
(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<MapConfig> {
(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<MapConfig> {
),
);
}
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();
}
}

View File

@ -75,7 +75,7 @@ Future<CategorieDTO?> 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<CategorieDTO?> showNewOrUpdateCategory(CategorieDTO? inputCategorieDTO, A
},
isSmall: true
),
),*/
),
],
),
],

View File

@ -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,

View File

@ -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;
},
);
}
}

View File

@ -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<String> 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<WeatherConfig> {
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,
);
}
}

View File

@ -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<SectionDetailScreen> {
save(false, sectionDTO, appContext);
},
);
case SectionType.Weather:
return WeatherConfig(
initialValue: sectionDTO.data!,
onChanged: (String data) {
sectionDTO.data = data;
save(false, sectionDTO, appContext);
},
);
}
}
}

View File

@ -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<ConfigurationDetailScreen> {
}
},
),
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<ConfigurationDetailScreen> {
}
},
),
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<ConfigurationDetailScreen> {
configurationDTO.weatherCity = value;
},
),
),
),*/
])
],
),

View File

@ -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<ResourceDTO?> 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(

View File

@ -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

View File

@ -16,7 +16,7 @@ const kWhite = Color(0xFFFFFFFF);
const kBlack = Color(0xFF000000);
const kSuccess = Color(0xFF8bc34a);
const List<String> section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz", "Article", "PDF", "Puzzle", "Agenda"];
const List<String> section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz", "Article", "PDF", "Puzzle", "Agenda", "Weather"];
const List<String> map_types = ["none", "normal", "satellite", "terrain", "hybrid"];
const List<String> languages = ["FR", "NL", "EN", "DE", "IT", "ES", "CN", "PL", "AR", "UK"];
const List<String> map_types_mapBox = ["standard", "streets", "outdoors", "light", "dark", "satellite", "satellite_streets"];

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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>**](SectionDTO.md) | | [optional] [default to const []]
**resources** | [**List<ResourceDTO>**](ResourceDTO.md) | | [optional] [default to const []]

View File

@ -15,6 +15,11 @@ Name | Type | Description | Notes
**categorie** | [**GeoPointDTOCategorie**](GeoPointDTOCategorie.md) | | [optional]
**latitude** | **String** | | [optional]
**longitude** | **String** | | [optional]
**schedules** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
**prices** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
**phone** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
**email** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
**site** | [**List<TranslationDTO>**](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)

View File

@ -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<OAuth>('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()

View File

@ -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)

View File

@ -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';

View File

@ -783,6 +783,47 @@ class SectionApi {
return null;
}
/// Performs an HTTP 'GET /api/Section/WeatherDTO' operation and returns the [Response].
Future<Response> sectionGetWeatherDTOWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/api/Section/WeatherDTO';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
Future<WeatherDTO?> 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<Response> sectionGetWebDTOWithHttpInfo() async {
// ignore: prefer_const_declarations

View File

@ -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:

View File

@ -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<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -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<bool>(json, r'isWeather'),
isDate: mapValueOfType<bool>(json, r'isDate'),
isHour: mapValueOfType<bool>(json, r'isHour'),
isSectionImageBackground: mapValueOfType<bool>(json, r'isSectionImageBackground'),
roundedValue: mapValueOfType<int>(json, r'roundedValue'),
screenPercentageSectionsMainPage: mapValueOfType<int>(json, r'screenPercentageSectionsMainPage'),
);
}
return null;

View File

@ -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<SectionDTO>? sections;
List<ResourceDTO>? 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<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -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<bool>(json, r'isWeather'),
isDate: mapValueOfType<bool>(json, r'isDate'),
isHour: mapValueOfType<bool>(json, r'isHour'),
isSectionImageBackground: mapValueOfType<bool>(json, r'isSectionImageBackground'),
roundedValue: mapValueOfType<int>(json, r'roundedValue'),
screenPercentageSectionsMainPage: mapValueOfType<int>(json, r'screenPercentageSectionsMainPage'),
sections: SectionDTO.listFromJson(json[r'sections']),
resources: ResourceDTO.listFromJson(json[r'resources']),
);

View File

@ -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<TranslationDTO>? title;
@ -42,6 +41,16 @@ class GeoPointDTO {
String? longitude;
List<TranslationDTO>? schedules;
List<TranslationDTO>? prices;
List<TranslationDTO>? phone;
List<TranslationDTO>? email;
List<TranslationDTO>? 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<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -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<String>(json, r'latitude'),
longitude: mapValueOfType<String>(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;

View File

@ -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 = <SectionType>[
@ -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');

View File

@ -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<String, dynamic> toJson() {
final json = <String, dynamic>{};
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<String, dynamic>();
// 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<String>(json, r'city'),
updatedDate: mapDateTime(json, r'updatedDate', ''),
result: mapValueOfType<String>(json, r'result'),
);
}
return null;
}
static List<WeatherDTO> listFromJson(dynamic json, {bool growable = false,}) {
final result = <WeatherDTO>[];
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<String, WeatherDTO> mapFromJson(dynamic json) {
final map = <String, WeatherDTO>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // 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<String, List<WeatherDTO>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<WeatherDTO>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
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 = <String>{
};
}

View File

@ -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
});
});
}

View File

@ -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"