bugs fix + update service generation

This commit is contained in:
Thomas Fransolet 2021-07-25 01:51:56 +02:00
parent c1a5b3fae7
commit 999e6c4b0e
26 changed files with 470 additions and 39 deletions

View File

@ -1,12 +1,15 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:manager_app/constants.dart'; import 'package:manager_app/constants.dart';
import 'message_notification.dart';
class MultiSelectContainer extends StatelessWidget { class MultiSelectContainer extends StatelessWidget {
final Color color; final Color color;
final String label; final String label;
final List<String> values; final List<String> values;
final List<String> initialValue; final List<String> initialValue;
final bool isMultiple; final bool isMultiple;
final bool isAtLeastOne;
final ValueChanged<List<dynamic>> onChanged; final ValueChanged<List<dynamic>> onChanged;
const MultiSelectContainer({ const MultiSelectContainer({
Key key, Key key,
@ -15,6 +18,7 @@ class MultiSelectContainer extends StatelessWidget {
this.values, this.values,
this.initialValue, this.initialValue,
this.isMultiple, this.isMultiple,
this.isAtLeastOne = false,
this.onChanged, this.onChanged,
}) : super(key: key); }) : super(key: key);
@ -36,6 +40,7 @@ class MultiSelectContainer extends StatelessWidget {
values, values,
initialValue, initialValue,
isMultiple, isMultiple,
isAtLeastOne,
onSelectionChanged: (selectedList) { onSelectionChanged: (selectedList) {
onChanged(selectedList); onChanged(selectedList);
}, },
@ -53,10 +58,12 @@ class MultiSelectChip extends StatefulWidget {
final List<String> selectedValues; final List<String> selectedValues;
final Function(List<String>) onSelectionChanged; // +added final Function(List<String>) onSelectionChanged; // +added
final bool isMultiple; final bool isMultiple;
final bool isAtLeastOne;
MultiSelectChip( MultiSelectChip(
this.values, this.values,
this.selectedValues, this.selectedValues,
this.isMultiple, this.isMultiple,
this.isAtLeastOne,
{this.onSelectionChanged} // +added {this.onSelectionChanged} // +added
); );
@override @override
@ -74,6 +81,9 @@ class _MultiSelectChipState extends State<MultiSelectChip> {
selectedColor: kPrimaryColor, selectedColor: kPrimaryColor,
onSelected: (selected) { onSelected: (selected) {
setState(() { 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);
} else {
if (widget.isMultiple) { if (widget.isMultiple) {
widget.selectedValues.contains(item) widget.selectedValues.contains(item)
? widget.selectedValues.remove(item) ? widget.selectedValues.remove(item)
@ -84,7 +94,7 @@ class _MultiSelectChipState extends State<MultiSelectChip> {
widget.selectedValues.add(item); widget.selectedValues.add(item);
widget.onSelectionChanged(widget.selectedValues); widget.onSelectionChanged(widget.selectedValues);
} }
// +added }
}); });
}, },
), ),

View File

@ -36,10 +36,13 @@ class _MapConfigState extends State<MapConfig> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
mapDTO = MapDTO.fromJson(json.decode(widget.initialValue)); mapDTO = MapDTO.fromJson(json.decode(widget.initialValue));
List<GeoPointDTO> test = new List<GeoPointDTO>.from(mapDTO.points); List<GeoPointDTO> test = new List<GeoPointDTO>.from(mapDTO.points);
mapDTO.points = test; mapDTO.points = test;
if (mapDTO.mapType == null) {
mapDTO.mapType = MapTypeApp.hybrid;
}
} }
@override @override
@ -77,7 +80,7 @@ class _MapConfigState extends State<MapConfig> {
values: map_types, values: map_types,
onChanged: (value) { onChanged: (value) {
var tempOutput = new List<String>.from(value); var tempOutput = new List<String>.from(value);
mapDTO.mapType = MapType.fromJson(tempOutput[0]); mapDTO.mapType = MapTypeApp.fromJson(tempOutput[0]);
widget.onChanged(jsonEncode(mapDTO).toString()); widget.onChanged(jsonEncode(mapDTO).toString());
}, },
), ),

View File

@ -78,17 +78,17 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Icon( child: Icon(
getSectionIcon(sectionDTO.type), sectionDTO != null ? getSectionIcon(sectionDTO.type) : Icons.add,
color: kPrimaryColor, color: kPrimaryColor,
size: 25, size: 25,
), ),
), ),
Text(sectionDTO.label, style: TextStyle(fontSize: 30, fontWeight: FontWeight.w400)), Text(sectionDTO != null ? sectionDTO.label : "", style: TextStyle(fontSize: 30, fontWeight: FontWeight.w400)),
], ],
), ),
Padding( Padding(
padding: const EdgeInsets.all(5.0), padding: const EdgeInsets.all(5.0),
child: Text(DateFormat('dd/MM/yyyy').format(sectionDTO.dateCreation), style: TextStyle(fontSize: 15, fontWeight: FontWeight.w200)), child: Text(sectionDTO != null ? DateFormat('dd/MM/yyyy').format(sectionDTO.dateCreation) : "", style: TextStyle(fontSize: 15, fontWeight: FontWeight.w200)),
), ),
], ],
), ),
@ -138,14 +138,14 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
children: [ children: [
StringInputContainer( StringInputContainer(
label: "Nom :", label: "Nom :",
initialValue: sectionDTO.label, initialValue: sectionDTO != null ? sectionDTO.label : "",
onChanged: (value) { onChanged: (value) {
sectionDTO.label = value; sectionDTO.label = value;
}, },
), ),
ImageInputContainer( ImageInputContainer(
label: "Image :", label: "Image :",
initialValue: sectionDTO.imageId, initialValue: sectionDTO != null ? sectionDTO.imageId : "",
color: kPrimaryColor, color: kPrimaryColor,
onChanged: (ResourceDTO resource) { onChanged: (ResourceDTO resource) {
print("received value in grant older"); print("received value in grant older");
@ -163,7 +163,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
label: "Titre :", label: "Titre :",
modalLabel: "Titre", modalLabel: "Titre",
color: kPrimaryColor, color: kPrimaryColor,
initialValue: sectionDTO.title, initialValue: sectionDTO != null ? sectionDTO.title : [],
onGetResult: (value) { onGetResult: (value) {
if (sectionDTO.title != value) { if (sectionDTO.title != value) {
sectionDTO.title = value; sectionDTO.title = value;
@ -176,7 +176,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
label: "Description :", label: "Description :",
modalLabel: "Description", modalLabel: "Description",
color: kPrimaryColor, color: kPrimaryColor,
initialValue: sectionDTO.description, initialValue: sectionDTO != null ? sectionDTO.description : [],
onGetResult: (value) { onGetResult: (value) {
if (sectionDTO.description != value) { if (sectionDTO.description != value) {
sectionDTO.description = value; sectionDTO.description = value;
@ -200,7 +200,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
width: size.width * 0.8, width: size.width * 0.8,
child: Padding( child: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: getSpecificData(sectionDTO, appContext), child: sectionDTO != null ? getSpecificData(sectionDTO, appContext) : null,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30), borderRadius: BorderRadius.circular(30),

View File

@ -133,6 +133,7 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
initialValue: configurationDTO.languages != null ? configurationDTO.languages: [], initialValue: configurationDTO.languages != null ? configurationDTO.languages: [],
values: languages, values: languages,
isMultiple: true, isMultiple: true,
isAtLeastOne: true,
onChanged: (value) { onChanged: (value) {
var tempOutput = new List<String>.from(value); var tempOutput = new List<String>.from(value);
configurationDTO.languages = tempOutput; configurationDTO.languages = tempOutput;
@ -317,7 +318,6 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
Future<List<SectionDTO>> getSections(ConfigurationDTO configurationDTO, Client client) async { Future<List<SectionDTO>> getSections(ConfigurationDTO configurationDTO, Client client) async {
print("getSections"); print("getSections");
print(configurationDTO.id);
List<SectionDTO> sections = await client.sectionApi.sectionGetFromConfiguration(configurationDTO.id); List<SectionDTO> sections = await client.sectionApi.sectionGetFromConfiguration(configurationDTO.id);
print(sections); print(sections);
sections.sort((a, b) => a.order.compareTo(b.order)); sections.sort((a, b) => a.order.compareTo(b.order));

View File

@ -78,7 +78,6 @@ void showNewConfiguration(AppContext appContext, BuildContext context) {
void create(ConfigurationDTO configurationDTO, AppContext appContext, context) async { void create(ConfigurationDTO configurationDTO, AppContext appContext, context) async {
if (configurationDTO.label != null) { if (configurationDTO.label != null) {
Navigator.of(context).pop();
ConfigurationDTO newConfiguration = await appContext.getContext().clientAPI.configurationApi.configurationCreate(configurationDTO); ConfigurationDTO newConfiguration = await appContext.getContext().clientAPI.configurationApi.configurationCreate(configurationDTO);
ManagerAppContext managerAppContext = appContext.getContext(); ManagerAppContext managerAppContext = appContext.getContext();
@ -86,5 +85,7 @@ void create(ConfigurationDTO configurationDTO, AppContext appContext, context) a
appContext.setContext(managerAppContext); appContext.setContext(managerAppContext);
showNotification(Colors.green, kWhite, 'La configuration a été créée avec succès', context); showNotification(Colors.green, kWhite, 'La configuration a été créée avec succès', context);
Navigator.of(context).pop();
} }
} }

View File

@ -98,7 +98,6 @@ void showNewSection(String configurationId, AppContext appContext, BuildContext
void create(SectionDTO sectionDTO, AppContext appContext, BuildContext context, bool isSubSection, Function sendSubSection) async { void create(SectionDTO sectionDTO, AppContext appContext, BuildContext context, bool isSubSection, Function sendSubSection) async {
if (sectionDTO.label != null) { if (sectionDTO.label != null) {
Navigator.of(context).pop();
SectionDTO newSection = await appContext.getContext().clientAPI.sectionApi.sectionCreate(sectionDTO); SectionDTO newSection = await appContext.getContext().clientAPI.sectionApi.sectionCreate(sectionDTO);
if (!isSubSection) { if (!isSubSection) {
@ -112,5 +111,6 @@ void create(SectionDTO sectionDTO, AppContext appContext, BuildContext context,
} else { } else {
sendSubSection(newSection); sendSubSection(newSection);
} }
Navigator.of(context).pop();
} }
} }

View File

@ -13,8 +13,9 @@ doc/ImageDTO.md
doc/ImageGeoPoint.md doc/ImageGeoPoint.md
doc/LoginDTO.md doc/LoginDTO.md
doc/MapDTO.md doc/MapDTO.md
doc/MapType.md doc/MapTypeApp.md
doc/MenuDTO.md doc/MenuDTO.md
doc/PlayerMessageDTO.md
doc/ResourceApi.md doc/ResourceApi.md
doc/ResourceDTO.md doc/ResourceDTO.md
doc/ResourceDetailDTO.md doc/ResourceDetailDTO.md
@ -55,8 +56,9 @@ lib/model/image_dto.dart
lib/model/image_geo_point.dart lib/model/image_geo_point.dart
lib/model/login_dto.dart lib/model/login_dto.dart
lib/model/map_dto.dart lib/model/map_dto.dart
lib/model/map_type.dart lib/model/map_type_app.dart
lib/model/menu_dto.dart lib/model/menu_dto.dart
lib/model/player_message_dto.dart
lib/model/resource_detail_dto.dart lib/model/resource_detail_dto.dart
lib/model/resource_dto.dart lib/model/resource_dto.dart
lib/model/resource_type.dart lib/model/resource_type.dart

View File

@ -96,6 +96,7 @@ Class | Method | HTTP request | Description
*SectionApi* | [**sectionGetSliderDTO**](doc\/SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO | *SectionApi* | [**sectionGetSliderDTO**](doc\/SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO |
*SectionApi* | [**sectionGetVideoDTO**](doc\/SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO | *SectionApi* | [**sectionGetVideoDTO**](doc\/SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO |
*SectionApi* | [**sectionGetWebDTO**](doc\/SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO | *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 | *SectionApi* | [**sectionUpdate**](doc\/SectionApi.md#sectionupdate) | **PUT** /api/Section |
*SectionApi* | [**sectionUpdateOrder**](doc\/SectionApi.md#sectionupdateorder) | **PUT** /api/Section/order | *SectionApi* | [**sectionUpdateOrder**](doc\/SectionApi.md#sectionupdateorder) | **PUT** /api/Section/order |
*UserApi* | [**userCreateUser**](doc\/UserApi.md#usercreateuser) | **POST** /api/User | *UserApi* | [**userCreateUser**](doc\/UserApi.md#usercreateuser) | **POST** /api/User |
@ -116,8 +117,9 @@ Class | Method | HTTP request | Description
- [ImageGeoPoint](doc\/ImageGeoPoint.md) - [ImageGeoPoint](doc\/ImageGeoPoint.md)
- [LoginDTO](doc\/LoginDTO.md) - [LoginDTO](doc\/LoginDTO.md)
- [MapDTO](doc\/MapDTO.md) - [MapDTO](doc\/MapDTO.md)
- [MapType](doc\/MapType.md) - [MapTypeApp](doc\/MapTypeApp.md)
- [MenuDTO](doc\/MenuDTO.md) - [MenuDTO](doc\/MenuDTO.md)
- [PlayerMessageDTO](doc\/PlayerMessageDTO.md)
- [ResourceDTO](doc\/ResourceDTO.md) - [ResourceDTO](doc\/ResourceDTO.md)
- [ResourceDetailDTO](doc\/ResourceDetailDTO.md) - [ResourceDetailDTO](doc\/ResourceDetailDTO.md)
- [ResourceType](doc\/ResourceType.md) - [ResourceType](doc\/ResourceType.md)

View File

@ -9,6 +9,7 @@ import 'package:managerapi/api.dart';
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **String** | | [optional] **id** | **String** | | [optional]
**identifier** | **String** | | [optional]
**name** | **String** | | [optional] **name** | **String** | | [optional]
**ipAddressWLAN** | **String** | | [optional] **ipAddressWLAN** | **String** | | [optional]
**ipAddressETH** | **String** | | [optional] **ipAddressETH** | **String** | | [optional]
@ -16,6 +17,7 @@ Name | Type | Description | Notes
**configuration** | **String** | | [optional] **configuration** | **String** | | [optional]
**connected** | **bool** | | [optional] **connected** | **bool** | | [optional]
**dateCreation** | [**DateTime**](DateTime.md) | | [optional] **dateCreation** | [**DateTime**](DateTime.md) | | [optional]
**dateUpdate** | [**DateTime**](DateTime.md) | | [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) [[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

@ -9,6 +9,7 @@ import 'package:managerapi/api.dart';
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **String** | | [optional] **id** | **String** | | [optional]
**identifier** | **String** | | [optional]
**name** | **String** | | [optional] **name** | **String** | | [optional]
**ipAddressWLAN** | **String** | | [optional] **ipAddressWLAN** | **String** | | [optional]
**ipAddressETH** | **String** | | [optional] **ipAddressETH** | **String** | | [optional]
@ -16,6 +17,7 @@ Name | Type | Description | Notes
**configuration** | **String** | | [optional] **configuration** | **String** | | [optional]
**connected** | **bool** | | [optional] **connected** | **bool** | | [optional]
**dateCreation** | [**DateTime**](DateTime.md) | | [optional] **dateCreation** | [**DateTime**](DateTime.md) | | [optional]
**dateUpdate** | [**DateTime**](DateTime.md) | | [optional]
**connectionLevel** | **String** | | [optional] **connectionLevel** | **String** | | [optional]
**lastConnectionLevel** | [**DateTime**](DateTime.md) | | [optional] **lastConnectionLevel** | [**DateTime**](DateTime.md) | | [optional]
**batteryLevel** | **String** | | [optional] **batteryLevel** | **String** | | [optional]

View File

@ -9,7 +9,7 @@ import 'package:managerapi/api.dart';
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**zoom** | **int** | | [optional] **zoom** | **int** | | [optional]
**mapType** | [**MapType**](MapType.md) | | [optional] **mapType** | [**MapTypeApp**](MapTypeApp.md) | | [optional]
**points** | [**List<GeoPointDTO>**](GeoPointDTO.md) | | [optional] [default to const []] **points** | [**List<GeoPointDTO>**](GeoPointDTO.md) | | [optional] [default to const []]
**iconResourceId** | **String** | | [optional] **iconResourceId** | **String** | | [optional]
**iconSource** | **String** | | [optional] **iconSource** | **String** | | [optional]

View File

@ -0,0 +1,14 @@
# managerapi.model.MapTypeApp
## Load the model package
```dart
import 'package:managerapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[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

@ -0,0 +1,16 @@
# managerapi.model.PlayerMessageDTO
## Load the model package
```dart
import 'package:managerapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**configChanged** | **bool** | | [optional]
**isDeleted** | **bool** | | [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

@ -21,6 +21,7 @@ Method | HTTP request | Description
[**sectionGetSliderDTO**](SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO | [**sectionGetSliderDTO**](SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO |
[**sectionGetVideoDTO**](SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO | [**sectionGetVideoDTO**](SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO |
[**sectionGetWebDTO**](SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO | [**sectionGetWebDTO**](SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO |
[**sectionPlayerMessageDTO**](SectionApi.md#sectionplayermessagedto) | **GET** /api/Section/PlayerMessageDTO |
[**sectionUpdate**](SectionApi.md#sectionupdate) | **PUT** /api/Section | [**sectionUpdate**](SectionApi.md#sectionupdate) | **PUT** /api/Section |
[**sectionUpdateOrder**](SectionApi.md#sectionupdateorder) | **PUT** /api/Section/order | [**sectionUpdateOrder**](SectionApi.md#sectionupdateorder) | **PUT** /api/Section/order |
@ -517,6 +518,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) [[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)
# **sectionPlayerMessageDTO**
> PlayerMessageDTO sectionPlayerMessageDTO()
### Example
```dart
import 'package:managerapi/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.sectionPlayerMessageDTO();
print(result);
} catch (e) {
print('Exception when calling SectionApi->sectionPlayerMessageDTO: $e\n');
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**PlayerMessageDTO**](PlayerMessageDTO.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)
# **sectionUpdate** # **sectionUpdate**
> SectionDTO sectionUpdate(sectionDTO) > SectionDTO sectionUpdate(sectionDTO)

View File

@ -43,8 +43,9 @@ part 'model/image_dto.dart';
part 'model/image_geo_point.dart'; part 'model/image_geo_point.dart';
part 'model/login_dto.dart'; part 'model/login_dto.dart';
part 'model/map_dto.dart'; part 'model/map_dto.dart';
part 'model/map_type.dart'; part 'model/map_type_app.dart';
part 'model/menu_dto.dart'; part 'model/menu_dto.dart';
part 'model/player_message_dto.dart';
part 'model/resource_dto.dart'; part 'model/resource_dto.dart';
part 'model/resource_detail_dto.dart'; part 'model/resource_detail_dto.dart';
part 'model/resource_type.dart'; part 'model/resource_type.dart';

View File

@ -716,6 +716,58 @@ class SectionApi {
return Future<WebDTO>.value(null); return Future<WebDTO>.value(null);
} }
/// Performs an HTTP 'GET /api/Section/PlayerMessageDTO' operation and returns the [Response].
Future<Response> sectionPlayerMessageDTOWithHttpInfo() async {
final path = r'/api/Section/PlayerMessageDTO';
Object postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
final contentTypes = <String>[];
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
final authNames = <String>['bearer'];
if (
nullableContentType != null &&
nullableContentType.toLowerCase().startsWith('multipart/form-data')
) {
bool hasFields = false;
final mp = MultipartRequest(null, null);
if (hasFields) {
postBody = mp;
}
} else {
}
return await apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
nullableContentType,
authNames,
);
}
Future<PlayerMessageDTO> sectionPlayerMessageDTO() async {
final response = await sectionPlayerMessageDTOWithHttpInfo();
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _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 != null && response.statusCode != HttpStatus.noContent) {
return apiClient.deserialize(_decodeBodyBytes(response), 'PlayerMessageDTO') as PlayerMessageDTO;
}
return Future<PlayerMessageDTO>.value(null);
}
/// Performs an HTTP 'PUT /api/Section' operation and returns the [Response]. /// Performs an HTTP 'PUT /api/Section' operation and returns the [Response].
/// Parameters: /// Parameters:
/// ///

View File

@ -174,11 +174,13 @@ class ApiClient {
return LoginDTO.fromJson(value); return LoginDTO.fromJson(value);
case 'MapDTO': case 'MapDTO':
return MapDTO.fromJson(value); return MapDTO.fromJson(value);
case 'MapType': case 'MapTypeApp':
return MapTypeTypeTransformer().decode(value); return MapTypeAppTypeTransformer().decode(value);
case 'MenuDTO': case 'MenuDTO':
return MenuDTO.fromJson(value); return MenuDTO.fromJson(value);
case 'PlayerMessageDTO':
return PlayerMessageDTO.fromJson(value);
case 'ResourceDTO': case 'ResourceDTO':
return ResourceDTO.fromJson(value); return ResourceDTO.fromJson(value);
case 'ResourceDetailDTO': case 'ResourceDetailDTO':

View File

@ -58,8 +58,8 @@ String parameterToString(dynamic value) {
if (value is DateTime) { if (value is DateTime) {
return value.toUtc().toIso8601String(); return value.toUtc().toIso8601String();
} }
if (value is MapType) { if (value is MapTypeApp) {
return MapTypeTypeTransformer().encode(value).toString(); return MapTypeAppTypeTransformer().encode(value).toString();
} }
if (value is ResourceType) { if (value is ResourceType) {
return ResourceTypeTypeTransformer().encode(value).toString(); return ResourceTypeTypeTransformer().encode(value).toString();

View File

@ -13,6 +13,7 @@ class DeviceDetailDTO {
/// Returns a new [DeviceDetailDTO] instance. /// Returns a new [DeviceDetailDTO] instance.
DeviceDetailDTO({ DeviceDetailDTO({
this.id, this.id,
this.identifier,
this.name, this.name,
this.ipAddressWLAN, this.ipAddressWLAN,
this.ipAddressETH, this.ipAddressETH,
@ -20,6 +21,7 @@ class DeviceDetailDTO {
this.configuration, this.configuration,
this.connected, this.connected,
this.dateCreation, this.dateCreation,
this.dateUpdate,
this.connectionLevel, this.connectionLevel,
this.lastConnectionLevel, this.lastConnectionLevel,
this.batteryLevel, this.batteryLevel,
@ -28,6 +30,8 @@ class DeviceDetailDTO {
String id; String id;
String identifier;
String name; String name;
String ipAddressWLAN; String ipAddressWLAN;
@ -42,6 +46,8 @@ class DeviceDetailDTO {
DateTime dateCreation; DateTime dateCreation;
DateTime dateUpdate;
String connectionLevel; String connectionLevel;
DateTime lastConnectionLevel; DateTime lastConnectionLevel;
@ -53,6 +59,7 @@ class DeviceDetailDTO {
@override @override
bool operator ==(Object other) => identical(this, other) || other is DeviceDetailDTO && bool operator ==(Object other) => identical(this, other) || other is DeviceDetailDTO &&
other.id == id && other.id == id &&
other.identifier == identifier &&
other.name == name && other.name == name &&
other.ipAddressWLAN == ipAddressWLAN && other.ipAddressWLAN == ipAddressWLAN &&
other.ipAddressETH == ipAddressETH && other.ipAddressETH == ipAddressETH &&
@ -60,6 +67,7 @@ class DeviceDetailDTO {
other.configuration == configuration && other.configuration == configuration &&
other.connected == connected && other.connected == connected &&
other.dateCreation == dateCreation && other.dateCreation == dateCreation &&
other.dateUpdate == dateUpdate &&
other.connectionLevel == connectionLevel && other.connectionLevel == connectionLevel &&
other.lastConnectionLevel == lastConnectionLevel && other.lastConnectionLevel == lastConnectionLevel &&
other.batteryLevel == batteryLevel && other.batteryLevel == batteryLevel &&
@ -68,6 +76,7 @@ class DeviceDetailDTO {
@override @override
int get hashCode => int get hashCode =>
(id == null ? 0 : id.hashCode) + (id == null ? 0 : id.hashCode) +
(identifier == null ? 0 : identifier.hashCode) +
(name == null ? 0 : name.hashCode) + (name == null ? 0 : name.hashCode) +
(ipAddressWLAN == null ? 0 : ipAddressWLAN.hashCode) + (ipAddressWLAN == null ? 0 : ipAddressWLAN.hashCode) +
(ipAddressETH == null ? 0 : ipAddressETH.hashCode) + (ipAddressETH == null ? 0 : ipAddressETH.hashCode) +
@ -75,19 +84,23 @@ class DeviceDetailDTO {
(configuration == null ? 0 : configuration.hashCode) + (configuration == null ? 0 : configuration.hashCode) +
(connected == null ? 0 : connected.hashCode) + (connected == null ? 0 : connected.hashCode) +
(dateCreation == null ? 0 : dateCreation.hashCode) + (dateCreation == null ? 0 : dateCreation.hashCode) +
(dateUpdate == null ? 0 : dateUpdate.hashCode) +
(connectionLevel == null ? 0 : connectionLevel.hashCode) + (connectionLevel == null ? 0 : connectionLevel.hashCode) +
(lastConnectionLevel == null ? 0 : lastConnectionLevel.hashCode) + (lastConnectionLevel == null ? 0 : lastConnectionLevel.hashCode) +
(batteryLevel == null ? 0 : batteryLevel.hashCode) + (batteryLevel == null ? 0 : batteryLevel.hashCode) +
(lastBatteryLevel == null ? 0 : lastBatteryLevel.hashCode); (lastBatteryLevel == null ? 0 : lastBatteryLevel.hashCode);
@override @override
String toString() => 'DeviceDetailDTO[id=$id, name=$name, ipAddressWLAN=$ipAddressWLAN, ipAddressETH=$ipAddressETH, configurationId=$configurationId, configuration=$configuration, connected=$connected, dateCreation=$dateCreation, connectionLevel=$connectionLevel, lastConnectionLevel=$lastConnectionLevel, batteryLevel=$batteryLevel, lastBatteryLevel=$lastBatteryLevel]'; String toString() => 'DeviceDetailDTO[id=$id, identifier=$identifier, name=$name, ipAddressWLAN=$ipAddressWLAN, ipAddressETH=$ipAddressETH, configurationId=$configurationId, configuration=$configuration, connected=$connected, dateCreation=$dateCreation, dateUpdate=$dateUpdate, connectionLevel=$connectionLevel, lastConnectionLevel=$lastConnectionLevel, batteryLevel=$batteryLevel, lastBatteryLevel=$lastBatteryLevel]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
if (id != null) { if (id != null) {
json[r'id'] = id; json[r'id'] = id;
} }
if (identifier != null) {
json[r'identifier'] = identifier;
}
if (name != null) { if (name != null) {
json[r'name'] = name; json[r'name'] = name;
} }
@ -109,6 +122,9 @@ class DeviceDetailDTO {
if (dateCreation != null) { if (dateCreation != null) {
json[r'dateCreation'] = dateCreation.toUtc().toIso8601String(); json[r'dateCreation'] = dateCreation.toUtc().toIso8601String();
} }
if (dateUpdate != null) {
json[r'dateUpdate'] = dateUpdate.toUtc().toIso8601String();
}
if (connectionLevel != null) { if (connectionLevel != null) {
json[r'connectionLevel'] = connectionLevel; json[r'connectionLevel'] = connectionLevel;
} }
@ -130,6 +146,7 @@ class DeviceDetailDTO {
? null ? null
: DeviceDetailDTO( : DeviceDetailDTO(
id: json[r'id'], id: json[r'id'],
identifier: json[r'identifier'],
name: json[r'name'], name: json[r'name'],
ipAddressWLAN: json[r'ipAddressWLAN'], ipAddressWLAN: json[r'ipAddressWLAN'],
ipAddressETH: json[r'ipAddressETH'], ipAddressETH: json[r'ipAddressETH'],
@ -139,6 +156,9 @@ class DeviceDetailDTO {
dateCreation: json[r'dateCreation'] == null dateCreation: json[r'dateCreation'] == null
? null ? null
: DateTime.parse(json[r'dateCreation']), : DateTime.parse(json[r'dateCreation']),
dateUpdate: json[r'dateUpdate'] == null
? null
: DateTime.parse(json[r'dateUpdate']),
connectionLevel: json[r'connectionLevel'], connectionLevel: json[r'connectionLevel'],
lastConnectionLevel: json[r'lastConnectionLevel'] == null lastConnectionLevel: json[r'lastConnectionLevel'] == null
? null ? null

View File

@ -13,6 +13,7 @@ class DeviceDTO {
/// Returns a new [DeviceDTO] instance. /// Returns a new [DeviceDTO] instance.
DeviceDTO({ DeviceDTO({
this.id, this.id,
this.identifier,
this.name, this.name,
this.ipAddressWLAN, this.ipAddressWLAN,
this.ipAddressETH, this.ipAddressETH,
@ -20,10 +21,13 @@ class DeviceDTO {
this.configuration, this.configuration,
this.connected, this.connected,
this.dateCreation, this.dateCreation,
this.dateUpdate,
}); });
String id; String id;
String identifier;
String name; String name;
String ipAddressWLAN; String ipAddressWLAN;
@ -38,36 +42,45 @@ class DeviceDTO {
DateTime dateCreation; DateTime dateCreation;
DateTime dateUpdate;
@override @override
bool operator ==(Object other) => identical(this, other) || other is DeviceDTO && bool operator ==(Object other) => identical(this, other) || other is DeviceDTO &&
other.id == id && other.id == id &&
other.identifier == identifier &&
other.name == name && other.name == name &&
other.ipAddressWLAN == ipAddressWLAN && other.ipAddressWLAN == ipAddressWLAN &&
other.ipAddressETH == ipAddressETH && other.ipAddressETH == ipAddressETH &&
other.configurationId == configurationId && other.configurationId == configurationId &&
other.configuration == configuration && other.configuration == configuration &&
other.connected == connected && other.connected == connected &&
other.dateCreation == dateCreation; other.dateCreation == dateCreation &&
other.dateUpdate == dateUpdate;
@override @override
int get hashCode => int get hashCode =>
(id == null ? 0 : id.hashCode) + (id == null ? 0 : id.hashCode) +
(identifier == null ? 0 : identifier.hashCode) +
(name == null ? 0 : name.hashCode) + (name == null ? 0 : name.hashCode) +
(ipAddressWLAN == null ? 0 : ipAddressWLAN.hashCode) + (ipAddressWLAN == null ? 0 : ipAddressWLAN.hashCode) +
(ipAddressETH == null ? 0 : ipAddressETH.hashCode) + (ipAddressETH == null ? 0 : ipAddressETH.hashCode) +
(configurationId == null ? 0 : configurationId.hashCode) + (configurationId == null ? 0 : configurationId.hashCode) +
(configuration == null ? 0 : configuration.hashCode) + (configuration == null ? 0 : configuration.hashCode) +
(connected == null ? 0 : connected.hashCode) + (connected == null ? 0 : connected.hashCode) +
(dateCreation == null ? 0 : dateCreation.hashCode); (dateCreation == null ? 0 : dateCreation.hashCode) +
(dateUpdate == null ? 0 : dateUpdate.hashCode);
@override @override
String toString() => 'DeviceDTO[id=$id, name=$name, ipAddressWLAN=$ipAddressWLAN, ipAddressETH=$ipAddressETH, configurationId=$configurationId, configuration=$configuration, connected=$connected, dateCreation=$dateCreation]'; String toString() => 'DeviceDTO[id=$id, identifier=$identifier, name=$name, ipAddressWLAN=$ipAddressWLAN, ipAddressETH=$ipAddressETH, configurationId=$configurationId, configuration=$configuration, connected=$connected, dateCreation=$dateCreation, dateUpdate=$dateUpdate]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
if (id != null) { if (id != null) {
json[r'id'] = id; json[r'id'] = id;
} }
if (identifier != null) {
json[r'identifier'] = identifier;
}
if (name != null) { if (name != null) {
json[r'name'] = name; json[r'name'] = name;
} }
@ -89,6 +102,9 @@ class DeviceDTO {
if (dateCreation != null) { if (dateCreation != null) {
json[r'dateCreation'] = dateCreation.toUtc().toIso8601String(); json[r'dateCreation'] = dateCreation.toUtc().toIso8601String();
} }
if (dateUpdate != null) {
json[r'dateUpdate'] = dateUpdate.toUtc().toIso8601String();
}
return json; return json;
} }
@ -98,6 +114,7 @@ class DeviceDTO {
? null ? null
: DeviceDTO( : DeviceDTO(
id: json[r'id'], id: json[r'id'],
identifier: json[r'identifier'],
name: json[r'name'], name: json[r'name'],
ipAddressWLAN: json[r'ipAddressWLAN'], ipAddressWLAN: json[r'ipAddressWLAN'],
ipAddressETH: json[r'ipAddressETH'], ipAddressETH: json[r'ipAddressETH'],
@ -107,6 +124,9 @@ class DeviceDTO {
dateCreation: json[r'dateCreation'] == null dateCreation: json[r'dateCreation'] == null
? null ? null
: DateTime.parse(json[r'dateCreation']), : DateTime.parse(json[r'dateCreation']),
dateUpdate: json[r'dateUpdate'] == null
? null
: DateTime.parse(json[r'dateUpdate']),
); );
static List<DeviceDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) => static List<DeviceDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>

View File

@ -21,7 +21,7 @@ class MapDTO {
int zoom; int zoom;
MapType mapType; MapTypeApp mapType;
List<GeoPointDTO> points; List<GeoPointDTO> points;
@ -74,7 +74,7 @@ class MapDTO {
? null ? null
: MapDTO( : MapDTO(
zoom: json[r'zoom'], zoom: json[r'zoom'],
mapType: MapType.fromJson(json[r'mapType']), mapType: MapTypeApp.fromJson(json[r'mapType']),
points: GeoPointDTO.listFromJson(json[r'points']), points: GeoPointDTO.listFromJson(json[r'points']),
iconResourceId: json[r'iconResourceId'], iconResourceId: json[r'iconResourceId'],
iconSource: json[r'iconSource'], iconSource: json[r'iconSource'],

View File

@ -0,0 +1,85 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class MapTypeApp {
/// Instantiate a new enum with the provided [value].
const MapTypeApp._(this.value);
/// The underlying value of this enum member.
final String value;
@override
String toString() => value;
String toJson() => value;
static const none = MapTypeApp._(r'none');
static const normal = MapTypeApp._(r'normal');
static const satellite = MapTypeApp._(r'satellite');
static const terrain = MapTypeApp._(r'terrain');
static const hybrid = MapTypeApp._(r'hybrid');
/// List of all possible values in this [enum][MapTypeApp].
static const values = <MapTypeApp>[
none,
normal,
satellite,
terrain,
hybrid,
];
static MapTypeApp fromJson(dynamic value) =>
MapTypeAppTypeTransformer().decode(value);
static List<MapTypeApp> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <MapTypeApp>[]
: json
.map((value) => MapTypeApp.fromJson(value))
.toList(growable: true == growable);
}
/// Transformation class that can [encode] an instance of [MapTypeApp] to String,
/// and [decode] dynamic data back to [MapTypeApp].
class MapTypeAppTypeTransformer {
const MapTypeAppTypeTransformer._();
factory MapTypeAppTypeTransformer() => _instance ??= MapTypeAppTypeTransformer._();
String encode(MapTypeApp data) => data.value;
/// Decodes a [dynamic value][data] to a MapTypeApp.
///
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code.
MapTypeApp decode(dynamic data, {bool allowNull}) {
switch (data) {
case r'none': return MapTypeApp.none;
case r'normal': return MapTypeApp.normal;
case r'satellite': return MapTypeApp.satellite;
case r'terrain': return MapTypeApp.terrain;
case r'hybrid': return MapTypeApp.hybrid;
default:
if (allowNull == false) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
return null;
}
/// Singleton [MapTypeAppTypeTransformer] instance.
static MapTypeAppTypeTransformer _instance;
}

View File

@ -0,0 +1,80 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class PlayerMessageDTO {
/// Returns a new [PlayerMessageDTO] instance.
PlayerMessageDTO({
this.configChanged,
this.isDeleted,
});
bool configChanged;
bool isDeleted;
@override
bool operator ==(Object other) => identical(this, other) || other is PlayerMessageDTO &&
other.configChanged == configChanged &&
other.isDeleted == isDeleted;
@override
int get hashCode =>
(configChanged == null ? 0 : configChanged.hashCode) +
(isDeleted == null ? 0 : isDeleted.hashCode);
@override
String toString() => 'PlayerMessageDTO[configChanged=$configChanged, isDeleted=$isDeleted]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (configChanged != null) {
json[r'configChanged'] = configChanged;
}
if (isDeleted != null) {
json[r'isDeleted'] = isDeleted;
}
return json;
}
/// Returns a new [PlayerMessageDTO] instance and imports its values from
/// [json] if it's non-null, null if [json] is null.
static PlayerMessageDTO fromJson(Map<String, dynamic> json) => json == null
? null
: PlayerMessageDTO(
configChanged: json[r'configChanged'],
isDeleted: json[r'isDeleted'],
);
static List<PlayerMessageDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <PlayerMessageDTO>[]
: json.map((v) => PlayerMessageDTO.fromJson(v)).toList(growable: true == growable);
static Map<String, PlayerMessageDTO> mapFromJson(Map<String, dynamic> json) {
final map = <String, PlayerMessageDTO>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) => map[key] = PlayerMessageDTO.fromJson(v));
}
return map;
}
// maps a json object with a list of PlayerMessageDTO-objects as value to a dart map
static Map<String, List<PlayerMessageDTO>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
final map = <String, List<PlayerMessageDTO>>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) {
map[key] = PlayerMessageDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
});
}
return map;
}
}

View File

@ -1018,6 +1018,20 @@ paths:
$ref: '#/components/schemas/MenuDTO' $ref: '#/components/schemas/MenuDTO'
security: security:
- bearer: [] - bearer: []
/api/Section/PlayerMessageDTO:
get:
tags:
- Section
operationId: Section_PlayerMessageDTO
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/PlayerMessageDTO'
security:
- bearer: []
/api/User: /api/User:
get: get:
tags: tags:
@ -1298,6 +1312,9 @@ components:
id: id:
type: string type: string
nullable: true nullable: true
identifier:
type: string
nullable: true
name: name:
type: string type: string
nullable: true nullable: true
@ -1318,6 +1335,9 @@ components:
dateCreation: dateCreation:
type: string type: string
format: date-time format: date-time
dateUpdate:
type: string
format: date-time
DeviceDetailDTO: DeviceDetailDTO:
allOf: allOf:
- $ref: '#/components/schemas/DeviceDTO' - $ref: '#/components/schemas/DeviceDTO'
@ -1460,7 +1480,7 @@ components:
type: integer type: integer
format: int32 format: int32
mapType: mapType:
$ref: '#/components/schemas/MapType' $ref: '#/components/schemas/MapTypeApp'
points: points:
type: array type: array
nullable: true nullable: true
@ -1472,7 +1492,7 @@ components:
iconSource: iconSource:
type: string type: string
nullable: true nullable: true
MapType: MapTypeApp:
type: string type: string
description: '' description: ''
x-enumNames: x-enumNames:
@ -1580,6 +1600,14 @@ components:
nullable: true nullable: true
items: items:
$ref: '#/components/schemas/SectionDTO' $ref: '#/components/schemas/SectionDTO'
PlayerMessageDTO:
type: object
additionalProperties: false
properties:
configChanged:
type: boolean
isDeleted:
type: boolean
User: User:
type: object type: object
additionalProperties: false additionalProperties: false

View File

@ -0,0 +1,20 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
import 'package:managerapi/api.dart';
import 'package:test/test.dart';
// tests for MapTypeApp
void main() {
group('test MapTypeApp', () {
});
}

View File

@ -0,0 +1,31 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
import 'package:managerapi/api.dart';
import 'package:test/test.dart';
// tests for PlayerMessageDTO
void main() {
final instance = PlayerMessageDTO();
group('test PlayerMessageDTO', () {
// bool configChanged
test('to test the property `configChanged`', () async {
// TODO
});
// bool isDeleted
test('to test the property `isDeleted`', () async {
// TODO
});
});
}