bugs fix + update service generation
This commit is contained in:
parent
c1a5b3fae7
commit
999e6c4b0e
@ -1,12 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:manager_app/constants.dart';
|
||||
|
||||
import 'message_notification.dart';
|
||||
|
||||
class MultiSelectContainer extends StatelessWidget {
|
||||
final Color color;
|
||||
final String label;
|
||||
final List<String> values;
|
||||
final List<String> initialValue;
|
||||
final bool isMultiple;
|
||||
final bool isAtLeastOne;
|
||||
final ValueChanged<List<dynamic>> onChanged;
|
||||
const MultiSelectContainer({
|
||||
Key key,
|
||||
@ -15,6 +18,7 @@ class MultiSelectContainer extends StatelessWidget {
|
||||
this.values,
|
||||
this.initialValue,
|
||||
this.isMultiple,
|
||||
this.isAtLeastOne = false,
|
||||
this.onChanged,
|
||||
}) : super(key: key);
|
||||
|
||||
@ -36,6 +40,7 @@ class MultiSelectContainer extends StatelessWidget {
|
||||
values,
|
||||
initialValue,
|
||||
isMultiple,
|
||||
isAtLeastOne,
|
||||
onSelectionChanged: (selectedList) {
|
||||
onChanged(selectedList);
|
||||
},
|
||||
@ -53,10 +58,12 @@ class MultiSelectChip extends StatefulWidget {
|
||||
final List<String> selectedValues;
|
||||
final Function(List<String>) onSelectionChanged; // +added
|
||||
final bool isMultiple;
|
||||
final bool isAtLeastOne;
|
||||
MultiSelectChip(
|
||||
this.values,
|
||||
this.selectedValues,
|
||||
this.isMultiple,
|
||||
this.isAtLeastOne,
|
||||
{this.onSelectionChanged} // +added
|
||||
);
|
||||
@override
|
||||
@ -74,17 +81,20 @@ class _MultiSelectChipState extends State<MultiSelectChip> {
|
||||
selectedColor: kPrimaryColor,
|
||||
onSelected: (selected) {
|
||||
setState(() {
|
||||
if (widget.isMultiple) {
|
||||
widget.selectedValues.contains(item)
|
||||
? widget.selectedValues.remove(item)
|
||||
: widget.selectedValues.add(item);
|
||||
widget.onSelectionChanged(widget.selectedValues);
|
||||
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 {
|
||||
widget.selectedValues.clear();
|
||||
widget.selectedValues.add(item);
|
||||
widget.onSelectionChanged(widget.selectedValues);
|
||||
if (widget.isMultiple) {
|
||||
widget.selectedValues.contains(item)
|
||||
? widget.selectedValues.remove(item)
|
||||
: widget.selectedValues.add(item);
|
||||
widget.onSelectionChanged(widget.selectedValues);
|
||||
} else {
|
||||
widget.selectedValues.clear();
|
||||
widget.selectedValues.add(item);
|
||||
widget.onSelectionChanged(widget.selectedValues);
|
||||
}
|
||||
}
|
||||
// +added
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
@ -36,10 +36,13 @@ class _MapConfigState extends State<MapConfig> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
mapDTO = MapDTO.fromJson(json.decode(widget.initialValue));
|
||||
List<GeoPointDTO> test = new List<GeoPointDTO>.from(mapDTO.points);
|
||||
mapDTO.points = test;
|
||||
|
||||
if (mapDTO.mapType == null) {
|
||||
mapDTO.mapType = MapTypeApp.hybrid;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@ -77,7 +80,7 @@ class _MapConfigState extends State<MapConfig> {
|
||||
values: map_types,
|
||||
onChanged: (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());
|
||||
},
|
||||
),
|
||||
|
||||
@ -78,17 +78,17 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
getSectionIcon(sectionDTO.type),
|
||||
sectionDTO != null ? getSectionIcon(sectionDTO.type) : Icons.add,
|
||||
color: kPrimaryColor,
|
||||
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: 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: [
|
||||
StringInputContainer(
|
||||
label: "Nom :",
|
||||
initialValue: sectionDTO.label,
|
||||
initialValue: sectionDTO != null ? sectionDTO.label : "",
|
||||
onChanged: (value) {
|
||||
sectionDTO.label = value;
|
||||
},
|
||||
),
|
||||
ImageInputContainer(
|
||||
label: "Image :",
|
||||
initialValue: sectionDTO.imageId,
|
||||
initialValue: sectionDTO != null ? sectionDTO.imageId : "",
|
||||
color: kPrimaryColor,
|
||||
onChanged: (ResourceDTO resource) {
|
||||
print("received value in grant older");
|
||||
@ -163,7 +163,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
label: "Titre :",
|
||||
modalLabel: "Titre",
|
||||
color: kPrimaryColor,
|
||||
initialValue: sectionDTO.title,
|
||||
initialValue: sectionDTO != null ? sectionDTO.title : [],
|
||||
onGetResult: (value) {
|
||||
if (sectionDTO.title != value) {
|
||||
sectionDTO.title = value;
|
||||
@ -176,7 +176,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
label: "Description :",
|
||||
modalLabel: "Description",
|
||||
color: kPrimaryColor,
|
||||
initialValue: sectionDTO.description,
|
||||
initialValue: sectionDTO != null ? sectionDTO.description : [],
|
||||
onGetResult: (value) {
|
||||
if (sectionDTO.description != value) {
|
||||
sectionDTO.description = value;
|
||||
@ -200,7 +200,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
width: size.width * 0.8,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: getSpecificData(sectionDTO, appContext),
|
||||
child: sectionDTO != null ? getSpecificData(sectionDTO, appContext) : null,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
|
||||
@ -133,6 +133,7 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
||||
initialValue: configurationDTO.languages != null ? configurationDTO.languages: [],
|
||||
values: languages,
|
||||
isMultiple: true,
|
||||
isAtLeastOne: true,
|
||||
onChanged: (value) {
|
||||
var tempOutput = new List<String>.from(value);
|
||||
configurationDTO.languages = tempOutput;
|
||||
@ -317,7 +318,6 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
||||
|
||||
Future<List<SectionDTO>> getSections(ConfigurationDTO configurationDTO, Client client) async {
|
||||
print("getSections");
|
||||
print(configurationDTO.id);
|
||||
List<SectionDTO> sections = await client.sectionApi.sectionGetFromConfiguration(configurationDTO.id);
|
||||
print(sections);
|
||||
sections.sort((a, b) => a.order.compareTo(b.order));
|
||||
|
||||
@ -78,7 +78,6 @@ void showNewConfiguration(AppContext appContext, BuildContext context) {
|
||||
|
||||
void create(ConfigurationDTO configurationDTO, AppContext appContext, context) async {
|
||||
if (configurationDTO.label != null) {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
ConfigurationDTO newConfiguration = await appContext.getContext().clientAPI.configurationApi.configurationCreate(configurationDTO);
|
||||
ManagerAppContext managerAppContext = appContext.getContext();
|
||||
@ -86,5 +85,7 @@ void create(ConfigurationDTO configurationDTO, AppContext appContext, context) a
|
||||
appContext.setContext(managerAppContext);
|
||||
|
||||
showNotification(Colors.green, kWhite, 'La configuration a été créée avec succès', context);
|
||||
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
@ -98,7 +98,6 @@ void showNewSection(String configurationId, AppContext appContext, BuildContext
|
||||
|
||||
void create(SectionDTO sectionDTO, AppContext appContext, BuildContext context, bool isSubSection, Function sendSubSection) async {
|
||||
if (sectionDTO.label != null) {
|
||||
Navigator.of(context).pop();
|
||||
SectionDTO newSection = await appContext.getContext().clientAPI.sectionApi.sectionCreate(sectionDTO);
|
||||
|
||||
if (!isSubSection) {
|
||||
@ -112,5 +111,6 @@ void create(SectionDTO sectionDTO, AppContext appContext, BuildContext context,
|
||||
} else {
|
||||
sendSubSection(newSection);
|
||||
}
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
@ -13,8 +13,9 @@ doc/ImageDTO.md
|
||||
doc/ImageGeoPoint.md
|
||||
doc/LoginDTO.md
|
||||
doc/MapDTO.md
|
||||
doc/MapType.md
|
||||
doc/MapTypeApp.md
|
||||
doc/MenuDTO.md
|
||||
doc/PlayerMessageDTO.md
|
||||
doc/ResourceApi.md
|
||||
doc/ResourceDTO.md
|
||||
doc/ResourceDetailDTO.md
|
||||
@ -55,8 +56,9 @@ lib/model/image_dto.dart
|
||||
lib/model/image_geo_point.dart
|
||||
lib/model/login_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/player_message_dto.dart
|
||||
lib/model/resource_detail_dto.dart
|
||||
lib/model/resource_dto.dart
|
||||
lib/model/resource_type.dart
|
||||
|
||||
@ -96,6 +96,7 @@ Class | Method | HTTP request | Description
|
||||
*SectionApi* | [**sectionGetSliderDTO**](doc\/SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO |
|
||||
*SectionApi* | [**sectionGetVideoDTO**](doc\/SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO |
|
||||
*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* | [**sectionUpdateOrder**](doc\/SectionApi.md#sectionupdateorder) | **PUT** /api/Section/order |
|
||||
*UserApi* | [**userCreateUser**](doc\/UserApi.md#usercreateuser) | **POST** /api/User |
|
||||
@ -116,8 +117,9 @@ Class | Method | HTTP request | Description
|
||||
- [ImageGeoPoint](doc\/ImageGeoPoint.md)
|
||||
- [LoginDTO](doc\/LoginDTO.md)
|
||||
- [MapDTO](doc\/MapDTO.md)
|
||||
- [MapType](doc\/MapType.md)
|
||||
- [MapTypeApp](doc\/MapTypeApp.md)
|
||||
- [MenuDTO](doc\/MenuDTO.md)
|
||||
- [PlayerMessageDTO](doc\/PlayerMessageDTO.md)
|
||||
- [ResourceDTO](doc\/ResourceDTO.md)
|
||||
- [ResourceDetailDTO](doc\/ResourceDetailDTO.md)
|
||||
- [ResourceType](doc\/ResourceType.md)
|
||||
|
||||
@ -9,6 +9,7 @@ import 'package:managerapi/api.dart';
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **String** | | [optional]
|
||||
**identifier** | **String** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
**ipAddressWLAN** | **String** | | [optional]
|
||||
**ipAddressETH** | **String** | | [optional]
|
||||
@ -16,6 +17,7 @@ Name | Type | Description | Notes
|
||||
**configuration** | **String** | | [optional]
|
||||
**connected** | **bool** | | [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)
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import 'package:managerapi/api.dart';
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **String** | | [optional]
|
||||
**identifier** | **String** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
**ipAddressWLAN** | **String** | | [optional]
|
||||
**ipAddressETH** | **String** | | [optional]
|
||||
@ -16,6 +17,7 @@ Name | Type | Description | Notes
|
||||
**configuration** | **String** | | [optional]
|
||||
**connected** | **bool** | | [optional]
|
||||
**dateCreation** | [**DateTime**](DateTime.md) | | [optional]
|
||||
**dateUpdate** | [**DateTime**](DateTime.md) | | [optional]
|
||||
**connectionLevel** | **String** | | [optional]
|
||||
**lastConnectionLevel** | [**DateTime**](DateTime.md) | | [optional]
|
||||
**batteryLevel** | **String** | | [optional]
|
||||
|
||||
@ -9,7 +9,7 @@ import 'package:managerapi/api.dart';
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**zoom** | **int** | | [optional]
|
||||
**mapType** | [**MapType**](MapType.md) | | [optional]
|
||||
**mapType** | [**MapTypeApp**](MapTypeApp.md) | | [optional]
|
||||
**points** | [**List<GeoPointDTO>**](GeoPointDTO.md) | | [optional] [default to const []]
|
||||
**iconResourceId** | **String** | | [optional]
|
||||
**iconSource** | **String** | | [optional]
|
||||
|
||||
14
manager_api/doc/MapTypeApp.md
Normal file
14
manager_api/doc/MapTypeApp.md
Normal 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)
|
||||
|
||||
|
||||
16
manager_api/doc/PlayerMessageDTO.md
Normal file
16
manager_api/doc/PlayerMessageDTO.md
Normal 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)
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ Method | HTTP request | Description
|
||||
[**sectionGetSliderDTO**](SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO |
|
||||
[**sectionGetVideoDTO**](SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO |
|
||||
[**sectionGetWebDTO**](SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO |
|
||||
[**sectionPlayerMessageDTO**](SectionApi.md#sectionplayermessagedto) | **GET** /api/Section/PlayerMessageDTO |
|
||||
[**sectionUpdate**](SectionApi.md#sectionupdate) | **PUT** /api/Section |
|
||||
[**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)
|
||||
|
||||
# **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**
|
||||
> SectionDTO sectionUpdate(sectionDTO)
|
||||
|
||||
|
||||
@ -43,8 +43,9 @@ part 'model/image_dto.dart';
|
||||
part 'model/image_geo_point.dart';
|
||||
part 'model/login_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/player_message_dto.dart';
|
||||
part 'model/resource_dto.dart';
|
||||
part 'model/resource_detail_dto.dart';
|
||||
part 'model/resource_type.dart';
|
||||
|
||||
@ -716,6 +716,58 @@ class SectionApi {
|
||||
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].
|
||||
/// Parameters:
|
||||
///
|
||||
|
||||
@ -174,11 +174,13 @@ class ApiClient {
|
||||
return LoginDTO.fromJson(value);
|
||||
case 'MapDTO':
|
||||
return MapDTO.fromJson(value);
|
||||
case 'MapType':
|
||||
return MapTypeTypeTransformer().decode(value);
|
||||
case 'MapTypeApp':
|
||||
return MapTypeAppTypeTransformer().decode(value);
|
||||
|
||||
case 'MenuDTO':
|
||||
return MenuDTO.fromJson(value);
|
||||
case 'PlayerMessageDTO':
|
||||
return PlayerMessageDTO.fromJson(value);
|
||||
case 'ResourceDTO':
|
||||
return ResourceDTO.fromJson(value);
|
||||
case 'ResourceDetailDTO':
|
||||
|
||||
@ -58,8 +58,8 @@ String parameterToString(dynamic value) {
|
||||
if (value is DateTime) {
|
||||
return value.toUtc().toIso8601String();
|
||||
}
|
||||
if (value is MapType) {
|
||||
return MapTypeTypeTransformer().encode(value).toString();
|
||||
if (value is MapTypeApp) {
|
||||
return MapTypeAppTypeTransformer().encode(value).toString();
|
||||
}
|
||||
if (value is ResourceType) {
|
||||
return ResourceTypeTypeTransformer().encode(value).toString();
|
||||
|
||||
@ -13,6 +13,7 @@ class DeviceDetailDTO {
|
||||
/// Returns a new [DeviceDetailDTO] instance.
|
||||
DeviceDetailDTO({
|
||||
this.id,
|
||||
this.identifier,
|
||||
this.name,
|
||||
this.ipAddressWLAN,
|
||||
this.ipAddressETH,
|
||||
@ -20,6 +21,7 @@ class DeviceDetailDTO {
|
||||
this.configuration,
|
||||
this.connected,
|
||||
this.dateCreation,
|
||||
this.dateUpdate,
|
||||
this.connectionLevel,
|
||||
this.lastConnectionLevel,
|
||||
this.batteryLevel,
|
||||
@ -28,6 +30,8 @@ class DeviceDetailDTO {
|
||||
|
||||
String id;
|
||||
|
||||
String identifier;
|
||||
|
||||
String name;
|
||||
|
||||
String ipAddressWLAN;
|
||||
@ -42,6 +46,8 @@ class DeviceDetailDTO {
|
||||
|
||||
DateTime dateCreation;
|
||||
|
||||
DateTime dateUpdate;
|
||||
|
||||
String connectionLevel;
|
||||
|
||||
DateTime lastConnectionLevel;
|
||||
@ -53,6 +59,7 @@ class DeviceDetailDTO {
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is DeviceDetailDTO &&
|
||||
other.id == id &&
|
||||
other.identifier == identifier &&
|
||||
other.name == name &&
|
||||
other.ipAddressWLAN == ipAddressWLAN &&
|
||||
other.ipAddressETH == ipAddressETH &&
|
||||
@ -60,6 +67,7 @@ class DeviceDetailDTO {
|
||||
other.configuration == configuration &&
|
||||
other.connected == connected &&
|
||||
other.dateCreation == dateCreation &&
|
||||
other.dateUpdate == dateUpdate &&
|
||||
other.connectionLevel == connectionLevel &&
|
||||
other.lastConnectionLevel == lastConnectionLevel &&
|
||||
other.batteryLevel == batteryLevel &&
|
||||
@ -68,6 +76,7 @@ class DeviceDetailDTO {
|
||||
@override
|
||||
int get hashCode =>
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(identifier == null ? 0 : identifier.hashCode) +
|
||||
(name == null ? 0 : name.hashCode) +
|
||||
(ipAddressWLAN == null ? 0 : ipAddressWLAN.hashCode) +
|
||||
(ipAddressETH == null ? 0 : ipAddressETH.hashCode) +
|
||||
@ -75,19 +84,23 @@ class DeviceDetailDTO {
|
||||
(configuration == null ? 0 : configuration.hashCode) +
|
||||
(connected == null ? 0 : connected.hashCode) +
|
||||
(dateCreation == null ? 0 : dateCreation.hashCode) +
|
||||
(dateUpdate == null ? 0 : dateUpdate.hashCode) +
|
||||
(connectionLevel == null ? 0 : connectionLevel.hashCode) +
|
||||
(lastConnectionLevel == null ? 0 : lastConnectionLevel.hashCode) +
|
||||
(batteryLevel == null ? 0 : batteryLevel.hashCode) +
|
||||
(lastBatteryLevel == null ? 0 : lastBatteryLevel.hashCode);
|
||||
|
||||
@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() {
|
||||
final json = <String, dynamic>{};
|
||||
if (id != null) {
|
||||
json[r'id'] = id;
|
||||
}
|
||||
if (identifier != null) {
|
||||
json[r'identifier'] = identifier;
|
||||
}
|
||||
if (name != null) {
|
||||
json[r'name'] = name;
|
||||
}
|
||||
@ -109,6 +122,9 @@ class DeviceDetailDTO {
|
||||
if (dateCreation != null) {
|
||||
json[r'dateCreation'] = dateCreation.toUtc().toIso8601String();
|
||||
}
|
||||
if (dateUpdate != null) {
|
||||
json[r'dateUpdate'] = dateUpdate.toUtc().toIso8601String();
|
||||
}
|
||||
if (connectionLevel != null) {
|
||||
json[r'connectionLevel'] = connectionLevel;
|
||||
}
|
||||
@ -130,6 +146,7 @@ class DeviceDetailDTO {
|
||||
? null
|
||||
: DeviceDetailDTO(
|
||||
id: json[r'id'],
|
||||
identifier: json[r'identifier'],
|
||||
name: json[r'name'],
|
||||
ipAddressWLAN: json[r'ipAddressWLAN'],
|
||||
ipAddressETH: json[r'ipAddressETH'],
|
||||
@ -139,6 +156,9 @@ class DeviceDetailDTO {
|
||||
dateCreation: json[r'dateCreation'] == null
|
||||
? null
|
||||
: DateTime.parse(json[r'dateCreation']),
|
||||
dateUpdate: json[r'dateUpdate'] == null
|
||||
? null
|
||||
: DateTime.parse(json[r'dateUpdate']),
|
||||
connectionLevel: json[r'connectionLevel'],
|
||||
lastConnectionLevel: json[r'lastConnectionLevel'] == null
|
||||
? null
|
||||
|
||||
@ -13,6 +13,7 @@ class DeviceDTO {
|
||||
/// Returns a new [DeviceDTO] instance.
|
||||
DeviceDTO({
|
||||
this.id,
|
||||
this.identifier,
|
||||
this.name,
|
||||
this.ipAddressWLAN,
|
||||
this.ipAddressETH,
|
||||
@ -20,10 +21,13 @@ class DeviceDTO {
|
||||
this.configuration,
|
||||
this.connected,
|
||||
this.dateCreation,
|
||||
this.dateUpdate,
|
||||
});
|
||||
|
||||
String id;
|
||||
|
||||
String identifier;
|
||||
|
||||
String name;
|
||||
|
||||
String ipAddressWLAN;
|
||||
@ -38,36 +42,45 @@ class DeviceDTO {
|
||||
|
||||
DateTime dateCreation;
|
||||
|
||||
DateTime dateUpdate;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is DeviceDTO &&
|
||||
other.id == id &&
|
||||
other.identifier == identifier &&
|
||||
other.name == name &&
|
||||
other.ipAddressWLAN == ipAddressWLAN &&
|
||||
other.ipAddressETH == ipAddressETH &&
|
||||
other.configurationId == configurationId &&
|
||||
other.configuration == configuration &&
|
||||
other.connected == connected &&
|
||||
other.dateCreation == dateCreation;
|
||||
other.dateCreation == dateCreation &&
|
||||
other.dateUpdate == dateUpdate;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(identifier == null ? 0 : identifier.hashCode) +
|
||||
(name == null ? 0 : name.hashCode) +
|
||||
(ipAddressWLAN == null ? 0 : ipAddressWLAN.hashCode) +
|
||||
(ipAddressETH == null ? 0 : ipAddressETH.hashCode) +
|
||||
(configurationId == null ? 0 : configurationId.hashCode) +
|
||||
(configuration == null ? 0 : configuration.hashCode) +
|
||||
(connected == null ? 0 : connected.hashCode) +
|
||||
(dateCreation == null ? 0 : dateCreation.hashCode);
|
||||
(dateCreation == null ? 0 : dateCreation.hashCode) +
|
||||
(dateUpdate == null ? 0 : dateUpdate.hashCode);
|
||||
|
||||
@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() {
|
||||
final json = <String, dynamic>{};
|
||||
if (id != null) {
|
||||
json[r'id'] = id;
|
||||
}
|
||||
if (identifier != null) {
|
||||
json[r'identifier'] = identifier;
|
||||
}
|
||||
if (name != null) {
|
||||
json[r'name'] = name;
|
||||
}
|
||||
@ -89,6 +102,9 @@ class DeviceDTO {
|
||||
if (dateCreation != null) {
|
||||
json[r'dateCreation'] = dateCreation.toUtc().toIso8601String();
|
||||
}
|
||||
if (dateUpdate != null) {
|
||||
json[r'dateUpdate'] = dateUpdate.toUtc().toIso8601String();
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -98,6 +114,7 @@ class DeviceDTO {
|
||||
? null
|
||||
: DeviceDTO(
|
||||
id: json[r'id'],
|
||||
identifier: json[r'identifier'],
|
||||
name: json[r'name'],
|
||||
ipAddressWLAN: json[r'ipAddressWLAN'],
|
||||
ipAddressETH: json[r'ipAddressETH'],
|
||||
@ -107,6 +124,9 @@ class DeviceDTO {
|
||||
dateCreation: json[r'dateCreation'] == null
|
||||
? null
|
||||
: 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,}) =>
|
||||
|
||||
@ -21,7 +21,7 @@ class MapDTO {
|
||||
|
||||
int zoom;
|
||||
|
||||
MapType mapType;
|
||||
MapTypeApp mapType;
|
||||
|
||||
List<GeoPointDTO> points;
|
||||
|
||||
@ -74,7 +74,7 @@ class MapDTO {
|
||||
? null
|
||||
: MapDTO(
|
||||
zoom: json[r'zoom'],
|
||||
mapType: MapType.fromJson(json[r'mapType']),
|
||||
mapType: MapTypeApp.fromJson(json[r'mapType']),
|
||||
points: GeoPointDTO.listFromJson(json[r'points']),
|
||||
iconResourceId: json[r'iconResourceId'],
|
||||
iconSource: json[r'iconSource'],
|
||||
|
||||
85
manager_api/lib/model/map_type_app.dart
Normal file
85
manager_api/lib/model/map_type_app.dart
Normal 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;
|
||||
}
|
||||
80
manager_api/lib/model/player_message_dto.dart
Normal file
80
manager_api/lib/model/player_message_dto.dart
Normal 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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1018,6 +1018,20 @@ paths:
|
||||
$ref: '#/components/schemas/MenuDTO'
|
||||
security:
|
||||
- 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:
|
||||
get:
|
||||
tags:
|
||||
@ -1298,6 +1312,9 @@ components:
|
||||
id:
|
||||
type: string
|
||||
nullable: true
|
||||
identifier:
|
||||
type: string
|
||||
nullable: true
|
||||
name:
|
||||
type: string
|
||||
nullable: true
|
||||
@ -1318,6 +1335,9 @@ components:
|
||||
dateCreation:
|
||||
type: string
|
||||
format: date-time
|
||||
dateUpdate:
|
||||
type: string
|
||||
format: date-time
|
||||
DeviceDetailDTO:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/DeviceDTO'
|
||||
@ -1460,7 +1480,7 @@ components:
|
||||
type: integer
|
||||
format: int32
|
||||
mapType:
|
||||
$ref: '#/components/schemas/MapType'
|
||||
$ref: '#/components/schemas/MapTypeApp'
|
||||
points:
|
||||
type: array
|
||||
nullable: true
|
||||
@ -1472,7 +1492,7 @@ components:
|
||||
iconSource:
|
||||
type: string
|
||||
nullable: true
|
||||
MapType:
|
||||
MapTypeApp:
|
||||
type: string
|
||||
description: ''
|
||||
x-enumNames:
|
||||
@ -1580,6 +1600,14 @@ components:
|
||||
nullable: true
|
||||
items:
|
||||
$ref: '#/components/schemas/SectionDTO'
|
||||
PlayerMessageDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
configChanged:
|
||||
type: boolean
|
||||
isDeleted:
|
||||
type: boolean
|
||||
User:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
|
||||
20
manager_api/test/map_type_app_test.dart
Normal file
20
manager_api/test/map_type_app_test.dart
Normal 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', () {
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
31
manager_api/test/player_message_dto_test.dart
Normal file
31
manager_api/test/player_message_dto_test.dart
Normal 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
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user