diff --git a/android/app/version.properties b/android/app/version.properties index 59dc9ee..19dae9d 100644 --- a/android/app/version.properties +++ b/android/app/version.properties @@ -1,5 +1,5 @@ -#Tue Aug 01 16:05:42 CEST 2023 -VERSION_BUILD=59 +#Fri Aug 04 18:34:37 CEST 2023 +VERSION_BUILD=69 VERSION_MAJOR=1 VERSION_MINOR=0 VERSION_PATCH=0 diff --git a/lib/Helpers/PushNotificationService.dart b/lib/Helpers/PushNotificationService.dart index 67c34c6..bc30a9a 100644 --- a/lib/Helpers/PushNotificationService.dart +++ b/lib/Helpers/PushNotificationService.dart @@ -53,9 +53,9 @@ class PushNotificationService { FirebaseMessaging.instance.subscribeToTopic("main"); if(homieAppContext != null) { - if (homieAppContext.userId != null) { - print('MyHomie USER ID for fcm notification = ' + homieAppContext.userId.toString()); - FirebaseMessaging.instance.subscribeToTopic(homieAppContext.userId!); + if (homieAppContext.homeId != null) { + print('MyHomie HOME ID for fcm notification = ' + homieAppContext.homeId.toString()); + FirebaseMessaging.instance.subscribeToTopic(homieAppContext.homeId!); } } diff --git a/lib/Screens/Main/Devices/deviceDetailPage.dart b/lib/Screens/Main/Devices/deviceDetailPage.dart new file mode 100644 index 0000000..2d20d93 --- /dev/null +++ b/lib/Screens/Main/Devices/deviceDetailPage.dart @@ -0,0 +1,121 @@ +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:flutter/material.dart'; +import 'package:mycore_api/api.dart'; + +import 'package:mycore_api/api.dart' as API; +import 'package:myhomie_app/Components/Alarms/getCurrentAlarmModeIcon.dart'; +import 'package:myhomie_app/Components/Custom_Navigation_Bar/CustomAppBar.dart'; +import 'package:myhomie_app/Components/check_input_container.dart'; +import 'package:myhomie_app/Components/loading_common.dart'; +import 'package:myhomie_app/Components/string_input_container.dart'; +import 'package:myhomie_app/Models/homieContext.dart'; +import 'package:myhomie_app/app_context.dart'; +import 'package:myhomie_app/constants.dart'; +import 'package:provider/provider.dart'; + +class DeviceDetailPage extends StatefulWidget { + const DeviceDetailPage({Key? key, this.deviceSummaryDTO, this.deviceDetailDTO}) : super(key: key); + + final API.DeviceSummaryDTO? deviceSummaryDTO; + final API.DeviceDetailDTO? deviceDetailDTO; + + @override + State createState() => _DeviceDetailPageState(); +} + +class _DeviceDetailPageState extends State { + final GlobalKey _scaffoldKey = GlobalKey(); + API.DeviceDetailDTO? deviceDetailDTO; + + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final appContext = Provider.of(context); + Size size = MediaQuery.of(context).size; + //final notchInset = MediaQuery.of(context).padding; + + HomieAppContext homieAppContext = appContext.getContext(); + + //debugPrint(widget.deviceSummaryDTO.id!); + + var deviceName = widget.deviceSummaryDTO == null ? widget.deviceDetailDTO!.name! : widget.deviceSummaryDTO!.name!; + var deviceId = widget.deviceSummaryDTO == null ? widget.deviceDetailDTO!.id! : widget.deviceSummaryDTO!.id!; + + return Scaffold( + key: _scaffoldKey, + appBar: CustomAppBar( + title: deviceName, + //titleIcon: getAlarmModeIcon(widget.alarmMode), + isTextSizeButton: true, + ), + body: FutureBuilder( + future: homieAppContext.clientAPI.deviceApi!.deviceGetDetail(deviceId), + builder: (context, AsyncSnapshot snapshot) { + if(snapshot.data != null ) { + deviceDetailDTO = snapshot.data; + + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: size.width *1.1, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: StringInputContainer( + label: "Nom:", + color: kMainColor, + textColor: Colors.white, + initialValue: deviceDetailDTO!.name, + onChanged: (String value) { + setState(() { + deviceDetailDTO!.name = value; + // TODO SAVE or not + }); + }, + ), + ), + ), + /*Padding( + padding: const EdgeInsets.all(8.0), + child: CheckInputContainer( + icon: Icons.notifications_active, + label: "Notification :", + fontSize: 20, + isChecked: alarmModeDetailDTO!.notification!, + onChanged: (bool value) { + alarmModeDetailDTO!.notification = value; + }, + ), + ),*/ + Text( + deviceDetailDTO!.type.toString(), + style: TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.bold + ), + ), + ], + ), + ); + } else { + return const LoadingCommon(); + } + } + ) + ); + } +} diff --git a/lib/Screens/Main/Devices/devices.dart b/lib/Screens/Main/Devices/devices.dart index 8a89412..33fc3e6 100644 --- a/lib/Screens/Main/Devices/devices.dart +++ b/lib/Screens/Main/Devices/devices.dart @@ -1,5 +1,10 @@ import 'package:flutter/material.dart'; +import 'package:mycore_api/api.dart'; +import 'package:myhomie_app/Components/loading_common.dart'; +import 'package:myhomie_app/Models/homieContext.dart'; +import 'package:myhomie_app/Screens/Main/Devices/deviceDetailPage.dart'; import 'package:myhomie_app/app_context.dart'; +import 'package:myhomie_app/constants.dart'; import 'package:provider/provider.dart'; class DevicesScreen extends StatefulWidget { @@ -22,8 +27,27 @@ class _DevicesScreenState extends State { Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; final appContext = Provider.of(context); + HomieAppContext homieAppContext = appContext.getContext(); - return interfaceElements(); + return FutureBuilder( + future: homieAppContext.clientAPI.deviceApi!.deviceGetAll(homieAppContext.homeId!), + builder: (context, AsyncSnapshot?> snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + print("connectionState done"); + print(snapshot); + if(snapshot.data != null) { + return interfaceElements(snapshot.data!); + } else { + return Text("No data - or error"); + } + } else if (snapshot.connectionState == ConnectionState.none) { + print('ConnectionState.none'); + return Text("No data"); + } else { + return Container(height: size.height * 0.2, child: LoadingCommon()); + } + } + ); /*if(appContext.getContext().feed != null) { return interfaceElements(); @@ -44,27 +68,135 @@ class _DevicesScreenState extends State { }*/ } - interfaceElements() { + interfaceElements(List devices) { Size size = MediaQuery.of(context).size; final appContext = Provider.of(context); - return RefreshIndicator( - color: Theme.of(context).primaryColor, - displacement: 20, - onRefresh: () async { - print("TODO refresh"); - //await Message.getMessages(this.messages, appContext, true, true); - }, - child: Container( - height: size.height * 0.8, - child: SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text("TODO Devices") - ], + HomieAppContext homieAppContext = appContext.getContext(); + + return SingleChildScrollView( + child: RefreshIndicator( + color: Theme.of(context).primaryColor, + displacement: 20, + onRefresh: () async { + print("onRefresh"); + await homieAppContext.clientAPI.deviceApi!.deviceGetAll(homieAppContext.homeId!); + }, + child: Container( + height: size.height * 0.85, + child: GridView.builder( + shrinkWrap: true, + gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1), + itemCount: devices.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () { + debugPrint(devices[index].toString()); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => DeviceDetailPage( + deviceSummaryDTO: devices[index] + ) + ), + ); + /*setState(() { + //selectedSection = menuDTO.sections[index]; + print("Hero to room detail"); + });*/ + }, + child: Container( + decoration: boxDecorationDevice(devices[index], false), + padding: const EdgeInsets.all(5), + margin: EdgeInsets.symmetric(vertical: 8, horizontal: 8), + child: Stack( + children: [ + Center( + child: Text( + devices[index].name!, + style: new TextStyle(fontSize: kDescriptionDetailSize, color: kBackgroundSecondGrey), + textAlign: TextAlign.center, + ), + ), + + if(devices[index].type != null) + Positioned( + top: 5, + child: Row( + children: [ + Icon( + getDeviceIcon(devices[index].type!), + size: 20, + //color: devices[index].status! ? kMainColor : kBackgroundSecondGrey, + ), + ], + ) + ), + ], + ), + ), + ); + } ), ), ), ); } +} + +getDeviceIcon(DeviceType type) { + switch(type) { + case DeviceType.sensor: + return Icons.sensors; + case DeviceType.actuator: + return Icons.devices; + case DeviceType.camera: + return Icons.camera_alt_outlined; + case DeviceType.switch_: + return Icons.toggle_off_outlined; + case DeviceType.light: + return Icons.light; + case DeviceType.sound: + return Icons.volume_up; + case DeviceType.plug: + return Icons.outlet_outlined; + case DeviceType.multiplug: + return Icons.settings_input_component_outlined; + case DeviceType.thermostat: + return Icons.thermostat; + case DeviceType.valve: + return Icons.thermostat_auto; + case DeviceType.door: + return Icons.door_back_door_outlined; + case DeviceType.environment: + return Icons.sensors_sharp; + case DeviceType.motion: + return Icons.directions_run; + case DeviceType.gateway: + return Icons.dns_outlined; + case DeviceType.unknown: + return Icons.question_mark; + } +} + +boxDecorationDevice(DeviceSummaryDTO deviceSummaryDTO, bool isSelected) { + return BoxDecoration( + color: kBackgroundLight, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(20.0), + /*image: roomMainDetailDTO.imageSource != null ? new DecorationImage( + fit: BoxFit.contain, + colorFilter: !isSelected? new ColorFilter.mode(Colors.black.withOpacity(0.5), BlendMode.dstATop) : null, + image: new NetworkImage( + section.imageSource, + ), + ): null,*/ + boxShadow: [ + BoxShadow( + color: kBackgroundSecondGrey, + spreadRadius: 0.5, + blurRadius: 6, + offset: Offset(0, 1.5), // changes position of shadow + ), + ], + ); } \ No newline at end of file diff --git a/lib/Screens/Main/Home/home.dart b/lib/Screens/Main/Home/home.dart index 8184cd8..14bba77 100644 --- a/lib/Screens/Main/Home/home.dart +++ b/lib/Screens/Main/Home/home.dart @@ -74,127 +74,125 @@ class _HomeScreenState extends State { print("onRefresh"); await homieAppContext.clientAPI.roomApi!.roomGetAllWithMainDetails(homieAppContext.homeId!); }, - child: Container( - height: size.height * 0.8, - child: SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - GridView.builder( - shrinkWrap: true, - gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 1), - itemCount: roomsMaindetails.length, - itemBuilder: (BuildContext context, int index) { - return InkWell( - onTap: () { - debugPrint(roomsMaindetails[index].toString()); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => RoomDetailPage( - roomMainDetailDTO: roomsMaindetails[index] - ) - ), - ); - /*setState(() { - //selectedSection = menuDTO.sections[index]; - print("Hero to room detail"); - });*/ - }, - child: Container( - decoration: boxDecorationRoom(roomsMaindetails[index], false), - padding: const EdgeInsets.all(5), - margin: EdgeInsets.symmetric(vertical: 8, horizontal: 8), - child: Stack( + child: SingleChildScrollView( + child: Container( + height: size.height * 0.88, + child: GridView.builder( + shrinkWrap: true, + gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 1), + itemCount: roomsMaindetails.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () { + debugPrint(roomsMaindetails[index].toString()); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => RoomDetailPage( + roomMainDetailDTO: roomsMaindetails[index] + ) + ), + ); + /*setState(() { + //selectedSection = menuDTO.sections[index]; + print("Hero to room detail"); + });*/ + }, + child: Container( + decoration: boxDecorationRoom(roomsMaindetails[index], false), + padding: const EdgeInsets.all(5), + margin: EdgeInsets.symmetric(vertical: 8, horizontal: 8), + child: Stack( + children: [ + Column( children: [ - Column( - children: [ - Align( - alignment: Alignment.bottomLeft, - child: Text( - roomsMaindetails[index].name!, - style: new TextStyle(fontSize: kDetailSize, color: kBackgroundSecondGrey), - ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Align( + alignment: Alignment.bottomLeft, + child: Text( + roomsMaindetails[index].name!, + style: new TextStyle(fontSize: kDetailSize, color: kBackgroundSecondGrey), ), - ], + ), ), + ], + ), - if(roomsMaindetails[index].isTemperature!) - Positioned( - bottom: 10, - left: 0, - child: Row( - children: [ - Icon( - Icons.thermostat, - size: 20, - color: kMainColor, - ), - Text( - roomsMaindetails[index].temperature!, - style: new TextStyle(fontSize: kDescriptionDetailSize, color: kBackgroundSecondGrey), - maxLines: 1, - ), - ], - ) - ), - - if(roomsMaindetails[index].isHumidity!) - Positioned( - bottom: 10, - left: roomsMaindetails[index].isTemperature! ? 60 : 0, - child: Row( - children: [ - Icon( - Icons.water, - size: 20, - color: kMainColor, - ), - Text( - roomsMaindetails[index].humidity!, + if(roomsMaindetails[index].isTemperature!) + Positioned( + bottom: 10, + left: 0, + child: Row( + children: [ + Icon( + Icons.thermostat, + size: 20, + color: kMainColor, + ), + Text( + roomsMaindetails[index].temperature!, style: new TextStyle(fontSize: kDescriptionDetailSize, color: kBackgroundSecondGrey), maxLines: 1, ), - ], - ) - ), + ], + ) + ), - if(roomsMaindetails[index].isDoor!) - Positioned( - bottom: 10, - right: 5, - child: Row( - children: [ - Icon( - Icons.motion_photos_on_rounded, - size: 20, - color: !roomsMaindetails[index].door! ? kMainColor : kBackgroundSecondGrey, - ), - ], - ) - ), + if(roomsMaindetails[index].isHumidity!) + Positioned( + bottom: 10, + left: roomsMaindetails[index].isTemperature! ? 60 : 0, + child: Row( + children: [ + Icon( + Icons.water, + size: 20, + color: kMainColor, + ), + Text( + roomsMaindetails[index].humidity!, + style: new TextStyle(fontSize: kDescriptionDetailSize, color: kBackgroundSecondGrey), + maxLines: 1, + ), + ], + ) + ), - if(roomsMaindetails[index].isMotion!) - Positioned( - bottom: 10, - right: roomsMaindetails[index].isDoor! ? 20 : 5, - child: Row( - children: [ - Icon( - Icons.directions_walk, - size: 20, - color: roomsMaindetails[index].motion! ? kMainColor : kBackgroundSecondGrey, - ), - ], - ) - ), - ], - ), - ), - ); - } - ), - ], + if(roomsMaindetails[index].isDoor!) + Positioned( + bottom: 10, + right: 5, + child: Row( + children: [ + Icon( + Icons.motion_photos_on_rounded, + size: 20, + color: !roomsMaindetails[index].door! ? kMainColor : kBackgroundSecondGrey, + ), + ], + ) + ), + + if(roomsMaindetails[index].isMotion!) + Positioned( + bottom: 10, + right: roomsMaindetails[index].isDoor! ? 20 : 5, + child: Row( + children: [ + Icon( + Icons.directions_walk, + size: 20, + color: roomsMaindetails[index].motion! ? kMainColor : kBackgroundSecondGrey, + ), + ], + ) + ), + ], + ), + ), + ); + } ), ), ), diff --git a/lib/Screens/Main/Home/roomDetailPage.dart b/lib/Screens/Main/Home/roomDetailPage.dart index aa9ac89..02dd9b6 100644 --- a/lib/Screens/Main/Home/roomDetailPage.dart +++ b/lib/Screens/Main/Home/roomDetailPage.dart @@ -11,22 +11,25 @@ import 'package:myhomie_app/Components/check_input_container.dart'; import 'package:myhomie_app/Components/loading_common.dart'; import 'package:myhomie_app/Components/string_input_container.dart'; import 'package:myhomie_app/Models/homieContext.dart'; +import 'package:myhomie_app/Screens/Main/Devices/deviceDetailPage.dart'; import 'package:myhomie_app/app_context.dart'; import 'package:myhomie_app/constants.dart'; import 'package:provider/provider.dart'; +import '../Devices/devices.dart'; + class RoomDetailPage extends StatefulWidget { const RoomDetailPage({Key? key, required this.roomMainDetailDTO}) : super(key: key); final API.RoomMainDetailDTO roomMainDetailDTO; @override - State createState() => _RoomDetailPagePageState(); + State createState() => _RoomDetailPageState(); } -class _RoomDetailPagePageState extends State { +class _RoomDetailPageState extends State { final GlobalKey _scaffoldKey = GlobalKey(); - API.RoomDetailDTO? roomDetailDTO; + late API.RoomDetailDTO roomDetailDTO; @override void initState() { @@ -59,74 +62,101 @@ class _RoomDetailPagePageState extends State { future: homieAppContext.clientAPI.roomApi!.roomGetDetail(widget.roomMainDetailDTO.id!), builder: (context, AsyncSnapshot snapshot) { if(snapshot.data != null ) { - roomDetailDTO = snapshot.data; + roomDetailDTO = snapshot.data!; return SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: size.width *1.1, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: StringInputContainer( - label: "Nom:", - color: kMainColor, - textColor: Colors.white, - initialValue: roomDetailDTO!.name, - onChanged: (String value) { - setState(() { - roomDetailDTO!.name = value; - // TODO SAVE or not - }); - }, - ), - ), - ), - /*Padding( - padding: const EdgeInsets.all(8.0), - child: CheckInputContainer( - icon: Icons.notifications_active, - label: "Notification :", - fontSize: 20, - isChecked: alarmModeDetailDTO!.notification!, - onChanged: (bool value) { - alarmModeDetailDTO!.notification = value; - }, - ), - ),*/ - ExpansionTile( - title: Text( - "Devices", - style: TextStyle( - fontSize: 18.0, - fontWeight: FontWeight.bold - ), - ), - children: [ - for(var device in roomDetailDTO!.devices!) - ExpansionTile( - title: Text(device.name!), - children: [ - ListTile( - title: Text("type: "+ (device.type != null ? device.type!.value : 'no type') ), + child: RefreshIndicator( + color: Theme.of(context).primaryColor, + displacement: 20, + onRefresh: () async { + print("onRefresh"); + //await homieAppContext.clientAPI.roomApi!.roomGetDetail(widget.roomMainDetailDTO.id!); + // for refresh + setState(() {}); + }, + child: Container( + height: size.height * 1, + child: GridView.builder( + shrinkWrap: true, + gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1), + itemCount: roomDetailDTO.devices!.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + onLongPress: () { + debugPrint(roomDetailDTO.devices![index].toString()); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => DeviceDetailPage( + deviceDetailDTO: roomDetailDTO.devices![index] + ) ), - ListTile( - title: Text("status: "+ device.status.toString()), - ), - ListTile( - title: Text("last update date: "+ device.lastStateDate!.toLocal().toString()), - ), - ListTile( - title: Text("lastState: "+ (device.lastState != null ? device.lastState! : 'no data')), - ) - ], + ); + /*setState(() { + //selectedSection = menuDTO.sections[index]; + print("Hero to room detail"); + });*/ + }, + onTap: () { + //if(roomDetailDTO.devices![index].meansOfCommunications!.contains(API.MeansOfCommunication.zigbee)) { + switch(roomDetailDTO.devices![index].type) { + case DeviceType.light: + case DeviceType.plug: + debugPrint("Quick action supported !"); + List? statesToSend = []; + statesToSend.add(AutomationState(name: "state", value: "toggle")); + API.Action action = API.Action( + deviceId: roomDetailDTO.devices![index].id, + groupId: null, + type: ActionType.DEVICE, + providerId: roomDetailDTO.devices![index].providerId, + states: statesToSend, + isForce: true + ); + + print(action); + homieAppContext.clientAPI.deviceApi!.deviceSendAction(action); + break; + default: + debugPrint("Quick action not supported for this type of device"); + break; + } + //} + }, + child: Container( + decoration: boxDecorationDeviceDetail(roomDetailDTO.devices![index], false), + padding: const EdgeInsets.all(5), + margin: EdgeInsets.symmetric(vertical: 8, horizontal: 8), + child: Stack( + children: [ + Center( + child: Text( + roomDetailDTO.devices![index].name!, + style: new TextStyle(fontSize: kDescriptionDetailSize, color: kBackgroundSecondGrey), + textAlign: TextAlign.center, + ), + ), + + if(roomDetailDTO.devices![index].type != null) + Positioned( + top: 5, + child: Row( + children: [ + Icon( + getDeviceIcon(roomDetailDTO.devices![index].type!), + size: 20, + //color: devices[index].status! ? kMainColor : kBackgroundSecondGrey, + ), + ], + ) + ), + ], + ), ), - ], + ); + } ), - ], + ), ), ); } else { @@ -137,3 +167,86 @@ class _RoomDetailPagePageState extends State { ); } } + +boxDecorationDeviceDetail(DeviceDetailDTO deviceDetailDTO, bool isSelected) { + return BoxDecoration( + color: kBackgroundLight, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(20.0), + /*image: roomMainDetailDTO.imageSource != null ? new DecorationImage( + fit: BoxFit.contain, + colorFilter: !isSelected? new ColorFilter.mode(Colors.black.withOpacity(0.5), BlendMode.dstATop) : null, + image: new NetworkImage( + section.imageSource, + ), + ): null,*/ + boxShadow: [ + BoxShadow( + color: kBackgroundSecondGrey, + spreadRadius: 0.5, + blurRadius: 6, + offset: Offset(0, 1.5), // changes position of shadow + ), + ], + ); +} + +/*SizedBox( + width: size.width *1.1, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: StringInputContainer( + label: "Nom:", + color: kMainColor, + textColor: Colors.white, + initialValue: roomDetailDTO!.name, + onChanged: (String value) { + setState(() { + roomDetailDTO!.name = value; + // TODO SAVE or not + }); + }, + ), + ), + ),*/ +/*Padding( + padding: const EdgeInsets.all(8.0), + child: CheckInputContainer( + icon: Icons.notifications_active, + label: "Notification :", + fontSize: 20, + isChecked: alarmModeDetailDTO!.notification!, + onChanged: (bool value) { + alarmModeDetailDTO!.notification = value; + }, + ), + ),*/ +/*ExpansionTile( + title: Text( + "Devices", + style: TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.bold + ), + ), + children: [ + for(var device in roomDetailDTO!.devices!) + ExpansionTile( + title: Text(device.name!), + children: [ + ListTile( + title: Text("type: "+ (device.type != null ? device.type!.value : 'no type') ), + ), + ListTile( + title: Text("status: "+ device.status.toString()), + ), + ListTile( + title: Text("last update date: "+ device.lastStateDate!.toLocal().toString()), + ), + ListTile( + title: Text("lastState: "+ (device.lastState != null ? device.lastState! : 'no data')), + ) + ], + ), + ], + ),*/ \ No newline at end of file diff --git a/lib/api/swagger.yaml b/lib/api/swagger.yaml index 3c91f93..48865cf 100644 --- a/lib/api/swagger.yaml +++ b/lib/api/swagger.yaml @@ -5,7 +5,7 @@ info: description: API description version: Version Pre-Alpha servers: - - url: http://192.168.31.140 + - url: http://localhost:25049 paths: /api/books: get: @@ -3105,6 +3105,63 @@ paths: type: string security: - bearer: [] + /Notification/all: + post: + tags: + - Notification + summary: Create a fcm notification + operationId: Notification_CreateSimpleNotification + requestBody: + x-name: notificationDTO + description: notificationDTO + content: + application/json: + schema: + $ref: '#/components/schemas/NotificationDTO' + required: true + x-position: 1 + responses: + '200': + description: bool result + content: + application/json: + schema: + type: boolean + security: + - bearer: [] + /Notification/home/{homeId}: + post: + tags: + - Notification + summary: Create a fcm notification for a specific home + operationId: Notification_CreateSimpleNotificationForSpecificUser + parameters: + - name: homeId + in: path + required: true + description: homeId + schema: + type: string + nullable: true + x-position: 1 + requestBody: + x-name: notificationDTO + description: notificationDTO + content: + application/json: + schema: + $ref: '#/components/schemas/NotificationDTO' + required: true + x-position: 2 + responses: + '200': + description: bool result + content: + application/json: + schema: + type: boolean + security: + - bearer: [] /api/room/{homeId}: get: tags: @@ -3631,6 +3688,9 @@ components: lastStateDate: type: string format: date-time + lastMessageDate: + type: string + format: date-time battery: type: boolean batteryStatus: @@ -3708,6 +3768,9 @@ components: updatedDate: type: string format: date-time + lastMessage: + type: string + nullable: true lastState: type: string nullable: true @@ -3733,6 +3796,116 @@ components: nullable: true items: type: string + isContact: + type: boolean + contact: + type: boolean + isIlluminance: + type: boolean + illuminance: + type: integer + format: int32 + nullable: true + isBrightness: + type: boolean + brightness: + type: integer + format: int32 + isState: + type: boolean + state: + type: boolean + isColorTemp: + type: boolean + colorTemp: + type: integer + format: int32 + isColorXY: + type: boolean + colorX: + type: integer + format: int32 + colorY: + type: integer + format: int32 + isOccupation: + type: boolean + occupation: + type: boolean + isAlarm: + type: boolean + alarm: + type: boolean + isWaterLeak: + type: boolean + waterLeak: + type: boolean + isSmoke: + type: boolean + smoke: + type: boolean + isVibration: + type: boolean + vibration: + type: boolean + isAction: + type: boolean + action: + type: string + nullable: true + isTemperature: + type: boolean + temperature: + type: number + format: decimal + nullable: true + isHumidity: + type: boolean + humidity: + type: number + format: decimal + nullable: true + isPressure: + type: boolean + pressure: + type: number + format: decimal + nullable: true + isAirQuality: + type: boolean + airQuality: + type: string + nullable: true + isFanSpeed: + type: boolean + fanSpeed: + type: integer + format: int32 + isFanMode: + type: boolean + fanMode: + type: string + nullable: true + isConsumption: + type: boolean + consumption: + type: number + format: decimal + isCurrentPower: + type: boolean + currentPower: + type: number + format: decimal + isVoltage: + type: boolean + voltage: + type: number + format: decimal + isLinkQuality: + type: boolean + linkQuality: + type: integer + format: int32 MeansOfCommunication: type: string description: '' @@ -4757,6 +4930,35 @@ components: nullable: true items: type: string + NotificationDTO: + type: object + additionalProperties: false + properties: + notificationTitle: + type: string + nullable: true + notificationMessage: + type: string + nullable: true + notificationLabelButton: + type: string + nullable: true + title: + type: string + nullable: true + body: + type: string + nullable: true + type: + type: string + nullable: true + isPushNotification: + type: boolean + isButton: + type: boolean + buttonLabel: + type: string + nullable: true RoomSummaryDTO: type: object additionalProperties: false @@ -4792,6 +4994,11 @@ components: humidity: type: string nullable: true + isPressure: + type: boolean + pressure: + type: string + nullable: true isMotion: type: boolean motion: @@ -4802,6 +5009,11 @@ components: door: type: boolean nullable: true + isIlluminance: + type: boolean + illuminance: + type: string + nullable: true environmentalDevices: type: array nullable: true diff --git a/mycore_api/.openapi-generator/FILES b/mycore_api/.openapi-generator/FILES index 45fadff..b2d973c 100644 --- a/mycore_api/.openapi-generator/FILES +++ b/mycore_api/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore .travis.yml README.md analysis_options.yaml @@ -12,8 +11,8 @@ doc/AlarmModeCreateOrUpdateDetailDTOAllOf.md doc/AlarmModeDTO.md doc/AlarmModeDetailDTO.md doc/AlarmModeDetailDTOAllOf.md -doc/AlarmModeGeolocalizedMode.md -doc/AlarmModeProgrammedMode.md +doc/AlarmModeDetailDTOAllOfGeolocalizedMode.md +doc/AlarmModeDetailDTOAllOfProgrammedMode.md doc/AlarmTriggered.md doc/AlarmType.md doc/AuthenticationApi.md @@ -46,6 +45,9 @@ doc/EventApi.md doc/EventDTO.md doc/EventDetailDTO.md doc/EventDetailDTOAllOf.md +doc/EventDetailDTOAllOfAlarmTriggered.md +doc/EventDetailDTOAllOfAutomationTriggered.md +doc/EventDetailDTOAllOfDeviceState.md doc/EventFilter.md doc/EventGetDeviceTypeParameter.md doc/EventGetEventTypeParameter.md @@ -76,6 +78,8 @@ doc/LoginDTO.md doc/MQTTApi.md doc/MeansOfCommunication.md doc/MqttMessageDTO.md +doc/NotificationApi.md +doc/NotificationDTO.md doc/OddApi.md doc/OddNice.md doc/OddNiceOdds.md @@ -127,6 +131,7 @@ lib/api/home_api.dart lib/api/iot_api.dart lib/api/layout_api.dart lib/api/mqtt_api.dart +lib/api/notification_api.dart lib/api/odd_api.dart lib/api/provider_api.dart lib/api/room_api.dart @@ -150,9 +155,9 @@ lib/model/alarm_mode_create_or_update_detail_dto.dart lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart lib/model/alarm_mode_detail_dto.dart lib/model/alarm_mode_detail_dto_all_of.dart +lib/model/alarm_mode_detail_dto_all_of_geolocalized_mode.dart +lib/model/alarm_mode_detail_dto_all_of_programmed_mode.dart lib/model/alarm_mode_dto.dart -lib/model/alarm_mode_geolocalized_mode.dart -lib/model/alarm_mode_programmed_mode.dart lib/model/alarm_triggered.dart lib/model/alarm_type.dart lib/model/automation_detail_dto.dart @@ -177,6 +182,9 @@ lib/model/device_type.dart lib/model/electricity_production.dart lib/model/event_detail_dto.dart lib/model/event_detail_dto_all_of.dart +lib/model/event_detail_dto_all_of_alarm_triggered.dart +lib/model/event_detail_dto_all_of_automation_triggered.dart +lib/model/event_detail_dto_all_of_device_state.dart lib/model/event_dto.dart lib/model/event_filter.dart lib/model/event_get_device_type_parameter.dart @@ -201,6 +209,7 @@ lib/model/list_response_of_event_detail_dto_and_event_home_filter_request_parame lib/model/login_dto.dart lib/model/means_of_communication.dart lib/model/mqtt_message_dto.dart +lib/model/notification_dto.dart lib/model/odd_nice.dart lib/model/odd_nice_odds.dart lib/model/odd_object.dart @@ -228,110 +237,10 @@ lib/model/user_info.dart lib/model/user_info_detail_dto.dart lib/model/view_by.dart pubspec.yaml -test/action_test.dart -test/action_type_test.dart -test/alarm_api_test.dart -test/alarm_mode_create_or_update_detail_dto_all_of_test.dart -test/alarm_mode_create_or_update_detail_dto_test.dart -test/alarm_mode_detail_dto_all_of_test.dart -test/alarm_mode_detail_dto_test.dart -test/alarm_mode_dto_test.dart -test/alarm_mode_geolocalized_mode_test.dart -test/alarm_mode_programmed_mode_test.dart -test/alarm_mode_test.dart -test/alarm_triggered_test.dart -test/alarm_type_test.dart -test/authentication_api_test.dart -test/automation_api_test.dart -test/automation_detail_dto_all_of_test.dart -test/automation_detail_dto_test.dart -test/automation_dto_test.dart -test/automation_state_test.dart -test/automation_triggered_test.dart -test/azure_ad_auth_model_test.dart -test/azure_api_test.dart -test/book_test.dart -test/books_api_test.dart -test/condition_state_test.dart -test/condition_test.dart -test/condition_type_test.dart -test/condition_value_test.dart -test/connection_status_test.dart -test/create_or_update_home_dto_all_of_test.dart -test/create_or_update_home_dto_test.dart -test/device_api_test.dart -test/device_detail_dto_all_of_test.dart -test/device_detail_dto_test.dart -test/device_state_test.dart -test/device_summary_dto_test.dart -test/device_type_test.dart -test/electricity_production_test.dart -test/energy_api_test.dart -test/event_api_test.dart -test/event_detail_dto_all_of_test.dart -test/event_detail_dto_test.dart -test/event_dto_test.dart -test/event_filter_test.dart -test/event_get_device_type_parameter_test.dart -test/event_get_event_type_parameter_test.dart -test/event_home_filter_all_of_test.dart -test/event_home_filter_test.dart -test/event_type_test.dart -test/facebook_api_test.dart -test/facebook_auth_model_test.dart -test/geolocalized_mode_test.dart -test/google_api_test.dart -test/google_auth_model_test.dart -test/group_api_test.dart -test/group_create_or_update_detail_dto_all_of_test.dart -test/group_create_or_update_detail_dto_test.dart -test/group_detail_dto_all_of_test.dart -test/group_detail_dto_test.dart -test/group_summary_dto_test.dart -test/home_api_test.dart -test/home_detail_dto_all_of_test.dart -test/home_detail_dto_test.dart -test/home_dto_current_alarm_mode_test.dart -test/home_dto_test.dart -test/iot_api_test.dart -test/layout_api_test.dart -test/list_response_of_event_detail_dto_and_event_home_filter_request_parameters_test.dart -test/list_response_of_event_detail_dto_and_event_home_filter_test.dart -test/login_dto_test.dart -test/means_of_communication_test.dart -test/mqtt_api_test.dart -test/mqtt_message_dto_test.dart -test/odd_api_test.dart -test/odd_nice_odds_test.dart -test/odd_nice_test.dart -test/odd_object_test.dart -test/panel_menu_item_test.dart -test/panel_section_test.dart -test/programmed_mode_test.dart -test/provider_api_test.dart -test/provider_dto_test.dart -test/provider_type_test.dart -test/room_api_test.dart -test/room_create_or_update_detail_dto_test.dart -test/room_detail_dto_test.dart -test/room_main_detail_dto_all_of_test.dart -test/room_main_detail_dto_test.dart -test/room_summary_dto_test.dart -test/screen_device_api_test.dart -test/screen_device_test.dart -test/smart_garden_message_test.dart -test/smart_printer_message_test.dart -test/time_period_alarm_alarm_mode_test.dart -test/time_period_alarm_test.dart -test/token_api_test.dart -test/token_dto_test.dart -test/trigger_test.dart -test/trigger_type_test.dart -test/twitter_api_test.dart -test/twitter_auth_model_test.dart -test/user_api_test.dart -test/user_info_detail_dto_test.dart -test/user_info_test.dart -test/user_test.dart -test/values_api_test.dart -test/view_by_test.dart +test/alarm_mode_detail_dto_all_of_geolocalized_mode_test.dart +test/alarm_mode_detail_dto_all_of_programmed_mode_test.dart +test/event_detail_dto_all_of_alarm_triggered_test.dart +test/event_detail_dto_all_of_automation_triggered_test.dart +test/event_detail_dto_all_of_device_state_test.dart +test/notification_api_test.dart +test/notification_dto_test.dart diff --git a/mycore_api/README.md b/mycore_api/README.md index 8755b36..d57167c 100644 --- a/mycore_api/README.md +++ b/mycore_api/README.md @@ -56,7 +56,7 @@ try { ## Documentation for API Endpoints -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- @@ -121,6 +121,8 @@ Class | Method | HTTP request | Description *IOTApi* | [**iOTPostToDBSmartGarden**](doc\/IOTApi.md#iotposttodbsmartgarden) | **POST** /api/iot/smartgarden/{idDevice} | It's the method to post data from mqtt broker to Database (Thanks Rpi!) *LayoutApi* | [**layoutGet**](doc\/LayoutApi.md#layoutget) | **GET** /api/layout/panelSection | It's a test ! :) *MQTTApi* | [**mQTTPublishMessage**](doc\/MQTTApi.md#mqttpublishmessage) | **POST** /api/mqtt | Publish mqtt test +*NotificationApi* | [**notificationCreateSimpleNotification**](doc\/NotificationApi.md#notificationcreatesimplenotification) | **POST** /Notification/all | Create a fcm notification +*NotificationApi* | [**notificationCreateSimpleNotificationForSpecificUser**](doc\/NotificationApi.md#notificationcreatesimplenotificationforspecificuser) | **POST** /Notification/home/{homeId} | Create a fcm notification for a specific home *OddApi* | [**oddGetAll**](doc\/OddApi.md#oddgetall) | **GET** /api/odd/{oddRequest} | Get odds for one country and one odd value maximum *OddApi* | [**oddGetForCountry**](doc\/OddApi.md#oddgetforcountry) | **GET** /api/odd/country/{id}/{oddRequest} | Get odds for one country and one odd value maximum *ProviderApi* | [**providerCreate**](doc\/ProviderApi.md#providercreate) | **POST** /api/provider | Create a provider @@ -167,8 +169,8 @@ Class | Method | HTTP request | Description - [AlarmModeDTO](doc\/AlarmModeDTO.md) - [AlarmModeDetailDTO](doc\/AlarmModeDetailDTO.md) - [AlarmModeDetailDTOAllOf](doc\/AlarmModeDetailDTOAllOf.md) - - [AlarmModeGeolocalizedMode](doc\/AlarmModeGeolocalizedMode.md) - - [AlarmModeProgrammedMode](doc\/AlarmModeProgrammedMode.md) + - [AlarmModeDetailDTOAllOfGeolocalizedMode](doc\/AlarmModeDetailDTOAllOfGeolocalizedMode.md) + - [AlarmModeDetailDTOAllOfProgrammedMode](doc\/AlarmModeDetailDTOAllOfProgrammedMode.md) - [AlarmTriggered](doc\/AlarmTriggered.md) - [AlarmType](doc\/AlarmType.md) - [AutomationDTO](doc\/AutomationDTO.md) @@ -194,6 +196,9 @@ Class | Method | HTTP request | Description - [EventDTO](doc\/EventDTO.md) - [EventDetailDTO](doc\/EventDetailDTO.md) - [EventDetailDTOAllOf](doc\/EventDetailDTOAllOf.md) + - [EventDetailDTOAllOfAlarmTriggered](doc\/EventDetailDTOAllOfAlarmTriggered.md) + - [EventDetailDTOAllOfAutomationTriggered](doc\/EventDetailDTOAllOfAutomationTriggered.md) + - [EventDetailDTOAllOfDeviceState](doc\/EventDetailDTOAllOfDeviceState.md) - [EventFilter](doc\/EventFilter.md) - [EventGetDeviceTypeParameter](doc\/EventGetDeviceTypeParameter.md) - [EventGetEventTypeParameter](doc\/EventGetEventTypeParameter.md) @@ -217,6 +222,7 @@ Class | Method | HTTP request | Description - [LoginDTO](doc\/LoginDTO.md) - [MeansOfCommunication](doc\/MeansOfCommunication.md) - [MqttMessageDTO](doc\/MqttMessageDTO.md) + - [NotificationDTO](doc\/NotificationDTO.md) - [OddNice](doc\/OddNice.md) - [OddNiceOdds](doc\/OddNiceOdds.md) - [OddObject](doc\/OddObject.md) @@ -248,7 +254,8 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## bearer +Authentication schemes defined for the API: +### bearer - **Type**: OAuth - **Flow**: password diff --git a/mycore_api/doc/AlarmApi.md b/mycore_api/doc/AlarmApi.md index 7c3b5f0..ea70350 100644 --- a/mycore_api/doc/AlarmApi.md +++ b/mycore_api/doc/AlarmApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/AlarmMode.md b/mycore_api/doc/AlarmMode.md index b2d600f..5671a7b 100644 --- a/mycore_api/doc/AlarmMode.md +++ b/mycore_api/doc/AlarmMode.md @@ -17,8 +17,8 @@ Name | Type | Description | Notes **createdDate** | [**DateTime**](DateTime.md) | | [optional] **updatedDate** | [**DateTime**](DateTime.md) | | [optional] **type** | [**AlarmType**](AlarmType.md) | | [optional] -**programmedMode** | [**AlarmModeProgrammedMode**](AlarmModeProgrammedMode.md) | | [optional] -**geolocalizedMode** | [**AlarmModeGeolocalizedMode**](AlarmModeGeolocalizedMode.md) | | [optional] +**programmedMode** | [**AlarmModeDetailDTOAllOfProgrammedMode**](AlarmModeDetailDTOAllOfProgrammedMode.md) | | [optional] +**geolocalizedMode** | [**AlarmModeDetailDTOAllOfGeolocalizedMode**](AlarmModeDetailDTOAllOfGeolocalizedMode.md) | | [optional] **triggers** | [**List**](Trigger.md) | | [optional] [default to const []] **actions** | [**List**](Action.md) | | [optional] [default to const []] **devicesIds** | **List** | | [optional] [default to const []] diff --git a/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTO.md b/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTO.md index 2ec5e09..30752ff 100644 --- a/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTO.md +++ b/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTO.md @@ -19,8 +19,8 @@ Name | Type | Description | Notes **updatedDate** | [**DateTime**](DateTime.md) | | [optional] **triggers** | [**List**](Trigger.md) | | [optional] [default to const []] **actions** | [**List**](Action.md) | | [optional] [default to const []] -**programmedMode** | [**OneOfProgrammedMode**](OneOfProgrammedMode.md) | | [optional] -**geolocalizedMode** | [**OneOfGeolocalizedMode**](OneOfGeolocalizedMode.md) | | [optional] +**programmedMode** | [**AlarmModeDetailDTOAllOfProgrammedMode**](AlarmModeDetailDTOAllOfProgrammedMode.md) | | [optional] +**geolocalizedMode** | [**AlarmModeDetailDTOAllOfGeolocalizedMode**](AlarmModeDetailDTOAllOfGeolocalizedMode.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) diff --git a/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTOAllOf.md b/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTOAllOf.md index c836cb1..54b765b 100644 --- a/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTOAllOf.md +++ b/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTOAllOf.md @@ -10,8 +10,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **triggers** | [**List**](Trigger.md) | | [optional] [default to const []] **actions** | [**List**](Action.md) | | [optional] [default to const []] -**programmedMode** | [**OneOfProgrammedMode**](OneOfProgrammedMode.md) | | [optional] -**geolocalizedMode** | [**OneOfGeolocalizedMode**](OneOfGeolocalizedMode.md) | | [optional] +**programmedMode** | [**AlarmModeDetailDTOAllOfProgrammedMode**](AlarmModeDetailDTOAllOfProgrammedMode.md) | | [optional] +**geolocalizedMode** | [**AlarmModeDetailDTOAllOfGeolocalizedMode**](AlarmModeDetailDTOAllOfGeolocalizedMode.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) diff --git a/mycore_api/doc/AlarmModeDetailDTO.md b/mycore_api/doc/AlarmModeDetailDTO.md index 9527dfd..5c3f4d3 100644 --- a/mycore_api/doc/AlarmModeDetailDTO.md +++ b/mycore_api/doc/AlarmModeDetailDTO.md @@ -20,8 +20,8 @@ Name | Type | Description | Notes **triggers** | [**List**](Trigger.md) | | [optional] [default to const []] **actions** | [**List**](Action.md) | | [optional] [default to const []] **devices** | [**List**](DeviceDetailDTO.md) | | [optional] [default to const []] -**programmedMode** | [**OneOfProgrammedMode**](OneOfProgrammedMode.md) | | [optional] -**geolocalizedMode** | [**OneOfGeolocalizedMode**](OneOfGeolocalizedMode.md) | | [optional] +**programmedMode** | [**AlarmModeDetailDTOAllOfProgrammedMode**](AlarmModeDetailDTOAllOfProgrammedMode.md) | | [optional] +**geolocalizedMode** | [**AlarmModeDetailDTOAllOfGeolocalizedMode**](AlarmModeDetailDTOAllOfGeolocalizedMode.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) diff --git a/mycore_api/doc/AlarmModeDetailDTOAllOf.md b/mycore_api/doc/AlarmModeDetailDTOAllOf.md index 019a8ba..8ab48b3 100644 --- a/mycore_api/doc/AlarmModeDetailDTOAllOf.md +++ b/mycore_api/doc/AlarmModeDetailDTOAllOf.md @@ -11,8 +11,8 @@ Name | Type | Description | Notes **triggers** | [**List**](Trigger.md) | | [optional] [default to const []] **actions** | [**List**](Action.md) | | [optional] [default to const []] **devices** | [**List**](DeviceDetailDTO.md) | | [optional] [default to const []] -**programmedMode** | [**OneOfProgrammedMode**](OneOfProgrammedMode.md) | | [optional] -**geolocalizedMode** | [**OneOfGeolocalizedMode**](OneOfGeolocalizedMode.md) | | [optional] +**programmedMode** | [**AlarmModeDetailDTOAllOfProgrammedMode**](AlarmModeDetailDTOAllOfProgrammedMode.md) | | [optional] +**geolocalizedMode** | [**AlarmModeDetailDTOAllOfGeolocalizedMode**](AlarmModeDetailDTOAllOfGeolocalizedMode.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) diff --git a/mycore_api/doc/AlarmModeDetailDTOAllOfGeolocalizedMode.md b/mycore_api/doc/AlarmModeDetailDTOAllOfGeolocalizedMode.md new file mode 100644 index 0000000..c1b1776 --- /dev/null +++ b/mycore_api/doc/AlarmModeDetailDTOAllOfGeolocalizedMode.md @@ -0,0 +1,18 @@ +# mycore_api.model.AlarmModeDetailDTOAllOfGeolocalizedMode + +## Load the model package +```dart +import 'package:mycore_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**latitude** | **String** | | [optional] +**longitude** | **String** | | [optional] +**homeMode** | [**TimePeriodAlarmAlarmMode**](TimePeriodAlarmAlarmMode.md) | | [optional] +**absentMode** | [**TimePeriodAlarmAlarmMode**](TimePeriodAlarmAlarmMode.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) + + diff --git a/mycore_api/doc/AlarmModeDetailDTOAllOfProgrammedMode.md b/mycore_api/doc/AlarmModeDetailDTOAllOfProgrammedMode.md new file mode 100644 index 0000000..d72b962 --- /dev/null +++ b/mycore_api/doc/AlarmModeDetailDTOAllOfProgrammedMode.md @@ -0,0 +1,21 @@ +# mycore_api.model.AlarmModeDetailDTOAllOfProgrammedMode + +## Load the model package +```dart +import 'package:mycore_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**monday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] +**tuesday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] +**wednesday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] +**thursday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] +**friday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] +**saturday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] +**sunday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/AuthenticationApi.md b/mycore_api/doc/AuthenticationApi.md index 27589a5..d713be5 100644 --- a/mycore_api/doc/AuthenticationApi.md +++ b/mycore_api/doc/AuthenticationApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/AutomationApi.md b/mycore_api/doc/AutomationApi.md index 034e2b6..ca18ed2 100644 --- a/mycore_api/doc/AutomationApi.md +++ b/mycore_api/doc/AutomationApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/AzureApi.md b/mycore_api/doc/AzureApi.md index 70bf32a..46985fc 100644 --- a/mycore_api/doc/AzureApi.md +++ b/mycore_api/doc/AzureApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/BooksApi.md b/mycore_api/doc/BooksApi.md index 00d2d06..4ee5b60 100644 --- a/mycore_api/doc/BooksApi.md +++ b/mycore_api/doc/BooksApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/DeviceApi.md b/mycore_api/doc/DeviceApi.md index b6e383c..b225513 100644 --- a/mycore_api/doc/DeviceApi.md +++ b/mycore_api/doc/DeviceApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/DeviceDetailDTO.md b/mycore_api/doc/DeviceDetailDTO.md index e8c4faa..937c269 100644 --- a/mycore_api/doc/DeviceDetailDTO.md +++ b/mycore_api/doc/DeviceDetailDTO.md @@ -20,6 +20,7 @@ Name | Type | Description | Notes **providerId** | **String** | | [optional] **providerName** | **String** | | [optional] **lastStateDate** | [**DateTime**](DateTime.md) | | [optional] +**lastMessageDate** | [**DateTime**](DateTime.md) | | [optional] **battery** | **bool** | | [optional] **batteryStatus** | **int** | | [optional] **firmwareVersion** | **String** | | [optional] @@ -28,6 +29,7 @@ Name | Type | Description | Notes **meansOfCommunications** | [**List**](MeansOfCommunication.md) | | [optional] [default to const []] **createdDate** | [**DateTime**](DateTime.md) | | [optional] **updatedDate** | [**DateTime**](DateTime.md) | | [optional] +**lastMessage** | **String** | | [optional] **lastState** | **String** | | [optional] **ipAddress** | **String** | | [optional] **serviceIdentification** | **String** | | [optional] @@ -35,6 +37,51 @@ Name | Type | Description | Notes **groupIds** | **List** | | [optional] [default to const []] **properties** | **String** | | [optional] **supportedOperations** | **List** | | [optional] [default to const []] +**isContact** | **bool** | | [optional] +**contact** | **bool** | | [optional] +**isIlluminance** | **bool** | | [optional] +**illuminance** | **int** | | [optional] +**isBrightness** | **bool** | | [optional] +**brightness** | **int** | | [optional] +**isState** | **bool** | | [optional] +**state** | **bool** | | [optional] +**isColorTemp** | **bool** | | [optional] +**colorTemp** | **int** | | [optional] +**isColorXY** | **bool** | | [optional] +**colorX** | **int** | | [optional] +**colorY** | **int** | | [optional] +**isOccupation** | **bool** | | [optional] +**occupation** | **bool** | | [optional] +**isAlarm** | **bool** | | [optional] +**alarm** | **bool** | | [optional] +**isWaterLeak** | **bool** | | [optional] +**waterLeak** | **bool** | | [optional] +**isSmoke** | **bool** | | [optional] +**smoke** | **bool** | | [optional] +**isVibration** | **bool** | | [optional] +**vibration** | **bool** | | [optional] +**isAction** | **bool** | | [optional] +**action** | **String** | | [optional] +**isTemperature** | **bool** | | [optional] +**temperature** | **num** | | [optional] +**isHumidity** | **bool** | | [optional] +**humidity** | **num** | | [optional] +**isPressure** | **bool** | | [optional] +**pressure** | **num** | | [optional] +**isAirQuality** | **bool** | | [optional] +**airQuality** | **String** | | [optional] +**isFanSpeed** | **bool** | | [optional] +**fanSpeed** | **int** | | [optional] +**isFanMode** | **bool** | | [optional] +**fanMode** | **String** | | [optional] +**isConsumption** | **bool** | | [optional] +**consumption** | **num** | | [optional] +**isCurrentPower** | **bool** | | [optional] +**currentPower** | **num** | | [optional] +**isVoltage** | **bool** | | [optional] +**voltage** | **num** | | [optional] +**isLinkQuality** | **bool** | | [optional] +**linkQuality** | **int** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/mycore_api/doc/DeviceDetailDTOAllOf.md b/mycore_api/doc/DeviceDetailDTOAllOf.md index 2238d67..94b6fa1 100644 --- a/mycore_api/doc/DeviceDetailDTOAllOf.md +++ b/mycore_api/doc/DeviceDetailDTOAllOf.md @@ -14,6 +14,7 @@ Name | Type | Description | Notes **meansOfCommunications** | [**List**](MeansOfCommunication.md) | | [optional] [default to const []] **createdDate** | [**DateTime**](DateTime.md) | | [optional] **updatedDate** | [**DateTime**](DateTime.md) | | [optional] +**lastMessage** | **String** | | [optional] **lastState** | **String** | | [optional] **ipAddress** | **String** | | [optional] **serviceIdentification** | **String** | | [optional] @@ -21,6 +22,51 @@ Name | Type | Description | Notes **groupIds** | **List** | | [optional] [default to const []] **properties** | **String** | | [optional] **supportedOperations** | **List** | | [optional] [default to const []] +**isContact** | **bool** | | [optional] +**contact** | **bool** | | [optional] +**isIlluminance** | **bool** | | [optional] +**illuminance** | **int** | | [optional] +**isBrightness** | **bool** | | [optional] +**brightness** | **int** | | [optional] +**isState** | **bool** | | [optional] +**state** | **bool** | | [optional] +**isColorTemp** | **bool** | | [optional] +**colorTemp** | **int** | | [optional] +**isColorXY** | **bool** | | [optional] +**colorX** | **int** | | [optional] +**colorY** | **int** | | [optional] +**isOccupation** | **bool** | | [optional] +**occupation** | **bool** | | [optional] +**isAlarm** | **bool** | | [optional] +**alarm** | **bool** | | [optional] +**isWaterLeak** | **bool** | | [optional] +**waterLeak** | **bool** | | [optional] +**isSmoke** | **bool** | | [optional] +**smoke** | **bool** | | [optional] +**isVibration** | **bool** | | [optional] +**vibration** | **bool** | | [optional] +**isAction** | **bool** | | [optional] +**action** | **String** | | [optional] +**isTemperature** | **bool** | | [optional] +**temperature** | **num** | | [optional] +**isHumidity** | **bool** | | [optional] +**humidity** | **num** | | [optional] +**isPressure** | **bool** | | [optional] +**pressure** | **num** | | [optional] +**isAirQuality** | **bool** | | [optional] +**airQuality** | **String** | | [optional] +**isFanSpeed** | **bool** | | [optional] +**fanSpeed** | **int** | | [optional] +**isFanMode** | **bool** | | [optional] +**fanMode** | **String** | | [optional] +**isConsumption** | **bool** | | [optional] +**consumption** | **num** | | [optional] +**isCurrentPower** | **bool** | | [optional] +**currentPower** | **num** | | [optional] +**isVoltage** | **bool** | | [optional] +**voltage** | **num** | | [optional] +**isLinkQuality** | **bool** | | [optional] +**linkQuality** | **int** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/mycore_api/doc/DeviceSummaryDTO.md b/mycore_api/doc/DeviceSummaryDTO.md index 9b97603..aa5e209 100644 --- a/mycore_api/doc/DeviceSummaryDTO.md +++ b/mycore_api/doc/DeviceSummaryDTO.md @@ -20,6 +20,7 @@ Name | Type | Description | Notes **providerId** | **String** | | [optional] **providerName** | **String** | | [optional] **lastStateDate** | [**DateTime**](DateTime.md) | | [optional] +**lastMessageDate** | [**DateTime**](DateTime.md) | | [optional] **battery** | **bool** | | [optional] **batteryStatus** | **int** | | [optional] diff --git a/mycore_api/doc/EnergyApi.md b/mycore_api/doc/EnergyApi.md index 2693d4b..8f394ad 100644 --- a/mycore_api/doc/EnergyApi.md +++ b/mycore_api/doc/EnergyApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/EventApi.md b/mycore_api/doc/EventApi.md index 5c945eb..6aae683 100644 --- a/mycore_api/doc/EventApi.md +++ b/mycore_api/doc/EventApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/EventDetailDTO.md b/mycore_api/doc/EventDetailDTO.md index a11865c..a2d27f6 100644 --- a/mycore_api/doc/EventDetailDTO.md +++ b/mycore_api/doc/EventDetailDTO.md @@ -13,9 +13,9 @@ Name | Type | Description | Notes **date** | [**DateTime**](DateTime.md) | | [optional] **type** | [**EventType**](EventType.md) | | [optional] **roomId** | **String** | | [optional] -**deviceState** | [**OneOfDeviceState**](OneOfDeviceState.md) | | [optional] -**automationTriggered** | [**OneOfAutomationTriggered**](OneOfAutomationTriggered.md) | | [optional] -**alarmTriggered** | [**OneOfAlarmTriggered**](OneOfAlarmTriggered.md) | | [optional] +**deviceState** | [**EventDetailDTOAllOfDeviceState**](EventDetailDTOAllOfDeviceState.md) | | [optional] +**automationTriggered** | [**EventDetailDTOAllOfAutomationTriggered**](EventDetailDTOAllOfAutomationTriggered.md) | | [optional] +**alarmTriggered** | [**EventDetailDTOAllOfAlarmTriggered**](EventDetailDTOAllOfAlarmTriggered.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) diff --git a/mycore_api/doc/EventDetailDTOAllOf.md b/mycore_api/doc/EventDetailDTOAllOf.md index 2759bdf..5a59cfe 100644 --- a/mycore_api/doc/EventDetailDTOAllOf.md +++ b/mycore_api/doc/EventDetailDTOAllOf.md @@ -8,9 +8,9 @@ import 'package:mycore_api/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**deviceState** | [**OneOfDeviceState**](OneOfDeviceState.md) | | [optional] -**automationTriggered** | [**OneOfAutomationTriggered**](OneOfAutomationTriggered.md) | | [optional] -**alarmTriggered** | [**OneOfAlarmTriggered**](OneOfAlarmTriggered.md) | | [optional] +**deviceState** | [**EventDetailDTOAllOfDeviceState**](EventDetailDTOAllOfDeviceState.md) | | [optional] +**automationTriggered** | [**EventDetailDTOAllOfAutomationTriggered**](EventDetailDTOAllOfAutomationTriggered.md) | | [optional] +**alarmTriggered** | [**EventDetailDTOAllOfAlarmTriggered**](EventDetailDTOAllOfAlarmTriggered.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) diff --git a/mycore_api/doc/EventDetailDTOAllOfAlarmTriggered.md b/mycore_api/doc/EventDetailDTOAllOfAlarmTriggered.md new file mode 100644 index 0000000..fd05357 --- /dev/null +++ b/mycore_api/doc/EventDetailDTOAllOfAlarmTriggered.md @@ -0,0 +1,17 @@ +# mycore_api.model.EventDetailDTOAllOfAlarmTriggered + +## Load the model package +```dart +import 'package:mycore_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**alarmModeId** | **String** | | [optional] +**alarmModeName** | **String** | | [optional] +**type** | [**AlarmType**](AlarmType.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) + + diff --git a/mycore_api/doc/EventDetailDTOAllOfAutomationTriggered.md b/mycore_api/doc/EventDetailDTOAllOfAutomationTriggered.md new file mode 100644 index 0000000..b8ddb89 --- /dev/null +++ b/mycore_api/doc/EventDetailDTOAllOfAutomationTriggered.md @@ -0,0 +1,16 @@ +# mycore_api.model.EventDetailDTOAllOfAutomationTriggered + +## Load the model package +```dart +import 'package:mycore_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**automationId** | **String** | | [optional] +**automationName** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/EventDetailDTOAllOfDeviceState.md b/mycore_api/doc/EventDetailDTOAllOfDeviceState.md new file mode 100644 index 0000000..b50272d --- /dev/null +++ b/mycore_api/doc/EventDetailDTOAllOfDeviceState.md @@ -0,0 +1,18 @@ +# mycore_api.model.EventDetailDTOAllOfDeviceState + +## Load the model package +```dart +import 'package:mycore_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**deviceId** | **String** | | [optional] +**deviceName** | **String** | | [optional] +**message** | **String** | | [optional] +**deviceType** | [**DeviceType**](DeviceType.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) + + diff --git a/mycore_api/doc/FacebookApi.md b/mycore_api/doc/FacebookApi.md index 15112d1..2688f29 100644 --- a/mycore_api/doc/FacebookApi.md +++ b/mycore_api/doc/FacebookApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/GoogleApi.md b/mycore_api/doc/GoogleApi.md index 88f0584..27d3ab8 100644 --- a/mycore_api/doc/GoogleApi.md +++ b/mycore_api/doc/GoogleApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/GroupApi.md b/mycore_api/doc/GroupApi.md index 6c2c548..565afa7 100644 --- a/mycore_api/doc/GroupApi.md +++ b/mycore_api/doc/GroupApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/HomeApi.md b/mycore_api/doc/HomeApi.md index 325e677..8f3bdd8 100644 --- a/mycore_api/doc/HomeApi.md +++ b/mycore_api/doc/HomeApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/IOTApi.md b/mycore_api/doc/IOTApi.md index 1074985..1389827 100644 --- a/mycore_api/doc/IOTApi.md +++ b/mycore_api/doc/IOTApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/LayoutApi.md b/mycore_api/doc/LayoutApi.md index 7218988..7bb600f 100644 --- a/mycore_api/doc/LayoutApi.md +++ b/mycore_api/doc/LayoutApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/MQTTApi.md b/mycore_api/doc/MQTTApi.md index 1c87906..ac6e3ec 100644 --- a/mycore_api/doc/MQTTApi.md +++ b/mycore_api/doc/MQTTApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/NotificationApi.md b/mycore_api/doc/NotificationApi.md new file mode 100644 index 0000000..0e9d63e --- /dev/null +++ b/mycore_api/doc/NotificationApi.md @@ -0,0 +1,103 @@ +# mycore_api.api.NotificationApi + +## Load the API package +```dart +import 'package:mycore_api/api.dart'; +``` + +All URIs are relative to *http://localhost:25049* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**notificationCreateSimpleNotification**](NotificationApi.md#notificationcreatesimplenotification) | **POST** /Notification/all | Create a fcm notification +[**notificationCreateSimpleNotificationForSpecificUser**](NotificationApi.md#notificationcreatesimplenotificationforspecificuser) | **POST** /Notification/home/{homeId} | Create a fcm notification for a specific home + + +# **notificationCreateSimpleNotification** +> bool notificationCreateSimpleNotification(notificationDTO) + +Create a fcm notification + +### Example +```dart +import 'package:mycore_api/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = NotificationApi(); +final notificationDTO = NotificationDTO(); // NotificationDTO | notificationDTO + +try { + final result = api_instance.notificationCreateSimpleNotification(notificationDTO); + print(result); +} catch (e) { + print('Exception when calling NotificationApi->notificationCreateSimpleNotification: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **notificationDTO** | [**NotificationDTO**](NotificationDTO.md)| notificationDTO | + +### Return type + +**bool** + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **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) + +# **notificationCreateSimpleNotificationForSpecificUser** +> bool notificationCreateSimpleNotificationForSpecificUser(homeId, notificationDTO) + +Create a fcm notification for a specific home + +### Example +```dart +import 'package:mycore_api/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = NotificationApi(); +final homeId = homeId_example; // String | homeId +final notificationDTO = NotificationDTO(); // NotificationDTO | notificationDTO + +try { + final result = api_instance.notificationCreateSimpleNotificationForSpecificUser(homeId, notificationDTO); + print(result); +} catch (e) { + print('Exception when calling NotificationApi->notificationCreateSimpleNotificationForSpecificUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **homeId** | **String**| homeId | + **notificationDTO** | [**NotificationDTO**](NotificationDTO.md)| notificationDTO | + +### Return type + +**bool** + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **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) + diff --git a/mycore_api/doc/NotificationDTO.md b/mycore_api/doc/NotificationDTO.md new file mode 100644 index 0000000..6025e88 --- /dev/null +++ b/mycore_api/doc/NotificationDTO.md @@ -0,0 +1,23 @@ +# mycore_api.model.NotificationDTO + +## Load the model package +```dart +import 'package:mycore_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**notificationTitle** | **String** | | [optional] +**notificationMessage** | **String** | | [optional] +**notificationLabelButton** | **String** | | [optional] +**title** | **String** | | [optional] +**body** | **String** | | [optional] +**type** | **String** | | [optional] +**isPushNotification** | **bool** | | [optional] +**isButton** | **bool** | | [optional] +**buttonLabel** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/OddApi.md b/mycore_api/doc/OddApi.md index d1d57eb..6be8b61 100644 --- a/mycore_api/doc/OddApi.md +++ b/mycore_api/doc/OddApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/ProviderApi.md b/mycore_api/doc/ProviderApi.md index 02e3196..8591422 100644 --- a/mycore_api/doc/ProviderApi.md +++ b/mycore_api/doc/ProviderApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/RoomApi.md b/mycore_api/doc/RoomApi.md index 4bef24c..13c5d14 100644 --- a/mycore_api/doc/RoomApi.md +++ b/mycore_api/doc/RoomApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/RoomMainDetailDTO.md b/mycore_api/doc/RoomMainDetailDTO.md index 2f37d92..1315930 100644 --- a/mycore_api/doc/RoomMainDetailDTO.md +++ b/mycore_api/doc/RoomMainDetailDTO.md @@ -17,10 +17,14 @@ Name | Type | Description | Notes **temperature** | **String** | | [optional] **isHumidity** | **bool** | | [optional] **humidity** | **String** | | [optional] +**isPressure** | **bool** | | [optional] +**pressure** | **String** | | [optional] **isMotion** | **bool** | | [optional] **motion** | **bool** | | [optional] **isDoor** | **bool** | | [optional] **door** | **bool** | | [optional] +**isIlluminance** | **bool** | | [optional] +**illuminance** | **String** | | [optional] **environmentalDevices** | [**List**](DeviceDetailDTO.md) | | [optional] [default to const []] **securityDevices** | [**List**](DeviceDetailDTO.md) | | [optional] [default to const []] diff --git a/mycore_api/doc/RoomMainDetailDTOAllOf.md b/mycore_api/doc/RoomMainDetailDTOAllOf.md index c047321..920f934 100644 --- a/mycore_api/doc/RoomMainDetailDTOAllOf.md +++ b/mycore_api/doc/RoomMainDetailDTOAllOf.md @@ -14,10 +14,14 @@ Name | Type | Description | Notes **temperature** | **String** | | [optional] **isHumidity** | **bool** | | [optional] **humidity** | **String** | | [optional] +**isPressure** | **bool** | | [optional] +**pressure** | **String** | | [optional] **isMotion** | **bool** | | [optional] **motion** | **bool** | | [optional] **isDoor** | **bool** | | [optional] **door** | **bool** | | [optional] +**isIlluminance** | **bool** | | [optional] +**illuminance** | **String** | | [optional] **environmentalDevices** | [**List**](DeviceDetailDTO.md) | | [optional] [default to const []] **securityDevices** | [**List**](DeviceDetailDTO.md) | | [optional] [default to const []] diff --git a/mycore_api/doc/ScreenDeviceApi.md b/mycore_api/doc/ScreenDeviceApi.md index 37df6f2..20e8403 100644 --- a/mycore_api/doc/ScreenDeviceApi.md +++ b/mycore_api/doc/ScreenDeviceApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/TimePeriodAlarmAlarmMode.md b/mycore_api/doc/TimePeriodAlarmAlarmMode.md index 6a096f4..ed37816 100644 --- a/mycore_api/doc/TimePeriodAlarmAlarmMode.md +++ b/mycore_api/doc/TimePeriodAlarmAlarmMode.md @@ -17,8 +17,8 @@ Name | Type | Description | Notes **createdDate** | [**DateTime**](DateTime.md) | | [optional] **updatedDate** | [**DateTime**](DateTime.md) | | [optional] **type** | [**AlarmType**](AlarmType.md) | | [optional] -**programmedMode** | [**AlarmModeProgrammedMode**](AlarmModeProgrammedMode.md) | | [optional] -**geolocalizedMode** | [**AlarmModeGeolocalizedMode**](AlarmModeGeolocalizedMode.md) | | [optional] +**programmedMode** | [**AlarmModeDetailDTOAllOfProgrammedMode**](AlarmModeDetailDTOAllOfProgrammedMode.md) | | [optional] +**geolocalizedMode** | [**AlarmModeDetailDTOAllOfGeolocalizedMode**](AlarmModeDetailDTOAllOfGeolocalizedMode.md) | | [optional] **triggers** | [**List**](Trigger.md) | | [optional] [default to const []] **actions** | [**List**](Action.md) | | [optional] [default to const []] **devicesIds** | **List** | | [optional] [default to const []] diff --git a/mycore_api/doc/TokenApi.md b/mycore_api/doc/TokenApi.md index 68ae463..56bf7f3 100644 --- a/mycore_api/doc/TokenApi.md +++ b/mycore_api/doc/TokenApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/TwitterApi.md b/mycore_api/doc/TwitterApi.md index 8dfc13b..3de11d6 100644 --- a/mycore_api/doc/TwitterApi.md +++ b/mycore_api/doc/TwitterApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/UserApi.md b/mycore_api/doc/UserApi.md index 5f5b8c7..1de6320 100644 --- a/mycore_api/doc/UserApi.md +++ b/mycore_api/doc/UserApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/ValuesApi.md b/mycore_api/doc/ValuesApi.md index 49f7512..60e9921 100644 --- a/mycore_api/doc/ValuesApi.md +++ b/mycore_api/doc/ValuesApi.md @@ -5,7 +5,7 @@ import 'package:mycore_api/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/lib/api.dart b/mycore_api/lib/api.dart index d88e707..949cf33 100644 --- a/mycore_api/lib/api.dart +++ b/mycore_api/lib/api.dart @@ -42,6 +42,7 @@ part 'api/home_api.dart'; part 'api/iot_api.dart'; part 'api/layout_api.dart'; part 'api/mqtt_api.dart'; +part 'api/notification_api.dart'; part 'api/odd_api.dart'; part 'api/provider_api.dart'; part 'api/room_api.dart'; @@ -59,8 +60,8 @@ part 'model/alarm_mode_create_or_update_detail_dto_all_of.dart'; part 'model/alarm_mode_dto.dart'; part 'model/alarm_mode_detail_dto.dart'; part 'model/alarm_mode_detail_dto_all_of.dart'; -part 'model/alarm_mode_geolocalized_mode.dart'; -part 'model/alarm_mode_programmed_mode.dart'; +part 'model/alarm_mode_detail_dto_all_of_geolocalized_mode.dart'; +part 'model/alarm_mode_detail_dto_all_of_programmed_mode.dart'; part 'model/alarm_triggered.dart'; part 'model/alarm_type.dart'; part 'model/automation_dto.dart'; @@ -86,7 +87,12 @@ part 'model/electricity_production.dart'; part 'model/event_dto.dart'; part 'model/event_detail_dto.dart'; part 'model/event_detail_dto_all_of.dart'; +part 'model/event_detail_dto_all_of_alarm_triggered.dart'; +part 'model/event_detail_dto_all_of_automation_triggered.dart'; +part 'model/event_detail_dto_all_of_device_state.dart'; part 'model/event_filter.dart'; +part 'model/event_get_device_type_parameter.dart'; +part 'model/event_get_event_type_parameter.dart'; part 'model/event_home_filter.dart'; part 'model/event_home_filter_all_of.dart'; part 'model/event_type.dart'; @@ -99,12 +105,15 @@ part 'model/group_detail_dto.dart'; part 'model/group_detail_dto_all_of.dart'; part 'model/group_summary_dto.dart'; part 'model/home_dto.dart'; +part 'model/home_dto_current_alarm_mode.dart'; part 'model/home_detail_dto.dart'; part 'model/home_detail_dto_all_of.dart'; part 'model/list_response_of_event_detail_dto_and_event_home_filter.dart'; +part 'model/list_response_of_event_detail_dto_and_event_home_filter_request_parameters.dart'; part 'model/login_dto.dart'; part 'model/means_of_communication.dart'; part 'model/mqtt_message_dto.dart'; +part 'model/notification_dto.dart'; part 'model/odd_nice.dart'; part 'model/odd_nice_odds.dart'; part 'model/odd_object.dart'; @@ -122,6 +131,7 @@ part 'model/screen_device.dart'; part 'model/smart_garden_message.dart'; part 'model/smart_printer_message.dart'; part 'model/time_period_alarm.dart'; +part 'model/time_period_alarm_alarm_mode.dart'; part 'model/token_dto.dart'; part 'model/trigger.dart'; part 'model/trigger_type.dart'; diff --git a/mycore_api/lib/api/event_api.dart b/mycore_api/lib/api/event_api.dart index 20c7a26..213cff9 100644 --- a/mycore_api/lib/api/event_api.dart +++ b/mycore_api/lib/api/event_api.dart @@ -150,7 +150,7 @@ class EventApi { /// * [EventGetEventTypeParameter] eventType: /// /// * [EventGetDeviceTypeParameter] deviceType: - Future eventGetWithHttpInfo(String homeId, { String? deviceId, String? roomId, int? startIndex, int? count, DateTime? dateStart, DateTime? dateEnd, EventType? eventType, DeviceType? deviceType, }) async { + Future eventGetWithHttpInfo(String homeId, { String? deviceId, String? roomId, int? startIndex, int? count, DateTime? dateStart, DateTime? dateEnd, EventGetEventTypeParameter? eventType, EventGetDeviceTypeParameter? deviceType, }) async { // ignore: prefer_const_declarations final path = r'/api/event/{homeId}' .replaceAll('{homeId}', homeId); @@ -223,7 +223,7 @@ class EventApi { /// * [EventGetEventTypeParameter] eventType: /// /// * [EventGetDeviceTypeParameter] deviceType: - Future eventGet(String homeId, { String? deviceId, String? roomId, int? startIndex, int? count, DateTime? dateStart, DateTime? dateEnd, EventType? eventType,DeviceType? deviceType, }) async { + Future eventGet(String homeId, { String? deviceId, String? roomId, int? startIndex, int? count, DateTime? dateStart, DateTime? dateEnd, EventGetEventTypeParameter? eventType, EventGetDeviceTypeParameter? deviceType, }) async { final response = await eventGetWithHttpInfo(homeId, deviceId: deviceId, roomId: roomId, startIndex: startIndex, count: count, dateStart: dateStart, dateEnd: dateEnd, eventType: eventType, deviceType: deviceType, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); diff --git a/mycore_api/lib/api/notification_api.dart b/mycore_api/lib/api/notification_api.dart new file mode 100644 index 0000000..d59675a --- /dev/null +++ b/mycore_api/lib/api/notification_api.dart @@ -0,0 +1,133 @@ +// +// 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 NotificationApi { + NotificationApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Create a fcm notification + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [NotificationDTO] notificationDTO (required): + /// notificationDTO + Future notificationCreateSimpleNotificationWithHttpInfo(NotificationDTO notificationDTO,) async { + // ignore: prefer_const_declarations + final path = r'/Notification/all'; + + // ignore: prefer_final_locals + Object? postBody = notificationDTO; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Create a fcm notification + /// + /// Parameters: + /// + /// * [NotificationDTO] notificationDTO (required): + /// notificationDTO + Future notificationCreateSimpleNotification(NotificationDTO notificationDTO,) async { + final response = await notificationCreateSimpleNotificationWithHttpInfo(notificationDTO,); + 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), 'bool',) as bool; + + } + return null; + } + + /// Create a fcm notification for a specific home + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// homeId + /// + /// * [NotificationDTO] notificationDTO (required): + /// notificationDTO + Future notificationCreateSimpleNotificationForSpecificUserWithHttpInfo(String homeId, NotificationDTO notificationDTO,) async { + // ignore: prefer_const_declarations + final path = r'/Notification/home/{homeId}' + .replaceAll('{homeId}', homeId); + + // ignore: prefer_final_locals + Object? postBody = notificationDTO; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Create a fcm notification for a specific home + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// homeId + /// + /// * [NotificationDTO] notificationDTO (required): + /// notificationDTO + Future notificationCreateSimpleNotificationForSpecificUser(String homeId, NotificationDTO notificationDTO,) async { + final response = await notificationCreateSimpleNotificationForSpecificUserWithHttpInfo(homeId, notificationDTO,); + 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), 'bool',) as bool; + + } + return null; + } +} diff --git a/mycore_api/lib/api_client.dart b/mycore_api/lib/api_client.dart index 5c1fc59..ac9567e 100644 --- a/mycore_api/lib/api_client.dart +++ b/mycore_api/lib/api_client.dart @@ -11,11 +11,13 @@ part of openapi.api; class ApiClient { - ApiClient({this.basePath = 'http://192.168.31.140', this.authentication}); + ApiClient({this.basePath = 'http://localhost:25049', this.authentication,}); final String basePath; + final Authentication? authentication; var _client = Client(); + final _defaultHeaderMap = {}; /// Returns the current HTTP [Client] instance to use in this class. /// @@ -27,15 +29,12 @@ class ApiClient { _client = newClient; } - final _defaultHeaderMap = {}; - final Authentication? authentication; + Map get defaultHeaderMap => _defaultHeaderMap; void addDefaultHeader(String key, String value) { _defaultHeaderMap[key] = value; } - Map get defaultHeaderMap => _defaultHeaderMap; - // We don't use a Map for queryParams. // If collectionFormat is 'multi', a key might appear multiple times. Future invokeAPI( @@ -47,7 +46,7 @@ class ApiClient { Map formParams, String? contentType, ) async { - _updateParamsForAuth(queryParams, headerParams); + await authentication?.applyToParams(queryParams, headerParams); headerParams.addAll(_defaultHeaderMap); if (contentType != null) { @@ -165,16 +164,6 @@ class ApiClient { @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') String serialize(Object? value) => value == null ? '' : json.encode(value); - /// Update query and header parameters based on authentication settings. - void _updateParamsForAuth( - List queryParams, - Map headerParams, - ) { - if (authentication != null) { - authentication!.applyToParams(queryParams, headerParams); - } - } - static dynamic _deserialize(dynamic value, String targetType, {bool growable = false}) { try { switch (targetType) { @@ -190,6 +179,8 @@ class ApiClient { } final valueString = '$value'.toLowerCase(); return valueString == 'true' || valueString == '1'; + case 'DateTime': + return value is DateTime ? value : DateTime.tryParse(value); case 'Action': return Action.fromJson(value); case 'ActionType': @@ -206,10 +197,10 @@ class ApiClient { return AlarmModeDetailDTO.fromJson(value); case 'AlarmModeDetailDTOAllOf': return AlarmModeDetailDTOAllOf.fromJson(value); - case 'AlarmModeGeolocalizedMode': - return AlarmModeGeolocalizedMode.fromJson(value); - case 'AlarmModeProgrammedMode': - return AlarmModeProgrammedMode.fromJson(value); + case 'AlarmModeDetailDTOAllOfGeolocalizedMode': + return AlarmModeDetailDTOAllOfGeolocalizedMode.fromJson(value); + case 'AlarmModeDetailDTOAllOfProgrammedMode': + return AlarmModeDetailDTOAllOfProgrammedMode.fromJson(value); case 'AlarmTriggered': return AlarmTriggered.fromJson(value); case 'AlarmType': @@ -260,8 +251,18 @@ class ApiClient { return EventDetailDTO.fromJson(value); case 'EventDetailDTOAllOf': return EventDetailDTOAllOf.fromJson(value); + case 'EventDetailDTOAllOfAlarmTriggered': + return EventDetailDTOAllOfAlarmTriggered.fromJson(value); + case 'EventDetailDTOAllOfAutomationTriggered': + return EventDetailDTOAllOfAutomationTriggered.fromJson(value); + case 'EventDetailDTOAllOfDeviceState': + return EventDetailDTOAllOfDeviceState.fromJson(value); case 'EventFilter': return EventFilter.fromJson(value); + case 'EventGetDeviceTypeParameter': + return EventGetDeviceTypeParameter.fromJson(value); + case 'EventGetEventTypeParameter': + return EventGetEventTypeParameter.fromJson(value); case 'EventHomeFilter': return EventHomeFilter.fromJson(value); case 'EventHomeFilterAllOf': @@ -286,18 +287,24 @@ class ApiClient { return GroupSummaryDTO.fromJson(value); case 'HomeDTO': return HomeDTO.fromJson(value); + case 'HomeDTOCurrentAlarmMode': + return HomeDTOCurrentAlarmMode.fromJson(value); case 'HomeDetailDTO': return HomeDetailDTO.fromJson(value); case 'HomeDetailDTOAllOf': return HomeDetailDTOAllOf.fromJson(value); case 'ListResponseOfEventDetailDTOAndEventHomeFilter': return ListResponseOfEventDetailDTOAndEventHomeFilter.fromJson(value); + case 'ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters': + return ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters.fromJson(value); case 'LoginDTO': return LoginDTO.fromJson(value); case 'MeansOfCommunication': return MeansOfCommunicationTypeTransformer().decode(value); case 'MqttMessageDTO': return MqttMessageDTO.fromJson(value); + case 'NotificationDTO': + return NotificationDTO.fromJson(value); case 'OddNice': return OddNice.fromJson(value); case 'OddNiceOdds': @@ -332,6 +339,8 @@ class ApiClient { return SmartPrinterMessage.fromJson(value); case 'TimePeriodAlarm': return TimePeriodAlarm.fromJson(value); + case 'TimePeriodAlarmAlarmMode': + return TimePeriodAlarmAlarmMode.fromJson(value); case 'TokenDTO': return TokenDTO.fromJson(value); case 'Trigger': diff --git a/mycore_api/lib/auth/api_key_auth.dart b/mycore_api/lib/auth/api_key_auth.dart index e304eda..84dc295 100644 --- a/mycore_api/lib/auth/api_key_auth.dart +++ b/mycore_api/lib/auth/api_key_auth.dart @@ -20,7 +20,7 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - void applyToParams(List queryParams, Map headerParams) { + Future applyToParams(List queryParams, Map headerParams,) async { final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { diff --git a/mycore_api/lib/auth/authentication.dart b/mycore_api/lib/auth/authentication.dart index 49baf7c..1b1b8ae 100644 --- a/mycore_api/lib/auth/authentication.dart +++ b/mycore_api/lib/auth/authentication.dart @@ -13,5 +13,5 @@ part of openapi.api; // ignore: one_member_abstracts abstract class Authentication { /// Apply authentication settings to header and query params. - void applyToParams(List queryParams, Map headerParams); + Future applyToParams(List queryParams, Map headerParams); } diff --git a/mycore_api/lib/auth/http_basic_auth.dart b/mycore_api/lib/auth/http_basic_auth.dart index 81abd71..dfedaa5 100644 --- a/mycore_api/lib/auth/http_basic_auth.dart +++ b/mycore_api/lib/auth/http_basic_auth.dart @@ -17,7 +17,7 @@ class HttpBasicAuth implements Authentication { String password; @override - void applyToParams(List queryParams, Map headerParams) { + Future applyToParams(List queryParams, Map headerParams,) async { if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; diff --git a/mycore_api/lib/auth/http_bearer_auth.dart b/mycore_api/lib/auth/http_bearer_auth.dart index 213f348..eddf3a5 100644 --- a/mycore_api/lib/auth/http_bearer_auth.dart +++ b/mycore_api/lib/auth/http_bearer_auth.dart @@ -27,7 +27,7 @@ class HttpBearerAuth implements Authentication { } @override - void applyToParams(List queryParams, Map headerParams) { + Future applyToParams(List queryParams, Map headerParams,) async { if (_accessToken == null) { return; } diff --git a/mycore_api/lib/auth/oauth.dart b/mycore_api/lib/auth/oauth.dart index e9b87cf..e9e7d78 100644 --- a/mycore_api/lib/auth/oauth.dart +++ b/mycore_api/lib/auth/oauth.dart @@ -16,7 +16,7 @@ class OAuth implements Authentication { String accessToken; @override - void applyToParams(List queryParams, Map headerParams) { + Future applyToParams(List queryParams, Map headerParams,) async { if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } diff --git a/mycore_api/lib/model/action.dart b/mycore_api/lib/model/action.dart index 4a10f5d..3ad957d 100644 --- a/mycore_api/lib/model/action.dart +++ b/mycore_api/lib/model/action.dart @@ -73,29 +73,43 @@ class Action { String toString() => 'Action[groupId=$groupId, deviceId=$deviceId, states=$states, rawRequest=$rawRequest, providerId=$providerId, type=$type, isForce=$isForce]'; Map toJson() { - final _json = {}; - if (groupId != null) { - _json[r'groupId'] = groupId; + final json = {}; + if (this.groupId != null) { + json[r'groupId'] = this.groupId; + } else { + json[r'groupId'] = null; } - if (deviceId != null) { - _json[r'deviceId'] = deviceId; + if (this.deviceId != null) { + json[r'deviceId'] = this.deviceId; + } else { + json[r'deviceId'] = null; } - if (states != null) { - _json[r'states'] = states; + if (this.states != null) { + json[r'states'] = this.states; + } else { + json[r'states'] = null; } - if (rawRequest != null) { - _json[r'rawRequest'] = rawRequest; + if (this.rawRequest != null) { + json[r'rawRequest'] = this.rawRequest; + } else { + json[r'rawRequest'] = null; } - if (providerId != null) { - _json[r'providerId'] = providerId; + if (this.providerId != null) { + json[r'providerId'] = this.providerId; + } else { + json[r'providerId'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (isForce != null) { - _json[r'isForce'] = isForce; + if (this.isForce != null) { + json[r'isForce'] = this.isForce; + } else { + json[r'isForce'] = null; } - return _json; + return json; } /// Returns a new [Action] instance and imports its values from @@ -119,7 +133,7 @@ class Action { return Action( groupId: mapValueOfType(json, r'groupId'), deviceId: mapValueOfType(json, r'deviceId'), - states: AutomationState.listFromJson(json[r'states']) ?? const [], + states: AutomationState.listFromJson(json[r'states']), rawRequest: mapValueOfType(json, r'rawRequest'), providerId: mapValueOfType(json, r'providerId'), type: ActionType.fromJson(json[r'type']), @@ -129,7 +143,7 @@ class Action { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -160,12 +174,10 @@ class Action { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = Action.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = Action.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/action_type.dart b/mycore_api/lib/model/action_type.dart index 4a90299..0dc8ec2 100644 --- a/mycore_api/lib/model/action_type.dart +++ b/mycore_api/lib/model/action_type.dart @@ -42,7 +42,7 @@ class ActionType { static ActionType? fromJson(dynamic value) => ActionTypeTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -75,7 +75,7 @@ class ActionTypeTypeTransformer { /// and users are still using an old app with the old code. ActionType? decode(dynamic data, {bool allowNull = true}) { if (data != null) { - switch (data.toString()) { + switch (data) { case r'DELAY': return ActionType.DELAY; case r'DEVICE': return ActionType.DEVICE; case r'HTTP': return ActionType.HTTP; diff --git a/mycore_api/lib/model/alarm_mode.dart b/mycore_api/lib/model/alarm_mode.dart index 977a959..636482b 100644 --- a/mycore_api/lib/model/alarm_mode.dart +++ b/mycore_api/lib/model/alarm_mode.dart @@ -83,9 +83,9 @@ class AlarmMode { /// AlarmType? type; - AlarmModeProgrammedMode? programmedMode; + AlarmModeDetailDTOAllOfProgrammedMode? programmedMode; - AlarmModeGeolocalizedMode? geolocalizedMode; + AlarmModeDetailDTOAllOfGeolocalizedMode? geolocalizedMode; List? triggers; @@ -132,50 +132,78 @@ class AlarmMode { String toString() => 'AlarmMode[id=$id, homeId=$homeId, name=$name, activated=$activated, isDefault=$isDefault, notification=$notification, createdDate=$createdDate, updatedDate=$updatedDate, type=$type, programmedMode=$programmedMode, geolocalizedMode=$geolocalizedMode, triggers=$triggers, actions=$actions, devicesIds=$devicesIds]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (activated != null) { - _json[r'activated'] = activated; + if (this.activated != null) { + json[r'activated'] = this.activated; + } else { + json[r'activated'] = null; } - if (isDefault != null) { - _json[r'isDefault'] = isDefault; + if (this.isDefault != null) { + json[r'isDefault'] = this.isDefault; + } else { + json[r'isDefault'] = null; } - if (notification != null) { - _json[r'notification'] = notification; + if (this.notification != null) { + json[r'notification'] = this.notification; + } else { + json[r'notification'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (programmedMode != null) { - _json[r'programmedMode'] = programmedMode; + if (this.programmedMode != null) { + json[r'programmedMode'] = this.programmedMode; + } else { + json[r'programmedMode'] = null; } - if (geolocalizedMode != null) { - _json[r'geolocalizedMode'] = geolocalizedMode; + if (this.geolocalizedMode != null) { + json[r'geolocalizedMode'] = this.geolocalizedMode; + } else { + json[r'geolocalizedMode'] = null; } - if (triggers != null) { - _json[r'triggers'] = triggers; + if (this.triggers != null) { + json[r'triggers'] = this.triggers; + } else { + json[r'triggers'] = null; } - if (actions != null) { - _json[r'actions'] = actions; + if (this.actions != null) { + json[r'actions'] = this.actions; + } else { + json[r'actions'] = null; } - if (devicesIds != null) { - _json[r'devicesIds'] = devicesIds; + if (this.devicesIds != null) { + json[r'devicesIds'] = this.devicesIds; + } else { + json[r'devicesIds'] = null; } - return _json; + return json; } /// Returns a new [AlarmMode] instance and imports its values from @@ -206,10 +234,10 @@ class AlarmMode { createdDate: mapDateTime(json, r'createdDate', ''), updatedDate: mapDateTime(json, r'updatedDate', ''), type: AlarmType.fromJson(json[r'type']), - programmedMode: AlarmModeProgrammedMode.fromJson(json[r'programmedMode']), - geolocalizedMode: AlarmModeGeolocalizedMode.fromJson(json[r'geolocalizedMode']), - triggers: Trigger.listFromJson(json[r'triggers']) ?? const [], - actions: Action.listFromJson(json[r'actions']) ?? const [], + programmedMode: AlarmModeDetailDTOAllOfProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: AlarmModeDetailDTOAllOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), + triggers: Trigger.listFromJson(json[r'triggers']), + actions: Action.listFromJson(json[r'actions']), devicesIds: json[r'devicesIds'] is List ? (json[r'devicesIds'] as List).cast() : const [], @@ -218,7 +246,7 @@ class AlarmMode { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -249,12 +277,10 @@ class AlarmMode { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = AlarmMode.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = AlarmMode.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto.dart b/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto.dart index 2d34f74..37233bd 100644 --- a/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto.dart +++ b/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto.dart @@ -86,9 +86,9 @@ class AlarmModeCreateOrUpdateDetailDTO { List? actions; - ProgrammedMode? programmedMode; + AlarmModeDetailDTOAllOfProgrammedMode? programmedMode; - GeolocalizedMode? geolocalizedMode; + AlarmModeDetailDTOAllOfGeolocalizedMode? geolocalizedMode; @override bool operator ==(Object other) => identical(this, other) || other is AlarmModeCreateOrUpdateDetailDTO && @@ -127,47 +127,73 @@ class AlarmModeCreateOrUpdateDetailDTO { String toString() => 'AlarmModeCreateOrUpdateDetailDTO[id=$id, homeId=$homeId, name=$name, type=$type, activated=$activated, isDefault=$isDefault, notification=$notification, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, actions=$actions, programmedMode=$programmedMode, geolocalizedMode=$geolocalizedMode]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (activated != null) { - _json[r'activated'] = activated; + if (this.activated != null) { + json[r'activated'] = this.activated; + } else { + json[r'activated'] = null; } - if (isDefault != null) { - _json[r'isDefault'] = isDefault; + if (this.isDefault != null) { + json[r'isDefault'] = this.isDefault; + } else { + json[r'isDefault'] = null; } - if (notification != null) { - _json[r'notification'] = notification; + if (this.notification != null) { + json[r'notification'] = this.notification; + } else { + json[r'notification'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (triggers != null) { - _json[r'triggers'] = triggers; + if (this.triggers != null) { + json[r'triggers'] = this.triggers; + } else { + json[r'triggers'] = null; } - if (actions != null) { - _json[r'actions'] = actions; + if (this.actions != null) { + json[r'actions'] = this.actions; + } else { + json[r'actions'] = null; } - if (programmedMode != null) { - _json[r'programmedMode'] = programmedMode; + if (this.programmedMode != null) { + json[r'programmedMode'] = this.programmedMode; + } else { + json[r'programmedMode'] = null; } - if (geolocalizedMode != null) { - _json[r'geolocalizedMode'] = geolocalizedMode; + if (this.geolocalizedMode != null) { + json[r'geolocalizedMode'] = this.geolocalizedMode; + } else { + json[r'geolocalizedMode'] = null; } - return _json; + return json; } /// Returns a new [AlarmModeCreateOrUpdateDetailDTO] instance and imports its values from @@ -198,16 +224,16 @@ class AlarmModeCreateOrUpdateDetailDTO { notification: mapValueOfType(json, r'notification'), createdDate: mapDateTime(json, r'createdDate', ''), updatedDate: mapDateTime(json, r'updatedDate', ''), - triggers: Trigger.listFromJson(json[r'triggers']) ?? const [], - actions: Action.listFromJson(json[r'actions']) ?? const [], - programmedMode: ProgrammedMode.fromJson(json[r'programmedMode']), - geolocalizedMode: GeolocalizedMode.fromJson(json[r'geolocalizedMode']), + triggers: Trigger.listFromJson(json[r'triggers']), + actions: Action.listFromJson(json[r'actions']), + programmedMode: AlarmModeDetailDTOAllOfProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: AlarmModeDetailDTOAllOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -238,12 +264,10 @@ class AlarmModeCreateOrUpdateDetailDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = AlarmModeCreateOrUpdateDetailDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = AlarmModeCreateOrUpdateDetailDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart b/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart index 8b6d8d3..60a0478 100644 --- a/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart +++ b/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart @@ -23,9 +23,9 @@ class AlarmModeCreateOrUpdateDetailDTOAllOf { List? actions; - ProgrammedMode? programmedMode; + AlarmModeDetailDTOAllOfProgrammedMode? programmedMode; - GeolocalizedMode? geolocalizedMode; + AlarmModeDetailDTOAllOfGeolocalizedMode? geolocalizedMode; @override bool operator ==(Object other) => identical(this, other) || other is AlarmModeCreateOrUpdateDetailDTOAllOf && @@ -46,20 +46,28 @@ class AlarmModeCreateOrUpdateDetailDTOAllOf { String toString() => 'AlarmModeCreateOrUpdateDetailDTOAllOf[triggers=$triggers, actions=$actions, programmedMode=$programmedMode, geolocalizedMode=$geolocalizedMode]'; Map toJson() { - final _json = {}; - if (triggers != null) { - _json[r'triggers'] = triggers; + final json = {}; + if (this.triggers != null) { + json[r'triggers'] = this.triggers; + } else { + json[r'triggers'] = null; } - if (actions != null) { - _json[r'actions'] = actions; + if (this.actions != null) { + json[r'actions'] = this.actions; + } else { + json[r'actions'] = null; } - if (programmedMode != null) { - _json[r'programmedMode'] = programmedMode; + if (this.programmedMode != null) { + json[r'programmedMode'] = this.programmedMode; + } else { + json[r'programmedMode'] = null; } - if (geolocalizedMode != null) { - _json[r'geolocalizedMode'] = geolocalizedMode; + if (this.geolocalizedMode != null) { + json[r'geolocalizedMode'] = this.geolocalizedMode; + } else { + json[r'geolocalizedMode'] = null; } - return _json; + return json; } /// Returns a new [AlarmModeCreateOrUpdateDetailDTOAllOf] instance and imports its values from @@ -81,16 +89,16 @@ class AlarmModeCreateOrUpdateDetailDTOAllOf { }()); return AlarmModeCreateOrUpdateDetailDTOAllOf( - triggers: Trigger.listFromJson(json[r'triggers']) ?? const [], - actions: Action.listFromJson(json[r'actions']) ?? const [], - programmedMode: ProgrammedMode.fromJson(json[r'programmedMode']), - geolocalizedMode: GeolocalizedMode.fromJson(json[r'geolocalizedMode']), + triggers: Trigger.listFromJson(json[r'triggers']), + actions: Action.listFromJson(json[r'actions']), + programmedMode: AlarmModeDetailDTOAllOfProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: AlarmModeDetailDTOAllOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -121,12 +129,10 @@ class AlarmModeCreateOrUpdateDetailDTOAllOf { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = AlarmModeCreateOrUpdateDetailDTOAllOf.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = AlarmModeCreateOrUpdateDetailDTOAllOf.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/alarm_mode_detail_dto.dart b/mycore_api/lib/model/alarm_mode_detail_dto.dart index a2d3923..597985f 100644 --- a/mycore_api/lib/model/alarm_mode_detail_dto.dart +++ b/mycore_api/lib/model/alarm_mode_detail_dto.dart @@ -89,9 +89,9 @@ class AlarmModeDetailDTO { List? devices; - ProgrammedMode? programmedMode; + AlarmModeDetailDTOAllOfProgrammedMode? programmedMode; - GeolocalizedMode? geolocalizedMode; + AlarmModeDetailDTOAllOfGeolocalizedMode? geolocalizedMode; @override bool operator ==(Object other) => identical(this, other) || other is AlarmModeDetailDTO && @@ -132,50 +132,78 @@ class AlarmModeDetailDTO { String toString() => 'AlarmModeDetailDTO[id=$id, homeId=$homeId, name=$name, type=$type, activated=$activated, isDefault=$isDefault, notification=$notification, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, actions=$actions, devices=$devices, programmedMode=$programmedMode, geolocalizedMode=$geolocalizedMode]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (activated != null) { - _json[r'activated'] = activated; + if (this.activated != null) { + json[r'activated'] = this.activated; + } else { + json[r'activated'] = null; } - if (isDefault != null) { - _json[r'isDefault'] = isDefault; + if (this.isDefault != null) { + json[r'isDefault'] = this.isDefault; + } else { + json[r'isDefault'] = null; } - if (notification != null) { - _json[r'notification'] = notification; + if (this.notification != null) { + json[r'notification'] = this.notification; + } else { + json[r'notification'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (triggers != null) { - _json[r'triggers'] = triggers; + if (this.triggers != null) { + json[r'triggers'] = this.triggers; + } else { + json[r'triggers'] = null; } - if (actions != null) { - _json[r'actions'] = actions; + if (this.actions != null) { + json[r'actions'] = this.actions; + } else { + json[r'actions'] = null; } - if (devices != null) { - _json[r'devices'] = devices; + if (this.devices != null) { + json[r'devices'] = this.devices; + } else { + json[r'devices'] = null; } - if (programmedMode != null) { - _json[r'programmedMode'] = programmedMode; + if (this.programmedMode != null) { + json[r'programmedMode'] = this.programmedMode; + } else { + json[r'programmedMode'] = null; } - if (geolocalizedMode != null) { - _json[r'geolocalizedMode'] = geolocalizedMode; + if (this.geolocalizedMode != null) { + json[r'geolocalizedMode'] = this.geolocalizedMode; + } else { + json[r'geolocalizedMode'] = null; } - return _json; + return json; } /// Returns a new [AlarmModeDetailDTO] instance and imports its values from @@ -206,17 +234,17 @@ class AlarmModeDetailDTO { notification: mapValueOfType(json, r'notification'), createdDate: mapDateTime(json, r'createdDate', ''), updatedDate: mapDateTime(json, r'updatedDate', ''), - triggers: Trigger.listFromJson(json[r'triggers']) ?? const [], - actions: Action.listFromJson(json[r'actions']) ?? const [], - devices: DeviceDetailDTO.listFromJson(json[r'devices']) ?? const [], - programmedMode: ProgrammedMode.fromJson(json[r'programmedMode']), - geolocalizedMode: GeolocalizedMode.fromJson(json[r'geolocalizedMode']), + triggers: Trigger.listFromJson(json[r'triggers']), + actions: Action.listFromJson(json[r'actions']), + devices: DeviceDetailDTO.listFromJson(json[r'devices']), + programmedMode: AlarmModeDetailDTOAllOfProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: AlarmModeDetailDTOAllOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -247,12 +275,10 @@ class AlarmModeDetailDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = AlarmModeDetailDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = AlarmModeDetailDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/alarm_mode_detail_dto_all_of.dart b/mycore_api/lib/model/alarm_mode_detail_dto_all_of.dart index b90f3e6..a77668e 100644 --- a/mycore_api/lib/model/alarm_mode_detail_dto_all_of.dart +++ b/mycore_api/lib/model/alarm_mode_detail_dto_all_of.dart @@ -26,9 +26,9 @@ class AlarmModeDetailDTOAllOf { List? devices; - ProgrammedMode? programmedMode; + AlarmModeDetailDTOAllOfProgrammedMode? programmedMode; - GeolocalizedMode? geolocalizedMode; + AlarmModeDetailDTOAllOfGeolocalizedMode? geolocalizedMode; @override bool operator ==(Object other) => identical(this, other) || other is AlarmModeDetailDTOAllOf && @@ -51,23 +51,33 @@ class AlarmModeDetailDTOAllOf { String toString() => 'AlarmModeDetailDTOAllOf[triggers=$triggers, actions=$actions, devices=$devices, programmedMode=$programmedMode, geolocalizedMode=$geolocalizedMode]'; Map toJson() { - final _json = {}; - if (triggers != null) { - _json[r'triggers'] = triggers; + final json = {}; + if (this.triggers != null) { + json[r'triggers'] = this.triggers; + } else { + json[r'triggers'] = null; } - if (actions != null) { - _json[r'actions'] = actions; + if (this.actions != null) { + json[r'actions'] = this.actions; + } else { + json[r'actions'] = null; } - if (devices != null) { - _json[r'devices'] = devices; + if (this.devices != null) { + json[r'devices'] = this.devices; + } else { + json[r'devices'] = null; } - if (programmedMode != null) { - _json[r'programmedMode'] = programmedMode; + if (this.programmedMode != null) { + json[r'programmedMode'] = this.programmedMode; + } else { + json[r'programmedMode'] = null; } - if (geolocalizedMode != null) { - _json[r'geolocalizedMode'] = geolocalizedMode; + if (this.geolocalizedMode != null) { + json[r'geolocalizedMode'] = this.geolocalizedMode; + } else { + json[r'geolocalizedMode'] = null; } - return _json; + return json; } /// Returns a new [AlarmModeDetailDTOAllOf] instance and imports its values from @@ -89,17 +99,17 @@ class AlarmModeDetailDTOAllOf { }()); return AlarmModeDetailDTOAllOf( - triggers: Trigger.listFromJson(json[r'triggers']) ?? const [], - actions: Action.listFromJson(json[r'actions']) ?? const [], - devices: DeviceDetailDTO.listFromJson(json[r'devices']) ?? const [], - programmedMode: ProgrammedMode.fromJson(json[r'programmedMode']), - geolocalizedMode: GeolocalizedMode.fromJson(json[r'geolocalizedMode']), + triggers: Trigger.listFromJson(json[r'triggers']), + actions: Action.listFromJson(json[r'actions']), + devices: DeviceDetailDTO.listFromJson(json[r'devices']), + programmedMode: AlarmModeDetailDTOAllOfProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: AlarmModeDetailDTOAllOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -130,12 +140,10 @@ class AlarmModeDetailDTOAllOf { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = AlarmModeDetailDTOAllOf.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = AlarmModeDetailDTOAllOf.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/alarm_mode_detail_dto_all_of_geolocalized_mode.dart b/mycore_api/lib/model/alarm_mode_detail_dto_all_of_geolocalized_mode.dart new file mode 100644 index 0000000..7f2a8d3 --- /dev/null +++ b/mycore_api/lib/model/alarm_mode_detail_dto_all_of_geolocalized_mode.dart @@ -0,0 +1,145 @@ +// +// 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 AlarmModeDetailDTOAllOfGeolocalizedMode { + /// Returns a new [AlarmModeDetailDTOAllOfGeolocalizedMode] instance. + AlarmModeDetailDTOAllOfGeolocalizedMode({ + this.latitude, + this.longitude, + this.homeMode, + this.absentMode, + }); + + String? latitude; + + String? longitude; + + TimePeriodAlarmAlarmMode? homeMode; + + TimePeriodAlarmAlarmMode? absentMode; + + @override + bool operator ==(Object other) => identical(this, other) || other is AlarmModeDetailDTOAllOfGeolocalizedMode && + other.latitude == latitude && + other.longitude == longitude && + other.homeMode == homeMode && + other.absentMode == absentMode; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (latitude == null ? 0 : latitude!.hashCode) + + (longitude == null ? 0 : longitude!.hashCode) + + (homeMode == null ? 0 : homeMode!.hashCode) + + (absentMode == null ? 0 : absentMode!.hashCode); + + @override + String toString() => 'AlarmModeDetailDTOAllOfGeolocalizedMode[latitude=$latitude, longitude=$longitude, homeMode=$homeMode, absentMode=$absentMode]'; + + Map toJson() { + final json = {}; + if (this.latitude != null) { + json[r'latitude'] = this.latitude; + } else { + json[r'latitude'] = null; + } + if (this.longitude != null) { + json[r'longitude'] = this.longitude; + } else { + json[r'longitude'] = null; + } + if (this.homeMode != null) { + json[r'homeMode'] = this.homeMode; + } else { + json[r'homeMode'] = null; + } + if (this.absentMode != null) { + json[r'absentMode'] = this.absentMode; + } else { + json[r'absentMode'] = null; + } + return json; + } + + /// Returns a new [AlarmModeDetailDTOAllOfGeolocalizedMode] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static AlarmModeDetailDTOAllOfGeolocalizedMode? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "AlarmModeDetailDTOAllOfGeolocalizedMode[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "AlarmModeDetailDTOAllOfGeolocalizedMode[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return AlarmModeDetailDTOAllOfGeolocalizedMode( + latitude: mapValueOfType(json, r'latitude'), + longitude: mapValueOfType(json, r'longitude'), + homeMode: TimePeriodAlarmAlarmMode.fromJson(json[r'homeMode']), + absentMode: TimePeriodAlarmAlarmMode.fromJson(json[r'absentMode']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = AlarmModeDetailDTOAllOfGeolocalizedMode.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = AlarmModeDetailDTOAllOfGeolocalizedMode.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of AlarmModeDetailDTOAllOfGeolocalizedMode-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = AlarmModeDetailDTOAllOfGeolocalizedMode.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/mycore_api/lib/model/alarm_mode_detail_dto_all_of_programmed_mode.dart b/mycore_api/lib/model/alarm_mode_detail_dto_all_of_programmed_mode.dart new file mode 100644 index 0000000..ac7b994 --- /dev/null +++ b/mycore_api/lib/model/alarm_mode_detail_dto_all_of_programmed_mode.dart @@ -0,0 +1,178 @@ +// +// 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 AlarmModeDetailDTOAllOfProgrammedMode { + /// Returns a new [AlarmModeDetailDTOAllOfProgrammedMode] instance. + AlarmModeDetailDTOAllOfProgrammedMode({ + this.monday = const [], + this.tuesday = const [], + this.wednesday = const [], + this.thursday = const [], + this.friday = const [], + this.saturday = const [], + this.sunday = const [], + }); + + List? monday; + + List? tuesday; + + List? wednesday; + + List? thursday; + + List? friday; + + List? saturday; + + List? sunday; + + @override + bool operator ==(Object other) => identical(this, other) || other is AlarmModeDetailDTOAllOfProgrammedMode && + other.monday == monday && + other.tuesday == tuesday && + other.wednesday == wednesday && + other.thursday == thursday && + other.friday == friday && + other.saturday == saturday && + other.sunday == sunday; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (monday == null ? 0 : monday!.hashCode) + + (tuesday == null ? 0 : tuesday!.hashCode) + + (wednesday == null ? 0 : wednesday!.hashCode) + + (thursday == null ? 0 : thursday!.hashCode) + + (friday == null ? 0 : friday!.hashCode) + + (saturday == null ? 0 : saturday!.hashCode) + + (sunday == null ? 0 : sunday!.hashCode); + + @override + String toString() => 'AlarmModeDetailDTOAllOfProgrammedMode[monday=$monday, tuesday=$tuesday, wednesday=$wednesday, thursday=$thursday, friday=$friday, saturday=$saturday, sunday=$sunday]'; + + Map toJson() { + final json = {}; + if (this.monday != null) { + json[r'monday'] = this.monday; + } else { + json[r'monday'] = null; + } + if (this.tuesday != null) { + json[r'tuesday'] = this.tuesday; + } else { + json[r'tuesday'] = null; + } + if (this.wednesday != null) { + json[r'wednesday'] = this.wednesday; + } else { + json[r'wednesday'] = null; + } + if (this.thursday != null) { + json[r'thursday'] = this.thursday; + } else { + json[r'thursday'] = null; + } + if (this.friday != null) { + json[r'friday'] = this.friday; + } else { + json[r'friday'] = null; + } + if (this.saturday != null) { + json[r'saturday'] = this.saturday; + } else { + json[r'saturday'] = null; + } + if (this.sunday != null) { + json[r'sunday'] = this.sunday; + } else { + json[r'sunday'] = null; + } + return json; + } + + /// Returns a new [AlarmModeDetailDTOAllOfProgrammedMode] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static AlarmModeDetailDTOAllOfProgrammedMode? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "AlarmModeDetailDTOAllOfProgrammedMode[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "AlarmModeDetailDTOAllOfProgrammedMode[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return AlarmModeDetailDTOAllOfProgrammedMode( + monday: TimePeriodAlarm.listFromJson(json[r'monday']), + tuesday: TimePeriodAlarm.listFromJson(json[r'tuesday']), + wednesday: TimePeriodAlarm.listFromJson(json[r'wednesday']), + thursday: TimePeriodAlarm.listFromJson(json[r'thursday']), + friday: TimePeriodAlarm.listFromJson(json[r'friday']), + saturday: TimePeriodAlarm.listFromJson(json[r'saturday']), + sunday: TimePeriodAlarm.listFromJson(json[r'sunday']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = AlarmModeDetailDTOAllOfProgrammedMode.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = AlarmModeDetailDTOAllOfProgrammedMode.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of AlarmModeDetailDTOAllOfProgrammedMode-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = AlarmModeDetailDTOAllOfProgrammedMode.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/mycore_api/lib/model/alarm_mode_dto.dart b/mycore_api/lib/model/alarm_mode_dto.dart index 6c609af..7de1a87 100644 --- a/mycore_api/lib/model/alarm_mode_dto.dart +++ b/mycore_api/lib/model/alarm_mode_dto.dart @@ -107,35 +107,53 @@ class AlarmModeDTO { String toString() => 'AlarmModeDTO[id=$id, homeId=$homeId, name=$name, type=$type, activated=$activated, isDefault=$isDefault, notification=$notification, createdDate=$createdDate, updatedDate=$updatedDate]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (activated != null) { - _json[r'activated'] = activated; + if (this.activated != null) { + json[r'activated'] = this.activated; + } else { + json[r'activated'] = null; } - if (isDefault != null) { - _json[r'isDefault'] = isDefault; + if (this.isDefault != null) { + json[r'isDefault'] = this.isDefault; + } else { + json[r'isDefault'] = null; } - if (notification != null) { - _json[r'notification'] = notification; + if (this.notification != null) { + json[r'notification'] = this.notification; + } else { + json[r'notification'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - return _json; + return json; } /// Returns a new [AlarmModeDTO] instance and imports its values from @@ -171,7 +189,7 @@ class AlarmModeDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -202,12 +220,10 @@ class AlarmModeDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = AlarmModeDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = AlarmModeDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/alarm_triggered.dart b/mycore_api/lib/model/alarm_triggered.dart index 71c5fa5..20509f3 100644 --- a/mycore_api/lib/model/alarm_triggered.dart +++ b/mycore_api/lib/model/alarm_triggered.dart @@ -47,17 +47,23 @@ class AlarmTriggered { String toString() => 'AlarmTriggered[alarmModeId=$alarmModeId, alarmModeName=$alarmModeName, type=$type]'; Map toJson() { - final _json = {}; - if (alarmModeId != null) { - _json[r'alarmModeId'] = alarmModeId; + final json = {}; + if (this.alarmModeId != null) { + json[r'alarmModeId'] = this.alarmModeId; + } else { + json[r'alarmModeId'] = null; } - if (alarmModeName != null) { - _json[r'alarmModeName'] = alarmModeName; + if (this.alarmModeName != null) { + json[r'alarmModeName'] = this.alarmModeName; + } else { + json[r'alarmModeName'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - return _json; + return json; } /// Returns a new [AlarmTriggered] instance and imports its values from @@ -87,7 +93,7 @@ class AlarmTriggered { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -118,12 +124,10 @@ class AlarmTriggered { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = AlarmTriggered.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = AlarmTriggered.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/alarm_type.dart b/mycore_api/lib/model/alarm_type.dart index 3d929b1..6178e24 100644 --- a/mycore_api/lib/model/alarm_type.dart +++ b/mycore_api/lib/model/alarm_type.dart @@ -42,7 +42,7 @@ class AlarmType { static AlarmType? fromJson(dynamic value) => AlarmTypeTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -75,7 +75,7 @@ class AlarmTypeTypeTransformer { /// and users are still using an old app with the old code. AlarmType? decode(dynamic data, {bool allowNull = true}) { if (data != null) { - switch (data.toString()) { + switch (data) { case r'Home': return AlarmType.home; case r'Absent': return AlarmType.absent; case r'Geolocalized': return AlarmType.geolocalized; diff --git a/mycore_api/lib/model/automation_detail_dto.dart b/mycore_api/lib/model/automation_detail_dto.dart index 964cb8a..a5486b4 100644 --- a/mycore_api/lib/model/automation_detail_dto.dart +++ b/mycore_api/lib/model/automation_detail_dto.dart @@ -99,41 +99,63 @@ class AutomationDetailDTO { String toString() => 'AutomationDetailDTO[id=$id, name=$name, active=$active, homeId=$homeId, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, conditions=$conditions, actions=$actions, devicesIds=$devicesIds, devices=$devices]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (active != null) { - _json[r'active'] = active; + if (this.active != null) { + json[r'active'] = this.active; + } else { + json[r'active'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (triggers != null) { - _json[r'triggers'] = triggers; + if (this.triggers != null) { + json[r'triggers'] = this.triggers; + } else { + json[r'triggers'] = null; } - if (conditions != null) { - _json[r'conditions'] = conditions; + if (this.conditions != null) { + json[r'conditions'] = this.conditions; + } else { + json[r'conditions'] = null; } - if (actions != null) { - _json[r'actions'] = actions; + if (this.actions != null) { + json[r'actions'] = this.actions; + } else { + json[r'actions'] = null; } - if (devicesIds != null) { - _json[r'devicesIds'] = devicesIds; + if (this.devicesIds != null) { + json[r'devicesIds'] = this.devicesIds; + } else { + json[r'devicesIds'] = null; } - if (devices != null) { - _json[r'devices'] = devices; + if (this.devices != null) { + json[r'devices'] = this.devices; + } else { + json[r'devices'] = null; } - return _json; + return json; } /// Returns a new [AutomationDetailDTO] instance and imports its values from @@ -161,19 +183,19 @@ class AutomationDetailDTO { homeId: mapValueOfType(json, r'homeId'), createdDate: mapDateTime(json, r'createdDate', ''), updatedDate: mapDateTime(json, r'updatedDate', ''), - triggers: Trigger.listFromJson(json[r'triggers']) ?? const [], - conditions: Condition.listFromJson(json[r'conditions']) ?? const [], - actions: Action.listFromJson(json[r'actions']) ?? const [], + triggers: Trigger.listFromJson(json[r'triggers']), + conditions: Condition.listFromJson(json[r'conditions']), + actions: Action.listFromJson(json[r'actions']), devicesIds: json[r'devicesIds'] is List ? (json[r'devicesIds'] as List).cast() : const [], - devices: DeviceDetailDTO.listFromJson(json[r'devices']) ?? const [], + devices: DeviceDetailDTO.listFromJson(json[r'devices']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -204,12 +226,10 @@ class AutomationDetailDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = AutomationDetailDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = AutomationDetailDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/automation_detail_dto_all_of.dart b/mycore_api/lib/model/automation_detail_dto_all_of.dart index dc5094e..1414e3e 100644 --- a/mycore_api/lib/model/automation_detail_dto_all_of.dart +++ b/mycore_api/lib/model/automation_detail_dto_all_of.dart @@ -51,23 +51,33 @@ class AutomationDetailDTOAllOf { String toString() => 'AutomationDetailDTOAllOf[triggers=$triggers, conditions=$conditions, actions=$actions, devicesIds=$devicesIds, devices=$devices]'; Map toJson() { - final _json = {}; - if (triggers != null) { - _json[r'triggers'] = triggers; + final json = {}; + if (this.triggers != null) { + json[r'triggers'] = this.triggers; + } else { + json[r'triggers'] = null; } - if (conditions != null) { - _json[r'conditions'] = conditions; + if (this.conditions != null) { + json[r'conditions'] = this.conditions; + } else { + json[r'conditions'] = null; } - if (actions != null) { - _json[r'actions'] = actions; + if (this.actions != null) { + json[r'actions'] = this.actions; + } else { + json[r'actions'] = null; } - if (devicesIds != null) { - _json[r'devicesIds'] = devicesIds; + if (this.devicesIds != null) { + json[r'devicesIds'] = this.devicesIds; + } else { + json[r'devicesIds'] = null; } - if (devices != null) { - _json[r'devices'] = devices; + if (this.devices != null) { + json[r'devices'] = this.devices; + } else { + json[r'devices'] = null; } - return _json; + return json; } /// Returns a new [AutomationDetailDTOAllOf] instance and imports its values from @@ -89,19 +99,19 @@ class AutomationDetailDTOAllOf { }()); return AutomationDetailDTOAllOf( - triggers: Trigger.listFromJson(json[r'triggers']) ?? const [], - conditions: Condition.listFromJson(json[r'conditions']) ?? const [], - actions: Action.listFromJson(json[r'actions']) ?? const [], + triggers: Trigger.listFromJson(json[r'triggers']), + conditions: Condition.listFromJson(json[r'conditions']), + actions: Action.listFromJson(json[r'actions']), devicesIds: json[r'devicesIds'] is List ? (json[r'devicesIds'] as List).cast() : const [], - devices: DeviceDetailDTO.listFromJson(json[r'devices']) ?? const [], + devices: DeviceDetailDTO.listFromJson(json[r'devices']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -132,12 +142,10 @@ class AutomationDetailDTOAllOf { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = AutomationDetailDTOAllOf.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = AutomationDetailDTOAllOf.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/automation_dto.dart b/mycore_api/lib/model/automation_dto.dart index 0e7f510..7b5ad25 100644 --- a/mycore_api/lib/model/automation_dto.dart +++ b/mycore_api/lib/model/automation_dto.dart @@ -74,26 +74,38 @@ class AutomationDTO { String toString() => 'AutomationDTO[id=$id, name=$name, active=$active, homeId=$homeId, createdDate=$createdDate, updatedDate=$updatedDate]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (active != null) { - _json[r'active'] = active; + if (this.active != null) { + json[r'active'] = this.active; + } else { + json[r'active'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - return _json; + return json; } /// Returns a new [AutomationDTO] instance and imports its values from @@ -126,7 +138,7 @@ class AutomationDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -157,12 +169,10 @@ class AutomationDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = AutomationDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = AutomationDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/automation_state.dart b/mycore_api/lib/model/automation_state.dart index fc72ac6..a0efacd 100644 --- a/mycore_api/lib/model/automation_state.dart +++ b/mycore_api/lib/model/automation_state.dart @@ -36,14 +36,18 @@ class AutomationState { String toString() => 'AutomationState[name=$name, value=$value]'; Map toJson() { - final _json = {}; - if (name != null) { - _json[r'name'] = name; + final json = {}; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (value != null) { - _json[r'value'] = value; + if (this.value != null) { + json[r'value'] = this.value; + } else { + json[r'value'] = null; } - return _json; + return json; } /// Returns a new [AutomationState] instance and imports its values from @@ -72,7 +76,7 @@ class AutomationState { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -103,12 +107,10 @@ class AutomationState { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = AutomationState.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = AutomationState.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/automation_triggered.dart b/mycore_api/lib/model/automation_triggered.dart index a3a5319..3f165b5 100644 --- a/mycore_api/lib/model/automation_triggered.dart +++ b/mycore_api/lib/model/automation_triggered.dart @@ -36,14 +36,18 @@ class AutomationTriggered { String toString() => 'AutomationTriggered[automationId=$automationId, automationName=$automationName]'; Map toJson() { - final _json = {}; - if (automationId != null) { - _json[r'automationId'] = automationId; + final json = {}; + if (this.automationId != null) { + json[r'automationId'] = this.automationId; + } else { + json[r'automationId'] = null; } - if (automationName != null) { - _json[r'automationName'] = automationName; + if (this.automationName != null) { + json[r'automationName'] = this.automationName; + } else { + json[r'automationName'] = null; } - return _json; + return json; } /// Returns a new [AutomationTriggered] instance and imports its values from @@ -72,7 +76,7 @@ class AutomationTriggered { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -103,12 +107,10 @@ class AutomationTriggered { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = AutomationTriggered.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = AutomationTriggered.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/azure_ad_auth_model.dart b/mycore_api/lib/model/azure_ad_auth_model.dart index e3f9eee..5dbda6f 100644 --- a/mycore_api/lib/model/azure_ad_auth_model.dart +++ b/mycore_api/lib/model/azure_ad_auth_model.dart @@ -31,11 +31,13 @@ class AzureADAuthModel { String toString() => 'AzureADAuthModel[apiKey=$apiKey]'; Map toJson() { - final _json = {}; - if (apiKey != null) { - _json[r'apiKey'] = apiKey; + final json = {}; + if (this.apiKey != null) { + json[r'apiKey'] = this.apiKey; + } else { + json[r'apiKey'] = null; } - return _json; + return json; } /// Returns a new [AzureADAuthModel] instance and imports its values from @@ -63,7 +65,7 @@ class AzureADAuthModel { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -94,12 +96,10 @@ class AzureADAuthModel { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = AzureADAuthModel.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = AzureADAuthModel.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/book.dart b/mycore_api/lib/model/book.dart index fc45aab..714ffcd 100644 --- a/mycore_api/lib/model/book.dart +++ b/mycore_api/lib/model/book.dart @@ -57,23 +57,33 @@ class Book { String toString() => 'Book[id=$id, bookName=$bookName, price=$price, category=$category, author=$author]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (bookName != null) { - _json[r'bookName'] = bookName; + if (this.bookName != null) { + json[r'bookName'] = this.bookName; + } else { + json[r'bookName'] = null; } - if (price != null) { - _json[r'price'] = price; + if (this.price != null) { + json[r'price'] = this.price; + } else { + json[r'price'] = null; } - if (category != null) { - _json[r'category'] = category; + if (this.category != null) { + json[r'category'] = this.category; + } else { + json[r'category'] = null; } - if (author != null) { - _json[r'author'] = author; + if (this.author != null) { + json[r'author'] = this.author; + } else { + json[r'author'] = null; } - return _json; + return json; } /// Returns a new [Book] instance and imports its values from @@ -107,7 +117,7 @@ class Book { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -138,12 +148,10 @@ class Book { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = Book.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = Book.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/condition.dart b/mycore_api/lib/model/condition.dart index 5e3a0ef..1d0a522 100644 --- a/mycore_api/lib/model/condition.dart +++ b/mycore_api/lib/model/condition.dart @@ -68,26 +68,38 @@ class Condition { String toString() => 'Condition[deviceId=$deviceId, state=$state, startTime=$startTime, endTime=$endTime, type=$type, value=$value]'; Map toJson() { - final _json = {}; - if (deviceId != null) { - _json[r'deviceId'] = deviceId; + final json = {}; + if (this.deviceId != null) { + json[r'deviceId'] = this.deviceId; + } else { + json[r'deviceId'] = null; } - if (state != null) { - _json[r'state'] = state; + if (this.state != null) { + json[r'state'] = this.state; + } else { + json[r'state'] = null; } - if (startTime != null) { - _json[r'startTime'] = startTime; + if (this.startTime != null) { + json[r'startTime'] = this.startTime; + } else { + json[r'startTime'] = null; } - if (endTime != null) { - _json[r'endTime'] = endTime; + if (this.endTime != null) { + json[r'endTime'] = this.endTime; + } else { + json[r'endTime'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (value != null) { - _json[r'value'] = value; + if (this.value != null) { + json[r'value'] = this.value; + } else { + json[r'value'] = null; } - return _json; + return json; } /// Returns a new [Condition] instance and imports its values from @@ -120,7 +132,7 @@ class Condition { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -151,12 +163,10 @@ class Condition { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = Condition.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = Condition.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/condition_state.dart b/mycore_api/lib/model/condition_state.dart index ef6fde5..491fecc 100644 --- a/mycore_api/lib/model/condition_state.dart +++ b/mycore_api/lib/model/condition_state.dart @@ -36,14 +36,18 @@ class ConditionState { String toString() => 'ConditionState[name=$name, value=$value]'; Map toJson() { - final _json = {}; - if (name != null) { - _json[r'name'] = name; + final json = {}; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (value != null) { - _json[r'value'] = value; + if (this.value != null) { + json[r'value'] = this.value; + } else { + json[r'value'] = null; } - return _json; + return json; } /// Returns a new [ConditionState] instance and imports its values from @@ -72,7 +76,7 @@ class ConditionState { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -103,12 +107,10 @@ class ConditionState { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = ConditionState.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ConditionState.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/condition_type.dart b/mycore_api/lib/model/condition_type.dart index cd39ab6..53d305c 100644 --- a/mycore_api/lib/model/condition_type.dart +++ b/mycore_api/lib/model/condition_type.dart @@ -34,7 +34,7 @@ class ConditionType { static ConditionType? fromJson(dynamic value) => ConditionTypeTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -67,7 +67,7 @@ class ConditionTypeTypeTransformer { /// and users are still using an old app with the old code. ConditionType? decode(dynamic data, {bool allowNull = true}) { if (data != null) { - switch (data.toString()) { + switch (data) { case r'STATE': return ConditionType.STATE; case r'TIME': return ConditionType.TIME; default: diff --git a/mycore_api/lib/model/condition_value.dart b/mycore_api/lib/model/condition_value.dart index bea1294..73eb287 100644 --- a/mycore_api/lib/model/condition_value.dart +++ b/mycore_api/lib/model/condition_value.dart @@ -42,7 +42,7 @@ class ConditionValue { static ConditionValue? fromJson(dynamic value) => ConditionValueTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -75,7 +75,7 @@ class ConditionValueTypeTransformer { /// and users are still using an old app with the old code. ConditionValue? decode(dynamic data, {bool allowNull = true}) { if (data != null) { - switch (data.toString()) { + switch (data) { case r'EQUAL': return ConditionValue.EQUAL; case r'NOT_EQUAL': return ConditionValue.NOT_EQUAL; case r'BIGGER': return ConditionValue.BIGGER; diff --git a/mycore_api/lib/model/connection_status.dart b/mycore_api/lib/model/connection_status.dart index 35642bb..2ac9b8f 100644 --- a/mycore_api/lib/model/connection_status.dart +++ b/mycore_api/lib/model/connection_status.dart @@ -36,7 +36,7 @@ class ConnectionStatus { static ConnectionStatus? fromJson(dynamic value) => ConnectionStatusTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -69,7 +69,7 @@ class ConnectionStatusTypeTransformer { /// and users are still using an old app with the old code. ConnectionStatus? decode(dynamic data, {bool allowNull = true}) { if (data != null) { - switch (data.toString()) { + switch (data) { case r'Connected': return ConnectionStatus.connected; case r'Disconnected': return ConnectionStatus.disconnected; case r'Unknown': return ConnectionStatus.unknown; diff --git a/mycore_api/lib/model/create_or_update_home_dto.dart b/mycore_api/lib/model/create_or_update_home_dto.dart index cee5952..ae35714 100644 --- a/mycore_api/lib/model/create_or_update_home_dto.dart +++ b/mycore_api/lib/model/create_or_update_home_dto.dart @@ -43,7 +43,7 @@ class CreateOrUpdateHomeDTO { /// bool? isDefault; - AlarmMode? currentAlarmMode; + HomeDTOCurrentAlarmMode? currentAlarmMode; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -90,32 +90,48 @@ class CreateOrUpdateHomeDTO { String toString() => 'CreateOrUpdateHomeDTO[id=$id, name=$name, isAlarm=$isAlarm, isDefault=$isDefault, currentAlarmMode=$currentAlarmMode, createdDate=$createdDate, updatedDate=$updatedDate, usersIds=$usersIds]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (isAlarm != null) { - _json[r'isAlarm'] = isAlarm; + if (this.isAlarm != null) { + json[r'isAlarm'] = this.isAlarm; + } else { + json[r'isAlarm'] = null; } - if (isDefault != null) { - _json[r'isDefault'] = isDefault; + if (this.isDefault != null) { + json[r'isDefault'] = this.isDefault; + } else { + json[r'isDefault'] = null; } - if (currentAlarmMode != null) { - _json[r'currentAlarmMode'] = currentAlarmMode; + if (this.currentAlarmMode != null) { + json[r'currentAlarmMode'] = this.currentAlarmMode; + } else { + json[r'currentAlarmMode'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (usersIds != null) { - _json[r'usersIds'] = usersIds; + if (this.usersIds != null) { + json[r'usersIds'] = this.usersIds; + } else { + json[r'usersIds'] = null; } - return _json; + return json; } /// Returns a new [CreateOrUpdateHomeDTO] instance and imports its values from @@ -141,7 +157,7 @@ class CreateOrUpdateHomeDTO { name: mapValueOfType(json, r'name'), isAlarm: mapValueOfType(json, r'isAlarm'), isDefault: mapValueOfType(json, r'isDefault'), - currentAlarmMode: AlarmMode.fromJson(json[r'currentAlarmMode']), + currentAlarmMode: HomeDTOCurrentAlarmMode.fromJson(json[r'currentAlarmMode']), createdDate: mapDateTime(json, r'createdDate', ''), updatedDate: mapDateTime(json, r'updatedDate', ''), usersIds: json[r'usersIds'] is List @@ -152,7 +168,7 @@ class CreateOrUpdateHomeDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -183,12 +199,10 @@ class CreateOrUpdateHomeDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = CreateOrUpdateHomeDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = CreateOrUpdateHomeDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/create_or_update_home_dto_all_of.dart b/mycore_api/lib/model/create_or_update_home_dto_all_of.dart index e1d3425..635198c 100644 --- a/mycore_api/lib/model/create_or_update_home_dto_all_of.dart +++ b/mycore_api/lib/model/create_or_update_home_dto_all_of.dart @@ -31,11 +31,13 @@ class CreateOrUpdateHomeDTOAllOf { String toString() => 'CreateOrUpdateHomeDTOAllOf[usersIds=$usersIds]'; Map toJson() { - final _json = {}; - if (usersIds != null) { - _json[r'usersIds'] = usersIds; + final json = {}; + if (this.usersIds != null) { + json[r'usersIds'] = this.usersIds; + } else { + json[r'usersIds'] = null; } - return _json; + return json; } /// Returns a new [CreateOrUpdateHomeDTOAllOf] instance and imports its values from @@ -65,7 +67,7 @@ class CreateOrUpdateHomeDTOAllOf { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -96,12 +98,10 @@ class CreateOrUpdateHomeDTOAllOf { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = CreateOrUpdateHomeDTOAllOf.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = CreateOrUpdateHomeDTOAllOf.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/device_detail_dto.dart b/mycore_api/lib/model/device_detail_dto.dart index c1931a3..f2d572f 100644 --- a/mycore_api/lib/model/device_detail_dto.dart +++ b/mycore_api/lib/model/device_detail_dto.dart @@ -25,6 +25,7 @@ class DeviceDetailDTO { this.providerId, this.providerName, this.lastStateDate, + this.lastMessageDate, this.battery, this.batteryStatus, this.firmwareVersion, @@ -33,6 +34,7 @@ class DeviceDetailDTO { this.meansOfCommunications = const [], this.createdDate, this.updatedDate, + this.lastMessage, this.lastState, this.ipAddress, this.serviceIdentification, @@ -40,6 +42,51 @@ class DeviceDetailDTO { this.groupIds = const [], this.properties, this.supportedOperations = const [], + this.isContact, + this.contact, + this.isIlluminance, + this.illuminance, + this.isBrightness, + this.brightness, + this.isState, + this.state, + this.isColorTemp, + this.colorTemp, + this.isColorXY, + this.colorX, + this.colorY, + this.isOccupation, + this.occupation, + this.isAlarm, + this.alarm, + this.isWaterLeak, + this.waterLeak, + this.isSmoke, + this.smoke, + this.isVibration, + this.vibration, + this.isAction, + this.action, + this.isTemperature, + this.temperature, + this.isHumidity, + this.humidity, + this.isPressure, + this.pressure, + this.isAirQuality, + this.airQuality, + this.isFanSpeed, + this.fanSpeed, + this.isFanMode, + this.fanMode, + this.isConsumption, + this.consumption, + this.isCurrentPower, + this.currentPower, + this.isVoltage, + this.voltage, + this.isLinkQuality, + this.linkQuality, }); String? id; @@ -90,6 +137,14 @@ class DeviceDetailDTO { /// DateTime? lastStateDate; + /// + /// 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. + /// + DateTime? lastMessageDate; + /// /// 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 @@ -136,6 +191,8 @@ class DeviceDetailDTO { /// DateTime? updatedDate; + String? lastMessage; + String? lastState; String? ipAddress; @@ -150,6 +207,324 @@ class DeviceDetailDTO { List? supportedOperations; + /// + /// 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? isContact; + + /// + /// 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? contact; + + /// + /// 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? isIlluminance; + + int? illuminance; + + /// + /// 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? isBrightness; + + /// + /// 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? brightness; + + /// + /// 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? isState; + + /// + /// 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? state; + + /// + /// 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? isColorTemp; + + /// + /// 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? colorTemp; + + /// + /// 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? isColorXY; + + /// + /// 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? colorX; + + /// + /// 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? colorY; + + /// + /// 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? isOccupation; + + /// + /// 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? occupation; + + /// + /// 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? isAlarm; + + /// + /// 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? alarm; + + /// + /// 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? isWaterLeak; + + /// + /// 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? waterLeak; + + /// + /// 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? isSmoke; + + /// + /// 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? smoke; + + /// + /// 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? isVibration; + + /// + /// 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? vibration; + + /// + /// 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? isAction; + + String? action; + + /// + /// 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? isTemperature; + + num? temperature; + + /// + /// 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? isHumidity; + + num? humidity; + + /// + /// 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? isPressure; + + num? pressure; + + /// + /// 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? isAirQuality; + + String? airQuality; + + /// + /// 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? isFanSpeed; + + /// + /// 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? fanSpeed; + + /// + /// 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? isFanMode; + + String? fanMode; + + /// + /// 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? isConsumption; + + /// + /// 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. + /// + num? consumption; + + /// + /// 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? isCurrentPower; + + /// + /// 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. + /// + num? currentPower; + + /// + /// 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? isVoltage; + + /// + /// 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. + /// + num? voltage; + + /// + /// 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? isLinkQuality; + + /// + /// 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? linkQuality; + @override bool operator ==(Object other) => identical(this, other) || other is DeviceDetailDTO && other.id == id && @@ -164,6 +539,7 @@ class DeviceDetailDTO { other.providerId == providerId && other.providerName == providerName && other.lastStateDate == lastStateDate && + other.lastMessageDate == lastMessageDate && other.battery == battery && other.batteryStatus == batteryStatus && other.firmwareVersion == firmwareVersion && @@ -172,13 +548,59 @@ class DeviceDetailDTO { other.meansOfCommunications == meansOfCommunications && other.createdDate == createdDate && other.updatedDate == updatedDate && + other.lastMessage == lastMessage && other.lastState == lastState && other.ipAddress == ipAddress && other.serviceIdentification == serviceIdentification && other.manufacturerName == manufacturerName && other.groupIds == groupIds && other.properties == properties && - other.supportedOperations == supportedOperations; + other.supportedOperations == supportedOperations && + other.isContact == isContact && + other.contact == contact && + other.isIlluminance == isIlluminance && + other.illuminance == illuminance && + other.isBrightness == isBrightness && + other.brightness == brightness && + other.isState == isState && + other.state == state && + other.isColorTemp == isColorTemp && + other.colorTemp == colorTemp && + other.isColorXY == isColorXY && + other.colorX == colorX && + other.colorY == colorY && + other.isOccupation == isOccupation && + other.occupation == occupation && + other.isAlarm == isAlarm && + other.alarm == alarm && + other.isWaterLeak == isWaterLeak && + other.waterLeak == waterLeak && + other.isSmoke == isSmoke && + other.smoke == smoke && + other.isVibration == isVibration && + other.vibration == vibration && + other.isAction == isAction && + other.action == action && + other.isTemperature == isTemperature && + other.temperature == temperature && + other.isHumidity == isHumidity && + other.humidity == humidity && + other.isPressure == isPressure && + other.pressure == pressure && + other.isAirQuality == isAirQuality && + other.airQuality == airQuality && + other.isFanSpeed == isFanSpeed && + other.fanSpeed == fanSpeed && + other.isFanMode == isFanMode && + other.fanMode == fanMode && + other.isConsumption == isConsumption && + other.consumption == consumption && + other.isCurrentPower == isCurrentPower && + other.currentPower == currentPower && + other.isVoltage == isVoltage && + other.voltage == voltage && + other.isLinkQuality == isLinkQuality && + other.linkQuality == linkQuality; @override int get hashCode => @@ -195,6 +617,7 @@ class DeviceDetailDTO { (providerId == null ? 0 : providerId!.hashCode) + (providerName == null ? 0 : providerName!.hashCode) + (lastStateDate == null ? 0 : lastStateDate!.hashCode) + + (lastMessageDate == null ? 0 : lastMessageDate!.hashCode) + (battery == null ? 0 : battery!.hashCode) + (batteryStatus == null ? 0 : batteryStatus!.hashCode) + (firmwareVersion == null ? 0 : firmwareVersion!.hashCode) + @@ -203,101 +626,436 @@ class DeviceDetailDTO { (meansOfCommunications == null ? 0 : meansOfCommunications!.hashCode) + (createdDate == null ? 0 : createdDate!.hashCode) + (updatedDate == null ? 0 : updatedDate!.hashCode) + + (lastMessage == null ? 0 : lastMessage!.hashCode) + (lastState == null ? 0 : lastState!.hashCode) + (ipAddress == null ? 0 : ipAddress!.hashCode) + (serviceIdentification == null ? 0 : serviceIdentification!.hashCode) + (manufacturerName == null ? 0 : manufacturerName!.hashCode) + (groupIds == null ? 0 : groupIds!.hashCode) + (properties == null ? 0 : properties!.hashCode) + - (supportedOperations == null ? 0 : supportedOperations!.hashCode); + (supportedOperations == null ? 0 : supportedOperations!.hashCode) + + (isContact == null ? 0 : isContact!.hashCode) + + (contact == null ? 0 : contact!.hashCode) + + (isIlluminance == null ? 0 : isIlluminance!.hashCode) + + (illuminance == null ? 0 : illuminance!.hashCode) + + (isBrightness == null ? 0 : isBrightness!.hashCode) + + (brightness == null ? 0 : brightness!.hashCode) + + (isState == null ? 0 : isState!.hashCode) + + (state == null ? 0 : state!.hashCode) + + (isColorTemp == null ? 0 : isColorTemp!.hashCode) + + (colorTemp == null ? 0 : colorTemp!.hashCode) + + (isColorXY == null ? 0 : isColorXY!.hashCode) + + (colorX == null ? 0 : colorX!.hashCode) + + (colorY == null ? 0 : colorY!.hashCode) + + (isOccupation == null ? 0 : isOccupation!.hashCode) + + (occupation == null ? 0 : occupation!.hashCode) + + (isAlarm == null ? 0 : isAlarm!.hashCode) + + (alarm == null ? 0 : alarm!.hashCode) + + (isWaterLeak == null ? 0 : isWaterLeak!.hashCode) + + (waterLeak == null ? 0 : waterLeak!.hashCode) + + (isSmoke == null ? 0 : isSmoke!.hashCode) + + (smoke == null ? 0 : smoke!.hashCode) + + (isVibration == null ? 0 : isVibration!.hashCode) + + (vibration == null ? 0 : vibration!.hashCode) + + (isAction == null ? 0 : isAction!.hashCode) + + (action == null ? 0 : action!.hashCode) + + (isTemperature == null ? 0 : isTemperature!.hashCode) + + (temperature == null ? 0 : temperature!.hashCode) + + (isHumidity == null ? 0 : isHumidity!.hashCode) + + (humidity == null ? 0 : humidity!.hashCode) + + (isPressure == null ? 0 : isPressure!.hashCode) + + (pressure == null ? 0 : pressure!.hashCode) + + (isAirQuality == null ? 0 : isAirQuality!.hashCode) + + (airQuality == null ? 0 : airQuality!.hashCode) + + (isFanSpeed == null ? 0 : isFanSpeed!.hashCode) + + (fanSpeed == null ? 0 : fanSpeed!.hashCode) + + (isFanMode == null ? 0 : isFanMode!.hashCode) + + (fanMode == null ? 0 : fanMode!.hashCode) + + (isConsumption == null ? 0 : isConsumption!.hashCode) + + (consumption == null ? 0 : consumption!.hashCode) + + (isCurrentPower == null ? 0 : isCurrentPower!.hashCode) + + (currentPower == null ? 0 : currentPower!.hashCode) + + (isVoltage == null ? 0 : isVoltage!.hashCode) + + (voltage == null ? 0 : voltage!.hashCode) + + (isLinkQuality == null ? 0 : isLinkQuality!.hashCode) + + (linkQuality == null ? 0 : linkQuality!.hashCode); @override - String toString() => 'DeviceDetailDTO[id=$id, homeId=$homeId, description=$description, name=$name, model=$model, type=$type, status=$status, connectionStatus=$connectionStatus, roomId=$roomId, providerId=$providerId, providerName=$providerName, lastStateDate=$lastStateDate, battery=$battery, batteryStatus=$batteryStatus, firmwareVersion=$firmwareVersion, hardwareVersion=$hardwareVersion, port=$port, meansOfCommunications=$meansOfCommunications, createdDate=$createdDate, updatedDate=$updatedDate, lastState=$lastState, ipAddress=$ipAddress, serviceIdentification=$serviceIdentification, manufacturerName=$manufacturerName, groupIds=$groupIds, properties=$properties, supportedOperations=$supportedOperations]'; + String toString() => 'DeviceDetailDTO[id=$id, homeId=$homeId, description=$description, name=$name, model=$model, type=$type, status=$status, connectionStatus=$connectionStatus, roomId=$roomId, providerId=$providerId, providerName=$providerName, lastStateDate=$lastStateDate, lastMessageDate=$lastMessageDate, battery=$battery, batteryStatus=$batteryStatus, firmwareVersion=$firmwareVersion, hardwareVersion=$hardwareVersion, port=$port, meansOfCommunications=$meansOfCommunications, createdDate=$createdDate, updatedDate=$updatedDate, lastMessage=$lastMessage, lastState=$lastState, ipAddress=$ipAddress, serviceIdentification=$serviceIdentification, manufacturerName=$manufacturerName, groupIds=$groupIds, properties=$properties, supportedOperations=$supportedOperations, isContact=$isContact, contact=$contact, isIlluminance=$isIlluminance, illuminance=$illuminance, isBrightness=$isBrightness, brightness=$brightness, isState=$isState, state=$state, isColorTemp=$isColorTemp, colorTemp=$colorTemp, isColorXY=$isColorXY, colorX=$colorX, colorY=$colorY, isOccupation=$isOccupation, occupation=$occupation, isAlarm=$isAlarm, alarm=$alarm, isWaterLeak=$isWaterLeak, waterLeak=$waterLeak, isSmoke=$isSmoke, smoke=$smoke, isVibration=$isVibration, vibration=$vibration, isAction=$isAction, action=$action, isTemperature=$isTemperature, temperature=$temperature, isHumidity=$isHumidity, humidity=$humidity, isPressure=$isPressure, pressure=$pressure, isAirQuality=$isAirQuality, airQuality=$airQuality, isFanSpeed=$isFanSpeed, fanSpeed=$fanSpeed, isFanMode=$isFanMode, fanMode=$fanMode, isConsumption=$isConsumption, consumption=$consumption, isCurrentPower=$isCurrentPower, currentPower=$currentPower, isVoltage=$isVoltage, voltage=$voltage, isLinkQuality=$isLinkQuality, linkQuality=$linkQuality]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (description != null) { - _json[r'description'] = description; + if (this.description != null) { + json[r'description'] = this.description; + } else { + json[r'description'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (model != null) { - _json[r'model'] = model; + if (this.model != null) { + json[r'model'] = this.model; + } else { + json[r'model'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (status != null) { - _json[r'status'] = status; + if (this.status != null) { + json[r'status'] = this.status; + } else { + json[r'status'] = null; } - if (connectionStatus != null) { - _json[r'connectionStatus'] = connectionStatus; + if (this.connectionStatus != null) { + json[r'connectionStatus'] = this.connectionStatus; + } else { + json[r'connectionStatus'] = null; } - if (roomId != null) { - _json[r'roomId'] = roomId; + if (this.roomId != null) { + json[r'roomId'] = this.roomId; + } else { + json[r'roomId'] = null; } - if (providerId != null) { - _json[r'providerId'] = providerId; + if (this.providerId != null) { + json[r'providerId'] = this.providerId; + } else { + json[r'providerId'] = null; } - if (providerName != null) { - _json[r'providerName'] = providerName; + if (this.providerName != null) { + json[r'providerName'] = this.providerName; + } else { + json[r'providerName'] = null; } - if (lastStateDate != null) { - _json[r'lastStateDate'] = lastStateDate!.toUtc().toIso8601String(); + if (this.lastStateDate != null) { + json[r'lastStateDate'] = this.lastStateDate!.toUtc().toIso8601String(); + } else { + json[r'lastStateDate'] = null; } - if (battery != null) { - _json[r'battery'] = battery; + if (this.lastMessageDate != null) { + json[r'lastMessageDate'] = this.lastMessageDate!.toUtc().toIso8601String(); + } else { + json[r'lastMessageDate'] = null; } - if (batteryStatus != null) { - _json[r'batteryStatus'] = batteryStatus; + if (this.battery != null) { + json[r'battery'] = this.battery; + } else { + json[r'battery'] = null; } - if (firmwareVersion != null) { - _json[r'firmwareVersion'] = firmwareVersion; + if (this.batteryStatus != null) { + json[r'batteryStatus'] = this.batteryStatus; + } else { + json[r'batteryStatus'] = null; } - if (hardwareVersion != null) { - _json[r'hardwareVersion'] = hardwareVersion; + if (this.firmwareVersion != null) { + json[r'firmwareVersion'] = this.firmwareVersion; + } else { + json[r'firmwareVersion'] = null; } - if (port != null) { - _json[r'port'] = port; + if (this.hardwareVersion != null) { + json[r'hardwareVersion'] = this.hardwareVersion; + } else { + json[r'hardwareVersion'] = null; } - if (meansOfCommunications != null) { - _json[r'meansOfCommunications'] = meansOfCommunications; + if (this.port != null) { + json[r'port'] = this.port; + } else { + json[r'port'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.meansOfCommunications != null) { + json[r'meansOfCommunications'] = this.meansOfCommunications; + } else { + json[r'meansOfCommunications'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (lastState != null) { - _json[r'lastState'] = lastState; + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (ipAddress != null) { - _json[r'ipAddress'] = ipAddress; + if (this.lastMessage != null) { + json[r'lastMessage'] = this.lastMessage; + } else { + json[r'lastMessage'] = null; } - if (serviceIdentification != null) { - _json[r'serviceIdentification'] = serviceIdentification; + if (this.lastState != null) { + json[r'lastState'] = this.lastState; + } else { + json[r'lastState'] = null; } - if (manufacturerName != null) { - _json[r'manufacturerName'] = manufacturerName; + if (this.ipAddress != null) { + json[r'ipAddress'] = this.ipAddress; + } else { + json[r'ipAddress'] = null; } - if (groupIds != null) { - _json[r'groupIds'] = groupIds; + if (this.serviceIdentification != null) { + json[r'serviceIdentification'] = this.serviceIdentification; + } else { + json[r'serviceIdentification'] = null; } - if (properties != null) { - _json[r'properties'] = properties; + if (this.manufacturerName != null) { + json[r'manufacturerName'] = this.manufacturerName; + } else { + json[r'manufacturerName'] = null; } - if (supportedOperations != null) { - _json[r'supportedOperations'] = supportedOperations; + if (this.groupIds != null) { + json[r'groupIds'] = this.groupIds; + } else { + json[r'groupIds'] = null; } - return _json; + if (this.properties != null) { + json[r'properties'] = this.properties; + } else { + json[r'properties'] = null; + } + if (this.supportedOperations != null) { + json[r'supportedOperations'] = this.supportedOperations; + } else { + json[r'supportedOperations'] = null; + } + if (this.isContact != null) { + json[r'isContact'] = this.isContact; + } else { + json[r'isContact'] = null; + } + if (this.contact != null) { + json[r'contact'] = this.contact; + } else { + json[r'contact'] = null; + } + if (this.isIlluminance != null) { + json[r'isIlluminance'] = this.isIlluminance; + } else { + json[r'isIlluminance'] = null; + } + if (this.illuminance != null) { + json[r'illuminance'] = this.illuminance; + } else { + json[r'illuminance'] = null; + } + if (this.isBrightness != null) { + json[r'isBrightness'] = this.isBrightness; + } else { + json[r'isBrightness'] = null; + } + if (this.brightness != null) { + json[r'brightness'] = this.brightness; + } else { + json[r'brightness'] = null; + } + if (this.isState != null) { + json[r'isState'] = this.isState; + } else { + json[r'isState'] = null; + } + if (this.state != null) { + json[r'state'] = this.state; + } else { + json[r'state'] = null; + } + if (this.isColorTemp != null) { + json[r'isColorTemp'] = this.isColorTemp; + } else { + json[r'isColorTemp'] = null; + } + if (this.colorTemp != null) { + json[r'colorTemp'] = this.colorTemp; + } else { + json[r'colorTemp'] = null; + } + if (this.isColorXY != null) { + json[r'isColorXY'] = this.isColorXY; + } else { + json[r'isColorXY'] = null; + } + if (this.colorX != null) { + json[r'colorX'] = this.colorX; + } else { + json[r'colorX'] = null; + } + if (this.colorY != null) { + json[r'colorY'] = this.colorY; + } else { + json[r'colorY'] = null; + } + if (this.isOccupation != null) { + json[r'isOccupation'] = this.isOccupation; + } else { + json[r'isOccupation'] = null; + } + if (this.occupation != null) { + json[r'occupation'] = this.occupation; + } else { + json[r'occupation'] = null; + } + if (this.isAlarm != null) { + json[r'isAlarm'] = this.isAlarm; + } else { + json[r'isAlarm'] = null; + } + if (this.alarm != null) { + json[r'alarm'] = this.alarm; + } else { + json[r'alarm'] = null; + } + if (this.isWaterLeak != null) { + json[r'isWaterLeak'] = this.isWaterLeak; + } else { + json[r'isWaterLeak'] = null; + } + if (this.waterLeak != null) { + json[r'waterLeak'] = this.waterLeak; + } else { + json[r'waterLeak'] = null; + } + if (this.isSmoke != null) { + json[r'isSmoke'] = this.isSmoke; + } else { + json[r'isSmoke'] = null; + } + if (this.smoke != null) { + json[r'smoke'] = this.smoke; + } else { + json[r'smoke'] = null; + } + if (this.isVibration != null) { + json[r'isVibration'] = this.isVibration; + } else { + json[r'isVibration'] = null; + } + if (this.vibration != null) { + json[r'vibration'] = this.vibration; + } else { + json[r'vibration'] = null; + } + if (this.isAction != null) { + json[r'isAction'] = this.isAction; + } else { + json[r'isAction'] = null; + } + if (this.action != null) { + json[r'action'] = this.action; + } else { + json[r'action'] = null; + } + if (this.isTemperature != null) { + json[r'isTemperature'] = this.isTemperature; + } else { + json[r'isTemperature'] = null; + } + if (this.temperature != null) { + json[r'temperature'] = this.temperature; + } else { + json[r'temperature'] = null; + } + if (this.isHumidity != null) { + json[r'isHumidity'] = this.isHumidity; + } else { + json[r'isHumidity'] = null; + } + if (this.humidity != null) { + json[r'humidity'] = this.humidity; + } else { + json[r'humidity'] = null; + } + if (this.isPressure != null) { + json[r'isPressure'] = this.isPressure; + } else { + json[r'isPressure'] = null; + } + if (this.pressure != null) { + json[r'pressure'] = this.pressure; + } else { + json[r'pressure'] = null; + } + if (this.isAirQuality != null) { + json[r'isAirQuality'] = this.isAirQuality; + } else { + json[r'isAirQuality'] = null; + } + if (this.airQuality != null) { + json[r'airQuality'] = this.airQuality; + } else { + json[r'airQuality'] = null; + } + if (this.isFanSpeed != null) { + json[r'isFanSpeed'] = this.isFanSpeed; + } else { + json[r'isFanSpeed'] = null; + } + if (this.fanSpeed != null) { + json[r'fanSpeed'] = this.fanSpeed; + } else { + json[r'fanSpeed'] = null; + } + if (this.isFanMode != null) { + json[r'isFanMode'] = this.isFanMode; + } else { + json[r'isFanMode'] = null; + } + if (this.fanMode != null) { + json[r'fanMode'] = this.fanMode; + } else { + json[r'fanMode'] = null; + } + if (this.isConsumption != null) { + json[r'isConsumption'] = this.isConsumption; + } else { + json[r'isConsumption'] = null; + } + if (this.consumption != null) { + json[r'consumption'] = this.consumption; + } else { + json[r'consumption'] = null; + } + if (this.isCurrentPower != null) { + json[r'isCurrentPower'] = this.isCurrentPower; + } else { + json[r'isCurrentPower'] = null; + } + if (this.currentPower != null) { + json[r'currentPower'] = this.currentPower; + } else { + json[r'currentPower'] = null; + } + if (this.isVoltage != null) { + json[r'isVoltage'] = this.isVoltage; + } else { + json[r'isVoltage'] = null; + } + if (this.voltage != null) { + json[r'voltage'] = this.voltage; + } else { + json[r'voltage'] = null; + } + if (this.isLinkQuality != null) { + json[r'isLinkQuality'] = this.isLinkQuality; + } else { + json[r'isLinkQuality'] = null; + } + if (this.linkQuality != null) { + json[r'linkQuality'] = this.linkQuality; + } else { + json[r'linkQuality'] = null; + } + return json; } /// Returns a new [DeviceDetailDTO] instance and imports its values from @@ -331,14 +1089,16 @@ class DeviceDetailDTO { providerId: mapValueOfType(json, r'providerId'), providerName: mapValueOfType(json, r'providerName'), lastStateDate: mapDateTime(json, r'lastStateDate', ''), + lastMessageDate: mapDateTime(json, r'lastMessageDate', ''), battery: mapValueOfType(json, r'battery'), batteryStatus: mapValueOfType(json, r'batteryStatus'), firmwareVersion: mapValueOfType(json, r'firmwareVersion'), hardwareVersion: mapValueOfType(json, r'hardwareVersion'), port: mapValueOfType(json, r'port'), - meansOfCommunications: MeansOfCommunication.listFromJson(json[r'meansOfCommunications']) ?? const [], + meansOfCommunications: MeansOfCommunication.listFromJson(json[r'meansOfCommunications']), createdDate: mapDateTime(json, r'createdDate', ''), updatedDate: mapDateTime(json, r'updatedDate', ''), + lastMessage: mapValueOfType(json, r'lastMessage'), lastState: mapValueOfType(json, r'lastState'), ipAddress: mapValueOfType(json, r'ipAddress'), serviceIdentification: mapValueOfType(json, r'serviceIdentification'), @@ -350,12 +1110,69 @@ class DeviceDetailDTO { supportedOperations: json[r'supportedOperations'] is List ? (json[r'supportedOperations'] as List).cast() : const [], + isContact: mapValueOfType(json, r'isContact'), + contact: mapValueOfType(json, r'contact'), + isIlluminance: mapValueOfType(json, r'isIlluminance'), + illuminance: mapValueOfType(json, r'illuminance'), + isBrightness: mapValueOfType(json, r'isBrightness'), + brightness: mapValueOfType(json, r'brightness'), + isState: mapValueOfType(json, r'isState'), + state: mapValueOfType(json, r'state'), + isColorTemp: mapValueOfType(json, r'isColorTemp'), + colorTemp: mapValueOfType(json, r'colorTemp'), + isColorXY: mapValueOfType(json, r'isColorXY'), + colorX: mapValueOfType(json, r'colorX'), + colorY: mapValueOfType(json, r'colorY'), + isOccupation: mapValueOfType(json, r'isOccupation'), + occupation: mapValueOfType(json, r'occupation'), + isAlarm: mapValueOfType(json, r'isAlarm'), + alarm: mapValueOfType(json, r'alarm'), + isWaterLeak: mapValueOfType(json, r'isWaterLeak'), + waterLeak: mapValueOfType(json, r'waterLeak'), + isSmoke: mapValueOfType(json, r'isSmoke'), + smoke: mapValueOfType(json, r'smoke'), + isVibration: mapValueOfType(json, r'isVibration'), + vibration: mapValueOfType(json, r'vibration'), + isAction: mapValueOfType(json, r'isAction'), + action: mapValueOfType(json, r'action'), + isTemperature: mapValueOfType(json, r'isTemperature'), + temperature: json[r'temperature'] == null + ? null + : num.parse(json[r'temperature'].toString()), + isHumidity: mapValueOfType(json, r'isHumidity'), + humidity: json[r'humidity'] == null + ? null + : num.parse(json[r'humidity'].toString()), + isPressure: mapValueOfType(json, r'isPressure'), + pressure: json[r'pressure'] == null + ? null + : num.parse(json[r'pressure'].toString()), + isAirQuality: mapValueOfType(json, r'isAirQuality'), + airQuality: mapValueOfType(json, r'airQuality'), + isFanSpeed: mapValueOfType(json, r'isFanSpeed'), + fanSpeed: mapValueOfType(json, r'fanSpeed'), + isFanMode: mapValueOfType(json, r'isFanMode'), + fanMode: mapValueOfType(json, r'fanMode'), + isConsumption: mapValueOfType(json, r'isConsumption'), + consumption: json[r'consumption'] == null + ? null + : num.parse(json[r'consumption'].toString()), + isCurrentPower: mapValueOfType(json, r'isCurrentPower'), + currentPower: json[r'currentPower'] == null + ? null + : num.parse(json[r'currentPower'].toString()), + isVoltage: mapValueOfType(json, r'isVoltage'), + voltage: json[r'voltage'] == null + ? null + : num.parse(json[r'voltage'].toString()), + isLinkQuality: mapValueOfType(json, r'isLinkQuality'), + linkQuality: mapValueOfType(json, r'linkQuality'), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -386,12 +1203,10 @@ class DeviceDetailDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = DeviceDetailDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = DeviceDetailDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/device_detail_dto_all_of.dart b/mycore_api/lib/model/device_detail_dto_all_of.dart index a671cf3..0469d75 100644 --- a/mycore_api/lib/model/device_detail_dto_all_of.dart +++ b/mycore_api/lib/model/device_detail_dto_all_of.dart @@ -19,6 +19,7 @@ class DeviceDetailDTOAllOf { this.meansOfCommunications = const [], this.createdDate, this.updatedDate, + this.lastMessage, this.lastState, this.ipAddress, this.serviceIdentification, @@ -26,6 +27,51 @@ class DeviceDetailDTOAllOf { this.groupIds = const [], this.properties, this.supportedOperations = const [], + this.isContact, + this.contact, + this.isIlluminance, + this.illuminance, + this.isBrightness, + this.brightness, + this.isState, + this.state, + this.isColorTemp, + this.colorTemp, + this.isColorXY, + this.colorX, + this.colorY, + this.isOccupation, + this.occupation, + this.isAlarm, + this.alarm, + this.isWaterLeak, + this.waterLeak, + this.isSmoke, + this.smoke, + this.isVibration, + this.vibration, + this.isAction, + this.action, + this.isTemperature, + this.temperature, + this.isHumidity, + this.humidity, + this.isPressure, + this.pressure, + this.isAirQuality, + this.airQuality, + this.isFanSpeed, + this.fanSpeed, + this.isFanMode, + this.fanMode, + this.isConsumption, + this.consumption, + this.isCurrentPower, + this.currentPower, + this.isVoltage, + this.voltage, + this.isLinkQuality, + this.linkQuality, }); String? firmwareVersion; @@ -58,6 +104,8 @@ class DeviceDetailDTOAllOf { /// DateTime? updatedDate; + String? lastMessage; + String? lastState; String? ipAddress; @@ -72,6 +120,324 @@ class DeviceDetailDTOAllOf { List? supportedOperations; + /// + /// 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? isContact; + + /// + /// 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? contact; + + /// + /// 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? isIlluminance; + + int? illuminance; + + /// + /// 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? isBrightness; + + /// + /// 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? brightness; + + /// + /// 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? isState; + + /// + /// 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? state; + + /// + /// 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? isColorTemp; + + /// + /// 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? colorTemp; + + /// + /// 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? isColorXY; + + /// + /// 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? colorX; + + /// + /// 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? colorY; + + /// + /// 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? isOccupation; + + /// + /// 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? occupation; + + /// + /// 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? isAlarm; + + /// + /// 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? alarm; + + /// + /// 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? isWaterLeak; + + /// + /// 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? waterLeak; + + /// + /// 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? isSmoke; + + /// + /// 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? smoke; + + /// + /// 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? isVibration; + + /// + /// 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? vibration; + + /// + /// 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? isAction; + + String? action; + + /// + /// 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? isTemperature; + + num? temperature; + + /// + /// 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? isHumidity; + + num? humidity; + + /// + /// 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? isPressure; + + num? pressure; + + /// + /// 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? isAirQuality; + + String? airQuality; + + /// + /// 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? isFanSpeed; + + /// + /// 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? fanSpeed; + + /// + /// 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? isFanMode; + + String? fanMode; + + /// + /// 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? isConsumption; + + /// + /// 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. + /// + num? consumption; + + /// + /// 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? isCurrentPower; + + /// + /// 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. + /// + num? currentPower; + + /// + /// 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? isVoltage; + + /// + /// 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. + /// + num? voltage; + + /// + /// 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? isLinkQuality; + + /// + /// 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? linkQuality; + @override bool operator ==(Object other) => identical(this, other) || other is DeviceDetailDTOAllOf && other.firmwareVersion == firmwareVersion && @@ -80,13 +446,59 @@ class DeviceDetailDTOAllOf { other.meansOfCommunications == meansOfCommunications && other.createdDate == createdDate && other.updatedDate == updatedDate && + other.lastMessage == lastMessage && other.lastState == lastState && other.ipAddress == ipAddress && other.serviceIdentification == serviceIdentification && other.manufacturerName == manufacturerName && other.groupIds == groupIds && other.properties == properties && - other.supportedOperations == supportedOperations; + other.supportedOperations == supportedOperations && + other.isContact == isContact && + other.contact == contact && + other.isIlluminance == isIlluminance && + other.illuminance == illuminance && + other.isBrightness == isBrightness && + other.brightness == brightness && + other.isState == isState && + other.state == state && + other.isColorTemp == isColorTemp && + other.colorTemp == colorTemp && + other.isColorXY == isColorXY && + other.colorX == colorX && + other.colorY == colorY && + other.isOccupation == isOccupation && + other.occupation == occupation && + other.isAlarm == isAlarm && + other.alarm == alarm && + other.isWaterLeak == isWaterLeak && + other.waterLeak == waterLeak && + other.isSmoke == isSmoke && + other.smoke == smoke && + other.isVibration == isVibration && + other.vibration == vibration && + other.isAction == isAction && + other.action == action && + other.isTemperature == isTemperature && + other.temperature == temperature && + other.isHumidity == isHumidity && + other.humidity == humidity && + other.isPressure == isPressure && + other.pressure == pressure && + other.isAirQuality == isAirQuality && + other.airQuality == airQuality && + other.isFanSpeed == isFanSpeed && + other.fanSpeed == fanSpeed && + other.isFanMode == isFanMode && + other.fanMode == fanMode && + other.isConsumption == isConsumption && + other.consumption == consumption && + other.isCurrentPower == isCurrentPower && + other.currentPower == currentPower && + other.isVoltage == isVoltage && + other.voltage == voltage && + other.isLinkQuality == isLinkQuality && + other.linkQuality == linkQuality; @override int get hashCode => @@ -97,59 +509,361 @@ class DeviceDetailDTOAllOf { (meansOfCommunications == null ? 0 : meansOfCommunications!.hashCode) + (createdDate == null ? 0 : createdDate!.hashCode) + (updatedDate == null ? 0 : updatedDate!.hashCode) + + (lastMessage == null ? 0 : lastMessage!.hashCode) + (lastState == null ? 0 : lastState!.hashCode) + (ipAddress == null ? 0 : ipAddress!.hashCode) + (serviceIdentification == null ? 0 : serviceIdentification!.hashCode) + (manufacturerName == null ? 0 : manufacturerName!.hashCode) + (groupIds == null ? 0 : groupIds!.hashCode) + (properties == null ? 0 : properties!.hashCode) + - (supportedOperations == null ? 0 : supportedOperations!.hashCode); + (supportedOperations == null ? 0 : supportedOperations!.hashCode) + + (isContact == null ? 0 : isContact!.hashCode) + + (contact == null ? 0 : contact!.hashCode) + + (isIlluminance == null ? 0 : isIlluminance!.hashCode) + + (illuminance == null ? 0 : illuminance!.hashCode) + + (isBrightness == null ? 0 : isBrightness!.hashCode) + + (brightness == null ? 0 : brightness!.hashCode) + + (isState == null ? 0 : isState!.hashCode) + + (state == null ? 0 : state!.hashCode) + + (isColorTemp == null ? 0 : isColorTemp!.hashCode) + + (colorTemp == null ? 0 : colorTemp!.hashCode) + + (isColorXY == null ? 0 : isColorXY!.hashCode) + + (colorX == null ? 0 : colorX!.hashCode) + + (colorY == null ? 0 : colorY!.hashCode) + + (isOccupation == null ? 0 : isOccupation!.hashCode) + + (occupation == null ? 0 : occupation!.hashCode) + + (isAlarm == null ? 0 : isAlarm!.hashCode) + + (alarm == null ? 0 : alarm!.hashCode) + + (isWaterLeak == null ? 0 : isWaterLeak!.hashCode) + + (waterLeak == null ? 0 : waterLeak!.hashCode) + + (isSmoke == null ? 0 : isSmoke!.hashCode) + + (smoke == null ? 0 : smoke!.hashCode) + + (isVibration == null ? 0 : isVibration!.hashCode) + + (vibration == null ? 0 : vibration!.hashCode) + + (isAction == null ? 0 : isAction!.hashCode) + + (action == null ? 0 : action!.hashCode) + + (isTemperature == null ? 0 : isTemperature!.hashCode) + + (temperature == null ? 0 : temperature!.hashCode) + + (isHumidity == null ? 0 : isHumidity!.hashCode) + + (humidity == null ? 0 : humidity!.hashCode) + + (isPressure == null ? 0 : isPressure!.hashCode) + + (pressure == null ? 0 : pressure!.hashCode) + + (isAirQuality == null ? 0 : isAirQuality!.hashCode) + + (airQuality == null ? 0 : airQuality!.hashCode) + + (isFanSpeed == null ? 0 : isFanSpeed!.hashCode) + + (fanSpeed == null ? 0 : fanSpeed!.hashCode) + + (isFanMode == null ? 0 : isFanMode!.hashCode) + + (fanMode == null ? 0 : fanMode!.hashCode) + + (isConsumption == null ? 0 : isConsumption!.hashCode) + + (consumption == null ? 0 : consumption!.hashCode) + + (isCurrentPower == null ? 0 : isCurrentPower!.hashCode) + + (currentPower == null ? 0 : currentPower!.hashCode) + + (isVoltage == null ? 0 : isVoltage!.hashCode) + + (voltage == null ? 0 : voltage!.hashCode) + + (isLinkQuality == null ? 0 : isLinkQuality!.hashCode) + + (linkQuality == null ? 0 : linkQuality!.hashCode); @override - String toString() => 'DeviceDetailDTOAllOf[firmwareVersion=$firmwareVersion, hardwareVersion=$hardwareVersion, port=$port, meansOfCommunications=$meansOfCommunications, createdDate=$createdDate, updatedDate=$updatedDate, lastState=$lastState, ipAddress=$ipAddress, serviceIdentification=$serviceIdentification, manufacturerName=$manufacturerName, groupIds=$groupIds, properties=$properties, supportedOperations=$supportedOperations]'; + String toString() => 'DeviceDetailDTOAllOf[firmwareVersion=$firmwareVersion, hardwareVersion=$hardwareVersion, port=$port, meansOfCommunications=$meansOfCommunications, createdDate=$createdDate, updatedDate=$updatedDate, lastMessage=$lastMessage, lastState=$lastState, ipAddress=$ipAddress, serviceIdentification=$serviceIdentification, manufacturerName=$manufacturerName, groupIds=$groupIds, properties=$properties, supportedOperations=$supportedOperations, isContact=$isContact, contact=$contact, isIlluminance=$isIlluminance, illuminance=$illuminance, isBrightness=$isBrightness, brightness=$brightness, isState=$isState, state=$state, isColorTemp=$isColorTemp, colorTemp=$colorTemp, isColorXY=$isColorXY, colorX=$colorX, colorY=$colorY, isOccupation=$isOccupation, occupation=$occupation, isAlarm=$isAlarm, alarm=$alarm, isWaterLeak=$isWaterLeak, waterLeak=$waterLeak, isSmoke=$isSmoke, smoke=$smoke, isVibration=$isVibration, vibration=$vibration, isAction=$isAction, action=$action, isTemperature=$isTemperature, temperature=$temperature, isHumidity=$isHumidity, humidity=$humidity, isPressure=$isPressure, pressure=$pressure, isAirQuality=$isAirQuality, airQuality=$airQuality, isFanSpeed=$isFanSpeed, fanSpeed=$fanSpeed, isFanMode=$isFanMode, fanMode=$fanMode, isConsumption=$isConsumption, consumption=$consumption, isCurrentPower=$isCurrentPower, currentPower=$currentPower, isVoltage=$isVoltage, voltage=$voltage, isLinkQuality=$isLinkQuality, linkQuality=$linkQuality]'; Map toJson() { - final _json = {}; - if (firmwareVersion != null) { - _json[r'firmwareVersion'] = firmwareVersion; + final json = {}; + if (this.firmwareVersion != null) { + json[r'firmwareVersion'] = this.firmwareVersion; + } else { + json[r'firmwareVersion'] = null; } - if (hardwareVersion != null) { - _json[r'hardwareVersion'] = hardwareVersion; + if (this.hardwareVersion != null) { + json[r'hardwareVersion'] = this.hardwareVersion; + } else { + json[r'hardwareVersion'] = null; } - if (port != null) { - _json[r'port'] = port; + if (this.port != null) { + json[r'port'] = this.port; + } else { + json[r'port'] = null; } - if (meansOfCommunications != null) { - _json[r'meansOfCommunications'] = meansOfCommunications; + if (this.meansOfCommunications != null) { + json[r'meansOfCommunications'] = this.meansOfCommunications; + } else { + json[r'meansOfCommunications'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (lastState != null) { - _json[r'lastState'] = lastState; + if (this.lastMessage != null) { + json[r'lastMessage'] = this.lastMessage; + } else { + json[r'lastMessage'] = null; } - if (ipAddress != null) { - _json[r'ipAddress'] = ipAddress; + if (this.lastState != null) { + json[r'lastState'] = this.lastState; + } else { + json[r'lastState'] = null; } - if (serviceIdentification != null) { - _json[r'serviceIdentification'] = serviceIdentification; + if (this.ipAddress != null) { + json[r'ipAddress'] = this.ipAddress; + } else { + json[r'ipAddress'] = null; } - if (manufacturerName != null) { - _json[r'manufacturerName'] = manufacturerName; + if (this.serviceIdentification != null) { + json[r'serviceIdentification'] = this.serviceIdentification; + } else { + json[r'serviceIdentification'] = null; } - if (groupIds != null) { - _json[r'groupIds'] = groupIds; + if (this.manufacturerName != null) { + json[r'manufacturerName'] = this.manufacturerName; + } else { + json[r'manufacturerName'] = null; } - if (properties != null) { - _json[r'properties'] = properties; + if (this.groupIds != null) { + json[r'groupIds'] = this.groupIds; + } else { + json[r'groupIds'] = null; } - if (supportedOperations != null) { - _json[r'supportedOperations'] = supportedOperations; + if (this.properties != null) { + json[r'properties'] = this.properties; + } else { + json[r'properties'] = null; } - return _json; + if (this.supportedOperations != null) { + json[r'supportedOperations'] = this.supportedOperations; + } else { + json[r'supportedOperations'] = null; + } + if (this.isContact != null) { + json[r'isContact'] = this.isContact; + } else { + json[r'isContact'] = null; + } + if (this.contact != null) { + json[r'contact'] = this.contact; + } else { + json[r'contact'] = null; + } + if (this.isIlluminance != null) { + json[r'isIlluminance'] = this.isIlluminance; + } else { + json[r'isIlluminance'] = null; + } + if (this.illuminance != null) { + json[r'illuminance'] = this.illuminance; + } else { + json[r'illuminance'] = null; + } + if (this.isBrightness != null) { + json[r'isBrightness'] = this.isBrightness; + } else { + json[r'isBrightness'] = null; + } + if (this.brightness != null) { + json[r'brightness'] = this.brightness; + } else { + json[r'brightness'] = null; + } + if (this.isState != null) { + json[r'isState'] = this.isState; + } else { + json[r'isState'] = null; + } + if (this.state != null) { + json[r'state'] = this.state; + } else { + json[r'state'] = null; + } + if (this.isColorTemp != null) { + json[r'isColorTemp'] = this.isColorTemp; + } else { + json[r'isColorTemp'] = null; + } + if (this.colorTemp != null) { + json[r'colorTemp'] = this.colorTemp; + } else { + json[r'colorTemp'] = null; + } + if (this.isColorXY != null) { + json[r'isColorXY'] = this.isColorXY; + } else { + json[r'isColorXY'] = null; + } + if (this.colorX != null) { + json[r'colorX'] = this.colorX; + } else { + json[r'colorX'] = null; + } + if (this.colorY != null) { + json[r'colorY'] = this.colorY; + } else { + json[r'colorY'] = null; + } + if (this.isOccupation != null) { + json[r'isOccupation'] = this.isOccupation; + } else { + json[r'isOccupation'] = null; + } + if (this.occupation != null) { + json[r'occupation'] = this.occupation; + } else { + json[r'occupation'] = null; + } + if (this.isAlarm != null) { + json[r'isAlarm'] = this.isAlarm; + } else { + json[r'isAlarm'] = null; + } + if (this.alarm != null) { + json[r'alarm'] = this.alarm; + } else { + json[r'alarm'] = null; + } + if (this.isWaterLeak != null) { + json[r'isWaterLeak'] = this.isWaterLeak; + } else { + json[r'isWaterLeak'] = null; + } + if (this.waterLeak != null) { + json[r'waterLeak'] = this.waterLeak; + } else { + json[r'waterLeak'] = null; + } + if (this.isSmoke != null) { + json[r'isSmoke'] = this.isSmoke; + } else { + json[r'isSmoke'] = null; + } + if (this.smoke != null) { + json[r'smoke'] = this.smoke; + } else { + json[r'smoke'] = null; + } + if (this.isVibration != null) { + json[r'isVibration'] = this.isVibration; + } else { + json[r'isVibration'] = null; + } + if (this.vibration != null) { + json[r'vibration'] = this.vibration; + } else { + json[r'vibration'] = null; + } + if (this.isAction != null) { + json[r'isAction'] = this.isAction; + } else { + json[r'isAction'] = null; + } + if (this.action != null) { + json[r'action'] = this.action; + } else { + json[r'action'] = null; + } + if (this.isTemperature != null) { + json[r'isTemperature'] = this.isTemperature; + } else { + json[r'isTemperature'] = null; + } + if (this.temperature != null) { + json[r'temperature'] = this.temperature; + } else { + json[r'temperature'] = null; + } + if (this.isHumidity != null) { + json[r'isHumidity'] = this.isHumidity; + } else { + json[r'isHumidity'] = null; + } + if (this.humidity != null) { + json[r'humidity'] = this.humidity; + } else { + json[r'humidity'] = null; + } + if (this.isPressure != null) { + json[r'isPressure'] = this.isPressure; + } else { + json[r'isPressure'] = null; + } + if (this.pressure != null) { + json[r'pressure'] = this.pressure; + } else { + json[r'pressure'] = null; + } + if (this.isAirQuality != null) { + json[r'isAirQuality'] = this.isAirQuality; + } else { + json[r'isAirQuality'] = null; + } + if (this.airQuality != null) { + json[r'airQuality'] = this.airQuality; + } else { + json[r'airQuality'] = null; + } + if (this.isFanSpeed != null) { + json[r'isFanSpeed'] = this.isFanSpeed; + } else { + json[r'isFanSpeed'] = null; + } + if (this.fanSpeed != null) { + json[r'fanSpeed'] = this.fanSpeed; + } else { + json[r'fanSpeed'] = null; + } + if (this.isFanMode != null) { + json[r'isFanMode'] = this.isFanMode; + } else { + json[r'isFanMode'] = null; + } + if (this.fanMode != null) { + json[r'fanMode'] = this.fanMode; + } else { + json[r'fanMode'] = null; + } + if (this.isConsumption != null) { + json[r'isConsumption'] = this.isConsumption; + } else { + json[r'isConsumption'] = null; + } + if (this.consumption != null) { + json[r'consumption'] = this.consumption; + } else { + json[r'consumption'] = null; + } + if (this.isCurrentPower != null) { + json[r'isCurrentPower'] = this.isCurrentPower; + } else { + json[r'isCurrentPower'] = null; + } + if (this.currentPower != null) { + json[r'currentPower'] = this.currentPower; + } else { + json[r'currentPower'] = null; + } + if (this.isVoltage != null) { + json[r'isVoltage'] = this.isVoltage; + } else { + json[r'isVoltage'] = null; + } + if (this.voltage != null) { + json[r'voltage'] = this.voltage; + } else { + json[r'voltage'] = null; + } + if (this.isLinkQuality != null) { + json[r'isLinkQuality'] = this.isLinkQuality; + } else { + json[r'isLinkQuality'] = null; + } + if (this.linkQuality != null) { + json[r'linkQuality'] = this.linkQuality; + } else { + json[r'linkQuality'] = null; + } + return json; } /// Returns a new [DeviceDetailDTOAllOf] instance and imports its values from @@ -174,9 +888,10 @@ class DeviceDetailDTOAllOf { firmwareVersion: mapValueOfType(json, r'firmwareVersion'), hardwareVersion: mapValueOfType(json, r'hardwareVersion'), port: mapValueOfType(json, r'port'), - meansOfCommunications: MeansOfCommunication.listFromJson(json[r'meansOfCommunications']) ?? const [], + meansOfCommunications: MeansOfCommunication.listFromJson(json[r'meansOfCommunications']), createdDate: mapDateTime(json, r'createdDate', ''), updatedDate: mapDateTime(json, r'updatedDate', ''), + lastMessage: mapValueOfType(json, r'lastMessage'), lastState: mapValueOfType(json, r'lastState'), ipAddress: mapValueOfType(json, r'ipAddress'), serviceIdentification: mapValueOfType(json, r'serviceIdentification'), @@ -188,12 +903,69 @@ class DeviceDetailDTOAllOf { supportedOperations: json[r'supportedOperations'] is List ? (json[r'supportedOperations'] as List).cast() : const [], + isContact: mapValueOfType(json, r'isContact'), + contact: mapValueOfType(json, r'contact'), + isIlluminance: mapValueOfType(json, r'isIlluminance'), + illuminance: mapValueOfType(json, r'illuminance'), + isBrightness: mapValueOfType(json, r'isBrightness'), + brightness: mapValueOfType(json, r'brightness'), + isState: mapValueOfType(json, r'isState'), + state: mapValueOfType(json, r'state'), + isColorTemp: mapValueOfType(json, r'isColorTemp'), + colorTemp: mapValueOfType(json, r'colorTemp'), + isColorXY: mapValueOfType(json, r'isColorXY'), + colorX: mapValueOfType(json, r'colorX'), + colorY: mapValueOfType(json, r'colorY'), + isOccupation: mapValueOfType(json, r'isOccupation'), + occupation: mapValueOfType(json, r'occupation'), + isAlarm: mapValueOfType(json, r'isAlarm'), + alarm: mapValueOfType(json, r'alarm'), + isWaterLeak: mapValueOfType(json, r'isWaterLeak'), + waterLeak: mapValueOfType(json, r'waterLeak'), + isSmoke: mapValueOfType(json, r'isSmoke'), + smoke: mapValueOfType(json, r'smoke'), + isVibration: mapValueOfType(json, r'isVibration'), + vibration: mapValueOfType(json, r'vibration'), + isAction: mapValueOfType(json, r'isAction'), + action: mapValueOfType(json, r'action'), + isTemperature: mapValueOfType(json, r'isTemperature'), + temperature: json[r'temperature'] == null + ? null + : num.parse(json[r'temperature'].toString()), + isHumidity: mapValueOfType(json, r'isHumidity'), + humidity: json[r'humidity'] == null + ? null + : num.parse(json[r'humidity'].toString()), + isPressure: mapValueOfType(json, r'isPressure'), + pressure: json[r'pressure'] == null + ? null + : num.parse(json[r'pressure'].toString()), + isAirQuality: mapValueOfType(json, r'isAirQuality'), + airQuality: mapValueOfType(json, r'airQuality'), + isFanSpeed: mapValueOfType(json, r'isFanSpeed'), + fanSpeed: mapValueOfType(json, r'fanSpeed'), + isFanMode: mapValueOfType(json, r'isFanMode'), + fanMode: mapValueOfType(json, r'fanMode'), + isConsumption: mapValueOfType(json, r'isConsumption'), + consumption: json[r'consumption'] == null + ? null + : num.parse(json[r'consumption'].toString()), + isCurrentPower: mapValueOfType(json, r'isCurrentPower'), + currentPower: json[r'currentPower'] == null + ? null + : num.parse(json[r'currentPower'].toString()), + isVoltage: mapValueOfType(json, r'isVoltage'), + voltage: json[r'voltage'] == null + ? null + : num.parse(json[r'voltage'].toString()), + isLinkQuality: mapValueOfType(json, r'isLinkQuality'), + linkQuality: mapValueOfType(json, r'linkQuality'), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -224,12 +996,10 @@ class DeviceDetailDTOAllOf { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = DeviceDetailDTOAllOf.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = DeviceDetailDTOAllOf.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/device_state.dart b/mycore_api/lib/model/device_state.dart index 4713a2d..c86c473 100644 --- a/mycore_api/lib/model/device_state.dart +++ b/mycore_api/lib/model/device_state.dart @@ -52,20 +52,28 @@ class DeviceState { String toString() => 'DeviceState[deviceId=$deviceId, deviceName=$deviceName, message=$message, deviceType=$deviceType]'; Map toJson() { - final _json = {}; - if (deviceId != null) { - _json[r'deviceId'] = deviceId; + final json = {}; + if (this.deviceId != null) { + json[r'deviceId'] = this.deviceId; + } else { + json[r'deviceId'] = null; } - if (deviceName != null) { - _json[r'deviceName'] = deviceName; + if (this.deviceName != null) { + json[r'deviceName'] = this.deviceName; + } else { + json[r'deviceName'] = null; } - if (message != null) { - _json[r'message'] = message; + if (this.message != null) { + json[r'message'] = this.message; + } else { + json[r'message'] = null; } - if (deviceType != null) { - _json[r'deviceType'] = deviceType; + if (this.deviceType != null) { + json[r'deviceType'] = this.deviceType; + } else { + json[r'deviceType'] = null; } - return _json; + return json; } /// Returns a new [DeviceState] instance and imports its values from @@ -96,7 +104,7 @@ class DeviceState { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -127,12 +135,10 @@ class DeviceState { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = DeviceState.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = DeviceState.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/device_summary_dto.dart b/mycore_api/lib/model/device_summary_dto.dart index 643e2a7..bcd5ca4 100644 --- a/mycore_api/lib/model/device_summary_dto.dart +++ b/mycore_api/lib/model/device_summary_dto.dart @@ -25,6 +25,7 @@ class DeviceSummaryDTO { this.providerId, this.providerName, this.lastStateDate, + this.lastMessageDate, this.battery, this.batteryStatus, }); @@ -77,6 +78,14 @@ class DeviceSummaryDTO { /// DateTime? lastStateDate; + /// + /// 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. + /// + DateTime? lastMessageDate; + /// /// 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 @@ -107,6 +116,7 @@ class DeviceSummaryDTO { other.providerId == providerId && other.providerName == providerName && other.lastStateDate == lastStateDate && + other.lastMessageDate == lastMessageDate && other.battery == battery && other.batteryStatus == batteryStatus; @@ -125,57 +135,91 @@ class DeviceSummaryDTO { (providerId == null ? 0 : providerId!.hashCode) + (providerName == null ? 0 : providerName!.hashCode) + (lastStateDate == null ? 0 : lastStateDate!.hashCode) + + (lastMessageDate == null ? 0 : lastMessageDate!.hashCode) + (battery == null ? 0 : battery!.hashCode) + (batteryStatus == null ? 0 : batteryStatus!.hashCode); @override - String toString() => 'DeviceSummaryDTO[id=$id, homeId=$homeId, description=$description, name=$name, model=$model, type=$type, status=$status, connectionStatus=$connectionStatus, roomId=$roomId, providerId=$providerId, providerName=$providerName, lastStateDate=$lastStateDate, battery=$battery, batteryStatus=$batteryStatus]'; + String toString() => 'DeviceSummaryDTO[id=$id, homeId=$homeId, description=$description, name=$name, model=$model, type=$type, status=$status, connectionStatus=$connectionStatus, roomId=$roomId, providerId=$providerId, providerName=$providerName, lastStateDate=$lastStateDate, lastMessageDate=$lastMessageDate, battery=$battery, batteryStatus=$batteryStatus]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (description != null) { - _json[r'description'] = description; + if (this.description != null) { + json[r'description'] = this.description; + } else { + json[r'description'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (model != null) { - _json[r'model'] = model; + if (this.model != null) { + json[r'model'] = this.model; + } else { + json[r'model'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (status != null) { - _json[r'status'] = status; + if (this.status != null) { + json[r'status'] = this.status; + } else { + json[r'status'] = null; } - if (connectionStatus != null) { - _json[r'connectionStatus'] = connectionStatus; + if (this.connectionStatus != null) { + json[r'connectionStatus'] = this.connectionStatus; + } else { + json[r'connectionStatus'] = null; } - if (roomId != null) { - _json[r'roomId'] = roomId; + if (this.roomId != null) { + json[r'roomId'] = this.roomId; + } else { + json[r'roomId'] = null; } - if (providerId != null) { - _json[r'providerId'] = providerId; + if (this.providerId != null) { + json[r'providerId'] = this.providerId; + } else { + json[r'providerId'] = null; } - if (providerName != null) { - _json[r'providerName'] = providerName; + if (this.providerName != null) { + json[r'providerName'] = this.providerName; + } else { + json[r'providerName'] = null; } - if (lastStateDate != null) { - _json[r'lastStateDate'] = lastStateDate!.toUtc().toIso8601String(); + if (this.lastStateDate != null) { + json[r'lastStateDate'] = this.lastStateDate!.toUtc().toIso8601String(); + } else { + json[r'lastStateDate'] = null; } - if (battery != null) { - _json[r'battery'] = battery; + if (this.lastMessageDate != null) { + json[r'lastMessageDate'] = this.lastMessageDate!.toUtc().toIso8601String(); + } else { + json[r'lastMessageDate'] = null; } - if (batteryStatus != null) { - _json[r'batteryStatus'] = batteryStatus; + if (this.battery != null) { + json[r'battery'] = this.battery; + } else { + json[r'battery'] = null; } - return _json; + if (this.batteryStatus != null) { + json[r'batteryStatus'] = this.batteryStatus; + } else { + json[r'batteryStatus'] = null; + } + return json; } /// Returns a new [DeviceSummaryDTO] instance and imports its values from @@ -209,6 +253,7 @@ class DeviceSummaryDTO { providerId: mapValueOfType(json, r'providerId'), providerName: mapValueOfType(json, r'providerName'), lastStateDate: mapDateTime(json, r'lastStateDate', ''), + lastMessageDate: mapDateTime(json, r'lastMessageDate', ''), battery: mapValueOfType(json, r'battery'), batteryStatus: mapValueOfType(json, r'batteryStatus'), ); @@ -216,7 +261,7 @@ class DeviceSummaryDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -247,12 +292,10 @@ class DeviceSummaryDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = DeviceSummaryDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = DeviceSummaryDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/device_type.dart b/mycore_api/lib/model/device_type.dart index 3dcdae2..05dea9c 100644 --- a/mycore_api/lib/model/device_type.dart +++ b/mycore_api/lib/model/device_type.dart @@ -60,7 +60,7 @@ class DeviceType { static DeviceType? fromJson(dynamic value) => DeviceTypeTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -93,7 +93,7 @@ class DeviceTypeTypeTransformer { /// and users are still using an old app with the old code. DeviceType? decode(dynamic data, {bool allowNull = true}) { if (data != null) { - switch (data.toString()) { + switch (data) { case r'Sensor': return DeviceType.sensor; case r'Actuator': return DeviceType.actuator; case r'Camera': return DeviceType.camera; diff --git a/mycore_api/lib/model/electricity_production.dart b/mycore_api/lib/model/electricity_production.dart index 8cd5381..5307d7d 100644 --- a/mycore_api/lib/model/electricity_production.dart +++ b/mycore_api/lib/model/electricity_production.dart @@ -74,26 +74,38 @@ class ElectricityProduction { String toString() => 'ElectricityProduction[id=$id, deviceId=$deviceId, homeId=$homeId, watt=$watt, ampere=$ampere, timestamp=$timestamp]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (deviceId != null) { - _json[r'deviceId'] = deviceId; + if (this.deviceId != null) { + json[r'deviceId'] = this.deviceId; + } else { + json[r'deviceId'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (watt != null) { - _json[r'watt'] = watt; + if (this.watt != null) { + json[r'watt'] = this.watt; + } else { + json[r'watt'] = null; } - if (ampere != null) { - _json[r'ampere'] = ampere; + if (this.ampere != null) { + json[r'ampere'] = this.ampere; + } else { + json[r'ampere'] = null; } - if (timestamp != null) { - _json[r'timestamp'] = timestamp!.toUtc().toIso8601String(); + if (this.timestamp != null) { + json[r'timestamp'] = this.timestamp!.toUtc().toIso8601String(); + } else { + json[r'timestamp'] = null; } - return _json; + return json; } /// Returns a new [ElectricityProduction] instance and imports its values from @@ -126,7 +138,7 @@ class ElectricityProduction { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -157,12 +169,10 @@ class ElectricityProduction { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = ElectricityProduction.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ElectricityProduction.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/event_detail_dto.dart b/mycore_api/lib/model/event_detail_dto.dart index 061dcb3..31551ae 100644 --- a/mycore_api/lib/model/event_detail_dto.dart +++ b/mycore_api/lib/model/event_detail_dto.dart @@ -45,11 +45,11 @@ class EventDetailDTO { String? roomId; - DeviceState? deviceState; + EventDetailDTOAllOfDeviceState? deviceState; - AutomationTriggered? automationTriggered; + EventDetailDTOAllOfAutomationTriggered? automationTriggered; - AlarmTriggered? alarmTriggered; + EventDetailDTOAllOfAlarmTriggered? alarmTriggered; @override bool operator ==(Object other) => identical(this, other) || other is EventDetailDTO && @@ -78,32 +78,48 @@ class EventDetailDTO { String toString() => 'EventDetailDTO[id=$id, homeId=$homeId, date=$date, type=$type, roomId=$roomId, deviceState=$deviceState, automationTriggered=$automationTriggered, alarmTriggered=$alarmTriggered]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (date != null) { - _json[r'date'] = date!.toUtc().toIso8601String(); + if (this.date != null) { + json[r'date'] = this.date!.toUtc().toIso8601String(); + } else { + json[r'date'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (roomId != null) { - _json[r'roomId'] = roomId; + if (this.roomId != null) { + json[r'roomId'] = this.roomId; + } else { + json[r'roomId'] = null; } - if (deviceState != null) { - _json[r'deviceState'] = deviceState; + if (this.deviceState != null) { + json[r'deviceState'] = this.deviceState; + } else { + json[r'deviceState'] = null; } - if (automationTriggered != null) { - _json[r'automationTriggered'] = automationTriggered; + if (this.automationTriggered != null) { + json[r'automationTriggered'] = this.automationTriggered; + } else { + json[r'automationTriggered'] = null; } - if (alarmTriggered != null) { - _json[r'alarmTriggered'] = alarmTriggered; + if (this.alarmTriggered != null) { + json[r'alarmTriggered'] = this.alarmTriggered; + } else { + json[r'alarmTriggered'] = null; } - return _json; + return json; } /// Returns a new [EventDetailDTO] instance and imports its values from @@ -130,15 +146,15 @@ class EventDetailDTO { date: mapDateTime(json, r'date', ''), type: EventType.fromJson(json[r'type']), roomId: mapValueOfType(json, r'roomId'), - deviceState: DeviceState.fromJson(json[r'deviceState']), - automationTriggered: AutomationTriggered.fromJson(json[r'automationTriggered']), - alarmTriggered: AlarmTriggered.fromJson(json[r'alarmTriggered']), + deviceState: EventDetailDTOAllOfDeviceState.fromJson(json[r'deviceState']), + automationTriggered: EventDetailDTOAllOfAutomationTriggered.fromJson(json[r'automationTriggered']), + alarmTriggered: EventDetailDTOAllOfAlarmTriggered.fromJson(json[r'alarmTriggered']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -169,12 +185,10 @@ class EventDetailDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = EventDetailDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = EventDetailDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/event_detail_dto_all_of.dart b/mycore_api/lib/model/event_detail_dto_all_of.dart index 8ddd7ef..53942ad 100644 --- a/mycore_api/lib/model/event_detail_dto_all_of.dart +++ b/mycore_api/lib/model/event_detail_dto_all_of.dart @@ -18,11 +18,11 @@ class EventDetailDTOAllOf { this.alarmTriggered, }); - DeviceState? deviceState; + EventDetailDTOAllOfDeviceState? deviceState; - AutomationTriggered? automationTriggered; + EventDetailDTOAllOfAutomationTriggered? automationTriggered; - AlarmTriggered? alarmTriggered; + EventDetailDTOAllOfAlarmTriggered? alarmTriggered; @override bool operator ==(Object other) => identical(this, other) || other is EventDetailDTOAllOf && @@ -41,17 +41,23 @@ class EventDetailDTOAllOf { String toString() => 'EventDetailDTOAllOf[deviceState=$deviceState, automationTriggered=$automationTriggered, alarmTriggered=$alarmTriggered]'; Map toJson() { - final _json = {}; - if (deviceState != null) { - _json[r'deviceState'] = deviceState; + final json = {}; + if (this.deviceState != null) { + json[r'deviceState'] = this.deviceState; + } else { + json[r'deviceState'] = null; } - if (automationTriggered != null) { - _json[r'automationTriggered'] = automationTriggered; + if (this.automationTriggered != null) { + json[r'automationTriggered'] = this.automationTriggered; + } else { + json[r'automationTriggered'] = null; } - if (alarmTriggered != null) { - _json[r'alarmTriggered'] = alarmTriggered; + if (this.alarmTriggered != null) { + json[r'alarmTriggered'] = this.alarmTriggered; + } else { + json[r'alarmTriggered'] = null; } - return _json; + return json; } /// Returns a new [EventDetailDTOAllOf] instance and imports its values from @@ -73,15 +79,15 @@ class EventDetailDTOAllOf { }()); return EventDetailDTOAllOf( - deviceState: DeviceState.fromJson(json[r'deviceState']), - automationTriggered: AutomationTriggered.fromJson(json[r'automationTriggered']), - alarmTriggered: AlarmTriggered.fromJson(json[r'alarmTriggered']), + deviceState: EventDetailDTOAllOfDeviceState.fromJson(json[r'deviceState']), + automationTriggered: EventDetailDTOAllOfAutomationTriggered.fromJson(json[r'automationTriggered']), + alarmTriggered: EventDetailDTOAllOfAlarmTriggered.fromJson(json[r'alarmTriggered']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -112,12 +118,10 @@ class EventDetailDTOAllOf { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = EventDetailDTOAllOf.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = EventDetailDTOAllOf.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/event_detail_dto_all_of_alarm_triggered.dart b/mycore_api/lib/model/event_detail_dto_all_of_alarm_triggered.dart new file mode 100644 index 0000000..ef6894c --- /dev/null +++ b/mycore_api/lib/model/event_detail_dto_all_of_alarm_triggered.dart @@ -0,0 +1,140 @@ +// +// 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 EventDetailDTOAllOfAlarmTriggered { + /// Returns a new [EventDetailDTOAllOfAlarmTriggered] instance. + EventDetailDTOAllOfAlarmTriggered({ + this.alarmModeId, + this.alarmModeName, + this.type, + }); + + String? alarmModeId; + + String? alarmModeName; + + /// + /// 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. + /// + AlarmType? type; + + @override + bool operator ==(Object other) => identical(this, other) || other is EventDetailDTOAllOfAlarmTriggered && + other.alarmModeId == alarmModeId && + other.alarmModeName == alarmModeName && + other.type == type; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (alarmModeId == null ? 0 : alarmModeId!.hashCode) + + (alarmModeName == null ? 0 : alarmModeName!.hashCode) + + (type == null ? 0 : type!.hashCode); + + @override + String toString() => 'EventDetailDTOAllOfAlarmTriggered[alarmModeId=$alarmModeId, alarmModeName=$alarmModeName, type=$type]'; + + Map toJson() { + final json = {}; + if (this.alarmModeId != null) { + json[r'alarmModeId'] = this.alarmModeId; + } else { + json[r'alarmModeId'] = null; + } + if (this.alarmModeName != null) { + json[r'alarmModeName'] = this.alarmModeName; + } else { + json[r'alarmModeName'] = null; + } + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; + } + return json; + } + + /// Returns a new [EventDetailDTOAllOfAlarmTriggered] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static EventDetailDTOAllOfAlarmTriggered? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "EventDetailDTOAllOfAlarmTriggered[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "EventDetailDTOAllOfAlarmTriggered[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return EventDetailDTOAllOfAlarmTriggered( + alarmModeId: mapValueOfType(json, r'alarmModeId'), + alarmModeName: mapValueOfType(json, r'alarmModeName'), + type: AlarmType.fromJson(json[r'type']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EventDetailDTOAllOfAlarmTriggered.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = EventDetailDTOAllOfAlarmTriggered.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of EventDetailDTOAllOfAlarmTriggered-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = EventDetailDTOAllOfAlarmTriggered.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/mycore_api/lib/model/event_detail_dto_all_of_automation_triggered.dart b/mycore_api/lib/model/event_detail_dto_all_of_automation_triggered.dart new file mode 100644 index 0000000..c3c8ee3 --- /dev/null +++ b/mycore_api/lib/model/event_detail_dto_all_of_automation_triggered.dart @@ -0,0 +1,123 @@ +// +// 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 EventDetailDTOAllOfAutomationTriggered { + /// Returns a new [EventDetailDTOAllOfAutomationTriggered] instance. + EventDetailDTOAllOfAutomationTriggered({ + this.automationId, + this.automationName, + }); + + String? automationId; + + String? automationName; + + @override + bool operator ==(Object other) => identical(this, other) || other is EventDetailDTOAllOfAutomationTriggered && + other.automationId == automationId && + other.automationName == automationName; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (automationId == null ? 0 : automationId!.hashCode) + + (automationName == null ? 0 : automationName!.hashCode); + + @override + String toString() => 'EventDetailDTOAllOfAutomationTriggered[automationId=$automationId, automationName=$automationName]'; + + Map toJson() { + final json = {}; + if (this.automationId != null) { + json[r'automationId'] = this.automationId; + } else { + json[r'automationId'] = null; + } + if (this.automationName != null) { + json[r'automationName'] = this.automationName; + } else { + json[r'automationName'] = null; + } + return json; + } + + /// Returns a new [EventDetailDTOAllOfAutomationTriggered] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static EventDetailDTOAllOfAutomationTriggered? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "EventDetailDTOAllOfAutomationTriggered[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "EventDetailDTOAllOfAutomationTriggered[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return EventDetailDTOAllOfAutomationTriggered( + automationId: mapValueOfType(json, r'automationId'), + automationName: mapValueOfType(json, r'automationName'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EventDetailDTOAllOfAutomationTriggered.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = EventDetailDTOAllOfAutomationTriggered.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of EventDetailDTOAllOfAutomationTriggered-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = EventDetailDTOAllOfAutomationTriggered.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/mycore_api/lib/model/event_detail_dto_all_of_device_state.dart b/mycore_api/lib/model/event_detail_dto_all_of_device_state.dart new file mode 100644 index 0000000..d84dde0 --- /dev/null +++ b/mycore_api/lib/model/event_detail_dto_all_of_device_state.dart @@ -0,0 +1,151 @@ +// +// 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 EventDetailDTOAllOfDeviceState { + /// Returns a new [EventDetailDTOAllOfDeviceState] instance. + EventDetailDTOAllOfDeviceState({ + this.deviceId, + this.deviceName, + this.message, + this.deviceType, + }); + + String? deviceId; + + String? deviceName; + + String? message; + + /// + /// 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. + /// + DeviceType? deviceType; + + @override + bool operator ==(Object other) => identical(this, other) || other is EventDetailDTOAllOfDeviceState && + other.deviceId == deviceId && + other.deviceName == deviceName && + other.message == message && + other.deviceType == deviceType; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (deviceId == null ? 0 : deviceId!.hashCode) + + (deviceName == null ? 0 : deviceName!.hashCode) + + (message == null ? 0 : message!.hashCode) + + (deviceType == null ? 0 : deviceType!.hashCode); + + @override + String toString() => 'EventDetailDTOAllOfDeviceState[deviceId=$deviceId, deviceName=$deviceName, message=$message, deviceType=$deviceType]'; + + Map toJson() { + final json = {}; + if (this.deviceId != null) { + json[r'deviceId'] = this.deviceId; + } else { + json[r'deviceId'] = null; + } + if (this.deviceName != null) { + json[r'deviceName'] = this.deviceName; + } else { + json[r'deviceName'] = null; + } + if (this.message != null) { + json[r'message'] = this.message; + } else { + json[r'message'] = null; + } + if (this.deviceType != null) { + json[r'deviceType'] = this.deviceType; + } else { + json[r'deviceType'] = null; + } + return json; + } + + /// Returns a new [EventDetailDTOAllOfDeviceState] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static EventDetailDTOAllOfDeviceState? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "EventDetailDTOAllOfDeviceState[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "EventDetailDTOAllOfDeviceState[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return EventDetailDTOAllOfDeviceState( + deviceId: mapValueOfType(json, r'deviceId'), + deviceName: mapValueOfType(json, r'deviceName'), + message: mapValueOfType(json, r'message'), + deviceType: DeviceType.fromJson(json[r'deviceType']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EventDetailDTOAllOfDeviceState.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = EventDetailDTOAllOfDeviceState.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of EventDetailDTOAllOfDeviceState-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = EventDetailDTOAllOfDeviceState.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/mycore_api/lib/model/event_dto.dart b/mycore_api/lib/model/event_dto.dart index cce1b1e..ecd73fe 100644 --- a/mycore_api/lib/model/event_dto.dart +++ b/mycore_api/lib/model/event_dto.dart @@ -63,23 +63,33 @@ class EventDTO { String toString() => 'EventDTO[id=$id, homeId=$homeId, date=$date, type=$type, roomId=$roomId]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (date != null) { - _json[r'date'] = date!.toUtc().toIso8601String(); + if (this.date != null) { + json[r'date'] = this.date!.toUtc().toIso8601String(); + } else { + json[r'date'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (roomId != null) { - _json[r'roomId'] = roomId; + if (this.roomId != null) { + json[r'roomId'] = this.roomId; + } else { + json[r'roomId'] = null; } - return _json; + return json; } /// Returns a new [EventDTO] instance and imports its values from @@ -111,7 +121,7 @@ class EventDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -142,12 +152,10 @@ class EventDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = EventDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = EventDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/event_filter.dart b/mycore_api/lib/model/event_filter.dart index e348e4e..3309bf9 100644 --- a/mycore_api/lib/model/event_filter.dart +++ b/mycore_api/lib/model/event_filter.dart @@ -41,9 +41,9 @@ class EventFilter { DateTime? dateEnd; - EventType? eventType; + EventGetEventTypeParameter? eventType; - DeviceType? deviceType; + EventGetDeviceTypeParameter? deviceType; @override bool operator ==(Object other) => identical(this, other) || other is EventFilter && @@ -68,26 +68,38 @@ class EventFilter { String toString() => 'EventFilter[startIndex=$startIndex, count=$count, dateStart=$dateStart, dateEnd=$dateEnd, eventType=$eventType, deviceType=$deviceType]'; Map toJson() { - final _json = {}; - if (startIndex != null) { - _json[r'startIndex'] = startIndex; + final json = {}; + if (this.startIndex != null) { + json[r'startIndex'] = this.startIndex; + } else { + json[r'startIndex'] = null; } - if (count != null) { - _json[r'count'] = count; + if (this.count != null) { + json[r'count'] = this.count; + } else { + json[r'count'] = null; } - if (dateStart != null) { - _json[r'dateStart'] = dateStart!.toUtc().toIso8601String(); + if (this.dateStart != null) { + json[r'dateStart'] = this.dateStart!.toUtc().toIso8601String(); + } else { + json[r'dateStart'] = null; } - if (dateEnd != null) { - _json[r'dateEnd'] = dateEnd!.toUtc().toIso8601String(); + if (this.dateEnd != null) { + json[r'dateEnd'] = this.dateEnd!.toUtc().toIso8601String(); + } else { + json[r'dateEnd'] = null; } - if (eventType != null) { - _json[r'eventType'] = eventType; + if (this.eventType != null) { + json[r'eventType'] = this.eventType; + } else { + json[r'eventType'] = null; } - if (deviceType != null) { - _json[r'deviceType'] = deviceType; + if (this.deviceType != null) { + json[r'deviceType'] = this.deviceType; + } else { + json[r'deviceType'] = null; } - return _json; + return json; } /// Returns a new [EventFilter] instance and imports its values from @@ -113,14 +125,14 @@ class EventFilter { count: mapValueOfType(json, r'count'), dateStart: mapDateTime(json, r'dateStart', ''), dateEnd: mapDateTime(json, r'dateEnd', ''), - eventType:EventType.fromJson(json[r'eventType']), - deviceType: DeviceType.fromJson(json[r'deviceType']), + eventType: EventGetEventTypeParameter.fromJson(json[r'eventType']), + deviceType: EventGetDeviceTypeParameter.fromJson(json[r'deviceType']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -151,12 +163,10 @@ class EventFilter { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = EventFilter.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = EventFilter.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/event_get_device_type_parameter.dart b/mycore_api/lib/model/event_get_device_type_parameter.dart new file mode 100644 index 0000000..8a8128f --- /dev/null +++ b/mycore_api/lib/model/event_get_device_type_parameter.dart @@ -0,0 +1,100 @@ +// +// 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 EventGetDeviceTypeParameter { + /// Returns a new [EventGetDeviceTypeParameter] instance. + EventGetDeviceTypeParameter(); + + /*@override + bool operator ==(Object other) => identical(this, other) || other is EventGetDeviceTypeParameter && +*/ + /*@override + int get hashCode =>*/ + // ignore: unnecessary_parenthesis + + /*@override + String toString() => 'EventGetDeviceTypeParameter[]';*/ + + Map toJson() { + final json = {}; + return json; + } + + /// Returns a new [EventGetDeviceTypeParameter] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static EventGetDeviceTypeParameter? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "EventGetDeviceTypeParameter[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "EventGetDeviceTypeParameter[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return EventGetDeviceTypeParameter( + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EventGetDeviceTypeParameter.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = EventGetDeviceTypeParameter.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of EventGetDeviceTypeParameter-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = EventGetDeviceTypeParameter.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/mycore_api/lib/model/event_get_event_type_parameter.dart b/mycore_api/lib/model/event_get_event_type_parameter.dart new file mode 100644 index 0000000..e2fb5bf --- /dev/null +++ b/mycore_api/lib/model/event_get_event_type_parameter.dart @@ -0,0 +1,100 @@ +// +// 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 EventGetEventTypeParameter { + /// Returns a new [EventGetEventTypeParameter] instance. + EventGetEventTypeParameter(); + + @override + bool operator ==(Object other) => identical(this, other) || other is EventGetEventTypeParameter; + + /*@override + int get hashCode =>*/ + // ignore: unnecessary_parenthesis + + @override + String toString() => 'EventGetEventTypeParameter[]'; + + Map toJson() { + final json = {}; + return json; + } + + /// Returns a new [EventGetEventTypeParameter] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static EventGetEventTypeParameter? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "EventGetEventTypeParameter[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "EventGetEventTypeParameter[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return EventGetEventTypeParameter( + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EventGetEventTypeParameter.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = EventGetEventTypeParameter.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of EventGetEventTypeParameter-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = EventGetEventTypeParameter.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/mycore_api/lib/model/event_home_filter.dart b/mycore_api/lib/model/event_home_filter.dart index 5f4d4a2..693ecd8 100644 --- a/mycore_api/lib/model/event_home_filter.dart +++ b/mycore_api/lib/model/event_home_filter.dart @@ -43,9 +43,9 @@ class EventHomeFilter { DateTime? dateEnd; - EventType? eventType; + EventGetEventTypeParameter? eventType; - DeviceType? deviceType; + EventGetDeviceTypeParameter? deviceType; String? deviceId; @@ -78,32 +78,48 @@ class EventHomeFilter { String toString() => 'EventHomeFilter[startIndex=$startIndex, count=$count, dateStart=$dateStart, dateEnd=$dateEnd, eventType=$eventType, deviceType=$deviceType, deviceId=$deviceId, roomId=$roomId]'; Map toJson() { - final _json = {}; - if (startIndex != null) { - _json[r'startIndex'] = startIndex; + final json = {}; + if (this.startIndex != null) { + json[r'startIndex'] = this.startIndex; + } else { + json[r'startIndex'] = null; } - if (count != null) { - _json[r'count'] = count; + if (this.count != null) { + json[r'count'] = this.count; + } else { + json[r'count'] = null; } - if (dateStart != null) { - _json[r'dateStart'] = dateStart!.toUtc().toIso8601String(); + if (this.dateStart != null) { + json[r'dateStart'] = this.dateStart!.toUtc().toIso8601String(); + } else { + json[r'dateStart'] = null; } - if (dateEnd != null) { - _json[r'dateEnd'] = dateEnd!.toUtc().toIso8601String(); + if (this.dateEnd != null) { + json[r'dateEnd'] = this.dateEnd!.toUtc().toIso8601String(); + } else { + json[r'dateEnd'] = null; } - if (eventType != null) { - _json[r'eventType'] = eventType; + if (this.eventType != null) { + json[r'eventType'] = this.eventType; + } else { + json[r'eventType'] = null; } - if (deviceType != null) { - _json[r'deviceType'] = deviceType; + if (this.deviceType != null) { + json[r'deviceType'] = this.deviceType; + } else { + json[r'deviceType'] = null; } - if (deviceId != null) { - _json[r'deviceId'] = deviceId; + if (this.deviceId != null) { + json[r'deviceId'] = this.deviceId; + } else { + json[r'deviceId'] = null; } - if (roomId != null) { - _json[r'roomId'] = roomId; + if (this.roomId != null) { + json[r'roomId'] = this.roomId; + } else { + json[r'roomId'] = null; } - return _json; + return json; } /// Returns a new [EventHomeFilter] instance and imports its values from @@ -129,8 +145,8 @@ class EventHomeFilter { count: mapValueOfType(json, r'count'), dateStart: mapDateTime(json, r'dateStart', ''), dateEnd: mapDateTime(json, r'dateEnd', ''), - eventType: EventType.fromJson(json[r'eventType']), - deviceType: DeviceType.fromJson(json[r'deviceType']), + eventType: EventGetEventTypeParameter.fromJson(json[r'eventType']), + deviceType: EventGetDeviceTypeParameter.fromJson(json[r'deviceType']), deviceId: mapValueOfType(json, r'deviceId'), roomId: mapValueOfType(json, r'roomId'), ); @@ -138,7 +154,7 @@ class EventHomeFilter { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -169,12 +185,10 @@ class EventHomeFilter { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = EventHomeFilter.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = EventHomeFilter.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/event_home_filter_all_of.dart b/mycore_api/lib/model/event_home_filter_all_of.dart index e3d2e08..9849f91 100644 --- a/mycore_api/lib/model/event_home_filter_all_of.dart +++ b/mycore_api/lib/model/event_home_filter_all_of.dart @@ -36,14 +36,18 @@ class EventHomeFilterAllOf { String toString() => 'EventHomeFilterAllOf[deviceId=$deviceId, roomId=$roomId]'; Map toJson() { - final _json = {}; - if (deviceId != null) { - _json[r'deviceId'] = deviceId; + final json = {}; + if (this.deviceId != null) { + json[r'deviceId'] = this.deviceId; + } else { + json[r'deviceId'] = null; } - if (roomId != null) { - _json[r'roomId'] = roomId; + if (this.roomId != null) { + json[r'roomId'] = this.roomId; + } else { + json[r'roomId'] = null; } - return _json; + return json; } /// Returns a new [EventHomeFilterAllOf] instance and imports its values from @@ -72,7 +76,7 @@ class EventHomeFilterAllOf { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -103,12 +107,10 @@ class EventHomeFilterAllOf { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = EventHomeFilterAllOf.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = EventHomeFilterAllOf.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/event_type.dart b/mycore_api/lib/model/event_type.dart index c0951f9..cf618d5 100644 --- a/mycore_api/lib/model/event_type.dart +++ b/mycore_api/lib/model/event_type.dart @@ -36,7 +36,7 @@ class EventType { static EventType? fromJson(dynamic value) => EventTypeTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -69,7 +69,7 @@ class EventTypeTypeTransformer { /// and users are still using an old app with the old code. EventType? decode(dynamic data, {bool allowNull = true}) { if (data != null) { - switch (data.toString()) { + switch (data) { case r'DeviceState': return EventType.deviceState; case r'AutomationTriggered': return EventType.automationTriggered; case r'AlarmTriggered': return EventType.alarmTriggered; diff --git a/mycore_api/lib/model/facebook_auth_model.dart b/mycore_api/lib/model/facebook_auth_model.dart index 6143f7c..749a12d 100644 --- a/mycore_api/lib/model/facebook_auth_model.dart +++ b/mycore_api/lib/model/facebook_auth_model.dart @@ -31,11 +31,13 @@ class FacebookAuthModel { String toString() => 'FacebookAuthModel[userAccessToken=$userAccessToken]'; Map toJson() { - final _json = {}; - if (userAccessToken != null) { - _json[r'userAccessToken'] = userAccessToken; + final json = {}; + if (this.userAccessToken != null) { + json[r'userAccessToken'] = this.userAccessToken; + } else { + json[r'userAccessToken'] = null; } - return _json; + return json; } /// Returns a new [FacebookAuthModel] instance and imports its values from @@ -63,7 +65,7 @@ class FacebookAuthModel { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -94,12 +96,10 @@ class FacebookAuthModel { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = FacebookAuthModel.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = FacebookAuthModel.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/geolocalized_mode.dart b/mycore_api/lib/model/geolocalized_mode.dart index ff1dbbc..818f9be 100644 --- a/mycore_api/lib/model/geolocalized_mode.dart +++ b/mycore_api/lib/model/geolocalized_mode.dart @@ -23,9 +23,9 @@ class GeolocalizedMode { String? longitude; - AlarmMode? homeMode; + TimePeriodAlarmAlarmMode? homeMode; - AlarmMode? absentMode; + TimePeriodAlarmAlarmMode? absentMode; @override bool operator ==(Object other) => identical(this, other) || other is GeolocalizedMode && @@ -46,20 +46,28 @@ class GeolocalizedMode { String toString() => 'GeolocalizedMode[latitude=$latitude, longitude=$longitude, homeMode=$homeMode, absentMode=$absentMode]'; Map toJson() { - final _json = {}; - if (latitude != null) { - _json[r'latitude'] = latitude; + final json = {}; + if (this.latitude != null) { + json[r'latitude'] = this.latitude; + } else { + json[r'latitude'] = null; } - if (longitude != null) { - _json[r'longitude'] = longitude; + if (this.longitude != null) { + json[r'longitude'] = this.longitude; + } else { + json[r'longitude'] = null; } - if (homeMode != null) { - _json[r'homeMode'] = homeMode; + if (this.homeMode != null) { + json[r'homeMode'] = this.homeMode; + } else { + json[r'homeMode'] = null; } - if (absentMode != null) { - _json[r'absentMode'] = absentMode; + if (this.absentMode != null) { + json[r'absentMode'] = this.absentMode; + } else { + json[r'absentMode'] = null; } - return _json; + return json; } /// Returns a new [GeolocalizedMode] instance and imports its values from @@ -83,14 +91,14 @@ class GeolocalizedMode { return GeolocalizedMode( latitude: mapValueOfType(json, r'latitude'), longitude: mapValueOfType(json, r'longitude'), - homeMode: AlarmMode.fromJson(json[r'homeMode']), - absentMode: AlarmMode.fromJson(json[r'absentMode']), + homeMode: TimePeriodAlarmAlarmMode.fromJson(json[r'homeMode']), + absentMode: TimePeriodAlarmAlarmMode.fromJson(json[r'absentMode']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -121,12 +129,10 @@ class GeolocalizedMode { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = GeolocalizedMode.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = GeolocalizedMode.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/google_auth_model.dart b/mycore_api/lib/model/google_auth_model.dart index c676821..fa7e635 100644 --- a/mycore_api/lib/model/google_auth_model.dart +++ b/mycore_api/lib/model/google_auth_model.dart @@ -36,14 +36,18 @@ class GoogleAuthModel { String toString() => 'GoogleAuthModel[authorizationCode=$authorizationCode, apiKey=$apiKey]'; Map toJson() { - final _json = {}; - if (authorizationCode != null) { - _json[r'authorizationCode'] = authorizationCode; + final json = {}; + if (this.authorizationCode != null) { + json[r'authorizationCode'] = this.authorizationCode; + } else { + json[r'authorizationCode'] = null; } - if (apiKey != null) { - _json[r'apiKey'] = apiKey; + if (this.apiKey != null) { + json[r'apiKey'] = this.apiKey; + } else { + json[r'apiKey'] = null; } - return _json; + return json; } /// Returns a new [GoogleAuthModel] instance and imports its values from @@ -72,7 +76,7 @@ class GoogleAuthModel { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -103,12 +107,10 @@ class GoogleAuthModel { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = GoogleAuthModel.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = GoogleAuthModel.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/group_create_or_update_detail_dto.dart b/mycore_api/lib/model/group_create_or_update_detail_dto.dart index 8b49502..0180354 100644 --- a/mycore_api/lib/model/group_create_or_update_detail_dto.dart +++ b/mycore_api/lib/model/group_create_or_update_detail_dto.dart @@ -62,26 +62,38 @@ class GroupCreateOrUpdateDetailDTO { String toString() => 'GroupCreateOrUpdateDetailDTO[id=$id, homeId=$homeId, name=$name, type=$type, isAlarm=$isAlarm, deviceIds=$deviceIds]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (isAlarm != null) { - _json[r'isAlarm'] = isAlarm; + if (this.isAlarm != null) { + json[r'isAlarm'] = this.isAlarm; + } else { + json[r'isAlarm'] = null; } - if (deviceIds != null) { - _json[r'deviceIds'] = deviceIds; + if (this.deviceIds != null) { + json[r'deviceIds'] = this.deviceIds; + } else { + json[r'deviceIds'] = null; } - return _json; + return json; } /// Returns a new [GroupCreateOrUpdateDetailDTO] instance and imports its values from @@ -116,7 +128,7 @@ class GroupCreateOrUpdateDetailDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -147,12 +159,10 @@ class GroupCreateOrUpdateDetailDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = GroupCreateOrUpdateDetailDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = GroupCreateOrUpdateDetailDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/group_create_or_update_detail_dto_all_of.dart b/mycore_api/lib/model/group_create_or_update_detail_dto_all_of.dart index 2e7befe..e2fb0bf 100644 --- a/mycore_api/lib/model/group_create_or_update_detail_dto_all_of.dart +++ b/mycore_api/lib/model/group_create_or_update_detail_dto_all_of.dart @@ -31,11 +31,13 @@ class GroupCreateOrUpdateDetailDTOAllOf { String toString() => 'GroupCreateOrUpdateDetailDTOAllOf[deviceIds=$deviceIds]'; Map toJson() { - final _json = {}; - if (deviceIds != null) { - _json[r'deviceIds'] = deviceIds; + final json = {}; + if (this.deviceIds != null) { + json[r'deviceIds'] = this.deviceIds; + } else { + json[r'deviceIds'] = null; } - return _json; + return json; } /// Returns a new [GroupCreateOrUpdateDetailDTOAllOf] instance and imports its values from @@ -65,7 +67,7 @@ class GroupCreateOrUpdateDetailDTOAllOf { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -96,12 +98,10 @@ class GroupCreateOrUpdateDetailDTOAllOf { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = GroupCreateOrUpdateDetailDTOAllOf.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = GroupCreateOrUpdateDetailDTOAllOf.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/group_detail_dto.dart b/mycore_api/lib/model/group_detail_dto.dart index 8359fe8..109873f 100644 --- a/mycore_api/lib/model/group_detail_dto.dart +++ b/mycore_api/lib/model/group_detail_dto.dart @@ -84,32 +84,48 @@ class GroupDetailDTO { String toString() => 'GroupDetailDTO[id=$id, homeId=$homeId, name=$name, type=$type, isAlarm=$isAlarm, createdDate=$createdDate, updatedDate=$updatedDate, devices=$devices]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (isAlarm != null) { - _json[r'isAlarm'] = isAlarm; + if (this.isAlarm != null) { + json[r'isAlarm'] = this.isAlarm; + } else { + json[r'isAlarm'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (devices != null) { - _json[r'devices'] = devices; + if (this.devices != null) { + json[r'devices'] = this.devices; + } else { + json[r'devices'] = null; } - return _json; + return json; } /// Returns a new [GroupDetailDTO] instance and imports its values from @@ -138,13 +154,13 @@ class GroupDetailDTO { isAlarm: mapValueOfType(json, r'isAlarm'), createdDate: mapDateTime(json, r'createdDate', ''), updatedDate: mapDateTime(json, r'updatedDate', ''), - devices: DeviceDetailDTO.listFromJson(json[r'devices']) ?? const [], + devices: DeviceDetailDTO.listFromJson(json[r'devices']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -175,12 +191,10 @@ class GroupDetailDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = GroupDetailDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = GroupDetailDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/group_detail_dto_all_of.dart b/mycore_api/lib/model/group_detail_dto_all_of.dart index d32a441..fd4778a 100644 --- a/mycore_api/lib/model/group_detail_dto_all_of.dart +++ b/mycore_api/lib/model/group_detail_dto_all_of.dart @@ -53,17 +53,23 @@ class GroupDetailDTOAllOf { String toString() => 'GroupDetailDTOAllOf[createdDate=$createdDate, updatedDate=$updatedDate, devices=$devices]'; Map toJson() { - final _json = {}; - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + final json = {}; + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (devices != null) { - _json[r'devices'] = devices; + if (this.devices != null) { + json[r'devices'] = this.devices; + } else { + json[r'devices'] = null; } - return _json; + return json; } /// Returns a new [GroupDetailDTOAllOf] instance and imports its values from @@ -87,13 +93,13 @@ class GroupDetailDTOAllOf { return GroupDetailDTOAllOf( createdDate: mapDateTime(json, r'createdDate', ''), updatedDate: mapDateTime(json, r'updatedDate', ''), - devices: DeviceDetailDTO.listFromJson(json[r'devices']) ?? const [], + devices: DeviceDetailDTO.listFromJson(json[r'devices']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -124,12 +130,10 @@ class GroupDetailDTOAllOf { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = GroupDetailDTOAllOf.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = GroupDetailDTOAllOf.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/group_summary_dto.dart b/mycore_api/lib/model/group_summary_dto.dart index e465c02..d109985 100644 --- a/mycore_api/lib/model/group_summary_dto.dart +++ b/mycore_api/lib/model/group_summary_dto.dart @@ -57,23 +57,33 @@ class GroupSummaryDTO { String toString() => 'GroupSummaryDTO[id=$id, homeId=$homeId, name=$name, type=$type, isAlarm=$isAlarm]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (isAlarm != null) { - _json[r'isAlarm'] = isAlarm; + if (this.isAlarm != null) { + json[r'isAlarm'] = this.isAlarm; + } else { + json[r'isAlarm'] = null; } - return _json; + return json; } /// Returns a new [GroupSummaryDTO] instance and imports its values from @@ -105,7 +115,7 @@ class GroupSummaryDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -136,12 +146,10 @@ class GroupSummaryDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = GroupSummaryDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = GroupSummaryDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/home_detail_dto.dart b/mycore_api/lib/model/home_detail_dto.dart index 6c8c2f8..432df65 100644 --- a/mycore_api/lib/model/home_detail_dto.dart +++ b/mycore_api/lib/model/home_detail_dto.dart @@ -48,7 +48,7 @@ class HomeDetailDTO { /// bool? isDefault; - AlarmMode? currentAlarmMode; + HomeDTOCurrentAlarmMode? currentAlarmMode; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -115,47 +115,73 @@ class HomeDetailDTO { String toString() => 'HomeDetailDTO[id=$id, name=$name, isAlarm=$isAlarm, isDefault=$isDefault, currentAlarmMode=$currentAlarmMode, createdDate=$createdDate, updatedDate=$updatedDate, usersIds=$usersIds, users=$users, devices=$devices, automations=$automations, providers=$providers, groups=$groups]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (isAlarm != null) { - _json[r'isAlarm'] = isAlarm; + if (this.isAlarm != null) { + json[r'isAlarm'] = this.isAlarm; + } else { + json[r'isAlarm'] = null; } - if (isDefault != null) { - _json[r'isDefault'] = isDefault; + if (this.isDefault != null) { + json[r'isDefault'] = this.isDefault; + } else { + json[r'isDefault'] = null; } - if (currentAlarmMode != null) { - _json[r'currentAlarmMode'] = currentAlarmMode; + if (this.currentAlarmMode != null) { + json[r'currentAlarmMode'] = this.currentAlarmMode; + } else { + json[r'currentAlarmMode'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (usersIds != null) { - _json[r'usersIds'] = usersIds; + if (this.usersIds != null) { + json[r'usersIds'] = this.usersIds; + } else { + json[r'usersIds'] = null; } - if (users != null) { - _json[r'users'] = users; + if (this.users != null) { + json[r'users'] = this.users; + } else { + json[r'users'] = null; } - if (devices != null) { - _json[r'devices'] = devices; + if (this.devices != null) { + json[r'devices'] = this.devices; + } else { + json[r'devices'] = null; } - if (automations != null) { - _json[r'automations'] = automations; + if (this.automations != null) { + json[r'automations'] = this.automations; + } else { + json[r'automations'] = null; } - if (providers != null) { - _json[r'providers'] = providers; + if (this.providers != null) { + json[r'providers'] = this.providers; + } else { + json[r'providers'] = null; } - if (groups != null) { - _json[r'groups'] = groups; + if (this.groups != null) { + json[r'groups'] = this.groups; + } else { + json[r'groups'] = null; } - return _json; + return json; } /// Returns a new [HomeDetailDTO] instance and imports its values from @@ -181,23 +207,23 @@ class HomeDetailDTO { name: mapValueOfType(json, r'name'), isAlarm: mapValueOfType(json, r'isAlarm'), isDefault: mapValueOfType(json, r'isDefault'), - currentAlarmMode: AlarmMode.fromJson(json[r'currentAlarmMode']), + currentAlarmMode: HomeDTOCurrentAlarmMode.fromJson(json[r'currentAlarmMode']), createdDate: mapDateTime(json, r'createdDate', ''), updatedDate: mapDateTime(json, r'updatedDate', ''), usersIds: json[r'usersIds'] is List ? (json[r'usersIds'] as List).cast() : const [], - users: UserInfoDetailDTO.listFromJson(json[r'users']) ?? const [], - devices: DeviceSummaryDTO.listFromJson(json[r'devices']) ?? const [], - automations: AutomationDTO.listFromJson(json[r'automations']) ?? const [], - providers: ProviderDTO.listFromJson(json[r'providers']) ?? const [], - groups: GroupSummaryDTO.listFromJson(json[r'groups']) ?? const [], + users: UserInfoDetailDTO.listFromJson(json[r'users']), + devices: DeviceSummaryDTO.listFromJson(json[r'devices']), + automations: AutomationDTO.listFromJson(json[r'automations']), + providers: ProviderDTO.listFromJson(json[r'providers']), + groups: GroupSummaryDTO.listFromJson(json[r'groups']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -228,12 +254,10 @@ class HomeDetailDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = HomeDetailDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = HomeDetailDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/home_detail_dto_all_of.dart b/mycore_api/lib/model/home_detail_dto_all_of.dart index 624b156..bd05a49 100644 --- a/mycore_api/lib/model/home_detail_dto_all_of.dart +++ b/mycore_api/lib/model/home_detail_dto_all_of.dart @@ -51,23 +51,33 @@ class HomeDetailDTOAllOf { String toString() => 'HomeDetailDTOAllOf[users=$users, devices=$devices, automations=$automations, providers=$providers, groups=$groups]'; Map toJson() { - final _json = {}; - if (users != null) { - _json[r'users'] = users; + final json = {}; + if (this.users != null) { + json[r'users'] = this.users; + } else { + json[r'users'] = null; } - if (devices != null) { - _json[r'devices'] = devices; + if (this.devices != null) { + json[r'devices'] = this.devices; + } else { + json[r'devices'] = null; } - if (automations != null) { - _json[r'automations'] = automations; + if (this.automations != null) { + json[r'automations'] = this.automations; + } else { + json[r'automations'] = null; } - if (providers != null) { - _json[r'providers'] = providers; + if (this.providers != null) { + json[r'providers'] = this.providers; + } else { + json[r'providers'] = null; } - if (groups != null) { - _json[r'groups'] = groups; + if (this.groups != null) { + json[r'groups'] = this.groups; + } else { + json[r'groups'] = null; } - return _json; + return json; } /// Returns a new [HomeDetailDTOAllOf] instance and imports its values from @@ -89,17 +99,17 @@ class HomeDetailDTOAllOf { }()); return HomeDetailDTOAllOf( - users: UserInfoDetailDTO.listFromJson(json[r'users']) ?? const [], - devices: DeviceSummaryDTO.listFromJson(json[r'devices']) ?? const [], - automations: AutomationDTO.listFromJson(json[r'automations']) ?? const [], - providers: ProviderDTO.listFromJson(json[r'providers']) ?? const [], - groups: GroupSummaryDTO.listFromJson(json[r'groups']) ?? const [], + users: UserInfoDetailDTO.listFromJson(json[r'users']), + devices: DeviceSummaryDTO.listFromJson(json[r'devices']), + automations: AutomationDTO.listFromJson(json[r'automations']), + providers: ProviderDTO.listFromJson(json[r'providers']), + groups: GroupSummaryDTO.listFromJson(json[r'groups']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -130,12 +140,10 @@ class HomeDetailDTOAllOf { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = HomeDetailDTOAllOf.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = HomeDetailDTOAllOf.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/home_dto.dart b/mycore_api/lib/model/home_dto.dart index bc20a0e..9e360a3 100644 --- a/mycore_api/lib/model/home_dto.dart +++ b/mycore_api/lib/model/home_dto.dart @@ -43,7 +43,7 @@ class HomeDTO { /// bool? isDefault; - AlarmMode? currentAlarmMode; + HomeDTOCurrentAlarmMode? currentAlarmMode; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -90,32 +90,48 @@ class HomeDTO { String toString() => 'HomeDTO[id=$id, name=$name, isAlarm=$isAlarm, isDefault=$isDefault, currentAlarmMode=$currentAlarmMode, createdDate=$createdDate, updatedDate=$updatedDate, usersIds=$usersIds]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (isAlarm != null) { - _json[r'isAlarm'] = isAlarm; + if (this.isAlarm != null) { + json[r'isAlarm'] = this.isAlarm; + } else { + json[r'isAlarm'] = null; } - if (isDefault != null) { - _json[r'isDefault'] = isDefault; + if (this.isDefault != null) { + json[r'isDefault'] = this.isDefault; + } else { + json[r'isDefault'] = null; } - if (currentAlarmMode != null) { - _json[r'currentAlarmMode'] = currentAlarmMode; + if (this.currentAlarmMode != null) { + json[r'currentAlarmMode'] = this.currentAlarmMode; + } else { + json[r'currentAlarmMode'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (usersIds != null) { - _json[r'usersIds'] = usersIds; + if (this.usersIds != null) { + json[r'usersIds'] = this.usersIds; + } else { + json[r'usersIds'] = null; } - return _json; + return json; } /// Returns a new [HomeDTO] instance and imports its values from @@ -141,7 +157,7 @@ class HomeDTO { name: mapValueOfType(json, r'name'), isAlarm: mapValueOfType(json, r'isAlarm'), isDefault: mapValueOfType(json, r'isDefault'), - currentAlarmMode: AlarmMode.fromJson(json[r'currentAlarmMode']), + currentAlarmMode: HomeDTOCurrentAlarmMode.fromJson(json[r'currentAlarmMode']), createdDate: mapDateTime(json, r'createdDate', ''), updatedDate: mapDateTime(json, r'updatedDate', ''), usersIds: json[r'usersIds'] is List @@ -152,7 +168,7 @@ class HomeDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -183,12 +199,10 @@ class HomeDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = HomeDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = HomeDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/home_dto_current_alarm_mode.dart b/mycore_api/lib/model/home_dto_current_alarm_mode.dart new file mode 100644 index 0000000..9aede85 --- /dev/null +++ b/mycore_api/lib/model/home_dto_current_alarm_mode.dart @@ -0,0 +1,236 @@ +// +// 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 HomeDTOCurrentAlarmMode { + /// Returns a new [HomeDTOCurrentAlarmMode] instance. + HomeDTOCurrentAlarmMode({ + this.id, + this.homeId, + this.name, + this.type, + this.activated, + this.isDefault, + this.notification, + this.createdDate, + this.updatedDate, + }); + + String? id; + + String? homeId; + + String? name; + + /// + /// 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. + /// + AlarmType? type; + + /// + /// 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? activated; + + /// + /// 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? isDefault; + + /// + /// 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? notification; + + /// + /// 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. + /// + DateTime? createdDate; + + /// + /// 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. + /// + DateTime? updatedDate; + + @override + bool operator ==(Object other) => identical(this, other) || other is HomeDTOCurrentAlarmMode && + other.id == id && + other.homeId == homeId && + other.name == name && + other.type == type && + other.activated == activated && + other.isDefault == isDefault && + other.notification == notification && + other.createdDate == createdDate && + other.updatedDate == updatedDate; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (homeId == null ? 0 : homeId!.hashCode) + + (name == null ? 0 : name!.hashCode) + + (type == null ? 0 : type!.hashCode) + + (activated == null ? 0 : activated!.hashCode) + + (isDefault == null ? 0 : isDefault!.hashCode) + + (notification == null ? 0 : notification!.hashCode) + + (createdDate == null ? 0 : createdDate!.hashCode) + + (updatedDate == null ? 0 : updatedDate!.hashCode); + + @override + String toString() => 'HomeDTOCurrentAlarmMode[id=$id, homeId=$homeId, name=$name, type=$type, activated=$activated, isDefault=$isDefault, notification=$notification, createdDate=$createdDate, updatedDate=$updatedDate]'; + + Map toJson() { + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; + } + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; + } + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; + } + if (this.activated != null) { + json[r'activated'] = this.activated; + } else { + json[r'activated'] = null; + } + if (this.isDefault != null) { + json[r'isDefault'] = this.isDefault; + } else { + json[r'isDefault'] = null; + } + if (this.notification != null) { + json[r'notification'] = this.notification; + } else { + json[r'notification'] = null; + } + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; + } + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; + } + return json; + } + + /// Returns a new [HomeDTOCurrentAlarmMode] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static HomeDTOCurrentAlarmMode? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "HomeDTOCurrentAlarmMode[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "HomeDTOCurrentAlarmMode[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return HomeDTOCurrentAlarmMode( + id: mapValueOfType(json, r'id'), + homeId: mapValueOfType(json, r'homeId'), + name: mapValueOfType(json, r'name'), + type: AlarmType.fromJson(json[r'type']), + activated: mapValueOfType(json, r'activated'), + isDefault: mapValueOfType(json, r'isDefault'), + notification: mapValueOfType(json, r'notification'), + createdDate: mapDateTime(json, r'createdDate', ''), + updatedDate: mapDateTime(json, r'updatedDate', ''), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = HomeDTOCurrentAlarmMode.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = HomeDTOCurrentAlarmMode.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of HomeDTOCurrentAlarmMode-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = HomeDTOCurrentAlarmMode.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/mycore_api/lib/model/list_response_of_event_detail_dto_and_event_home_filter.dart b/mycore_api/lib/model/list_response_of_event_detail_dto_and_event_home_filter.dart index 96c35af..3d926b5 100644 --- a/mycore_api/lib/model/list_response_of_event_detail_dto_and_event_home_filter.dart +++ b/mycore_api/lib/model/list_response_of_event_detail_dto_and_event_home_filter.dart @@ -21,7 +21,7 @@ class ListResponseOfEventDetailDTOAndEventHomeFilter { List? values; - ListResponseOfEventDetailDTOAndEventHomeFilter? requestParameters; + ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters? requestParameters; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -58,20 +58,28 @@ class ListResponseOfEventDetailDTOAndEventHomeFilter { String toString() => 'ListResponseOfEventDetailDTOAndEventHomeFilter[values=$values, requestParameters=$requestParameters, totalCount=$totalCount, actualCount=$actualCount]'; Map toJson() { - final _json = {}; - if (values != null) { - _json[r'values'] = values; + final json = {}; + if (this.values != null) { + json[r'values'] = this.values; + } else { + json[r'values'] = null; } - if (requestParameters != null) { - _json[r'requestParameters'] = requestParameters; + if (this.requestParameters != null) { + json[r'requestParameters'] = this.requestParameters; + } else { + json[r'requestParameters'] = null; } - if (totalCount != null) { - _json[r'totalCount'] = totalCount; + if (this.totalCount != null) { + json[r'totalCount'] = this.totalCount; + } else { + json[r'totalCount'] = null; } - if (actualCount != null) { - _json[r'actualCount'] = actualCount; + if (this.actualCount != null) { + json[r'actualCount'] = this.actualCount; + } else { + json[r'actualCount'] = null; } - return _json; + return json; } /// Returns a new [ListResponseOfEventDetailDTOAndEventHomeFilter] instance and imports its values from @@ -93,8 +101,8 @@ class ListResponseOfEventDetailDTOAndEventHomeFilter { }()); return ListResponseOfEventDetailDTOAndEventHomeFilter( - values: EventDetailDTO.listFromJson(json[r'values']) ?? const [], - requestParameters: ListResponseOfEventDetailDTOAndEventHomeFilter.fromJson(json[r'requestParameters']), + values: EventDetailDTO.listFromJson(json[r'values']), + requestParameters: ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters.fromJson(json[r'requestParameters']), totalCount: mapValueOfType(json, r'totalCount'), actualCount: mapValueOfType(json, r'actualCount'), ); @@ -102,7 +110,7 @@ class ListResponseOfEventDetailDTOAndEventHomeFilter { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -133,12 +141,10 @@ class ListResponseOfEventDetailDTOAndEventHomeFilter { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = ListResponseOfEventDetailDTOAndEventHomeFilter.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ListResponseOfEventDetailDTOAndEventHomeFilter.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/list_response_of_event_detail_dto_and_event_home_filter_request_parameters.dart b/mycore_api/lib/model/list_response_of_event_detail_dto_and_event_home_filter_request_parameters.dart new file mode 100644 index 0000000..aff749e --- /dev/null +++ b/mycore_api/lib/model/list_response_of_event_detail_dto_and_event_home_filter_request_parameters.dart @@ -0,0 +1,201 @@ +// +// 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 ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters { + /// Returns a new [ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters] instance. + ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters({ + this.startIndex, + this.count, + this.dateStart, + this.dateEnd, + this.eventType, + this.deviceType, + this.deviceId, + this.roomId, + }); + + /// + /// 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? startIndex; + + /// + /// 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? count; + + DateTime? dateStart; + + DateTime? dateEnd; + + EventGetEventTypeParameter? eventType; + + EventGetDeviceTypeParameter? deviceType; + + String? deviceId; + + String? roomId; + + @override + bool operator ==(Object other) => identical(this, other) || other is ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters && + other.startIndex == startIndex && + other.count == count && + other.dateStart == dateStart && + other.dateEnd == dateEnd && + other.eventType == eventType && + other.deviceType == deviceType && + other.deviceId == deviceId && + other.roomId == roomId; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (startIndex == null ? 0 : startIndex!.hashCode) + + (count == null ? 0 : count!.hashCode) + + (dateStart == null ? 0 : dateStart!.hashCode) + + (dateEnd == null ? 0 : dateEnd!.hashCode) + + (eventType == null ? 0 : eventType!.hashCode) + + (deviceType == null ? 0 : deviceType!.hashCode) + + (deviceId == null ? 0 : deviceId!.hashCode) + + (roomId == null ? 0 : roomId!.hashCode); + + @override + String toString() => 'ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters[startIndex=$startIndex, count=$count, dateStart=$dateStart, dateEnd=$dateEnd, eventType=$eventType, deviceType=$deviceType, deviceId=$deviceId, roomId=$roomId]'; + + Map toJson() { + final json = {}; + if (this.startIndex != null) { + json[r'startIndex'] = this.startIndex; + } else { + json[r'startIndex'] = null; + } + if (this.count != null) { + json[r'count'] = this.count; + } else { + json[r'count'] = null; + } + if (this.dateStart != null) { + json[r'dateStart'] = this.dateStart!.toUtc().toIso8601String(); + } else { + json[r'dateStart'] = null; + } + if (this.dateEnd != null) { + json[r'dateEnd'] = this.dateEnd!.toUtc().toIso8601String(); + } else { + json[r'dateEnd'] = null; + } + if (this.eventType != null) { + json[r'eventType'] = this.eventType; + } else { + json[r'eventType'] = null; + } + if (this.deviceType != null) { + json[r'deviceType'] = this.deviceType; + } else { + json[r'deviceType'] = null; + } + if (this.deviceId != null) { + json[r'deviceId'] = this.deviceId; + } else { + json[r'deviceId'] = null; + } + if (this.roomId != null) { + json[r'roomId'] = this.roomId; + } else { + json[r'roomId'] = null; + } + return json; + } + + /// Returns a new [ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters( + startIndex: mapValueOfType(json, r'startIndex'), + count: mapValueOfType(json, r'count'), + dateStart: mapDateTime(json, r'dateStart', ''), + dateEnd: mapDateTime(json, r'dateEnd', ''), + eventType: EventGetEventTypeParameter.fromJson(json[r'eventType']), + deviceType: EventGetDeviceTypeParameter.fromJson(json[r'deviceType']), + deviceId: mapValueOfType(json, r'deviceId'), + roomId: mapValueOfType(json, r'roomId'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ListResponseOfEventDetailDTOAndEventHomeFilterRequestParameters.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/mycore_api/lib/model/login_dto.dart b/mycore_api/lib/model/login_dto.dart index e5543ec..a8e6b90 100644 --- a/mycore_api/lib/model/login_dto.dart +++ b/mycore_api/lib/model/login_dto.dart @@ -36,14 +36,18 @@ class LoginDTO { String toString() => 'LoginDTO[email=$email, password=$password]'; Map toJson() { - final _json = {}; - if (email != null) { - _json[r'email'] = email; + final json = {}; + if (this.email != null) { + json[r'email'] = this.email; + } else { + json[r'email'] = null; } - if (password != null) { - _json[r'password'] = password; + if (this.password != null) { + json[r'password'] = this.password; + } else { + json[r'password'] = null; } - return _json; + return json; } /// Returns a new [LoginDTO] instance and imports its values from @@ -72,7 +76,7 @@ class LoginDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -103,12 +107,10 @@ class LoginDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = LoginDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = LoginDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/means_of_communication.dart b/mycore_api/lib/model/means_of_communication.dart index da157b8..085d5b5 100644 --- a/mycore_api/lib/model/means_of_communication.dart +++ b/mycore_api/lib/model/means_of_communication.dart @@ -38,7 +38,7 @@ class MeansOfCommunication { static MeansOfCommunication? fromJson(dynamic value) => MeansOfCommunicationTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -71,7 +71,7 @@ class MeansOfCommunicationTypeTransformer { /// and users are still using an old app with the old code. MeansOfCommunication? decode(dynamic data, {bool allowNull = true}) { if (data != null) { - switch (data.toString()) { + switch (data) { case r'Wifi': return MeansOfCommunication.wifi; case r'Bluetooth': return MeansOfCommunication.bluetooth; case r'Zigbee': return MeansOfCommunication.zigbee; diff --git a/mycore_api/lib/model/mqtt_message_dto.dart b/mycore_api/lib/model/mqtt_message_dto.dart index 750157f..203cbe6 100644 --- a/mycore_api/lib/model/mqtt_message_dto.dart +++ b/mycore_api/lib/model/mqtt_message_dto.dart @@ -47,17 +47,23 @@ class MqttMessageDTO { String toString() => 'MqttMessageDTO[topic=$topic, message=$message, online=$online]'; Map toJson() { - final _json = {}; - if (topic != null) { - _json[r'topic'] = topic; + final json = {}; + if (this.topic != null) { + json[r'topic'] = this.topic; + } else { + json[r'topic'] = null; } - if (message != null) { - _json[r'message'] = message; + if (this.message != null) { + json[r'message'] = this.message; + } else { + json[r'message'] = null; } - if (online != null) { - _json[r'online'] = online; + if (this.online != null) { + json[r'online'] = this.online; + } else { + json[r'online'] = null; } - return _json; + return json; } /// Returns a new [MqttMessageDTO] instance and imports its values from @@ -87,7 +93,7 @@ class MqttMessageDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -118,12 +124,10 @@ class MqttMessageDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = MqttMessageDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = MqttMessageDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/notification_dto.dart b/mycore_api/lib/model/notification_dto.dart new file mode 100644 index 0000000..9a1695f --- /dev/null +++ b/mycore_api/lib/model/notification_dto.dart @@ -0,0 +1,212 @@ +// +// 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 NotificationDTO { + /// Returns a new [NotificationDTO] instance. + NotificationDTO({ + this.notificationTitle, + this.notificationMessage, + this.notificationLabelButton, + this.title, + this.body, + this.type, + this.isPushNotification, + this.isButton, + this.buttonLabel, + }); + + String? notificationTitle; + + String? notificationMessage; + + String? notificationLabelButton; + + String? title; + + String? body; + + String? type; + + /// + /// 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? isPushNotification; + + /// + /// 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? isButton; + + String? buttonLabel; + + @override + bool operator ==(Object other) => identical(this, other) || other is NotificationDTO && + other.notificationTitle == notificationTitle && + other.notificationMessage == notificationMessage && + other.notificationLabelButton == notificationLabelButton && + other.title == title && + other.body == body && + other.type == type && + other.isPushNotification == isPushNotification && + other.isButton == isButton && + other.buttonLabel == buttonLabel; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (notificationTitle == null ? 0 : notificationTitle!.hashCode) + + (notificationMessage == null ? 0 : notificationMessage!.hashCode) + + (notificationLabelButton == null ? 0 : notificationLabelButton!.hashCode) + + (title == null ? 0 : title!.hashCode) + + (body == null ? 0 : body!.hashCode) + + (type == null ? 0 : type!.hashCode) + + (isPushNotification == null ? 0 : isPushNotification!.hashCode) + + (isButton == null ? 0 : isButton!.hashCode) + + (buttonLabel == null ? 0 : buttonLabel!.hashCode); + + @override + String toString() => 'NotificationDTO[notificationTitle=$notificationTitle, notificationMessage=$notificationMessage, notificationLabelButton=$notificationLabelButton, title=$title, body=$body, type=$type, isPushNotification=$isPushNotification, isButton=$isButton, buttonLabel=$buttonLabel]'; + + Map toJson() { + final json = {}; + if (this.notificationTitle != null) { + json[r'notificationTitle'] = this.notificationTitle; + } else { + json[r'notificationTitle'] = null; + } + if (this.notificationMessage != null) { + json[r'notificationMessage'] = this.notificationMessage; + } else { + json[r'notificationMessage'] = null; + } + if (this.notificationLabelButton != null) { + json[r'notificationLabelButton'] = this.notificationLabelButton; + } else { + json[r'notificationLabelButton'] = null; + } + if (this.title != null) { + json[r'title'] = this.title; + } else { + json[r'title'] = null; + } + if (this.body != null) { + json[r'body'] = this.body; + } else { + json[r'body'] = null; + } + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; + } + if (this.isPushNotification != null) { + json[r'isPushNotification'] = this.isPushNotification; + } else { + json[r'isPushNotification'] = null; + } + if (this.isButton != null) { + json[r'isButton'] = this.isButton; + } else { + json[r'isButton'] = null; + } + if (this.buttonLabel != null) { + json[r'buttonLabel'] = this.buttonLabel; + } else { + json[r'buttonLabel'] = null; + } + return json; + } + + /// Returns a new [NotificationDTO] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static NotificationDTO? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "NotificationDTO[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "NotificationDTO[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return NotificationDTO( + notificationTitle: mapValueOfType(json, r'notificationTitle'), + notificationMessage: mapValueOfType(json, r'notificationMessage'), + notificationLabelButton: mapValueOfType(json, r'notificationLabelButton'), + title: mapValueOfType(json, r'title'), + body: mapValueOfType(json, r'body'), + type: mapValueOfType(json, r'type'), + isPushNotification: mapValueOfType(json, r'isPushNotification'), + isButton: mapValueOfType(json, r'isButton'), + buttonLabel: mapValueOfType(json, r'buttonLabel'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = NotificationDTO.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = NotificationDTO.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of NotificationDTO-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = NotificationDTO.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/mycore_api/lib/model/odd_nice.dart b/mycore_api/lib/model/odd_nice.dart index 8b5774d..53bb497 100644 --- a/mycore_api/lib/model/odd_nice.dart +++ b/mycore_api/lib/model/odd_nice.dart @@ -52,20 +52,28 @@ class OddNice { String toString() => 'OddNice[teams=$teams, commenceTime=$commenceTime, homeTeam=$homeTeam, odds=$odds]'; Map toJson() { - final _json = {}; - if (teams != null) { - _json[r'teams'] = teams; + final json = {}; + if (this.teams != null) { + json[r'teams'] = this.teams; + } else { + json[r'teams'] = null; } - if (commenceTime != null) { - _json[r'commence_time'] = commenceTime; + if (this.commenceTime != null) { + json[r'commence_time'] = this.commenceTime; + } else { + json[r'commence_time'] = null; } - if (homeTeam != null) { - _json[r'home_team'] = homeTeam; + if (this.homeTeam != null) { + json[r'home_team'] = this.homeTeam; + } else { + json[r'home_team'] = null; } - if (odds != null) { - _json[r'odds'] = odds; + if (this.odds != null) { + json[r'odds'] = this.odds; + } else { + json[r'odds'] = null; } - return _json; + return json; } /// Returns a new [OddNice] instance and imports its values from @@ -98,7 +106,7 @@ class OddNice { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -129,12 +137,10 @@ class OddNice { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = OddNice.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = OddNice.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/odd_nice_odds.dart b/mycore_api/lib/model/odd_nice_odds.dart index ecd15c4..73aab8a 100644 --- a/mycore_api/lib/model/odd_nice_odds.dart +++ b/mycore_api/lib/model/odd_nice_odds.dart @@ -59,17 +59,23 @@ class OddNiceOdds { String toString() => 'OddNiceOdds[homeOdd=$homeOdd, drawOdd=$drawOdd, visitOdd=$visitOdd]'; Map toJson() { - final _json = {}; - if (homeOdd != null) { - _json[r'homeOdd'] = homeOdd; + final json = {}; + if (this.homeOdd != null) { + json[r'homeOdd'] = this.homeOdd; + } else { + json[r'homeOdd'] = null; } - if (drawOdd != null) { - _json[r'drawOdd'] = drawOdd; + if (this.drawOdd != null) { + json[r'drawOdd'] = this.drawOdd; + } else { + json[r'drawOdd'] = null; } - if (visitOdd != null) { - _json[r'visitOdd'] = visitOdd; + if (this.visitOdd != null) { + json[r'visitOdd'] = this.visitOdd; + } else { + json[r'visitOdd'] = null; } - return _json; + return json; } /// Returns a new [OddNiceOdds] instance and imports its values from @@ -99,7 +105,7 @@ class OddNiceOdds { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -130,12 +136,10 @@ class OddNiceOdds { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = OddNiceOdds.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = OddNiceOdds.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/odd_object.dart b/mycore_api/lib/model/odd_object.dart index c8e62ff..10c3ae8 100644 --- a/mycore_api/lib/model/odd_object.dart +++ b/mycore_api/lib/model/odd_object.dart @@ -59,17 +59,23 @@ class OddObject { String toString() => 'OddObject[homeOdd=$homeOdd, drawOdd=$drawOdd, visitOdd=$visitOdd]'; Map toJson() { - final _json = {}; - if (homeOdd != null) { - _json[r'homeOdd'] = homeOdd; + final json = {}; + if (this.homeOdd != null) { + json[r'homeOdd'] = this.homeOdd; + } else { + json[r'homeOdd'] = null; } - if (drawOdd != null) { - _json[r'drawOdd'] = drawOdd; + if (this.drawOdd != null) { + json[r'drawOdd'] = this.drawOdd; + } else { + json[r'drawOdd'] = null; } - if (visitOdd != null) { - _json[r'visitOdd'] = visitOdd; + if (this.visitOdd != null) { + json[r'visitOdd'] = this.visitOdd; + } else { + json[r'visitOdd'] = null; } - return _json; + return json; } /// Returns a new [OddObject] instance and imports its values from @@ -99,7 +105,7 @@ class OddObject { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -130,12 +136,10 @@ class OddObject { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = OddObject.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = OddObject.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/panel_menu_item.dart b/mycore_api/lib/model/panel_menu_item.dart index 9d24e2f..34ad2d7 100644 --- a/mycore_api/lib/model/panel_menu_item.dart +++ b/mycore_api/lib/model/panel_menu_item.dart @@ -67,29 +67,43 @@ class PanelMenuItem { String toString() => 'PanelMenuItem[label=$label, route=$route, icon=$icon, color=$color, badgeValue=$badgeValue, badgeType=$badgeType, children=$children]'; Map toJson() { - final _json = {}; - if (label != null) { - _json[r'label'] = label; + final json = {}; + if (this.label != null) { + json[r'label'] = this.label; + } else { + json[r'label'] = null; } - if (route != null) { - _json[r'route'] = route; + if (this.route != null) { + json[r'route'] = this.route; + } else { + json[r'route'] = null; } - if (icon != null) { - _json[r'icon'] = icon; + if (this.icon != null) { + json[r'icon'] = this.icon; + } else { + json[r'icon'] = null; } - if (color != null) { - _json[r'color'] = color; + if (this.color != null) { + json[r'color'] = this.color; + } else { + json[r'color'] = null; } - if (badgeValue != null) { - _json[r'badgeValue'] = badgeValue; + if (this.badgeValue != null) { + json[r'badgeValue'] = this.badgeValue; + } else { + json[r'badgeValue'] = null; } - if (badgeType != null) { - _json[r'badgeType'] = badgeType; + if (this.badgeType != null) { + json[r'badgeType'] = this.badgeType; + } else { + json[r'badgeType'] = null; } - if (children != null) { - _json[r'children'] = children; + if (this.children != null) { + json[r'children'] = this.children; + } else { + json[r'children'] = null; } - return _json; + return json; } /// Returns a new [PanelMenuItem] instance and imports its values from @@ -117,13 +131,13 @@ class PanelMenuItem { color: mapValueOfType(json, r'color'), badgeValue: mapValueOfType(json, r'badgeValue'), badgeType: mapValueOfType(json, r'badgeType'), - children: PanelMenuItem.listFromJson(json[r'children']) ?? const [], + children: PanelMenuItem.listFromJson(json[r'children']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -154,12 +168,10 @@ class PanelMenuItem { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = PanelMenuItem.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = PanelMenuItem.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/panel_section.dart b/mycore_api/lib/model/panel_section.dart index 2989fb2..0fc9c91 100644 --- a/mycore_api/lib/model/panel_section.dart +++ b/mycore_api/lib/model/panel_section.dart @@ -51,23 +51,33 @@ class PanelSection { String toString() => 'PanelSection[label=$label, icon=$icon, color=$color, defaultRoute=$defaultRoute, children=$children]'; Map toJson() { - final _json = {}; - if (label != null) { - _json[r'label'] = label; + final json = {}; + if (this.label != null) { + json[r'label'] = this.label; + } else { + json[r'label'] = null; } - if (icon != null) { - _json[r'icon'] = icon; + if (this.icon != null) { + json[r'icon'] = this.icon; + } else { + json[r'icon'] = null; } - if (color != null) { - _json[r'color'] = color; + if (this.color != null) { + json[r'color'] = this.color; + } else { + json[r'color'] = null; } - if (defaultRoute != null) { - _json[r'defaultRoute'] = defaultRoute; + if (this.defaultRoute != null) { + json[r'defaultRoute'] = this.defaultRoute; + } else { + json[r'defaultRoute'] = null; } - if (children != null) { - _json[r'children'] = children; + if (this.children != null) { + json[r'children'] = this.children; + } else { + json[r'children'] = null; } - return _json; + return json; } /// Returns a new [PanelSection] instance and imports its values from @@ -93,13 +103,13 @@ class PanelSection { icon: mapValueOfType(json, r'icon'), color: mapValueOfType(json, r'color'), defaultRoute: mapValueOfType(json, r'defaultRoute'), - children: PanelMenuItem.listFromJson(json[r'children']) ?? const [], + children: PanelMenuItem.listFromJson(json[r'children']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -130,12 +140,10 @@ class PanelSection { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = PanelSection.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = PanelSection.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/programmed_mode.dart b/mycore_api/lib/model/programmed_mode.dart index 3542ffd..4c2f361 100644 --- a/mycore_api/lib/model/programmed_mode.dart +++ b/mycore_api/lib/model/programmed_mode.dart @@ -61,29 +61,43 @@ class ProgrammedMode { String toString() => 'ProgrammedMode[monday=$monday, tuesday=$tuesday, wednesday=$wednesday, thursday=$thursday, friday=$friday, saturday=$saturday, sunday=$sunday]'; Map toJson() { - final _json = {}; - if (monday != null) { - _json[r'monday'] = monday; + final json = {}; + if (this.monday != null) { + json[r'monday'] = this.monday; + } else { + json[r'monday'] = null; } - if (tuesday != null) { - _json[r'tuesday'] = tuesday; + if (this.tuesday != null) { + json[r'tuesday'] = this.tuesday; + } else { + json[r'tuesday'] = null; } - if (wednesday != null) { - _json[r'wednesday'] = wednesday; + if (this.wednesday != null) { + json[r'wednesday'] = this.wednesday; + } else { + json[r'wednesday'] = null; } - if (thursday != null) { - _json[r'thursday'] = thursday; + if (this.thursday != null) { + json[r'thursday'] = this.thursday; + } else { + json[r'thursday'] = null; } - if (friday != null) { - _json[r'friday'] = friday; + if (this.friday != null) { + json[r'friday'] = this.friday; + } else { + json[r'friday'] = null; } - if (saturday != null) { - _json[r'saturday'] = saturday; + if (this.saturday != null) { + json[r'saturday'] = this.saturday; + } else { + json[r'saturday'] = null; } - if (sunday != null) { - _json[r'sunday'] = sunday; + if (this.sunday != null) { + json[r'sunday'] = this.sunday; + } else { + json[r'sunday'] = null; } - return _json; + return json; } /// Returns a new [ProgrammedMode] instance and imports its values from @@ -105,19 +119,19 @@ class ProgrammedMode { }()); return ProgrammedMode( - monday: TimePeriodAlarm.listFromJson(json[r'monday']) ?? const [], - tuesday: TimePeriodAlarm.listFromJson(json[r'tuesday']) ?? const [], - wednesday: TimePeriodAlarm.listFromJson(json[r'wednesday']) ?? const [], - thursday: TimePeriodAlarm.listFromJson(json[r'thursday']) ?? const [], - friday: TimePeriodAlarm.listFromJson(json[r'friday']) ?? const [], - saturday: TimePeriodAlarm.listFromJson(json[r'saturday']) ?? const [], - sunday: TimePeriodAlarm.listFromJson(json[r'sunday']) ?? const [], + monday: TimePeriodAlarm.listFromJson(json[r'monday']), + tuesday: TimePeriodAlarm.listFromJson(json[r'tuesday']), + wednesday: TimePeriodAlarm.listFromJson(json[r'wednesday']), + thursday: TimePeriodAlarm.listFromJson(json[r'thursday']), + friday: TimePeriodAlarm.listFromJson(json[r'friday']), + saturday: TimePeriodAlarm.listFromJson(json[r'saturday']), + sunday: TimePeriodAlarm.listFromJson(json[r'sunday']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -148,12 +162,10 @@ class ProgrammedMode { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = ProgrammedMode.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ProgrammedMode.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/provider_dto.dart b/mycore_api/lib/model/provider_dto.dart index 7b9614c..6cb30bd 100644 --- a/mycore_api/lib/model/provider_dto.dart +++ b/mycore_api/lib/model/provider_dto.dart @@ -83,35 +83,53 @@ class ProviderDTO { String toString() => 'ProviderDTO[id=$id, name=$name, type=$type, homeId=$homeId, endpoint=$endpoint, username=$username, password=$password, apiKey=$apiKey, active=$active]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (endpoint != null) { - _json[r'endpoint'] = endpoint; + if (this.endpoint != null) { + json[r'endpoint'] = this.endpoint; + } else { + json[r'endpoint'] = null; } - if (username != null) { - _json[r'username'] = username; + if (this.username != null) { + json[r'username'] = this.username; + } else { + json[r'username'] = null; } - if (password != null) { - _json[r'password'] = password; + if (this.password != null) { + json[r'password'] = this.password; + } else { + json[r'password'] = null; } - if (apiKey != null) { - _json[r'apiKey'] = apiKey; + if (this.apiKey != null) { + json[r'apiKey'] = this.apiKey; + } else { + json[r'apiKey'] = null; } - if (active != null) { - _json[r'active'] = active; + if (this.active != null) { + json[r'active'] = this.active; + } else { + json[r'active'] = null; } - return _json; + return json; } /// Returns a new [ProviderDTO] instance and imports its values from @@ -147,7 +165,7 @@ class ProviderDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -178,12 +196,10 @@ class ProviderDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = ProviderDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ProviderDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/provider_type.dart b/mycore_api/lib/model/provider_type.dart index afa4266..2044bb7 100644 --- a/mycore_api/lib/model/provider_type.dart +++ b/mycore_api/lib/model/provider_type.dart @@ -38,7 +38,7 @@ class ProviderType { static ProviderType? fromJson(dynamic value) => ProviderTypeTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -71,7 +71,7 @@ class ProviderTypeTypeTransformer { /// and users are still using an old app with the old code. ProviderType? decode(dynamic data, {bool allowNull = true}) { if (data != null) { - switch (data.toString()) { + switch (data) { case r'arlo': return ProviderType.arlo; case r'meross': return ProviderType.meross; case r'yeelight': return ProviderType.yeelight; diff --git a/mycore_api/lib/model/room_create_or_update_detail_dto.dart b/mycore_api/lib/model/room_create_or_update_detail_dto.dart index e1de08a..9f26253 100644 --- a/mycore_api/lib/model/room_create_or_update_detail_dto.dart +++ b/mycore_api/lib/model/room_create_or_update_detail_dto.dart @@ -46,20 +46,28 @@ class RoomCreateOrUpdateDetailDTO { String toString() => 'RoomCreateOrUpdateDetailDTO[id=$id, homeId=$homeId, name=$name, deviceIds=$deviceIds]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (deviceIds != null) { - _json[r'deviceIds'] = deviceIds; + if (this.deviceIds != null) { + json[r'deviceIds'] = this.deviceIds; + } else { + json[r'deviceIds'] = null; } - return _json; + return json; } /// Returns a new [RoomCreateOrUpdateDetailDTO] instance and imports its values from @@ -92,7 +100,7 @@ class RoomCreateOrUpdateDetailDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -123,12 +131,10 @@ class RoomCreateOrUpdateDetailDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = RoomCreateOrUpdateDetailDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = RoomCreateOrUpdateDetailDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/room_detail_dto.dart b/mycore_api/lib/model/room_detail_dto.dart index ef45078..d7f602f 100644 --- a/mycore_api/lib/model/room_detail_dto.dart +++ b/mycore_api/lib/model/room_detail_dto.dart @@ -68,26 +68,38 @@ class RoomDetailDTO { String toString() => 'RoomDetailDTO[id=$id, homeId=$homeId, name=$name, createdDate=$createdDate, updatedDate=$updatedDate, devices=$devices]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (devices != null) { - _json[r'devices'] = devices; + if (this.devices != null) { + json[r'devices'] = this.devices; + } else { + json[r'devices'] = null; } - return _json; + return json; } /// Returns a new [RoomDetailDTO] instance and imports its values from @@ -114,13 +126,13 @@ class RoomDetailDTO { name: mapValueOfType(json, r'name'), createdDate: mapDateTime(json, r'createdDate', ''), updatedDate: mapDateTime(json, r'updatedDate', ''), - devices: DeviceDetailDTO.listFromJson(json[r'devices']) ?? const [], + devices: DeviceDetailDTO.listFromJson(json[r'devices']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -151,12 +163,10 @@ class RoomDetailDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = RoomDetailDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = RoomDetailDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/room_main_detail_dto.dart b/mycore_api/lib/model/room_main_detail_dto.dart index abf1a47..ab9219e 100644 --- a/mycore_api/lib/model/room_main_detail_dto.dart +++ b/mycore_api/lib/model/room_main_detail_dto.dart @@ -22,10 +22,14 @@ class RoomMainDetailDTO { this.temperature, this.isHumidity, this.humidity, + this.isPressure, + this.pressure, this.isMotion, this.motion, this.isDoor, this.door, + this.isIlluminance, + this.illuminance, this.environmentalDevices = const [], this.securityDevices = const [], }); @@ -72,6 +76,16 @@ class RoomMainDetailDTO { String? humidity; + /// + /// 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? isPressure; + + String? pressure; + /// /// 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 @@ -92,6 +106,16 @@ class RoomMainDetailDTO { bool? door; + /// + /// 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? isIlluminance; + + String? illuminance; + List? environmentalDevices; List? securityDevices; @@ -107,10 +131,14 @@ class RoomMainDetailDTO { other.temperature == temperature && other.isHumidity == isHumidity && other.humidity == humidity && + other.isPressure == isPressure && + other.pressure == pressure && other.isMotion == isMotion && other.motion == motion && other.isDoor == isDoor && other.door == door && + other.isIlluminance == isIlluminance && + other.illuminance == illuminance && other.environmentalDevices == environmentalDevices && other.securityDevices == securityDevices; @@ -126,64 +154,118 @@ class RoomMainDetailDTO { (temperature == null ? 0 : temperature!.hashCode) + (isHumidity == null ? 0 : isHumidity!.hashCode) + (humidity == null ? 0 : humidity!.hashCode) + + (isPressure == null ? 0 : isPressure!.hashCode) + + (pressure == null ? 0 : pressure!.hashCode) + (isMotion == null ? 0 : isMotion!.hashCode) + (motion == null ? 0 : motion!.hashCode) + (isDoor == null ? 0 : isDoor!.hashCode) + (door == null ? 0 : door!.hashCode) + + (isIlluminance == null ? 0 : isIlluminance!.hashCode) + + (illuminance == null ? 0 : illuminance!.hashCode) + (environmentalDevices == null ? 0 : environmentalDevices!.hashCode) + (securityDevices == null ? 0 : securityDevices!.hashCode); @override - String toString() => 'RoomMainDetailDTO[id=$id, homeId=$homeId, name=$name, createdDate=$createdDate, updatedDate=$updatedDate, isTemperature=$isTemperature, temperature=$temperature, isHumidity=$isHumidity, humidity=$humidity, isMotion=$isMotion, motion=$motion, isDoor=$isDoor, door=$door, environmentalDevices=$environmentalDevices, securityDevices=$securityDevices]'; + String toString() => 'RoomMainDetailDTO[id=$id, homeId=$homeId, name=$name, createdDate=$createdDate, updatedDate=$updatedDate, isTemperature=$isTemperature, temperature=$temperature, isHumidity=$isHumidity, humidity=$humidity, isPressure=$isPressure, pressure=$pressure, isMotion=$isMotion, motion=$motion, isDoor=$isDoor, door=$door, isIlluminance=$isIlluminance, illuminance=$illuminance, environmentalDevices=$environmentalDevices, securityDevices=$securityDevices]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (isTemperature != null) { - _json[r'isTemperature'] = isTemperature; + if (this.isTemperature != null) { + json[r'isTemperature'] = this.isTemperature; + } else { + json[r'isTemperature'] = null; } - if (temperature != null) { - _json[r'temperature'] = temperature; + if (this.temperature != null) { + json[r'temperature'] = this.temperature; + } else { + json[r'temperature'] = null; } - if (isHumidity != null) { - _json[r'isHumidity'] = isHumidity; + if (this.isHumidity != null) { + json[r'isHumidity'] = this.isHumidity; + } else { + json[r'isHumidity'] = null; } - if (humidity != null) { - _json[r'humidity'] = humidity; + if (this.humidity != null) { + json[r'humidity'] = this.humidity; + } else { + json[r'humidity'] = null; } - if (isMotion != null) { - _json[r'isMotion'] = isMotion; + if (this.isPressure != null) { + json[r'isPressure'] = this.isPressure; + } else { + json[r'isPressure'] = null; } - if (motion != null) { - _json[r'motion'] = motion; + if (this.pressure != null) { + json[r'pressure'] = this.pressure; + } else { + json[r'pressure'] = null; } - if (isDoor != null) { - _json[r'isDoor'] = isDoor; + if (this.isMotion != null) { + json[r'isMotion'] = this.isMotion; + } else { + json[r'isMotion'] = null; } - if (door != null) { - _json[r'door'] = door; + if (this.motion != null) { + json[r'motion'] = this.motion; + } else { + json[r'motion'] = null; } - if (environmentalDevices != null) { - _json[r'environmentalDevices'] = environmentalDevices; + if (this.isDoor != null) { + json[r'isDoor'] = this.isDoor; + } else { + json[r'isDoor'] = null; } - if (securityDevices != null) { - _json[r'securityDevices'] = securityDevices; + if (this.door != null) { + json[r'door'] = this.door; + } else { + json[r'door'] = null; } - return _json; + if (this.isIlluminance != null) { + json[r'isIlluminance'] = this.isIlluminance; + } else { + json[r'isIlluminance'] = null; + } + if (this.illuminance != null) { + json[r'illuminance'] = this.illuminance; + } else { + json[r'illuminance'] = null; + } + if (this.environmentalDevices != null) { + json[r'environmentalDevices'] = this.environmentalDevices; + } else { + json[r'environmentalDevices'] = null; + } + if (this.securityDevices != null) { + json[r'securityDevices'] = this.securityDevices; + } else { + json[r'securityDevices'] = null; + } + return json; } /// Returns a new [RoomMainDetailDTO] instance and imports its values from @@ -214,18 +296,22 @@ class RoomMainDetailDTO { temperature: mapValueOfType(json, r'temperature'), isHumidity: mapValueOfType(json, r'isHumidity'), humidity: mapValueOfType(json, r'humidity'), + isPressure: mapValueOfType(json, r'isPressure'), + pressure: mapValueOfType(json, r'pressure'), isMotion: mapValueOfType(json, r'isMotion'), motion: mapValueOfType(json, r'motion'), isDoor: mapValueOfType(json, r'isDoor'), door: mapValueOfType(json, r'door'), - environmentalDevices: DeviceDetailDTO.listFromJson(json[r'environmentalDevices']) ?? const [], - securityDevices: DeviceDetailDTO.listFromJson(json[r'securityDevices']) ?? const [], + isIlluminance: mapValueOfType(json, r'isIlluminance'), + illuminance: mapValueOfType(json, r'illuminance'), + environmentalDevices: DeviceDetailDTO.listFromJson(json[r'environmentalDevices']), + securityDevices: DeviceDetailDTO.listFromJson(json[r'securityDevices']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -256,12 +342,10 @@ class RoomMainDetailDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = RoomMainDetailDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = RoomMainDetailDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/room_main_detail_dto_all_of.dart b/mycore_api/lib/model/room_main_detail_dto_all_of.dart index 2d0e170..10ec917 100644 --- a/mycore_api/lib/model/room_main_detail_dto_all_of.dart +++ b/mycore_api/lib/model/room_main_detail_dto_all_of.dart @@ -19,10 +19,14 @@ class RoomMainDetailDTOAllOf { this.temperature, this.isHumidity, this.humidity, + this.isPressure, + this.pressure, this.isMotion, this.motion, this.isDoor, this.door, + this.isIlluminance, + this.illuminance, this.environmentalDevices = const [], this.securityDevices = const [], }); @@ -63,6 +67,16 @@ class RoomMainDetailDTOAllOf { String? humidity; + /// + /// 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? isPressure; + + String? pressure; + /// /// 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 @@ -83,6 +97,16 @@ class RoomMainDetailDTOAllOf { bool? door; + /// + /// 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? isIlluminance; + + String? illuminance; + List? environmentalDevices; List? securityDevices; @@ -95,10 +119,14 @@ class RoomMainDetailDTOAllOf { other.temperature == temperature && other.isHumidity == isHumidity && other.humidity == humidity && + other.isPressure == isPressure && + other.pressure == pressure && other.isMotion == isMotion && other.motion == motion && other.isDoor == isDoor && other.door == door && + other.isIlluminance == isIlluminance && + other.illuminance == illuminance && other.environmentalDevices == environmentalDevices && other.securityDevices == securityDevices; @@ -111,55 +139,103 @@ class RoomMainDetailDTOAllOf { (temperature == null ? 0 : temperature!.hashCode) + (isHumidity == null ? 0 : isHumidity!.hashCode) + (humidity == null ? 0 : humidity!.hashCode) + + (isPressure == null ? 0 : isPressure!.hashCode) + + (pressure == null ? 0 : pressure!.hashCode) + (isMotion == null ? 0 : isMotion!.hashCode) + (motion == null ? 0 : motion!.hashCode) + (isDoor == null ? 0 : isDoor!.hashCode) + (door == null ? 0 : door!.hashCode) + + (isIlluminance == null ? 0 : isIlluminance!.hashCode) + + (illuminance == null ? 0 : illuminance!.hashCode) + (environmentalDevices == null ? 0 : environmentalDevices!.hashCode) + (securityDevices == null ? 0 : securityDevices!.hashCode); @override - String toString() => 'RoomMainDetailDTOAllOf[createdDate=$createdDate, updatedDate=$updatedDate, isTemperature=$isTemperature, temperature=$temperature, isHumidity=$isHumidity, humidity=$humidity, isMotion=$isMotion, motion=$motion, isDoor=$isDoor, door=$door, environmentalDevices=$environmentalDevices, securityDevices=$securityDevices]'; + String toString() => 'RoomMainDetailDTOAllOf[createdDate=$createdDate, updatedDate=$updatedDate, isTemperature=$isTemperature, temperature=$temperature, isHumidity=$isHumidity, humidity=$humidity, isPressure=$isPressure, pressure=$pressure, isMotion=$isMotion, motion=$motion, isDoor=$isDoor, door=$door, isIlluminance=$isIlluminance, illuminance=$illuminance, environmentalDevices=$environmentalDevices, securityDevices=$securityDevices]'; Map toJson() { - final _json = {}; - if (createdDate != null) { - _json[r'createdDate'] = createdDate!.toUtc().toIso8601String(); + final json = {}; + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; } - if (updatedDate != null) { - _json[r'updatedDate'] = updatedDate!.toUtc().toIso8601String(); + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; } - if (isTemperature != null) { - _json[r'isTemperature'] = isTemperature; + if (this.isTemperature != null) { + json[r'isTemperature'] = this.isTemperature; + } else { + json[r'isTemperature'] = null; } - if (temperature != null) { - _json[r'temperature'] = temperature; + if (this.temperature != null) { + json[r'temperature'] = this.temperature; + } else { + json[r'temperature'] = null; } - if (isHumidity != null) { - _json[r'isHumidity'] = isHumidity; + if (this.isHumidity != null) { + json[r'isHumidity'] = this.isHumidity; + } else { + json[r'isHumidity'] = null; } - if (humidity != null) { - _json[r'humidity'] = humidity; + if (this.humidity != null) { + json[r'humidity'] = this.humidity; + } else { + json[r'humidity'] = null; } - if (isMotion != null) { - _json[r'isMotion'] = isMotion; + if (this.isPressure != null) { + json[r'isPressure'] = this.isPressure; + } else { + json[r'isPressure'] = null; } - if (motion != null) { - _json[r'motion'] = motion; + if (this.pressure != null) { + json[r'pressure'] = this.pressure; + } else { + json[r'pressure'] = null; } - if (isDoor != null) { - _json[r'isDoor'] = isDoor; + if (this.isMotion != null) { + json[r'isMotion'] = this.isMotion; + } else { + json[r'isMotion'] = null; } - if (door != null) { - _json[r'door'] = door; + if (this.motion != null) { + json[r'motion'] = this.motion; + } else { + json[r'motion'] = null; } - if (environmentalDevices != null) { - _json[r'environmentalDevices'] = environmentalDevices; + if (this.isDoor != null) { + json[r'isDoor'] = this.isDoor; + } else { + json[r'isDoor'] = null; } - if (securityDevices != null) { - _json[r'securityDevices'] = securityDevices; + if (this.door != null) { + json[r'door'] = this.door; + } else { + json[r'door'] = null; } - return _json; + if (this.isIlluminance != null) { + json[r'isIlluminance'] = this.isIlluminance; + } else { + json[r'isIlluminance'] = null; + } + if (this.illuminance != null) { + json[r'illuminance'] = this.illuminance; + } else { + json[r'illuminance'] = null; + } + if (this.environmentalDevices != null) { + json[r'environmentalDevices'] = this.environmentalDevices; + } else { + json[r'environmentalDevices'] = null; + } + if (this.securityDevices != null) { + json[r'securityDevices'] = this.securityDevices; + } else { + json[r'securityDevices'] = null; + } + return json; } /// Returns a new [RoomMainDetailDTOAllOf] instance and imports its values from @@ -187,18 +263,22 @@ class RoomMainDetailDTOAllOf { temperature: mapValueOfType(json, r'temperature'), isHumidity: mapValueOfType(json, r'isHumidity'), humidity: mapValueOfType(json, r'humidity'), + isPressure: mapValueOfType(json, r'isPressure'), + pressure: mapValueOfType(json, r'pressure'), isMotion: mapValueOfType(json, r'isMotion'), motion: mapValueOfType(json, r'motion'), isDoor: mapValueOfType(json, r'isDoor'), door: mapValueOfType(json, r'door'), - environmentalDevices: DeviceDetailDTO.listFromJson(json[r'environmentalDevices']) ?? const [], - securityDevices: DeviceDetailDTO.listFromJson(json[r'securityDevices']) ?? const [], + isIlluminance: mapValueOfType(json, r'isIlluminance'), + illuminance: mapValueOfType(json, r'illuminance'), + environmentalDevices: DeviceDetailDTO.listFromJson(json[r'environmentalDevices']), + securityDevices: DeviceDetailDTO.listFromJson(json[r'securityDevices']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -229,12 +309,10 @@ class RoomMainDetailDTOAllOf { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = RoomMainDetailDTOAllOf.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = RoomMainDetailDTOAllOf.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/room_summary_dto.dart b/mycore_api/lib/model/room_summary_dto.dart index 97471ec..1e9368a 100644 --- a/mycore_api/lib/model/room_summary_dto.dart +++ b/mycore_api/lib/model/room_summary_dto.dart @@ -41,17 +41,23 @@ class RoomSummaryDTO { String toString() => 'RoomSummaryDTO[id=$id, homeId=$homeId, name=$name]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (homeId != null) { - _json[r'homeId'] = homeId; + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - return _json; + return json; } /// Returns a new [RoomSummaryDTO] instance and imports its values from @@ -81,7 +87,7 @@ class RoomSummaryDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -112,12 +118,10 @@ class RoomSummaryDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = RoomSummaryDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = RoomSummaryDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/screen_device.dart b/mycore_api/lib/model/screen_device.dart index 82099d9..e5215d8 100644 --- a/mycore_api/lib/model/screen_device.dart +++ b/mycore_api/lib/model/screen_device.dart @@ -73,29 +73,43 @@ class ScreenDevice { String toString() => 'ScreenDevice[id=$id, name=$name, type=$type, location=$location, locationExplanation=$locationExplanation, height=$height, width=$width]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (location != null) { - _json[r'location'] = location; + if (this.location != null) { + json[r'location'] = this.location; + } else { + json[r'location'] = null; } - if (locationExplanation != null) { - _json[r'locationExplanation'] = locationExplanation; + if (this.locationExplanation != null) { + json[r'locationExplanation'] = this.locationExplanation; + } else { + json[r'locationExplanation'] = null; } - if (height != null) { - _json[r'height'] = height; + if (this.height != null) { + json[r'height'] = this.height; + } else { + json[r'height'] = null; } - if (width != null) { - _json[r'width'] = width; + if (this.width != null) { + json[r'width'] = this.width; + } else { + json[r'width'] = null; } - return _json; + return json; } /// Returns a new [ScreenDevice] instance and imports its values from @@ -129,7 +143,7 @@ class ScreenDevice { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -160,12 +174,10 @@ class ScreenDevice { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = ScreenDevice.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ScreenDevice.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/smart_garden_message.dart b/mycore_api/lib/model/smart_garden_message.dart index 713ac7d..1112da2 100644 --- a/mycore_api/lib/model/smart_garden_message.dart +++ b/mycore_api/lib/model/smart_garden_message.dart @@ -96,32 +96,48 @@ class SmartGardenMessage { String toString() => 'SmartGardenMessage[id=$id, type=$type, time=$time, temperature=$temperature, pressure=$pressure, humidity=$humidity, water=$water, light=$light]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (time != null) { - _json[r'time'] = time; + if (this.time != null) { + json[r'time'] = this.time; + } else { + json[r'time'] = null; } - if (temperature != null) { - _json[r'temperature'] = temperature; + if (this.temperature != null) { + json[r'temperature'] = this.temperature; + } else { + json[r'temperature'] = null; } - if (pressure != null) { - _json[r'pressure'] = pressure; + if (this.pressure != null) { + json[r'pressure'] = this.pressure; + } else { + json[r'pressure'] = null; } - if (humidity != null) { - _json[r'humidity'] = humidity; + if (this.humidity != null) { + json[r'humidity'] = this.humidity; + } else { + json[r'humidity'] = null; } - if (water != null) { - _json[r'water'] = water; + if (this.water != null) { + json[r'water'] = this.water; + } else { + json[r'water'] = null; } - if (light != null) { - _json[r'light'] = light; + if (this.light != null) { + json[r'light'] = this.light; + } else { + json[r'light'] = null; } - return _json; + return json; } /// Returns a new [SmartGardenMessage] instance and imports its values from @@ -156,7 +172,7 @@ class SmartGardenMessage { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -187,12 +203,10 @@ class SmartGardenMessage { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = SmartGardenMessage.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = SmartGardenMessage.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/smart_printer_message.dart b/mycore_api/lib/model/smart_printer_message.dart index 55ff658..42d8bf2 100644 --- a/mycore_api/lib/model/smart_printer_message.dart +++ b/mycore_api/lib/model/smart_printer_message.dart @@ -74,26 +74,38 @@ class SmartPrinterMessage { String toString() => 'SmartPrinterMessage[id=$id, type=$type, time=$time, temperature=$temperature, pressure=$pressure, smoke=$smoke]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (time != null) { - _json[r'time'] = time; + if (this.time != null) { + json[r'time'] = this.time; + } else { + json[r'time'] = null; } - if (temperature != null) { - _json[r'temperature'] = temperature; + if (this.temperature != null) { + json[r'temperature'] = this.temperature; + } else { + json[r'temperature'] = null; } - if (pressure != null) { - _json[r'pressure'] = pressure; + if (this.pressure != null) { + json[r'pressure'] = this.pressure; + } else { + json[r'pressure'] = null; } - if (smoke != null) { - _json[r'smoke'] = smoke; + if (this.smoke != null) { + json[r'smoke'] = this.smoke; + } else { + json[r'smoke'] = null; } - return _json; + return json; } /// Returns a new [SmartPrinterMessage] instance and imports its values from @@ -126,7 +138,7 @@ class SmartPrinterMessage { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -157,12 +169,10 @@ class SmartPrinterMessage { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = SmartPrinterMessage.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = SmartPrinterMessage.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/time_period_alarm.dart b/mycore_api/lib/model/time_period_alarm.dart index 4d5da82..deb91e2 100644 --- a/mycore_api/lib/model/time_period_alarm.dart +++ b/mycore_api/lib/model/time_period_alarm.dart @@ -22,7 +22,7 @@ class TimePeriodAlarm { String? end; - AlarmMode? alarmMode; + TimePeriodAlarmAlarmMode? alarmMode; @override bool operator ==(Object other) => identical(this, other) || other is TimePeriodAlarm && @@ -41,17 +41,23 @@ class TimePeriodAlarm { String toString() => 'TimePeriodAlarm[start=$start, end=$end, alarmMode=$alarmMode]'; Map toJson() { - final _json = {}; - if (start != null) { - _json[r'start'] = start; + final json = {}; + if (this.start != null) { + json[r'start'] = this.start; + } else { + json[r'start'] = null; } - if (end != null) { - _json[r'end'] = end; + if (this.end != null) { + json[r'end'] = this.end; + } else { + json[r'end'] = null; } - if (alarmMode != null) { - _json[r'alarmMode'] = alarmMode; + if (this.alarmMode != null) { + json[r'alarmMode'] = this.alarmMode; + } else { + json[r'alarmMode'] = null; } - return _json; + return json; } /// Returns a new [TimePeriodAlarm] instance and imports its values from @@ -75,13 +81,13 @@ class TimePeriodAlarm { return TimePeriodAlarm( start: mapValueOfType(json, r'start'), end: mapValueOfType(json, r'end'), - alarmMode: AlarmMode.fromJson(json[r'alarmMode']), + alarmMode: TimePeriodAlarmAlarmMode.fromJson(json[r'alarmMode']), ); } return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -112,12 +118,10 @@ class TimePeriodAlarm { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = TimePeriodAlarm.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = TimePeriodAlarm.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/time_period_alarm_alarm_mode.dart b/mycore_api/lib/model/time_period_alarm_alarm_mode.dart new file mode 100644 index 0000000..8584a77 --- /dev/null +++ b/mycore_api/lib/model/time_period_alarm_alarm_mode.dart @@ -0,0 +1,293 @@ +// +// 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 TimePeriodAlarmAlarmMode { + /// Returns a new [TimePeriodAlarmAlarmMode] instance. + TimePeriodAlarmAlarmMode({ + this.id, + this.homeId, + this.name, + this.activated, + this.isDefault, + this.notification, + this.createdDate, + this.updatedDate, + this.type, + this.programmedMode, + this.geolocalizedMode, + this.triggers = const [], + this.actions = const [], + this.devicesIds = const [], + }); + + String? id; + + String? homeId; + + String? name; + + /// + /// 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? activated; + + /// + /// 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? isDefault; + + /// + /// 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? notification; + + /// + /// 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. + /// + DateTime? createdDate; + + /// + /// 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. + /// + DateTime? updatedDate; + + /// + /// 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. + /// + AlarmType? type; + + AlarmModeDetailDTOAllOfProgrammedMode? programmedMode; + + AlarmModeDetailDTOAllOfGeolocalizedMode? geolocalizedMode; + + List? triggers; + + List? actions; + + List? devicesIds; + + @override + bool operator ==(Object other) => identical(this, other) || other is TimePeriodAlarmAlarmMode && + other.id == id && + other.homeId == homeId && + other.name == name && + other.activated == activated && + other.isDefault == isDefault && + other.notification == notification && + other.createdDate == createdDate && + other.updatedDate == updatedDate && + other.type == type && + other.programmedMode == programmedMode && + other.geolocalizedMode == geolocalizedMode && + other.triggers == triggers && + other.actions == actions && + other.devicesIds == devicesIds; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (homeId == null ? 0 : homeId!.hashCode) + + (name == null ? 0 : name!.hashCode) + + (activated == null ? 0 : activated!.hashCode) + + (isDefault == null ? 0 : isDefault!.hashCode) + + (notification == null ? 0 : notification!.hashCode) + + (createdDate == null ? 0 : createdDate!.hashCode) + + (updatedDate == null ? 0 : updatedDate!.hashCode) + + (type == null ? 0 : type!.hashCode) + + (programmedMode == null ? 0 : programmedMode!.hashCode) + + (geolocalizedMode == null ? 0 : geolocalizedMode!.hashCode) + + (triggers == null ? 0 : triggers!.hashCode) + + (actions == null ? 0 : actions!.hashCode) + + (devicesIds == null ? 0 : devicesIds!.hashCode); + + @override + String toString() => 'TimePeriodAlarmAlarmMode[id=$id, homeId=$homeId, name=$name, activated=$activated, isDefault=$isDefault, notification=$notification, createdDate=$createdDate, updatedDate=$updatedDate, type=$type, programmedMode=$programmedMode, geolocalizedMode=$geolocalizedMode, triggers=$triggers, actions=$actions, devicesIds=$devicesIds]'; + + Map toJson() { + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + if (this.homeId != null) { + json[r'homeId'] = this.homeId; + } else { + json[r'homeId'] = null; + } + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; + } + if (this.activated != null) { + json[r'activated'] = this.activated; + } else { + json[r'activated'] = null; + } + if (this.isDefault != null) { + json[r'isDefault'] = this.isDefault; + } else { + json[r'isDefault'] = null; + } + if (this.notification != null) { + json[r'notification'] = this.notification; + } else { + json[r'notification'] = null; + } + if (this.createdDate != null) { + json[r'createdDate'] = this.createdDate!.toUtc().toIso8601String(); + } else { + json[r'createdDate'] = null; + } + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; + } + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; + } + if (this.programmedMode != null) { + json[r'programmedMode'] = this.programmedMode; + } else { + json[r'programmedMode'] = null; + } + if (this.geolocalizedMode != null) { + json[r'geolocalizedMode'] = this.geolocalizedMode; + } else { + json[r'geolocalizedMode'] = null; + } + if (this.triggers != null) { + json[r'triggers'] = this.triggers; + } else { + json[r'triggers'] = null; + } + if (this.actions != null) { + json[r'actions'] = this.actions; + } else { + json[r'actions'] = null; + } + if (this.devicesIds != null) { + json[r'devicesIds'] = this.devicesIds; + } else { + json[r'devicesIds'] = null; + } + return json; + } + + /// Returns a new [TimePeriodAlarmAlarmMode] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static TimePeriodAlarmAlarmMode? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "TimePeriodAlarmAlarmMode[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "TimePeriodAlarmAlarmMode[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return TimePeriodAlarmAlarmMode( + id: mapValueOfType(json, r'id'), + homeId: mapValueOfType(json, r'homeId'), + name: mapValueOfType(json, r'name'), + activated: mapValueOfType(json, r'activated'), + isDefault: mapValueOfType(json, r'isDefault'), + notification: mapValueOfType(json, r'notification'), + createdDate: mapDateTime(json, r'createdDate', ''), + updatedDate: mapDateTime(json, r'updatedDate', ''), + type: AlarmType.fromJson(json[r'type']), + programmedMode: AlarmModeDetailDTOAllOfProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: AlarmModeDetailDTOAllOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), + triggers: Trigger.listFromJson(json[r'triggers']), + actions: Action.listFromJson(json[r'actions']), + devicesIds: json[r'devicesIds'] is List + ? (json[r'devicesIds'] as List).cast() + : const [], + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = TimePeriodAlarmAlarmMode.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = TimePeriodAlarmAlarmMode.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of TimePeriodAlarmAlarmMode-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = TimePeriodAlarmAlarmMode.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/mycore_api/lib/model/token_dto.dart b/mycore_api/lib/model/token_dto.dart index 395efdd..310a224 100644 --- a/mycore_api/lib/model/token_dto.dart +++ b/mycore_api/lib/model/token_dto.dart @@ -68,26 +68,38 @@ class TokenDTO { String toString() => 'TokenDTO[accessToken=$accessToken, refreshToken=$refreshToken, scope=$scope, tokenType=$tokenType, expiresIn=$expiresIn, expiration=$expiration]'; Map toJson() { - final _json = {}; - if (accessToken != null) { - _json[r'access_token'] = accessToken; + final json = {}; + if (this.accessToken != null) { + json[r'access_token'] = this.accessToken; + } else { + json[r'access_token'] = null; } - if (refreshToken != null) { - _json[r'refresh_token'] = refreshToken; + if (this.refreshToken != null) { + json[r'refresh_token'] = this.refreshToken; + } else { + json[r'refresh_token'] = null; } - if (scope != null) { - _json[r'scope'] = scope; + if (this.scope != null) { + json[r'scope'] = this.scope; + } else { + json[r'scope'] = null; } - if (tokenType != null) { - _json[r'token_type'] = tokenType; + if (this.tokenType != null) { + json[r'token_type'] = this.tokenType; + } else { + json[r'token_type'] = null; } - if (expiresIn != null) { - _json[r'expires_in'] = expiresIn; + if (this.expiresIn != null) { + json[r'expires_in'] = this.expiresIn; + } else { + json[r'expires_in'] = null; } - if (expiration != null) { - _json[r'expiration'] = expiration!.toUtc().toIso8601String(); + if (this.expiration != null) { + json[r'expiration'] = this.expiration!.toUtc().toIso8601String(); + } else { + json[r'expiration'] = null; } - return _json; + return json; } /// Returns a new [TokenDTO] instance and imports its values from @@ -120,7 +132,7 @@ class TokenDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -151,12 +163,10 @@ class TokenDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = TokenDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = TokenDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/trigger.dart b/mycore_api/lib/model/trigger.dart index 2a14727..c67c855 100644 --- a/mycore_api/lib/model/trigger.dart +++ b/mycore_api/lib/model/trigger.dart @@ -57,23 +57,33 @@ class Trigger { String toString() => 'Trigger[providerId=$providerId, deviceId=$deviceId, stateName=$stateName, stateValue=$stateValue, type=$type]'; Map toJson() { - final _json = {}; - if (providerId != null) { - _json[r'providerId'] = providerId; + final json = {}; + if (this.providerId != null) { + json[r'providerId'] = this.providerId; + } else { + json[r'providerId'] = null; } - if (deviceId != null) { - _json[r'deviceId'] = deviceId; + if (this.deviceId != null) { + json[r'deviceId'] = this.deviceId; + } else { + json[r'deviceId'] = null; } - if (stateName != null) { - _json[r'stateName'] = stateName; + if (this.stateName != null) { + json[r'stateName'] = this.stateName; + } else { + json[r'stateName'] = null; } - if (stateValue != null) { - _json[r'stateValue'] = stateValue; + if (this.stateValue != null) { + json[r'stateValue'] = this.stateValue; + } else { + json[r'stateValue'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - return _json; + return json; } /// Returns a new [Trigger] instance and imports its values from @@ -105,7 +115,7 @@ class Trigger { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -136,12 +146,10 @@ class Trigger { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = Trigger.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = Trigger.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/trigger_type.dart b/mycore_api/lib/model/trigger_type.dart index a281fb0..a15506a 100644 --- a/mycore_api/lib/model/trigger_type.dart +++ b/mycore_api/lib/model/trigger_type.dart @@ -36,7 +36,7 @@ class TriggerType { static TriggerType? fromJson(dynamic value) => TriggerTypeTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -69,7 +69,7 @@ class TriggerTypeTypeTransformer { /// and users are still using an old app with the old code. TriggerType? decode(dynamic data, {bool allowNull = true}) { if (data != null) { - switch (data.toString()) { + switch (data) { case r'MQTT': return TriggerType.MQTT; case r'WEB': return TriggerType.WEB; case r'TIME': return TriggerType.TIME; diff --git a/mycore_api/lib/model/twitter_auth_model.dart b/mycore_api/lib/model/twitter_auth_model.dart index 0d8724d..f6568a2 100644 --- a/mycore_api/lib/model/twitter_auth_model.dart +++ b/mycore_api/lib/model/twitter_auth_model.dart @@ -31,11 +31,13 @@ class TwitterAuthModel { String toString() => 'TwitterAuthModel[apiKey=$apiKey]'; Map toJson() { - final _json = {}; - if (apiKey != null) { - _json[r'apiKey'] = apiKey; + final json = {}; + if (this.apiKey != null) { + json[r'apiKey'] = this.apiKey; + } else { + json[r'apiKey'] = null; } - return _json; + return json; } /// Returns a new [TwitterAuthModel] instance and imports its values from @@ -63,7 +65,7 @@ class TwitterAuthModel { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -94,12 +96,10 @@ class TwitterAuthModel { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = TwitterAuthModel.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = TwitterAuthModel.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/user.dart b/mycore_api/lib/model/user.dart index 54663b2..4c857aa 100644 --- a/mycore_api/lib/model/user.dart +++ b/mycore_api/lib/model/user.dart @@ -36,14 +36,18 @@ class User { String toString() => 'User[id=$id, password=$password]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (password != null) { - _json[r'password'] = password; + if (this.password != null) { + json[r'password'] = this.password; + } else { + json[r'password'] = null; } - return _json; + return json; } /// Returns a new [User] instance and imports its values from @@ -72,7 +76,7 @@ class User { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -103,12 +107,10 @@ class User { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = User.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = User.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/user_info.dart b/mycore_api/lib/model/user_info.dart index 78a8327..5960198 100644 --- a/mycore_api/lib/model/user_info.dart +++ b/mycore_api/lib/model/user_info.dart @@ -129,59 +129,93 @@ class UserInfo { String toString() => 'UserInfo[id=$id, role=$role, email=$email, password=$password, firstName=$firstName, lastName=$lastName, token=$token, birthday=$birthday, homeIds=$homeIds, dateCreation=$dateCreation, address=$address, city=$city, state=$state, country=$country, language=$language, timeZone=$timeZone, postalCode=$postalCode]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (role != null) { - _json[r'role'] = role; + if (this.role != null) { + json[r'role'] = this.role; + } else { + json[r'role'] = null; } - if (email != null) { - _json[r'email'] = email; + if (this.email != null) { + json[r'email'] = this.email; + } else { + json[r'email'] = null; } - if (password != null) { - _json[r'password'] = password; + if (this.password != null) { + json[r'password'] = this.password; + } else { + json[r'password'] = null; } - if (firstName != null) { - _json[r'firstName'] = firstName; + if (this.firstName != null) { + json[r'firstName'] = this.firstName; + } else { + json[r'firstName'] = null; } - if (lastName != null) { - _json[r'lastName'] = lastName; + if (this.lastName != null) { + json[r'lastName'] = this.lastName; + } else { + json[r'lastName'] = null; } - if (token != null) { - _json[r'token'] = token; + if (this.token != null) { + json[r'token'] = this.token; + } else { + json[r'token'] = null; } - if (birthday != null) { - _json[r'birthday'] = birthday!.toUtc().toIso8601String(); + if (this.birthday != null) { + json[r'birthday'] = this.birthday!.toUtc().toIso8601String(); + } else { + json[r'birthday'] = null; } - if (homeIds != null) { - _json[r'homeIds'] = homeIds; + if (this.homeIds != null) { + json[r'homeIds'] = this.homeIds; + } else { + json[r'homeIds'] = null; } - if (dateCreation != null) { - _json[r'dateCreation'] = dateCreation!.toUtc().toIso8601String(); + if (this.dateCreation != null) { + json[r'dateCreation'] = this.dateCreation!.toUtc().toIso8601String(); + } else { + json[r'dateCreation'] = null; } - if (address != null) { - _json[r'address'] = address; + if (this.address != null) { + json[r'address'] = this.address; + } else { + json[r'address'] = null; } - if (city != null) { - _json[r'city'] = city; + if (this.city != null) { + json[r'city'] = this.city; + } else { + json[r'city'] = null; } - if (state != null) { - _json[r'state'] = state; + if (this.state != null) { + json[r'state'] = this.state; + } else { + json[r'state'] = null; } - if (country != null) { - _json[r'country'] = country; + if (this.country != null) { + json[r'country'] = this.country; + } else { + json[r'country'] = null; } - if (language != null) { - _json[r'language'] = language; + if (this.language != null) { + json[r'language'] = this.language; + } else { + json[r'language'] = null; } - if (timeZone != null) { - _json[r'timeZone'] = timeZone; + if (this.timeZone != null) { + json[r'timeZone'] = this.timeZone; + } else { + json[r'timeZone'] = null; } - if (postalCode != null) { - _json[r'postalCode'] = postalCode; + if (this.postalCode != null) { + json[r'postalCode'] = this.postalCode; + } else { + json[r'postalCode'] = null; } - return _json; + return json; } /// Returns a new [UserInfo] instance and imports its values from @@ -227,7 +261,7 @@ class UserInfo { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -258,12 +292,10 @@ class UserInfo { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = UserInfo.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = UserInfo.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/user_info_detail_dto.dart b/mycore_api/lib/model/user_info_detail_dto.dart index ef11a74..61757d4 100644 --- a/mycore_api/lib/model/user_info_detail_dto.dart +++ b/mycore_api/lib/model/user_info_detail_dto.dart @@ -56,26 +56,38 @@ class UserInfoDetailDTO { String toString() => 'UserInfoDetailDTO[id=$id, email=$email, firstName=$firstName, lastName=$lastName, language=$language, homeIds=$homeIds]'; Map toJson() { - final _json = {}; - if (id != null) { - _json[r'id'] = id; + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; } - if (email != null) { - _json[r'email'] = email; + if (this.email != null) { + json[r'email'] = this.email; + } else { + json[r'email'] = null; } - if (firstName != null) { - _json[r'firstName'] = firstName; + if (this.firstName != null) { + json[r'firstName'] = this.firstName; + } else { + json[r'firstName'] = null; } - if (lastName != null) { - _json[r'lastName'] = lastName; + if (this.lastName != null) { + json[r'lastName'] = this.lastName; + } else { + json[r'lastName'] = null; } - if (language != null) { - _json[r'language'] = language; + if (this.language != null) { + json[r'language'] = this.language; + } else { + json[r'language'] = null; } - if (homeIds != null) { - _json[r'homeIds'] = homeIds; + if (this.homeIds != null) { + json[r'homeIds'] = this.homeIds; + } else { + json[r'homeIds'] = null; } - return _json; + return json; } /// Returns a new [UserInfoDetailDTO] instance and imports its values from @@ -110,7 +122,7 @@ class UserInfoDetailDTO { return null; } - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -141,12 +153,10 @@ class UserInfoDetailDTO { static Map> mapListFromJson(dynamic json, {bool growable = false,}) { final map = >{}; if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments + // ignore: parameter_assignments + json = json.cast(); for (final entry in json.entries) { - final value = UserInfoDetailDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = UserInfoDetailDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mycore_api/lib/model/view_by.dart b/mycore_api/lib/model/view_by.dart index 2cf70e9..8af2ff4 100644 --- a/mycore_api/lib/model/view_by.dart +++ b/mycore_api/lib/model/view_by.dart @@ -36,7 +36,7 @@ class ViewBy { static ViewBy? fromJson(dynamic value) => ViewByTypeTransformer().decode(value); - static List? listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson(dynamic json, {bool growable = false,}) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -69,7 +69,7 @@ class ViewByTypeTransformer { /// and users are still using an old app with the old code. ViewBy? decode(dynamic data, {bool allowNull = true}) { if (data != null) { - switch (data.toString()) { + switch (data) { case r'Year': return ViewBy.year; case r'Month': return ViewBy.month; case r'Day': return ViewBy.day; diff --git a/mycore_api/pubspec.lock b/mycore_api/pubspec.lock index cce4316..3218b3f 100644 --- a/mycore_api/pubspec.lock +++ b/mycore_api/pubspec.lock @@ -402,4 +402,4 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.19.0 <3.0.0" + dart: ">=2.19.0 <4.0.0" diff --git a/mycore_api/test/alarm_mode_detail_dto_all_of_geolocalized_mode_test.dart b/mycore_api/test/alarm_mode_detail_dto_all_of_geolocalized_mode_test.dart new file mode 100644 index 0000000..7121d92 --- /dev/null +++ b/mycore_api/test/alarm_mode_detail_dto_all_of_geolocalized_mode_test.dart @@ -0,0 +1,42 @@ +// +// 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:mycore_api/api.dart'; +import 'package:test/test.dart'; + +// tests for AlarmModeDetailDTOAllOfGeolocalizedMode +void main() { + // final instance = AlarmModeDetailDTOAllOfGeolocalizedMode(); + + group('test AlarmModeDetailDTOAllOfGeolocalizedMode', () { + // String latitude + test('to test the property `latitude`', () async { + // TODO + }); + + // String longitude + test('to test the property `longitude`', () async { + // TODO + }); + + // TimePeriodAlarmAlarmMode homeMode + test('to test the property `homeMode`', () async { + // TODO + }); + + // TimePeriodAlarmAlarmMode absentMode + test('to test the property `absentMode`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/alarm_mode_detail_dto_all_of_programmed_mode_test.dart b/mycore_api/test/alarm_mode_detail_dto_all_of_programmed_mode_test.dart new file mode 100644 index 0000000..b92941e --- /dev/null +++ b/mycore_api/test/alarm_mode_detail_dto_all_of_programmed_mode_test.dart @@ -0,0 +1,57 @@ +// +// 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:mycore_api/api.dart'; +import 'package:test/test.dart'; + +// tests for AlarmModeDetailDTOAllOfProgrammedMode +void main() { + // final instance = AlarmModeDetailDTOAllOfProgrammedMode(); + + group('test AlarmModeDetailDTOAllOfProgrammedMode', () { + // List monday (default value: const []) + test('to test the property `monday`', () async { + // TODO + }); + + // List tuesday (default value: const []) + test('to test the property `tuesday`', () async { + // TODO + }); + + // List wednesday (default value: const []) + test('to test the property `wednesday`', () async { + // TODO + }); + + // List thursday (default value: const []) + test('to test the property `thursday`', () async { + // TODO + }); + + // List friday (default value: const []) + test('to test the property `friday`', () async { + // TODO + }); + + // List saturday (default value: const []) + test('to test the property `saturday`', () async { + // TODO + }); + + // List sunday (default value: const []) + test('to test the property `sunday`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/event_detail_dto_all_of_alarm_triggered_test.dart b/mycore_api/test/event_detail_dto_all_of_alarm_triggered_test.dart new file mode 100644 index 0000000..0e10664 --- /dev/null +++ b/mycore_api/test/event_detail_dto_all_of_alarm_triggered_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycore_api/api.dart'; +import 'package:test/test.dart'; + +// tests for EventDetailDTOAllOfAlarmTriggered +void main() { + // final instance = EventDetailDTOAllOfAlarmTriggered(); + + group('test EventDetailDTOAllOfAlarmTriggered', () { + // String alarmModeId + test('to test the property `alarmModeId`', () async { + // TODO + }); + + // String alarmModeName + test('to test the property `alarmModeName`', () async { + // TODO + }); + + // AlarmType type + test('to test the property `type`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/event_detail_dto_all_of_automation_triggered_test.dart b/mycore_api/test/event_detail_dto_all_of_automation_triggered_test.dart new file mode 100644 index 0000000..0aa1c45 --- /dev/null +++ b/mycore_api/test/event_detail_dto_all_of_automation_triggered_test.dart @@ -0,0 +1,32 @@ +// +// 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:mycore_api/api.dart'; +import 'package:test/test.dart'; + +// tests for EventDetailDTOAllOfAutomationTriggered +void main() { + // final instance = EventDetailDTOAllOfAutomationTriggered(); + + group('test EventDetailDTOAllOfAutomationTriggered', () { + // String automationId + test('to test the property `automationId`', () async { + // TODO + }); + + // String automationName + test('to test the property `automationName`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/event_detail_dto_all_of_device_state_test.dart b/mycore_api/test/event_detail_dto_all_of_device_state_test.dart new file mode 100644 index 0000000..b0ab5c7 --- /dev/null +++ b/mycore_api/test/event_detail_dto_all_of_device_state_test.dart @@ -0,0 +1,42 @@ +// +// 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:mycore_api/api.dart'; +import 'package:test/test.dart'; + +// tests for EventDetailDTOAllOfDeviceState +void main() { + // final instance = EventDetailDTOAllOfDeviceState(); + + group('test EventDetailDTOAllOfDeviceState', () { + // String deviceId + test('to test the property `deviceId`', () async { + // TODO + }); + + // String deviceName + test('to test the property `deviceName`', () async { + // TODO + }); + + // String message + test('to test the property `message`', () async { + // TODO + }); + + // DeviceType deviceType + test('to test the property `deviceType`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/notification_api_test.dart b/mycore_api/test/notification_api_test.dart new file mode 100644 index 0000000..24e8961 --- /dev/null +++ b/mycore_api/test/notification_api_test.dart @@ -0,0 +1,35 @@ +// +// 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:mycore_api/api.dart'; +import 'package:test/test.dart'; + + +/// tests for NotificationApi +void main() { + // final instance = NotificationApi(); + + group('tests for NotificationApi', () { + // Create a fcm notification + // + //Future notificationCreateSimpleNotification(NotificationDTO notificationDTO) async + test('test notificationCreateSimpleNotification', () async { + // TODO + }); + + // Create a fcm notification for a specific home + // + //Future notificationCreateSimpleNotificationForSpecificUser(String homeId, NotificationDTO notificationDTO) async + test('test notificationCreateSimpleNotificationForSpecificUser', () async { + // TODO + }); + + }); +} diff --git a/mycore_api/test/notification_dto_test.dart b/mycore_api/test/notification_dto_test.dart new file mode 100644 index 0000000..123780b --- /dev/null +++ b/mycore_api/test/notification_dto_test.dart @@ -0,0 +1,67 @@ +// +// 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:mycore_api/api.dart'; +import 'package:test/test.dart'; + +// tests for NotificationDTO +void main() { + // final instance = NotificationDTO(); + + group('test NotificationDTO', () { + // String notificationTitle + test('to test the property `notificationTitle`', () async { + // TODO + }); + + // String notificationMessage + test('to test the property `notificationMessage`', () async { + // TODO + }); + + // String notificationLabelButton + test('to test the property `notificationLabelButton`', () async { + // TODO + }); + + // String title + test('to test the property `title`', () async { + // TODO + }); + + // String body + test('to test the property `body`', () async { + // TODO + }); + + // String type + test('to test the property `type`', () async { + // TODO + }); + + // bool isPushNotification + test('to test the property `isPushNotification`', () async { + // TODO + }); + + // bool isButton + test('to test the property `isButton`', () async { + // TODO + }); + + // String buttonLabel + test('to test the property `buttonLabel`', () async { + // TODO + }); + + + }); + +} diff --git a/pubspec.lock b/pubspec.lock index a4d498d..f020723 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "37bb1e815e15fbeefe916e4c941ef070f2f64d15a7eacc3cc0f6e8847b62319c" + sha256: "0816708f5fbcacca324d811297153fe3c8e047beb5c6752e12292d2974c17045" url: "https://pub.dev" source: hosted - version: "48.0.0" + version: "62.0.0" _flutterfire_internals: dependency: transitive description: @@ -21,18 +21,18 @@ packages: dependency: transitive description: name: analyzer - sha256: c50aea66893c20d44c365d4269983a74a5c1a4055b7b78f38fbf0e24f519b6a2 + sha256: "21862995c9932cd082f89d72ae5f5e2c110d1a0204ad06e4ebaee8307b76b834" url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "6.0.0" args: dependency: transitive description: name: args - sha256: "4cab82a83ffef80b262ddedf47a0a8e56ee6fbf7fe21e6e768b02792034dd440" + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.2" async: dependency: transitive description: @@ -61,10 +61,10 @@ packages: dependency: transitive description: name: build - sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777" + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.4.1" build_config: dependency: transitive description: @@ -77,34 +77,34 @@ packages: dependency: transitive description: name: build_daemon - sha256: "757153e5d9cd88253cb13f28c2fb55a537dc31fefd98137549895b5beb7c6169" + sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "4.0.0" build_resolvers: dependency: transitive description: name: build_resolvers - sha256: "687cf90a3951affac1bd5f9ecb5e3e90b60487f3d9cdc359bb310f8876bb02a6" + sha256: "6c4dd11d05d056e76320b828a1db0fc01ccd376922526f8e9d6c796a5adbac20" url: "https://pub.dev" source: hosted - version: "2.0.10" + version: "2.2.1" build_runner: dependency: "direct dev" description: name: build_runner - sha256: b0a8a7b8a76c493e85f1b84bffa0588859a06197863dba8c9036b15581fd9727 + sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b" url: "https://pub.dev" source: hosted - version: "2.3.3" + version: "2.4.6" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292" + sha256: "6d6ee4276b1c5f34f21fdf39425202712d2be82019983d52f351c94aafbc2c41" url: "https://pub.dev" source: hosted - version: "7.2.7" + version: "7.2.10" built_collection: dependency: transitive description: @@ -117,10 +117,10 @@ packages: dependency: transitive description: name: built_value - sha256: "31b7c748fd4b9adf8d25d72a4c4a59ef119f12876cf414f94f8af5131d5fa2b0" + sha256: "598a2a682e2a7a90f08ba39c0aaa9374c5112340f0a2e275f61b59389543d166" url: "https://pub.dev" source: hosted - version: "8.4.4" + version: "8.6.1" characters: dependency: transitive description: @@ -133,10 +133,10 @@ packages: dependency: transitive description: name: checked_yaml - sha256: "3d1505d91afa809d177efd4eed5bb0eb65805097a1463abdd2add076effae311" + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.0.3" clock: dependency: transitive description: @@ -149,10 +149,10 @@ packages: dependency: transitive description: name: code_builder - sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe" + sha256: "4ad01d6e56db961d29661561effde45e519939fdaeb46c351275b182eac70189" url: "https://pub.dev" source: hosted - version: "4.4.0" + version: "4.5.0" collection: dependency: transitive description: @@ -185,14 +185,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.5" + dart_internal: + dependency: transitive + description: + name: dart_internal + sha256: "689dccc3d5f62affd339534cca548dce12b3a6b32f0f10861569d3025efc0567" + url: "https://pub.dev" + source: hosted + version: "0.2.9" dart_style: dependency: transitive description: name: dart_style - sha256: "7a03456c3490394c8e7665890333e91ae8a49be43542b616e414449ac358acd4" + sha256: "1efa911ca7086affd35f463ca2fc1799584fb6aa89883cf0af8e3664d6a02d55" url: "https://pub.dev" source: hosted - version: "2.2.4" + version: "2.3.2" enum_to_string: dependency: "direct main" description: @@ -221,10 +229,10 @@ packages: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.0" firebase_core: dependency: "direct main" description: @@ -316,10 +324,10 @@ packages: dependency: "direct main" description: name: fluttertoast - sha256: "2f9c4d3f4836421f7067a28f8939814597b27614e021da9d63e5d3fb6e212d25" + sha256: "474f7d506230897a3cd28c965ec21c5328ae5605fc9c400cd330e9e9d6ac175c" url: "https://pub.dev" source: hosted - version: "8.2.1" + version: "8.2.2" frontend_server_client: dependency: transitive description: @@ -332,26 +340,26 @@ packages: dependency: transitive description: name: glob - sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c" + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" graphs: dependency: transitive description: name: graphs - sha256: f9e130f3259f52d26f0cfc0e964513796dafed572fa52e45d2f8d6ca14db39b2 + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.1" http: dependency: transitive description: name: http - sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482" + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" url: "https://pub.dev" source: hosted - version: "0.13.5" + version: "0.13.6" http_multi_server: dependency: transitive description: @@ -388,26 +396,26 @@ packages: dependency: transitive description: name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.7" json_annotation: dependency: transitive description: name: json_annotation - sha256: c33da08e136c3df0190bd5bbe51ae1df4a7d96e7954d1d7249fea2968a72d317 + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 url: "https://pub.dev" source: hosted - version: "4.8.0" + version: "4.8.1" logging: dependency: transitive description: name: logging - sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d" + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" matcher: dependency: transitive description: @@ -547,18 +555,18 @@ packages: dependency: transitive description: name: pub_semver - sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17" + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" pubspec_parse: dependency: transitive description: name: pubspec_parse - sha256: ec85d7d55339d85f44ec2b682a82fea340071e8978257e5a43e69f79e98ef50c + sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 url: "https://pub.dev" source: hosted - version: "1.2.2" + version: "1.2.3" rxdart: dependency: "direct main" description: @@ -571,18 +579,18 @@ packages: dependency: transitive description: name: shelf - sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - sha256: a988c0e8d8ffbdb8a28aa7ec8e449c260f3deb808781fe1284d22c5bba7156e8 + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" sky_engine: dependency: transitive description: flutter @@ -592,10 +600,10 @@ packages: dependency: transitive description: name: source_gen - sha256: "2d79738b6bbf38a43920e2b8d189e9a3ce6cc201f4b8fc76be5e4fe377b1c38d" + sha256: fc0da689e5302edb6177fdd964efcb7f58912f43c28c2047a808f5bfff643d16 url: "https://pub.dev" source: hosted - version: "1.2.6" + version: "1.4.0" source_span: dependency: transitive description: @@ -608,18 +616,18 @@ packages: dependency: "direct main" description: name: sqflite - sha256: "500d6fec583d2c021f2d25a056d96654f910662c64f836cd2063167b8f1fa758" + sha256: "591f1602816e9c31377d5f008c2d9ef7b8aca8941c3f89cc5fd9d84da0c38a9a" url: "https://pub.dev" source: hosted - version: "2.2.6" + version: "2.3.0" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "963dad8c4aa2f814ce7d2d5b1da2f36f31bd1a439d8f27e3dc189bb9d26bc684" + sha256: "1b92f368f44b0dee2425bb861cfa17b6f6cf3961f762ff6f941d20b33355660a" url: "https://pub.dev" source: hosted - version: "2.4.3" + version: "2.5.0" stack_trace: dependency: transitive description: @@ -656,10 +664,10 @@ packages: dependency: transitive description: name: synchronized - sha256: "33b31b6beb98100bf9add464a36a8dd03eb10c7a8cf15aeec535e9b054aaf04b" + sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.1.0" term_glyph: dependency: transitive description: @@ -736,10 +744,10 @@ packages: dependency: transitive description: name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.1.0" web: dependency: transitive description: @@ -752,10 +760,10 @@ packages: dependency: transitive description: name: web_socket_channel - sha256: ca49c0bc209c687b887f30527fb6a9d80040b072cc2990f34b9bec3e7663101b + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.0" xml: dependency: transitive description: @@ -768,10 +776,10 @@ packages: dependency: transitive description: name: yaml - sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" + dart: ">=3.1.0-185.0.dev <3.3.0" flutter: ">=3.7.0-0"