From 0ae552622d86c9610a7f0c3dbe6e2d0635e2873e Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Fri, 1 Dec 2023 09:09:16 +0100 Subject: [PATCH] Wip add pin for access --- lib/Components/rounded_input_field.dart | 3 + lib/Helpers/DatabaseHelper.dart | 6 +- lib/Helpers/MQTTHelper.dart | 11 +- lib/Screens/Configuration/config_view.dart | 116 ++++++++------ lib/api/swagger.yaml | 125 ++++++++++++++- lib/client.dart | 4 + lib/main.dart | 11 +- manager_api/README.md | 8 +- manager_api/doc/AuthenticationApi.md | 2 +- manager_api/doc/ConfigurationApi.md | 52 ++++++- manager_api/doc/ConfigurationDTO.md | 2 + manager_api/doc/DeviceApi.md | 2 +- manager_api/doc/ExportConfigurationDTO.md | 2 + manager_api/doc/Instance.md | 1 + manager_api/doc/InstanceApi.md | 46 +++++- manager_api/doc/InstanceDTO.md | 1 + manager_api/doc/ResourceApi.md | 2 +- manager_api/doc/SectionApi.md | 46 +++++- manager_api/doc/SectionDTO.md | 2 +- manager_api/doc/UserApi.md | 2 +- manager_api/lib/api/configuration_api.dart | 68 ++++++++- manager_api/lib/api/instance_api.dart | 51 +++++++ manager_api/lib/api/section_api.dart | 51 +++++++ manager_api/lib/api_client.dart | 23 +-- manager_api/lib/auth/api_key_auth.dart | 2 +- manager_api/lib/auth/authentication.dart | 2 +- manager_api/lib/auth/http_basic_auth.dart | 2 +- manager_api/lib/auth/http_bearer_auth.dart | 2 +- manager_api/lib/auth/oauth.dart | 2 +- manager_api/lib/model/article_dto.dart | 50 +++--- manager_api/lib/model/configuration_dto.dart | 130 +++++++++++----- manager_api/lib/model/device_detail_dto.dart | 104 ++++++++----- .../lib/model/device_detail_dto_all_of.dart | 38 +++-- manager_api/lib/model/device_dto.dart | 80 ++++++---- .../lib/model/export_configuration_dto.dart | 142 ++++++++++++------ .../export_configuration_dto_all_of.dart | 30 ++-- manager_api/lib/model/geo_point_dto.dart | 56 ++++--- manager_api/lib/model/image_dto.dart | 48 +++--- manager_api/lib/model/image_geo_point.dart | 26 ++-- manager_api/lib/model/instance.dart | 49 +++--- manager_api/lib/model/instance_dto.dart | 49 +++--- manager_api/lib/model/level_dto.dart | 34 +++-- manager_api/lib/model/login_dto.dart | 26 ++-- manager_api/lib/model/map_dto.dart | 46 +++--- manager_api/lib/model/map_type_app.dart | 2 +- manager_api/lib/model/menu_dto.dart | 22 +-- manager_api/lib/model/player_message_dto.dart | 26 ++-- manager_api/lib/model/question_dto.dart | 48 +++--- manager_api/lib/model/quizz_dto.dart | 46 +++--- .../lib/model/quizz_dto_bad_level.dart | 34 +++-- manager_api/lib/model/resource_dto.dart | 50 +++--- manager_api/lib/model/resource_type.dart | 2 +- manager_api/lib/model/response_dto.dart | 34 +++-- manager_api/lib/model/section_dto.dart | 136 +++++++++++------ manager_api/lib/model/section_type.dart | 2 +- manager_api/lib/model/slider_dto.dart | 22 +-- manager_api/lib/model/token_dto.dart | 56 ++++--- manager_api/lib/model/translation_dto.dart | 26 ++-- manager_api/lib/model/user.dart | 62 +++++--- manager_api/lib/model/user_detail_dto.dart | 38 +++-- manager_api/lib/model/video_dto.dart | 20 +-- manager_api/lib/model/web_dto.dart | 20 +-- 62 files changed, 1506 insertions(+), 695 deletions(-) diff --git a/lib/Components/rounded_input_field.dart b/lib/Components/rounded_input_field.dart index 550de92..9c8ee78 100644 --- a/lib/Components/rounded_input_field.dart +++ b/lib/Components/rounded_input_field.dart @@ -9,6 +9,7 @@ class RoundedInputField extends StatelessWidget { final String? initialValue; final Color? color, textColor, iconColor; final int? maxLength; + final bool isString; const RoundedInputField({ Key? key, this.hintText, @@ -19,6 +20,7 @@ class RoundedInputField extends StatelessWidget { this.iconColor = kMainRed, this.onChanged, this.maxLength, // 50 + this.isString = true, }) : super(key: key); @override @@ -30,6 +32,7 @@ class RoundedInputField extends StatelessWidget { initialValue: initialValue, cursorColor: textColor, maxLength: maxLength, + keyboardType: isString ? TextInputType.text : TextInputType.number, style: TextStyle(fontSize: 20, color: textColor), decoration: InputDecoration( icon: icon != null ? Icon( diff --git a/lib/Helpers/DatabaseHelper.dart b/lib/Helpers/DatabaseHelper.dart index 2ccbd12..495e18a 100644 --- a/lib/Helpers/DatabaseHelper.dart +++ b/lib/Helpers/DatabaseHelper.dart @@ -83,8 +83,8 @@ class DatabaseHelper { return await db.rawQuery("DELETE FROM $table"); } - Future getData() async { - TabletAppContext tabletAppContext = TabletAppContext(); + Future getData() async { + TabletAppContext? tabletAppContext; await DatabaseHelper.instance.queryAllRows().then((value) { value.forEach((element) { @@ -95,6 +95,7 @@ class DatabaseHelper { tabletAppContext = TabletAppContext( id: element["id"], + instanceId: element["instanceId"], deviceId: element["deviceId"], host: element["host"], configuration: configuration, @@ -103,6 +104,7 @@ class DatabaseHelper { }); }).catchError((error) { print(error); + return null; }); return tabletAppContext; diff --git a/lib/Helpers/MQTTHelper.dart b/lib/Helpers/MQTTHelper.dart index ba432f1..a5f0925 100644 --- a/lib/Helpers/MQTTHelper.dart +++ b/lib/Helpers/MQTTHelper.dart @@ -132,7 +132,7 @@ class MQTTHelper { "connected": false }; - final connMessage = MqttConnectMessage().authenticateAs('admin', 'mdlf2021!') // TODO ONLINE + final connMessage = MqttConnectMessage().authenticateAs("user1", "MyMuseum2023!") // TODO ONLINE // 'admin', 'mdlf2021!' .keepAliveFor(60) .withWillTopic('player/status') .withWillMessage(jsonEncode(message)) @@ -141,7 +141,7 @@ class MQTTHelper { .withWillQos(MqttQos.atLeastOnce); if(kIsWeb) { - /*tabletAppContext.clientBrowserMQTT = MqttBrowserClient.withPort(hostToTake!.replaceAll('http://', ''), 'tablet_app_'+identifier!, 1883); + /*tabletAppContext.clientBrowserMQTT = MqttBrowserClient.withPort(hostToTake!.replaceAll('https://api.', ''), 'tablet_app_'+identifier!, 1883); tabletAppContext.clientBrowserMQTT!.logging(on: false); tabletAppContext.clientBrowserMQTT!.keepAlivePeriod = 20; tabletAppContext.clientBrowserMQTT!.onDisconnected = onDisconnected; @@ -178,8 +178,8 @@ class MQTTHelper { tabletAppContext.clientBrowserMQTT!.disconnect(); }*/ } else { - tabletAppContext.clientMQTT = MqttServerClient.withPort(hostToTake!.replaceAll('http://', ''), 'tablet_app_'+identifier!, 1883); - tabletAppContext.clientMQTT!.logging(on: false); + tabletAppContext.clientMQTT = MqttServerClient.withPort(hostToTake!.replaceAll('https://api.', ''), 'tablet_app_'+identifier!, 1883); + tabletAppContext.clientMQTT!.logging(on: true); tabletAppContext.clientMQTT!.keepAlivePeriod = 20; tabletAppContext.clientMQTT!.onDisconnected = onDisconnected; tabletAppContext.clientMQTT!.onConnected = () => onConnected(appContext); @@ -236,6 +236,9 @@ class MQTTHelper { tabletAppContext.deviceId = device.id; tabletAppContext.configuration!.id = device.configurationId; + print(tabletAppContext); + print(tabletAppContext.instanceId); + appContext.setContext(tabletAppContext); // STORE IT LOCALLY (SQLite) diff --git a/lib/Screens/Configuration/config_view.dart b/lib/Screens/Configuration/config_view.dart index 6b1b269..d1a168d 100644 --- a/lib/Screens/Configuration/config_view.dart +++ b/lib/Screens/Configuration/config_view.dart @@ -34,6 +34,7 @@ class ConfigViewWidget extends StatefulWidget { class _ConfigViewWidget extends State { Size sizeScreen = new Size(1080.0, 1920.0); // Tablet resolution String url = "https://api.mymuseum.be"; //DEV "http://192.168.31.96" http://192.168.31.140:8089 // PROD MDLF "http://192.168.1.19" + int? pinCode; bool configOk = false; @override @@ -148,8 +149,8 @@ class _ConfigViewWidget extends State { borderRadius: BorderRadius.circular(29), color: kBackgroundLight, ), - constraints: BoxConstraints(maxWidth: 500, minWidth: 450), - height: size.height*0.3, + constraints: BoxConstraints(maxWidth: 500, minWidth: 450, minHeight: 350, maxHeight: 450), + height: size.height*0.35, width: size.width*0.6, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, @@ -171,61 +172,81 @@ class _ConfigViewWidget extends State { initialValue: url, onChanged: (value) { setState(() { + print("Setstate value"); url = value; + print(url); }); }, icon: Icons.language ), ), + Padding( + padding: const EdgeInsets.only(left: 50, right: 50), + child: RoundedInputField( + hintText: "PIN", + onChanged: (value) { + setState(() { + pinCode = int.tryParse(value); + }); + }, + icon: Icons.pin, + isString: false + ), + ), RoundedButton( text: "OK", fontSize: 25, press: () async { var client = new Client(url); print(url); - var isOk = await isValidApi(client); - if (isOk) { - Fluttertoast.showToast( - msg: "Connecté au manager", - toastLength: Toast.LENGTH_SHORT, - gravity: ToastGravity.BOTTOM, - timeInSecForIosWeb: 1, - backgroundColor: Colors.lightGreen, - textColor: Colors.white, - fontSize: 16.0 - ); + print(pinCode); - TabletAppContext? tabletAppContext = appContext.getContext(); - if(tabletAppContext == null) { - TabletAppContext tabletAppContext = new TabletAppContext(); - tabletAppContext.host = url; - } + if(url.length > 0 && pinCode != null) { + var instance = await getInstanceIdByPinCode(client, pinCode!); + if (instance != null) { + Fluttertoast.showToast( + msg: "Connecté au manager", + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + timeInSecForIosWeb: 1, + backgroundColor: Colors.lightGreen, + textColor: Colors.white, + fontSize: 16.0 + ); - tabletAppContext!.clientAPI = client; - var identifier = kIsWeb ? "WEB TEST" : await DeviceInfoHelper.getDeviceDetails(); + TabletAppContext? tabletAppContext = appContext.getContext(); + if(tabletAppContext == null) { + tabletAppContext = new TabletAppContext(host: url, instanceId: instance.id); + } + tabletAppContext.instanceId = instance.id; + tabletAppContext.clientAPI = client; + var identifier = kIsWeb ? "WEB TEST" : await DeviceInfoHelper.getDeviceDetails(); - if(kIsWeb) { - //tabletAppContext.clientBrowserMQTT = new MqttBrowserClient(url.replaceAll('http://', ''),'tablet_app_'+ identifier!); - } else - { - // mobile specific - tabletAppContext.clientMQTT = new MqttServerClient(url.replaceAll('http://', ''),'tablet_app_'+ identifier!); - } + if(kIsWeb) { + //tabletAppContext.clientBrowserMQTT = new MqttBrowserClient(url.replaceAll('http://', ''),'tablet_app_'+ identifier!); + } else + { + print("init mqtt"); + print(identifier); + // mobile specific + tabletAppContext.clientMQTT = new MqttServerClient(url.replaceAll('https://api.', ''),'tablet_app_'+ identifier!); + } - setState(() { - appContext.setContext(tabletAppContext); + setState(() { + appContext.setContext(tabletAppContext!); configOk = true; - }); - } else { - Fluttertoast.showToast( - msg: "L'url ne correspond pas à un manager", - toastLength: Toast.LENGTH_SHORT, - gravity: ToastGravity.BOTTOM, - timeInSecForIosWeb: 1, - backgroundColor: Colors.redAccent, - textColor: Colors.white, - fontSize: 16.0 - ); + }); + } else { + Fluttertoast.showToast( + msg: "L'url ne correspond pas à un manager", + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + timeInSecForIosWeb: 1, + backgroundColor: Colors.redAccent, + textColor: Colors.white, + fontSize: 16.0 + ); + } } }, ) @@ -250,6 +271,10 @@ class _ConfigViewWidget extends State { newDevice.ipAddressWLAN = await getIP(true); newDevice.ipAddressETH = await getIP(false); newDevice.name = newDevice.ipAddressWLAN; + newDevice.dateCreation = DateTime.now(); + newDevice.dateUpdate = DateTime.now(); + newDevice.lastConnectionLevel = DateTime.now(); + newDevice.lastBatteryLevel = DateTime.now(); print(newDevice); @@ -270,7 +295,7 @@ class _ConfigViewWidget extends State { appContext.setContext(tabletAppContext); // STORE IT LOCALLY (SQLite) - TabletAppContext localContext = await DatabaseHelper.instance.getData(); + TabletAppContext? localContext = await DatabaseHelper.instance.getData(); if (localContext != null) { // Check if sql DB exist await DatabaseHelper.instance.update(tabletAppContext); } else { @@ -299,14 +324,13 @@ class _ConfigViewWidget extends State { } } - isValidApi(Client client) async { - print("TEST URL"); + Future getInstanceIdByPinCode(Client client, int pinCode) async { try { - var configs = await client.configurationApi!.configurationGet(); - return configs != null; + var instance = await client.instanceApi!.instanceGetInstanceByPinCode(pinCode: pinCode); + return instance; } catch (ex) { print(ex); - return false; + return null; } } } diff --git a/lib/api/swagger.yaml b/lib/api/swagger.yaml index bf69b89..71950c8 100644 --- a/lib/api/swagger.yaml +++ b/lib/api/swagger.yaml @@ -5,7 +5,7 @@ info: description: API Manager Service version: Version Alpha servers: - - url: https://api.mymuseum.be + - url: http://localhost:5000 paths: /api/Configuration: get: @@ -112,6 +112,39 @@ paths: type: string security: - bearer: [] + /api/Configuration/byPin: + get: + tags: + - Configuration + operationId: Configuration_GetConfigurationsByPinCode + parameters: + - name: pinCode + in: query + schema: + type: integer + format: int32 + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/ConfigurationDTO' + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string /api/Configuration/{id}: get: tags: @@ -196,6 +229,12 @@ paths: type: string nullable: true x-position: 1 + - name: language + in: query + schema: + type: string + nullable: true + x-position: 2 responses: '200': description: '' @@ -664,6 +703,37 @@ paths: type: string security: - bearer: [] + /api/Instance/byPin: + get: + tags: + - Instance + operationId: Instance_GetInstanceByPinCode + parameters: + - name: pinCode + in: query + schema: + type: integer + format: int32 + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/InstanceDTO' + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string /api/Resource: get: tags: @@ -1205,6 +1275,40 @@ paths: type: string security: - bearer: [] + /api/Section/beacons/{instanceId}: + get: + tags: + - Section + operationId: Section_GetAllBeaconsForInstance + parameters: + - name: instanceId + in: path + required: true + schema: + type: string + nullable: true + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/SectionDTO' + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string /api/Section/order: put: tags: @@ -1654,6 +1758,14 @@ components: instanceId: type: string nullable: true + sectionIds: + type: array + nullable: true + items: + type: string + pinCode: + type: integer + format: int32 TranslationDTO: type: object additionalProperties: false @@ -1741,7 +1853,8 @@ components: isBeacon: type: boolean beaconId: - type: string + type: integer + format: int32 nullable: true SectionType: type: integer @@ -1877,6 +1990,10 @@ components: dateCreation: type: string format: date-time + pinCode: + type: integer + format: int32 + nullable: true InstanceDTO: type: object additionalProperties: false @@ -1890,6 +2007,10 @@ components: dateCreation: type: string format: date-time + pinCode: + type: integer + format: int32 + nullable: true MapDTO: type: object additionalProperties: false diff --git a/lib/client.dart b/lib/client.dart index c345f19..c7518e2 100644 --- a/lib/client.dart +++ b/lib/client.dart @@ -8,6 +8,9 @@ class Client { AuthenticationApi? _authenticationApi; AuthenticationApi? get authenticationApi => _authenticationApi; + InstanceApi? _instanceApi; + InstanceApi? get instanceApi => _instanceApi; + UserApi? _userApi; UserApi? get userApi => _userApi; @@ -28,6 +31,7 @@ class Client { basePath: path); // "http://192.168.31.96" //basePath: "https://localhost:44339"); _authenticationApi = AuthenticationApi(_apiClient); + _instanceApi = InstanceApi(_apiClient); _userApi = UserApi(_apiClient); _configurationApi = ConfigurationApi(_apiClient); _sectionApi = SectionApi(_apiClient); diff --git a/lib/main.dart b/lib/main.dart index 18c94b8..d842ba8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -25,12 +25,18 @@ void main() async { if(localContext != null && localContext.host != null) { print("we've got an local db !"); - localContext.clientAPI = new Client(localContext.host!); + print(localContext); + localContext.clientAPI = new Client(localContext.host!); // retrieve instanceId from local DB isConfig = localContext.configuration != null; print(localContext); + print("localContext.deviceId"); + print(localContext.deviceId!); + print("localContext.instanceId"); + print(localContext.instanceId); // Get config from manager DeviceDetailDTO? device = await localContext.clientAPI!.deviceApi!.deviceGetDetail(localContext.deviceId!); localContext.configuration!.id = device!.configurationId; + localContext.instanceId = device.instanceId; if (device.configurationId == null) { print("device.configurationId == null"); localContext.configuration = null; @@ -43,6 +49,9 @@ void main() async { if(kIsWeb) { localContext = TabletAppContext(host: "https://api.mymuseum.be", instanceId: "63514fd67ed8c735aaa4b8f1"); // mymuseum : 63514fd67ed8c735aaa4b8f1 print(localContext); + } else { + /*print("MOBILE - set host"); + localContext = TabletAppContext(host: "https://api.mymuseum.be"); // mymuseum : 63514fd67ed8c735aaa4b8f1 //https://localhost:5001/ // https://api.mymuseum.be*/ } initialRoute = isConfig ? '/main' : '/config'; diff --git a/manager_api/README.md b/manager_api/README.md index 93893f7..5b4274c 100644 --- a/manager_api/README.md +++ b/manager_api/README.md @@ -60,7 +60,7 @@ try { ## Documentation for API Endpoints -All URIs are relative to *https://api.mymuseum.be* +All URIs are relative to *http://localhost:5000* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- @@ -70,6 +70,7 @@ Class | Method | HTTP request | Description *ConfigurationApi* | [**configurationDelete**](doc\/ConfigurationApi.md#configurationdelete) | **DELETE** /api/Configuration/{id} | *ConfigurationApi* | [**configurationExport**](doc\/ConfigurationApi.md#configurationexport) | **GET** /api/Configuration/{id}/export | *ConfigurationApi* | [**configurationGet**](doc\/ConfigurationApi.md#configurationget) | **GET** /api/Configuration | +*ConfigurationApi* | [**configurationGetConfigurationsByPinCode**](doc\/ConfigurationApi.md#configurationgetconfigurationsbypincode) | **GET** /api/Configuration/byPin | *ConfigurationApi* | [**configurationGetDetail**](doc\/ConfigurationApi.md#configurationgetdetail) | **GET** /api/Configuration/{id} | *ConfigurationApi* | [**configurationImport**](doc\/ConfigurationApi.md#configurationimport) | **POST** /api/Configuration/import | *ConfigurationApi* | [**configurationUpdate**](doc\/ConfigurationApi.md#configurationupdate) | **PUT** /api/Configuration | @@ -83,6 +84,7 @@ Class | Method | HTTP request | Description *InstanceApi* | [**instanceDeleteInstance**](doc\/InstanceApi.md#instancedeleteinstance) | **DELETE** /api/Instance/{id} | *InstanceApi* | [**instanceGet**](doc\/InstanceApi.md#instanceget) | **GET** /api/Instance | *InstanceApi* | [**instanceGetDetail**](doc\/InstanceApi.md#instancegetdetail) | **GET** /api/Instance/{id} | +*InstanceApi* | [**instanceGetInstanceByPinCode**](doc\/InstanceApi.md#instancegetinstancebypincode) | **GET** /api/Instance/byPin | *InstanceApi* | [**instanceUpdateinstance**](doc\/InstanceApi.md#instanceupdateinstance) | **PUT** /api/Instance | *ResourceApi* | [**resourceCreate**](doc\/ResourceApi.md#resourcecreate) | **POST** /api/Resource | *ResourceApi* | [**resourceDelete**](doc\/ResourceApi.md#resourcedelete) | **DELETE** /api/Resource/{id} | @@ -95,6 +97,7 @@ Class | Method | HTTP request | Description *SectionApi* | [**sectionDelete**](doc\/SectionApi.md#sectiondelete) | **DELETE** /api/Section/{id} | *SectionApi* | [**sectionDeleteAllForConfiguration**](doc\/SectionApi.md#sectiondeleteallforconfiguration) | **DELETE** /api/Section/configuration/{id} | *SectionApi* | [**sectionGet**](doc\/SectionApi.md#sectionget) | **GET** /api/Section | +*SectionApi* | [**sectionGetAllBeaconsForInstance**](doc\/SectionApi.md#sectiongetallbeaconsforinstance) | **GET** /api/Section/beacons/{instanceId} | *SectionApi* | [**sectionGetAllSectionSubSections**](doc\/SectionApi.md#sectiongetallsectionsubsections) | **GET** /api/Section/{id}/subsections | *SectionApi* | [**sectionGetArticleDTO**](doc\/SectionApi.md#sectiongetarticledto) | **GET** /api/Section/ArticleDTO | *SectionApi* | [**sectionGetDetail**](doc\/SectionApi.md#sectiongetdetail) | **GET** /api/Section/{id} | @@ -155,7 +158,8 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## bearer +Authentication schemes defined for the API: +### bearer - **Type**: OAuth - **Flow**: password diff --git a/manager_api/doc/AuthenticationApi.md b/manager_api/doc/AuthenticationApi.md index be64641..8fdf05d 100644 --- a/manager_api/doc/AuthenticationApi.md +++ b/manager_api/doc/AuthenticationApi.md @@ -5,7 +5,7 @@ import 'package:manager_api/api.dart'; ``` -All URIs are relative to *https://api.mymuseum.be* +All URIs are relative to *http://localhost:5000* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/manager_api/doc/ConfigurationApi.md b/manager_api/doc/ConfigurationApi.md index 751fdea..99d625e 100644 --- a/manager_api/doc/ConfigurationApi.md +++ b/manager_api/doc/ConfigurationApi.md @@ -5,7 +5,7 @@ import 'package:manager_api/api.dart'; ``` -All URIs are relative to *https://api.mymuseum.be* +All URIs are relative to *http://localhost:5000* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -13,6 +13,7 @@ Method | HTTP request | Description [**configurationDelete**](ConfigurationApi.md#configurationdelete) | **DELETE** /api/Configuration/{id} | [**configurationExport**](ConfigurationApi.md#configurationexport) | **GET** /api/Configuration/{id}/export | [**configurationGet**](ConfigurationApi.md#configurationget) | **GET** /api/Configuration | +[**configurationGetConfigurationsByPinCode**](ConfigurationApi.md#configurationgetconfigurationsbypincode) | **GET** /api/Configuration/byPin | [**configurationGetDetail**](ConfigurationApi.md#configurationgetdetail) | **GET** /api/Configuration/{id} | [**configurationImport**](ConfigurationApi.md#configurationimport) | **POST** /api/Configuration/import | [**configurationUpdate**](ConfigurationApi.md#configurationupdate) | **PUT** /api/Configuration | @@ -105,7 +106,7 @@ Name | Type | Description | Notes [[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) # **configurationExport** -> MultipartFile configurationExport(id) +> MultipartFile configurationExport(id, language) @@ -117,9 +118,10 @@ import 'package:manager_api/api.dart'; final api_instance = ConfigurationApi(); final id = id_example; // String | +final language = language_example; // String | try { - final result = api_instance.configurationExport(id); + final result = api_instance.configurationExport(id, language); print(result); } catch (e) { print('Exception when calling ConfigurationApi->configurationExport: $e\n'); @@ -131,6 +133,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **String**| | + **language** | **String**| | [optional] ### Return type @@ -190,6 +193,49 @@ Name | Type | Description | Notes [[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) +# **configurationGetConfigurationsByPinCode** +> List configurationGetConfigurationsByPinCode(pinCode) + + + +### Example +```dart +import 'package:manager_api/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = ConfigurationApi(); +final pinCode = 56; // int | + +try { + final result = api_instance.configurationGetConfigurationsByPinCode(pinCode); + print(result); +} catch (e) { + print('Exception when calling ConfigurationApi->configurationGetConfigurationsByPinCode: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pinCode** | **int**| | [optional] + +### Return type + +[**List**](ConfigurationDTO.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **configurationGetDetail** > ConfigurationDTO configurationGetDetail(id) diff --git a/manager_api/doc/ConfigurationDTO.md b/manager_api/doc/ConfigurationDTO.md index 1856cc4..f74d55c 100644 --- a/manager_api/doc/ConfigurationDTO.md +++ b/manager_api/doc/ConfigurationDTO.md @@ -21,6 +21,8 @@ Name | Type | Description | Notes **isTablet** | **bool** | | [optional] **isOffline** | **bool** | | [optional] **instanceId** | **String** | | [optional] +**sectionIds** | **List** | | [optional] [default to const []] +**pinCode** | **int** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/manager_api/doc/DeviceApi.md b/manager_api/doc/DeviceApi.md index 30e9574..020ce00 100644 --- a/manager_api/doc/DeviceApi.md +++ b/manager_api/doc/DeviceApi.md @@ -5,7 +5,7 @@ import 'package:manager_api/api.dart'; ``` -All URIs are relative to *https://api.mymuseum.be* +All URIs are relative to *http://localhost:5000* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/manager_api/doc/ExportConfigurationDTO.md b/manager_api/doc/ExportConfigurationDTO.md index 4e16206..d7e8a01 100644 --- a/manager_api/doc/ExportConfigurationDTO.md +++ b/manager_api/doc/ExportConfigurationDTO.md @@ -21,6 +21,8 @@ Name | Type | Description | Notes **isTablet** | **bool** | | [optional] **isOffline** | **bool** | | [optional] **instanceId** | **String** | | [optional] +**sectionIds** | **List** | | [optional] [default to const []] +**pinCode** | **int** | | [optional] **sections** | [**List**](SectionDTO.md) | | [optional] [default to const []] **resources** | [**List**](ResourceDTO.md) | | [optional] [default to const []] diff --git a/manager_api/doc/Instance.md b/manager_api/doc/Instance.md index dd6770c..1fd6ac6 100644 --- a/manager_api/doc/Instance.md +++ b/manager_api/doc/Instance.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **id** | **String** | | [optional] **name** | **String** | | [optional] **dateCreation** | [**DateTime**](DateTime.md) | | [optional] +**pinCode** | **int** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/manager_api/doc/InstanceApi.md b/manager_api/doc/InstanceApi.md index cf81e4a..4176d2e 100644 --- a/manager_api/doc/InstanceApi.md +++ b/manager_api/doc/InstanceApi.md @@ -5,7 +5,7 @@ import 'package:manager_api/api.dart'; ``` -All URIs are relative to *https://api.mymuseum.be* +All URIs are relative to *http://localhost:5000* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -13,6 +13,7 @@ Method | HTTP request | Description [**instanceDeleteInstance**](InstanceApi.md#instancedeleteinstance) | **DELETE** /api/Instance/{id} | [**instanceGet**](InstanceApi.md#instanceget) | **GET** /api/Instance | [**instanceGetDetail**](InstanceApi.md#instancegetdetail) | **GET** /api/Instance/{id} | +[**instanceGetInstanceByPinCode**](InstanceApi.md#instancegetinstancebypincode) | **GET** /api/Instance/byPin | [**instanceUpdateinstance**](InstanceApi.md#instanceupdateinstance) | **PUT** /api/Instance | @@ -184,6 +185,49 @@ Name | Type | Description | Notes [[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) +# **instanceGetInstanceByPinCode** +> InstanceDTO instanceGetInstanceByPinCode(pinCode) + + + +### Example +```dart +import 'package:manager_api/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = InstanceApi(); +final pinCode = 56; // int | + +try { + final result = api_instance.instanceGetInstanceByPinCode(pinCode); + print(result); +} catch (e) { + print('Exception when calling InstanceApi->instanceGetInstanceByPinCode: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pinCode** | **int**| | [optional] + +### Return type + +[**InstanceDTO**](InstanceDTO.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **instanceUpdateinstance** > InstanceDTO instanceUpdateinstance(instance) diff --git a/manager_api/doc/InstanceDTO.md b/manager_api/doc/InstanceDTO.md index 1f678ff..ec1d952 100644 --- a/manager_api/doc/InstanceDTO.md +++ b/manager_api/doc/InstanceDTO.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **id** | **String** | | [optional] **name** | **String** | | [optional] **dateCreation** | [**DateTime**](DateTime.md) | | [optional] +**pinCode** | **int** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/manager_api/doc/ResourceApi.md b/manager_api/doc/ResourceApi.md index 83d00db..fb6bad9 100644 --- a/manager_api/doc/ResourceApi.md +++ b/manager_api/doc/ResourceApi.md @@ -5,7 +5,7 @@ import 'package:manager_api/api.dart'; ``` -All URIs are relative to *https://api.mymuseum.be* +All URIs are relative to *http://localhost:5000* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/manager_api/doc/SectionApi.md b/manager_api/doc/SectionApi.md index 93873b6..2d83ce4 100644 --- a/manager_api/doc/SectionApi.md +++ b/manager_api/doc/SectionApi.md @@ -5,7 +5,7 @@ import 'package:manager_api/api.dart'; ``` -All URIs are relative to *https://api.mymuseum.be* +All URIs are relative to *http://localhost:5000* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -13,6 +13,7 @@ Method | HTTP request | Description [**sectionDelete**](SectionApi.md#sectiondelete) | **DELETE** /api/Section/{id} | [**sectionDeleteAllForConfiguration**](SectionApi.md#sectiondeleteallforconfiguration) | **DELETE** /api/Section/configuration/{id} | [**sectionGet**](SectionApi.md#sectionget) | **GET** /api/Section | +[**sectionGetAllBeaconsForInstance**](SectionApi.md#sectiongetallbeaconsforinstance) | **GET** /api/Section/beacons/{instanceId} | [**sectionGetAllSectionSubSections**](SectionApi.md#sectiongetallsectionsubsections) | **GET** /api/Section/{id}/subsections | [**sectionGetArticleDTO**](SectionApi.md#sectiongetarticledto) | **GET** /api/Section/ArticleDTO | [**sectionGetDetail**](SectionApi.md#sectiongetdetail) | **GET** /api/Section/{id} | @@ -200,6 +201,49 @@ Name | Type | Description | Notes [[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) +# **sectionGetAllBeaconsForInstance** +> List sectionGetAllBeaconsForInstance(instanceId) + + + +### Example +```dart +import 'package:manager_api/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = SectionApi(); +final instanceId = instanceId_example; // String | + +try { + final result = api_instance.sectionGetAllBeaconsForInstance(instanceId); + print(result); +} catch (e) { + print('Exception when calling SectionApi->sectionGetAllBeaconsForInstance: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **instanceId** | **String**| | + +### Return type + +[**List**](SectionDTO.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **sectionGetAllSectionSubSections** > List sectionGetAllSectionSubSections(id) diff --git a/manager_api/doc/SectionDTO.md b/manager_api/doc/SectionDTO.md index 0349cd4..484d474 100644 --- a/manager_api/doc/SectionDTO.md +++ b/manager_api/doc/SectionDTO.md @@ -26,7 +26,7 @@ Name | Type | Description | Notes **longitude** | **String** | | [optional] **meterZoneGPS** | **int** | | [optional] **isBeacon** | **bool** | | [optional] -**beaconId** | **String** | | [optional] +**beaconId** | **int** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/manager_api/doc/UserApi.md b/manager_api/doc/UserApi.md index 5963708..6a55295 100644 --- a/manager_api/doc/UserApi.md +++ b/manager_api/doc/UserApi.md @@ -5,7 +5,7 @@ import 'package:manager_api/api.dart'; ``` -All URIs are relative to *https://api.mymuseum.be* +All URIs are relative to *http://localhost:5000* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/manager_api/lib/api/configuration_api.dart b/manager_api/lib/api/configuration_api.dart index ffc3cf0..22d6a3a 100644 --- a/manager_api/lib/api/configuration_api.dart +++ b/manager_api/lib/api/configuration_api.dart @@ -115,7 +115,9 @@ class ConfigurationApi { /// Parameters: /// /// * [String] id (required): - Future configurationExportWithHttpInfo(String id,) async { + /// + /// * [String] language: + Future configurationExportWithHttpInfo(String id, { String? language, }) async { // ignore: prefer_const_declarations final path = r'/api/Configuration/{id}/export' .replaceAll('{id}', id); @@ -127,6 +129,10 @@ class ConfigurationApi { final headerParams = {}; final formParams = {}; + if (language != null) { + queryParams.addAll(_queryParams('', 'language', language)); + } + const contentTypes = []; @@ -144,8 +150,10 @@ class ConfigurationApi { /// Parameters: /// /// * [String] id (required): - Future configurationExport(String id,) async { - final response = await configurationExportWithHttpInfo(id,); + /// + /// * [String] language: + Future configurationExport(String id, { String? language, }) async { + final response = await configurationExportWithHttpInfo(id, language: language, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } @@ -213,6 +221,60 @@ class ConfigurationApi { return null; } + /// Performs an HTTP 'GET /api/Configuration/byPin' operation and returns the [Response]. + /// Parameters: + /// + /// * [int] pinCode: + Future configurationGetConfigurationsByPinCodeWithHttpInfo({ int? pinCode, }) async { + // ignore: prefer_const_declarations + final path = r'/api/Configuration/byPin'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (pinCode != null) { + queryParams.addAll(_queryParams('', 'pinCode', pinCode)); + } + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Parameters: + /// + /// * [int] pinCode: + Future?> configurationGetConfigurationsByPinCode({ int? pinCode, }) async { + final response = await configurationGetConfigurationsByPinCodeWithHttpInfo( pinCode: pinCode, ); + 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) { + final responseBody = await _decodeBodyBytes(response); + return (await apiClient.deserializeAsync(responseBody, 'List') as List) + .cast() + .toList(); + + } + return null; + } + /// Performs an HTTP 'GET /api/Configuration/{id}' operation and returns the [Response]. /// Parameters: /// diff --git a/manager_api/lib/api/instance_api.dart b/manager_api/lib/api/instance_api.dart index ef652ce..2e120d1 100644 --- a/manager_api/lib/api/instance_api.dart +++ b/manager_api/lib/api/instance_api.dart @@ -203,6 +203,57 @@ class InstanceApi { return null; } + /// Performs an HTTP 'GET /api/Instance/byPin' operation and returns the [Response]. + /// Parameters: + /// + /// * [int] pinCode: + Future instanceGetInstanceByPinCodeWithHttpInfo({ int? pinCode, }) async { + // ignore: prefer_const_declarations + final path = r'/api/Instance/byPin'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (pinCode != null) { + queryParams.addAll(_queryParams('', 'pinCode', pinCode)); + } + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Parameters: + /// + /// * [int] pinCode: + Future instanceGetInstanceByPinCode({ int? pinCode, }) async { + final response = await instanceGetInstanceByPinCodeWithHttpInfo( pinCode: pinCode, ); + 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), 'InstanceDTO',) as InstanceDTO; + + } + return null; + } + /// Performs an HTTP 'PUT /api/Instance' operation and returns the [Response]. /// Parameters: /// diff --git a/manager_api/lib/api/section_api.dart b/manager_api/lib/api/section_api.dart index cb2897c..bc9addb 100644 --- a/manager_api/lib/api/section_api.dart +++ b/manager_api/lib/api/section_api.dart @@ -213,6 +213,57 @@ class SectionApi { return null; } + /// Performs an HTTP 'GET /api/Section/beacons/{instanceId}' operation and returns the [Response]. + /// Parameters: + /// + /// * [String] instanceId (required): + Future sectionGetAllBeaconsForInstanceWithHttpInfo(String instanceId,) async { + // ignore: prefer_const_declarations + final path = r'/api/Section/beacons/{instanceId}' + .replaceAll('{instanceId}', instanceId); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Parameters: + /// + /// * [String] instanceId (required): + Future?> sectionGetAllBeaconsForInstance(String instanceId,) async { + final response = await sectionGetAllBeaconsForInstanceWithHttpInfo(instanceId,); + 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) { + final responseBody = await _decodeBodyBytes(response); + return (await apiClient.deserializeAsync(responseBody, 'List') as List) + .cast() + .toList(); + + } + return null; + } + /// Performs an HTTP 'GET /api/Section/{id}/subsections' operation and returns the [Response]. /// Parameters: /// diff --git a/manager_api/lib/api_client.dart b/manager_api/lib/api_client.dart index 70d5cce..961d5d4 100644 --- a/manager_api/lib/api_client.dart +++ b/manager_api/lib/api_client.dart @@ -11,11 +11,13 @@ part of openapi.api; class ApiClient { - ApiClient({this.basePath = 'https://api.mymuseum.be', this.authentication}); + ApiClient({this.basePath = 'http://localhost:5000', 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 'ArticleDTO': return ArticleDTO.fromJson(value); case 'ConfigurationDTO': diff --git a/manager_api/lib/auth/api_key_auth.dart b/manager_api/lib/auth/api_key_auth.dart index e304eda..84dc295 100644 --- a/manager_api/lib/auth/api_key_auth.dart +++ b/manager_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/manager_api/lib/auth/authentication.dart b/manager_api/lib/auth/authentication.dart index 49baf7c..1b1b8ae 100644 --- a/manager_api/lib/auth/authentication.dart +++ b/manager_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/manager_api/lib/auth/http_basic_auth.dart b/manager_api/lib/auth/http_basic_auth.dart index 81abd71..dfedaa5 100644 --- a/manager_api/lib/auth/http_basic_auth.dart +++ b/manager_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/manager_api/lib/auth/http_bearer_auth.dart b/manager_api/lib/auth/http_bearer_auth.dart index 213f348..eddf3a5 100644 --- a/manager_api/lib/auth/http_bearer_auth.dart +++ b/manager_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/manager_api/lib/auth/oauth.dart b/manager_api/lib/auth/oauth.dart index e9b87cf..e9e7d78 100644 --- a/manager_api/lib/auth/oauth.dart +++ b/manager_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/manager_api/lib/model/article_dto.dart b/manager_api/lib/model/article_dto.dart index 5e6cd8f..3b72137 100644 --- a/manager_api/lib/model/article_dto.dart +++ b/manager_api/lib/model/article_dto.dart @@ -63,23 +63,33 @@ class ArticleDTO { String toString() => 'ArticleDTO[content=$content, isContentTop=$isContentTop, audioIds=$audioIds, isReadAudioAuto=$isReadAudioAuto, images=$images]'; Map toJson() { - final _json = {}; - if (content != null) { - _json[r'content'] = content; + final json = {}; + if (this.content != null) { + json[r'content'] = this.content; + } else { + json[r'content'] = null; } - if (isContentTop != null) { - _json[r'isContentTop'] = isContentTop; + if (this.isContentTop != null) { + json[r'isContentTop'] = this.isContentTop; + } else { + json[r'isContentTop'] = null; } - if (audioIds != null) { - _json[r'audioIds'] = audioIds; + if (this.audioIds != null) { + json[r'audioIds'] = this.audioIds; + } else { + json[r'audioIds'] = null; } - if (isReadAudioAuto != null) { - _json[r'isReadAudioAuto'] = isReadAudioAuto; + if (this.isReadAudioAuto != null) { + json[r'isReadAudioAuto'] = this.isReadAudioAuto; + } else { + json[r'isReadAudioAuto'] = null; } - if (images != null) { - _json[r'images'] = images; + if (this.images != null) { + json[r'images'] = this.images; + } else { + json[r'images'] = null; } - return _json; + return json; } /// Returns a new [ArticleDTO] instance and imports its values from @@ -101,17 +111,17 @@ class ArticleDTO { }()); return ArticleDTO( - content: TranslationDTO.listFromJson(json[r'content']) ?? const [], + content: TranslationDTO.listFromJson(json[r'content']), isContentTop: mapValueOfType(json, r'isContentTop'), - audioIds: TranslationDTO.listFromJson(json[r'audioIds']) ?? const [], + audioIds: TranslationDTO.listFromJson(json[r'audioIds']), isReadAudioAuto: mapValueOfType(json, r'isReadAudioAuto'), - images: ImageDTO.listFromJson(json[r'images']) ?? const [], + images: ImageDTO.listFromJson(json[r'images']), ); } 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 ArticleDTO { 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 = ArticleDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ArticleDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/configuration_dto.dart b/manager_api/lib/model/configuration_dto.dart index 5b29c23..7f523e0 100644 --- a/manager_api/lib/model/configuration_dto.dart +++ b/manager_api/lib/model/configuration_dto.dart @@ -26,6 +26,8 @@ class ConfigurationDTO { this.isTablet, this.isOffline, this.instanceId, + this.sectionIds = const [], + this.pinCode, }); String? id; @@ -78,6 +80,16 @@ class ConfigurationDTO { String? instanceId; + List? sectionIds; + + /// + /// 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? pinCode; + @override bool operator ==(Object other) => identical(this, other) || other is ConfigurationDTO && other.id == id && @@ -92,7 +104,9 @@ class ConfigurationDTO { other.isMobile == isMobile && other.isTablet == isTablet && other.isOffline == isOffline && - other.instanceId == instanceId; + other.instanceId == instanceId && + other.sectionIds == sectionIds && + other.pinCode == pinCode; @override int get hashCode => @@ -109,53 +123,91 @@ class ConfigurationDTO { (isMobile == null ? 0 : isMobile!.hashCode) + (isTablet == null ? 0 : isTablet!.hashCode) + (isOffline == null ? 0 : isOffline!.hashCode) + - (instanceId == null ? 0 : instanceId!.hashCode); + (instanceId == null ? 0 : instanceId!.hashCode) + + (sectionIds == null ? 0 : sectionIds!.hashCode) + + (pinCode == null ? 0 : pinCode!.hashCode); @override - String toString() => 'ConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId]'; + String toString() => 'ConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, pinCode=$pinCode]'; 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 (label != null) { - _json[r'label'] = label; + if (this.label != null) { + json[r'label'] = this.label; + } else { + json[r'label'] = null; } - if (title != null) { - _json[r'title'] = title; + if (this.title != null) { + json[r'title'] = this.title; + } else { + json[r'title'] = null; } - if (imageId != null) { - _json[r'imageId'] = imageId; + if (this.imageId != null) { + json[r'imageId'] = this.imageId; + } else { + json[r'imageId'] = null; } - if (imageSource != null) { - _json[r'imageSource'] = imageSource; + if (this.imageSource != null) { + json[r'imageSource'] = this.imageSource; + } else { + json[r'imageSource'] = null; } - if (primaryColor != null) { - _json[r'primaryColor'] = primaryColor; + if (this.primaryColor != null) { + json[r'primaryColor'] = this.primaryColor; + } else { + json[r'primaryColor'] = null; } - if (secondaryColor != null) { - _json[r'secondaryColor'] = secondaryColor; + if (this.secondaryColor != null) { + json[r'secondaryColor'] = this.secondaryColor; + } else { + json[r'secondaryColor'] = null; } - if (languages != null) { - _json[r'languages'] = languages; + if (this.languages != null) { + json[r'languages'] = this.languages; + } else { + json[r'languages'] = 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 (isMobile != null) { - _json[r'isMobile'] = isMobile; + if (this.isMobile != null) { + json[r'isMobile'] = this.isMobile; + } else { + json[r'isMobile'] = null; } - if (isTablet != null) { - _json[r'isTablet'] = isTablet; + if (this.isTablet != null) { + json[r'isTablet'] = this.isTablet; + } else { + json[r'isTablet'] = null; } - if (isOffline != null) { - _json[r'isOffline'] = isOffline; + if (this.isOffline != null) { + json[r'isOffline'] = this.isOffline; + } else { + json[r'isOffline'] = null; } - if (instanceId != null) { - _json[r'instanceId'] = instanceId; + if (this.instanceId != null) { + json[r'instanceId'] = this.instanceId; + } else { + json[r'instanceId'] = null; } - return _json; + if (this.sectionIds != null) { + json[r'sectionIds'] = this.sectionIds; + } else { + json[r'sectionIds'] = null; + } + if (this.pinCode != null) { + json[r'pinCode'] = this.pinCode; + } else { + json[r'pinCode'] = null; + } + return json; } /// Returns a new [ConfigurationDTO] instance and imports its values from @@ -179,7 +231,7 @@ class ConfigurationDTO { return ConfigurationDTO( id: mapValueOfType(json, r'id'), label: mapValueOfType(json, r'label'), - title: TranslationDTO.listFromJson(json[r'title']) ?? const [], + title: TranslationDTO.listFromJson(json[r'title']), imageId: mapValueOfType(json, r'imageId'), imageSource: mapValueOfType(json, r'imageSource'), primaryColor: mapValueOfType(json, r'primaryColor'), @@ -192,12 +244,16 @@ class ConfigurationDTO { isTablet: mapValueOfType(json, r'isTablet'), isOffline: mapValueOfType(json, r'isOffline'), instanceId: mapValueOfType(json, r'instanceId'), + sectionIds: json[r'sectionIds'] is List + ? (json[r'sectionIds'] as List).cast() + : const [], + pinCode: mapValueOfType(json, r'pinCode'), ); } 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 +284,10 @@ class ConfigurationDTO { 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 = ConfigurationDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ConfigurationDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/device_detail_dto.dart b/manager_api/lib/model/device_detail_dto.dart index 88ec18f..8c645d6 100644 --- a/manager_api/lib/model/device_detail_dto.dart +++ b/manager_api/lib/model/device_detail_dto.dart @@ -131,53 +131,83 @@ class DeviceDetailDTO { String toString() => 'DeviceDetailDTO[id=$id, identifier=$identifier, name=$name, ipAddressWLAN=$ipAddressWLAN, ipAddressETH=$ipAddressETH, configurationId=$configurationId, configuration=$configuration, connected=$connected, dateCreation=$dateCreation, dateUpdate=$dateUpdate, instanceId=$instanceId, connectionLevel=$connectionLevel, lastConnectionLevel=$lastConnectionLevel, batteryLevel=$batteryLevel, lastBatteryLevel=$lastBatteryLevel]'; 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 (identifier != null) { - _json[r'identifier'] = identifier; + if (this.identifier != null) { + json[r'identifier'] = this.identifier; + } else { + json[r'identifier'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (ipAddressWLAN != null) { - _json[r'ipAddressWLAN'] = ipAddressWLAN; + if (this.ipAddressWLAN != null) { + json[r'ipAddressWLAN'] = this.ipAddressWLAN; + } else { + json[r'ipAddressWLAN'] = null; } - if (ipAddressETH != null) { - _json[r'ipAddressETH'] = ipAddressETH; + if (this.ipAddressETH != null) { + json[r'ipAddressETH'] = this.ipAddressETH; + } else { + json[r'ipAddressETH'] = null; } - if (configurationId != null) { - _json[r'configurationId'] = configurationId; + if (this.configurationId != null) { + json[r'configurationId'] = this.configurationId; + } else { + json[r'configurationId'] = null; } - if (configuration != null) { - _json[r'configuration'] = configuration; + if (this.configuration != null) { + json[r'configuration'] = this.configuration; + } else { + json[r'configuration'] = null; } - if (connected != null) { - _json[r'connected'] = connected; + if (this.connected != null) { + json[r'connected'] = this.connected; + } else { + json[r'connected'] = 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 (dateUpdate != null) { - _json[r'dateUpdate'] = dateUpdate!.toUtc().toIso8601String(); + if (this.dateUpdate != null) { + json[r'dateUpdate'] = this.dateUpdate!.toUtc().toIso8601String(); + } else { + json[r'dateUpdate'] = null; } - if (instanceId != null) { - _json[r'instanceId'] = instanceId; + if (this.instanceId != null) { + json[r'instanceId'] = this.instanceId; + } else { + json[r'instanceId'] = null; } - if (connectionLevel != null) { - _json[r'connectionLevel'] = connectionLevel; + if (this.connectionLevel != null) { + json[r'connectionLevel'] = this.connectionLevel; + } else { + json[r'connectionLevel'] = null; } - if (lastConnectionLevel != null) { - _json[r'lastConnectionLevel'] = lastConnectionLevel!.toUtc().toIso8601String(); + if (this.lastConnectionLevel != null) { + json[r'lastConnectionLevel'] = this.lastConnectionLevel!.toUtc().toIso8601String(); + } else { + json[r'lastConnectionLevel'] = null; } - if (batteryLevel != null) { - _json[r'batteryLevel'] = batteryLevel; + if (this.batteryLevel != null) { + json[r'batteryLevel'] = this.batteryLevel; + } else { + json[r'batteryLevel'] = null; } - if (lastBatteryLevel != null) { - _json[r'lastBatteryLevel'] = lastBatteryLevel!.toUtc().toIso8601String(); + if (this.lastBatteryLevel != null) { + json[r'lastBatteryLevel'] = this.lastBatteryLevel!.toUtc().toIso8601String(); + } else { + json[r'lastBatteryLevel'] = null; } - return _json; + return json; } /// Returns a new [DeviceDetailDTO] instance and imports its values from @@ -219,7 +249,7 @@ class DeviceDetailDTO { 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) { @@ -250,12 +280,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/manager_api/lib/model/device_detail_dto_all_of.dart b/manager_api/lib/model/device_detail_dto_all_of.dart index cc7cfb6..2e990db 100644 --- a/manager_api/lib/model/device_detail_dto_all_of.dart +++ b/manager_api/lib/model/device_detail_dto_all_of.dart @@ -58,20 +58,28 @@ class DeviceDetailDTOAllOf { String toString() => 'DeviceDetailDTOAllOf[connectionLevel=$connectionLevel, lastConnectionLevel=$lastConnectionLevel, batteryLevel=$batteryLevel, lastBatteryLevel=$lastBatteryLevel]'; Map toJson() { - final _json = {}; - if (connectionLevel != null) { - _json[r'connectionLevel'] = connectionLevel; + final json = {}; + if (this.connectionLevel != null) { + json[r'connectionLevel'] = this.connectionLevel; + } else { + json[r'connectionLevel'] = null; } - if (lastConnectionLevel != null) { - _json[r'lastConnectionLevel'] = lastConnectionLevel!.toUtc().toIso8601String(); + if (this.lastConnectionLevel != null) { + json[r'lastConnectionLevel'] = this.lastConnectionLevel!.toUtc().toIso8601String(); + } else { + json[r'lastConnectionLevel'] = null; } - if (batteryLevel != null) { - _json[r'batteryLevel'] = batteryLevel; + if (this.batteryLevel != null) { + json[r'batteryLevel'] = this.batteryLevel; + } else { + json[r'batteryLevel'] = null; } - if (lastBatteryLevel != null) { - _json[r'lastBatteryLevel'] = lastBatteryLevel!.toUtc().toIso8601String(); + if (this.lastBatteryLevel != null) { + json[r'lastBatteryLevel'] = this.lastBatteryLevel!.toUtc().toIso8601String(); + } else { + json[r'lastBatteryLevel'] = null; } - return _json; + return json; } /// Returns a new [DeviceDetailDTOAllOf] instance and imports its values from @@ -102,7 +110,7 @@ class DeviceDetailDTOAllOf { 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 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/manager_api/lib/model/device_dto.dart b/manager_api/lib/model/device_dto.dart index 7915fb8..7d8ea3a 100644 --- a/manager_api/lib/model/device_dto.dart +++ b/manager_api/lib/model/device_dto.dart @@ -99,41 +99,63 @@ class DeviceDTO { String toString() => 'DeviceDTO[id=$id, identifier=$identifier, name=$name, ipAddressWLAN=$ipAddressWLAN, ipAddressETH=$ipAddressETH, configurationId=$configurationId, configuration=$configuration, connected=$connected, dateCreation=$dateCreation, dateUpdate=$dateUpdate, instanceId=$instanceId]'; 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 (identifier != null) { - _json[r'identifier'] = identifier; + if (this.identifier != null) { + json[r'identifier'] = this.identifier; + } else { + json[r'identifier'] = null; } - if (name != null) { - _json[r'name'] = name; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; } - if (ipAddressWLAN != null) { - _json[r'ipAddressWLAN'] = ipAddressWLAN; + if (this.ipAddressWLAN != null) { + json[r'ipAddressWLAN'] = this.ipAddressWLAN; + } else { + json[r'ipAddressWLAN'] = null; } - if (ipAddressETH != null) { - _json[r'ipAddressETH'] = ipAddressETH; + if (this.ipAddressETH != null) { + json[r'ipAddressETH'] = this.ipAddressETH; + } else { + json[r'ipAddressETH'] = null; } - if (configurationId != null) { - _json[r'configurationId'] = configurationId; + if (this.configurationId != null) { + json[r'configurationId'] = this.configurationId; + } else { + json[r'configurationId'] = null; } - if (configuration != null) { - _json[r'configuration'] = configuration; + if (this.configuration != null) { + json[r'configuration'] = this.configuration; + } else { + json[r'configuration'] = null; } - if (connected != null) { - _json[r'connected'] = connected; + if (this.connected != null) { + json[r'connected'] = this.connected; + } else { + json[r'connected'] = 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 (dateUpdate != null) { - _json[r'dateUpdate'] = dateUpdate!.toUtc().toIso8601String(); + if (this.dateUpdate != null) { + json[r'dateUpdate'] = this.dateUpdate!.toUtc().toIso8601String(); + } else { + json[r'dateUpdate'] = null; } - if (instanceId != null) { - _json[r'instanceId'] = instanceId; + if (this.instanceId != null) { + json[r'instanceId'] = this.instanceId; + } else { + json[r'instanceId'] = null; } - return _json; + return json; } /// Returns a new [DeviceDTO] instance and imports its values from @@ -171,7 +193,7 @@ class DeviceDTO { 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 +224,10 @@ class DeviceDTO { 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 = DeviceDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = DeviceDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/export_configuration_dto.dart b/manager_api/lib/model/export_configuration_dto.dart index ac75edc..19ca31a 100644 --- a/manager_api/lib/model/export_configuration_dto.dart +++ b/manager_api/lib/model/export_configuration_dto.dart @@ -26,6 +26,8 @@ class ExportConfigurationDTO { this.isTablet, this.isOffline, this.instanceId, + this.sectionIds = const [], + this.pinCode, this.sections = const [], this.resources = const [], }); @@ -80,6 +82,16 @@ class ExportConfigurationDTO { String? instanceId; + List? sectionIds; + + /// + /// 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? pinCode; + List? sections; List? resources; @@ -99,6 +111,8 @@ class ExportConfigurationDTO { other.isTablet == isTablet && other.isOffline == isOffline && other.instanceId == instanceId && + other.sectionIds == sectionIds && + other.pinCode == pinCode && other.sections == sections && other.resources == resources; @@ -118,60 +132,102 @@ class ExportConfigurationDTO { (isTablet == null ? 0 : isTablet!.hashCode) + (isOffline == null ? 0 : isOffline!.hashCode) + (instanceId == null ? 0 : instanceId!.hashCode) + + (sectionIds == null ? 0 : sectionIds!.hashCode) + + (pinCode == null ? 0 : pinCode!.hashCode) + (sections == null ? 0 : sections!.hashCode) + (resources == null ? 0 : resources!.hashCode); @override - String toString() => 'ExportConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sections=$sections, resources=$resources]'; + String toString() => 'ExportConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, pinCode=$pinCode, sections=$sections, resources=$resources]'; 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 (label != null) { - _json[r'label'] = label; + if (this.label != null) { + json[r'label'] = this.label; + } else { + json[r'label'] = null; } - if (title != null) { - _json[r'title'] = title; + if (this.title != null) { + json[r'title'] = this.title; + } else { + json[r'title'] = null; } - if (imageId != null) { - _json[r'imageId'] = imageId; + if (this.imageId != null) { + json[r'imageId'] = this.imageId; + } else { + json[r'imageId'] = null; } - if (imageSource != null) { - _json[r'imageSource'] = imageSource; + if (this.imageSource != null) { + json[r'imageSource'] = this.imageSource; + } else { + json[r'imageSource'] = null; } - if (primaryColor != null) { - _json[r'primaryColor'] = primaryColor; + if (this.primaryColor != null) { + json[r'primaryColor'] = this.primaryColor; + } else { + json[r'primaryColor'] = null; } - if (secondaryColor != null) { - _json[r'secondaryColor'] = secondaryColor; + if (this.secondaryColor != null) { + json[r'secondaryColor'] = this.secondaryColor; + } else { + json[r'secondaryColor'] = null; } - if (languages != null) { - _json[r'languages'] = languages; + if (this.languages != null) { + json[r'languages'] = this.languages; + } else { + json[r'languages'] = 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 (isMobile != null) { - _json[r'isMobile'] = isMobile; + if (this.isMobile != null) { + json[r'isMobile'] = this.isMobile; + } else { + json[r'isMobile'] = null; } - if (isTablet != null) { - _json[r'isTablet'] = isTablet; + if (this.isTablet != null) { + json[r'isTablet'] = this.isTablet; + } else { + json[r'isTablet'] = null; } - if (isOffline != null) { - _json[r'isOffline'] = isOffline; + if (this.isOffline != null) { + json[r'isOffline'] = this.isOffline; + } else { + json[r'isOffline'] = null; } - if (instanceId != null) { - _json[r'instanceId'] = instanceId; + if (this.instanceId != null) { + json[r'instanceId'] = this.instanceId; + } else { + json[r'instanceId'] = null; } - if (sections != null) { - _json[r'sections'] = sections; + if (this.sectionIds != null) { + json[r'sectionIds'] = this.sectionIds; + } else { + json[r'sectionIds'] = null; } - if (resources != null) { - _json[r'resources'] = resources; + if (this.pinCode != null) { + json[r'pinCode'] = this.pinCode; + } else { + json[r'pinCode'] = null; } - return _json; + if (this.sections != null) { + json[r'sections'] = this.sections; + } else { + json[r'sections'] = null; + } + if (this.resources != null) { + json[r'resources'] = this.resources; + } else { + json[r'resources'] = null; + } + return json; } /// Returns a new [ExportConfigurationDTO] instance and imports its values from @@ -195,7 +251,7 @@ class ExportConfigurationDTO { return ExportConfigurationDTO( id: mapValueOfType(json, r'id'), label: mapValueOfType(json, r'label'), - title: TranslationDTO.listFromJson(json[r'title']) ?? const [], + title: TranslationDTO.listFromJson(json[r'title']), imageId: mapValueOfType(json, r'imageId'), imageSource: mapValueOfType(json, r'imageSource'), primaryColor: mapValueOfType(json, r'primaryColor'), @@ -208,14 +264,18 @@ class ExportConfigurationDTO { isTablet: mapValueOfType(json, r'isTablet'), isOffline: mapValueOfType(json, r'isOffline'), instanceId: mapValueOfType(json, r'instanceId'), - sections: SectionDTO.listFromJson(json[r'sections']) ?? const [], - resources: ResourceDTO.listFromJson(json[r'resources']) ?? const [], + sectionIds: json[r'sectionIds'] is List + ? (json[r'sectionIds'] as List).cast() + : const [], + pinCode: mapValueOfType(json, r'pinCode'), + sections: SectionDTO.listFromJson(json[r'sections']), + resources: ResourceDTO.listFromJson(json[r'resources']), ); } 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) { @@ -246,12 +306,10 @@ class ExportConfigurationDTO { 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 = ExportConfigurationDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ExportConfigurationDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/export_configuration_dto_all_of.dart b/manager_api/lib/model/export_configuration_dto_all_of.dart index 28c86a7..89650d1 100644 --- a/manager_api/lib/model/export_configuration_dto_all_of.dart +++ b/manager_api/lib/model/export_configuration_dto_all_of.dart @@ -36,14 +36,18 @@ class ExportConfigurationDTOAllOf { String toString() => 'ExportConfigurationDTOAllOf[sections=$sections, resources=$resources]'; Map toJson() { - final _json = {}; - if (sections != null) { - _json[r'sections'] = sections; + final json = {}; + if (this.sections != null) { + json[r'sections'] = this.sections; + } else { + json[r'sections'] = null; } - if (resources != null) { - _json[r'resources'] = resources; + if (this.resources != null) { + json[r'resources'] = this.resources; + } else { + json[r'resources'] = null; } - return _json; + return json; } /// Returns a new [ExportConfigurationDTOAllOf] instance and imports its values from @@ -65,14 +69,14 @@ class ExportConfigurationDTOAllOf { }()); return ExportConfigurationDTOAllOf( - sections: SectionDTO.listFromJson(json[r'sections']) ?? const [], - resources: ResourceDTO.listFromJson(json[r'resources']) ?? const [], + sections: SectionDTO.listFromJson(json[r'sections']), + resources: ResourceDTO.listFromJson(json[r'resources']), ); } 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 ExportConfigurationDTOAllOf { 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 = ExportConfigurationDTOAllOf.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ExportConfigurationDTOAllOf.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/geo_point_dto.dart b/manager_api/lib/model/geo_point_dto.dart index 28600c5..e03a69c 100644 --- a/manager_api/lib/model/geo_point_dto.dart +++ b/manager_api/lib/model/geo_point_dto.dart @@ -62,26 +62,38 @@ class GeoPointDTO { String toString() => 'GeoPointDTO[id=$id, title=$title, description=$description, images=$images, latitude=$latitude, longitude=$longitude]'; 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 (title != null) { - _json[r'title'] = title; + if (this.title != null) { + json[r'title'] = this.title; + } else { + json[r'title'] = null; } - if (description != null) { - _json[r'description'] = description; + if (this.description != null) { + json[r'description'] = this.description; + } else { + json[r'description'] = null; } - if (images != null) { - _json[r'images'] = images; + if (this.images != null) { + json[r'images'] = this.images; + } else { + json[r'images'] = null; } - if (latitude != null) { - _json[r'latitude'] = latitude; + 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; } - return _json; + return json; } /// Returns a new [GeoPointDTO] instance and imports its values from @@ -104,9 +116,9 @@ class GeoPointDTO { return GeoPointDTO( id: mapValueOfType(json, r'id'), - title: TranslationDTO.listFromJson(json[r'title']) ?? const [], - description: TranslationDTO.listFromJson(json[r'description']) ?? const [], - images: ImageGeoPoint.listFromJson(json[r'images']) ?? const [], + title: TranslationDTO.listFromJson(json[r'title']), + description: TranslationDTO.listFromJson(json[r'description']), + images: ImageGeoPoint.listFromJson(json[r'images']), latitude: mapValueOfType(json, r'latitude'), longitude: mapValueOfType(json, r'longitude'), ); @@ -114,7 +126,7 @@ class GeoPointDTO { 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) { @@ -145,12 +157,10 @@ class GeoPointDTO { 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 = GeoPointDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = GeoPointDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/image_dto.dart b/manager_api/lib/model/image_dto.dart index b72c787..0a55eed 100644 --- a/manager_api/lib/model/image_dto.dart +++ b/manager_api/lib/model/image_dto.dart @@ -57,23 +57,33 @@ class ImageDTO { String toString() => 'ImageDTO[title=$title, description=$description, resourceId=$resourceId, source_=$source_, order=$order]'; Map toJson() { - final _json = {}; - if (title != null) { - _json[r'title'] = title; + final json = {}; + if (this.title != null) { + json[r'title'] = this.title; + } else { + json[r'title'] = null; } - if (description != null) { - _json[r'description'] = description; + if (this.description != null) { + json[r'description'] = this.description; + } else { + json[r'description'] = null; } - if (resourceId != null) { - _json[r'resourceId'] = resourceId; + if (this.resourceId != null) { + json[r'resourceId'] = this.resourceId; + } else { + json[r'resourceId'] = null; } - if (source_ != null) { - _json[r'source'] = source_; + if (this.source_ != null) { + json[r'source'] = this.source_; + } else { + json[r'source'] = null; } - if (order != null) { - _json[r'order'] = order; + if (this.order != null) { + json[r'order'] = this.order; + } else { + json[r'order'] = null; } - return _json; + return json; } /// Returns a new [ImageDTO] instance and imports its values from @@ -95,8 +105,8 @@ class ImageDTO { }()); return ImageDTO( - title: TranslationDTO.listFromJson(json[r'title']) ?? const [], - description: TranslationDTO.listFromJson(json[r'description']) ?? const [], + title: TranslationDTO.listFromJson(json[r'title']), + description: TranslationDTO.listFromJson(json[r'description']), resourceId: mapValueOfType(json, r'resourceId'), source_: mapValueOfType(json, r'source'), order: mapValueOfType(json, r'order'), @@ -105,7 +115,7 @@ class ImageDTO { 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 ImageDTO { 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 = ImageDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ImageDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/image_geo_point.dart b/manager_api/lib/model/image_geo_point.dart index 8291c85..4ecb68c 100644 --- a/manager_api/lib/model/image_geo_point.dart +++ b/manager_api/lib/model/image_geo_point.dart @@ -36,14 +36,18 @@ class ImageGeoPoint { String toString() => 'ImageGeoPoint[imageResourceId=$imageResourceId, imageSource=$imageSource]'; Map toJson() { - final _json = {}; - if (imageResourceId != null) { - _json[r'imageResourceId'] = imageResourceId; + final json = {}; + if (this.imageResourceId != null) { + json[r'imageResourceId'] = this.imageResourceId; + } else { + json[r'imageResourceId'] = null; } - if (imageSource != null) { - _json[r'imageSource'] = imageSource; + if (this.imageSource != null) { + json[r'imageSource'] = this.imageSource; + } else { + json[r'imageSource'] = null; } - return _json; + return json; } /// Returns a new [ImageGeoPoint] instance and imports its values from @@ -72,7 +76,7 @@ class ImageGeoPoint { 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 ImageGeoPoint { 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 = ImageGeoPoint.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ImageGeoPoint.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/instance.dart b/manager_api/lib/model/instance.dart index 74e7ca8..62800f6 100644 --- a/manager_api/lib/model/instance.dart +++ b/manager_api/lib/model/instance.dart @@ -16,6 +16,7 @@ class Instance { this.id, this.name, this.dateCreation, + this.pinCode, }); String? id; @@ -30,34 +31,49 @@ class Instance { /// DateTime? dateCreation; + int? pinCode; + @override bool operator ==(Object other) => identical(this, other) || other is Instance && other.id == id && other.name == name && - other.dateCreation == dateCreation; + other.dateCreation == dateCreation && + other.pinCode == pinCode; @override int get hashCode => // ignore: unnecessary_parenthesis (id == null ? 0 : id!.hashCode) + (name == null ? 0 : name!.hashCode) + - (dateCreation == null ? 0 : dateCreation!.hashCode); + (dateCreation == null ? 0 : dateCreation!.hashCode) + + (pinCode == null ? 0 : pinCode!.hashCode); @override - String toString() => 'Instance[id=$id, name=$name, dateCreation=$dateCreation]'; + String toString() => 'Instance[id=$id, name=$name, dateCreation=$dateCreation, pinCode=$pinCode]'; 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 (dateCreation != null) { - _json[r'dateCreation'] = dateCreation!.toUtc().toIso8601String(); + if (this.dateCreation != null) { + json[r'dateCreation'] = this.dateCreation!.toUtc().toIso8601String(); + } else { + json[r'dateCreation'] = null; } - return _json; + if (this.pinCode != null) { + json[r'pinCode'] = this.pinCode; + } else { + json[r'pinCode'] = null; + } + return json; } /// Returns a new [Instance] instance and imports its values from @@ -82,12 +98,13 @@ class Instance { id: mapValueOfType(json, r'id'), name: mapValueOfType(json, r'name'), dateCreation: mapDateTime(json, r'dateCreation', ''), + pinCode: mapValueOfType(json, r'pinCode'), ); } 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 +135,10 @@ class Instance { 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 = Instance.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = Instance.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/instance_dto.dart b/manager_api/lib/model/instance_dto.dart index a1d77a7..5f4399d 100644 --- a/manager_api/lib/model/instance_dto.dart +++ b/manager_api/lib/model/instance_dto.dart @@ -16,6 +16,7 @@ class InstanceDTO { this.id, this.name, this.dateCreation, + this.pinCode, }); String? id; @@ -30,34 +31,49 @@ class InstanceDTO { /// DateTime? dateCreation; + int? pinCode; + @override bool operator ==(Object other) => identical(this, other) || other is InstanceDTO && other.id == id && other.name == name && - other.dateCreation == dateCreation; + other.dateCreation == dateCreation && + other.pinCode == pinCode; @override int get hashCode => // ignore: unnecessary_parenthesis (id == null ? 0 : id!.hashCode) + (name == null ? 0 : name!.hashCode) + - (dateCreation == null ? 0 : dateCreation!.hashCode); + (dateCreation == null ? 0 : dateCreation!.hashCode) + + (pinCode == null ? 0 : pinCode!.hashCode); @override - String toString() => 'InstanceDTO[id=$id, name=$name, dateCreation=$dateCreation]'; + String toString() => 'InstanceDTO[id=$id, name=$name, dateCreation=$dateCreation, pinCode=$pinCode]'; 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 (dateCreation != null) { - _json[r'dateCreation'] = dateCreation!.toUtc().toIso8601String(); + if (this.dateCreation != null) { + json[r'dateCreation'] = this.dateCreation!.toUtc().toIso8601String(); + } else { + json[r'dateCreation'] = null; } - return _json; + if (this.pinCode != null) { + json[r'pinCode'] = this.pinCode; + } else { + json[r'pinCode'] = null; + } + return json; } /// Returns a new [InstanceDTO] instance and imports its values from @@ -82,12 +98,13 @@ class InstanceDTO { id: mapValueOfType(json, r'id'), name: mapValueOfType(json, r'name'), dateCreation: mapDateTime(json, r'dateCreation', ''), + pinCode: mapValueOfType(json, r'pinCode'), ); } 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 +135,10 @@ class InstanceDTO { 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 = InstanceDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = InstanceDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/level_dto.dart b/manager_api/lib/model/level_dto.dart index 58cfe04..3332644 100644 --- a/manager_api/lib/model/level_dto.dart +++ b/manager_api/lib/model/level_dto.dart @@ -41,17 +41,23 @@ class LevelDTO { String toString() => 'LevelDTO[label=$label, resourceId=$resourceId, source_=$source_]'; 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 (resourceId != null) { - _json[r'resourceId'] = resourceId; + if (this.resourceId != null) { + json[r'resourceId'] = this.resourceId; + } else { + json[r'resourceId'] = null; } - if (source_ != null) { - _json[r'source'] = source_; + if (this.source_ != null) { + json[r'source'] = this.source_; + } else { + json[r'source'] = null; } - return _json; + return json; } /// Returns a new [LevelDTO] instance and imports its values from @@ -73,7 +79,7 @@ class LevelDTO { }()); return LevelDTO( - label: TranslationDTO.listFromJson(json[r'label']) ?? const [], + label: TranslationDTO.listFromJson(json[r'label']), resourceId: mapValueOfType(json, r'resourceId'), source_: mapValueOfType(json, r'source'), ); @@ -81,7 +87,7 @@ class LevelDTO { 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 LevelDTO { 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 = LevelDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = LevelDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/login_dto.dart b/manager_api/lib/model/login_dto.dart index e5543ec..a8e6b90 100644 --- a/manager_api/lib/model/login_dto.dart +++ b/manager_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/manager_api/lib/model/map_dto.dart b/manager_api/lib/model/map_dto.dart index 8a283e6..b193330 100644 --- a/manager_api/lib/model/map_dto.dart +++ b/manager_api/lib/model/map_dto.dart @@ -63,23 +63,33 @@ class MapDTO { String toString() => 'MapDTO[zoom=$zoom, mapType=$mapType, points=$points, iconResourceId=$iconResourceId, iconSource=$iconSource]'; Map toJson() { - final _json = {}; - if (zoom != null) { - _json[r'zoom'] = zoom; + final json = {}; + if (this.zoom != null) { + json[r'zoom'] = this.zoom; + } else { + json[r'zoom'] = null; } - if (mapType != null) { - _json[r'mapType'] = mapType; + if (this.mapType != null) { + json[r'mapType'] = this.mapType; + } else { + json[r'mapType'] = null; } - if (points != null) { - _json[r'points'] = points; + if (this.points != null) { + json[r'points'] = this.points; + } else { + json[r'points'] = null; } - if (iconResourceId != null) { - _json[r'iconResourceId'] = iconResourceId; + if (this.iconResourceId != null) { + json[r'iconResourceId'] = this.iconResourceId; + } else { + json[r'iconResourceId'] = null; } - if (iconSource != null) { - _json[r'iconSource'] = iconSource; + if (this.iconSource != null) { + json[r'iconSource'] = this.iconSource; + } else { + json[r'iconSource'] = null; } - return _json; + return json; } /// Returns a new [MapDTO] instance and imports its values from @@ -103,7 +113,7 @@ class MapDTO { return MapDTO( zoom: mapValueOfType(json, r'zoom'), mapType: MapTypeApp.fromJson(json[r'mapType']), - points: GeoPointDTO.listFromJson(json[r'points']) ?? const [], + points: GeoPointDTO.listFromJson(json[r'points']), iconResourceId: mapValueOfType(json, r'iconResourceId'), iconSource: mapValueOfType(json, r'iconSource'), ); @@ -111,7 +121,7 @@ class MapDTO { 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 MapDTO { 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 = MapDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = MapDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/map_type_app.dart b/manager_api/lib/model/map_type_app.dart index deee49b..735acb9 100644 --- a/manager_api/lib/model/map_type_app.dart +++ b/manager_api/lib/model/map_type_app.dart @@ -40,7 +40,7 @@ class MapTypeApp { static MapTypeApp? fromJson(dynamic value) => MapTypeAppTypeTransformer().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) { diff --git a/manager_api/lib/model/menu_dto.dart b/manager_api/lib/model/menu_dto.dart index feb29a8..0f47549 100644 --- a/manager_api/lib/model/menu_dto.dart +++ b/manager_api/lib/model/menu_dto.dart @@ -31,11 +31,13 @@ class MenuDTO { String toString() => 'MenuDTO[sections=$sections]'; Map toJson() { - final _json = {}; - if (sections != null) { - _json[r'sections'] = sections; + final json = {}; + if (this.sections != null) { + json[r'sections'] = this.sections; + } else { + json[r'sections'] = null; } - return _json; + return json; } /// Returns a new [MenuDTO] instance and imports its values from @@ -57,13 +59,13 @@ class MenuDTO { }()); return MenuDTO( - sections: SectionDTO.listFromJson(json[r'sections']) ?? const [], + sections: SectionDTO.listFromJson(json[r'sections']), ); } 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 MenuDTO { 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 = MenuDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = MenuDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/player_message_dto.dart b/manager_api/lib/model/player_message_dto.dart index c51ce09..9e67106 100644 --- a/manager_api/lib/model/player_message_dto.dart +++ b/manager_api/lib/model/player_message_dto.dart @@ -48,14 +48,18 @@ class PlayerMessageDTO { String toString() => 'PlayerMessageDTO[configChanged=$configChanged, isDeleted=$isDeleted]'; Map toJson() { - final _json = {}; - if (configChanged != null) { - _json[r'configChanged'] = configChanged; + final json = {}; + if (this.configChanged != null) { + json[r'configChanged'] = this.configChanged; + } else { + json[r'configChanged'] = null; } - if (isDeleted != null) { - _json[r'isDeleted'] = isDeleted; + if (this.isDeleted != null) { + json[r'isDeleted'] = this.isDeleted; + } else { + json[r'isDeleted'] = null; } - return _json; + return json; } /// Returns a new [PlayerMessageDTO] instance and imports its values from @@ -84,7 +88,7 @@ class PlayerMessageDTO { 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) { @@ -115,12 +119,10 @@ class PlayerMessageDTO { 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 = PlayerMessageDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = PlayerMessageDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/question_dto.dart b/manager_api/lib/model/question_dto.dart index 0e7f86b..9d52588 100644 --- a/manager_api/lib/model/question_dto.dart +++ b/manager_api/lib/model/question_dto.dart @@ -57,23 +57,33 @@ class QuestionDTO { String toString() => 'QuestionDTO[label=$label, responses=$responses, resourceId=$resourceId, source_=$source_, order=$order]'; 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 (responses != null) { - _json[r'responses'] = responses; + if (this.responses != null) { + json[r'responses'] = this.responses; + } else { + json[r'responses'] = null; } - if (resourceId != null) { - _json[r'resourceId'] = resourceId; + if (this.resourceId != null) { + json[r'resourceId'] = this.resourceId; + } else { + json[r'resourceId'] = null; } - if (source_ != null) { - _json[r'source'] = source_; + if (this.source_ != null) { + json[r'source'] = this.source_; + } else { + json[r'source'] = null; } - if (order != null) { - _json[r'order'] = order; + if (this.order != null) { + json[r'order'] = this.order; + } else { + json[r'order'] = null; } - return _json; + return json; } /// Returns a new [QuestionDTO] instance and imports its values from @@ -95,8 +105,8 @@ class QuestionDTO { }()); return QuestionDTO( - label: TranslationDTO.listFromJson(json[r'label']) ?? const [], - responses: ResponseDTO.listFromJson(json[r'responses']) ?? const [], + label: TranslationDTO.listFromJson(json[r'label']), + responses: ResponseDTO.listFromJson(json[r'responses']), resourceId: mapValueOfType(json, r'resourceId'), source_: mapValueOfType(json, r'source'), order: mapValueOfType(json, r'order'), @@ -105,7 +115,7 @@ class QuestionDTO { 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 QuestionDTO { 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 = QuestionDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = QuestionDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/quizz_dto.dart b/manager_api/lib/model/quizz_dto.dart index d4cfd58..808d5c2 100644 --- a/manager_api/lib/model/quizz_dto.dart +++ b/manager_api/lib/model/quizz_dto.dart @@ -51,23 +51,33 @@ class QuizzDTO { String toString() => 'QuizzDTO[questions=$questions, badLevel=$badLevel, mediumLevel=$mediumLevel, goodLevel=$goodLevel, greatLevel=$greatLevel]'; Map toJson() { - final _json = {}; - if (questions != null) { - _json[r'questions'] = questions; + final json = {}; + if (this.questions != null) { + json[r'questions'] = this.questions; + } else { + json[r'questions'] = null; } - if (badLevel != null) { - _json[r'bad_level'] = badLevel; + if (this.badLevel != null) { + json[r'bad_level'] = this.badLevel; + } else { + json[r'bad_level'] = null; } - if (mediumLevel != null) { - _json[r'medium_level'] = mediumLevel; + if (this.mediumLevel != null) { + json[r'medium_level'] = this.mediumLevel; + } else { + json[r'medium_level'] = null; } - if (goodLevel != null) { - _json[r'good_level'] = goodLevel; + if (this.goodLevel != null) { + json[r'good_level'] = this.goodLevel; + } else { + json[r'good_level'] = null; } - if (greatLevel != null) { - _json[r'great_level'] = greatLevel; + if (this.greatLevel != null) { + json[r'great_level'] = this.greatLevel; + } else { + json[r'great_level'] = null; } - return _json; + return json; } /// Returns a new [QuizzDTO] instance and imports its values from @@ -89,7 +99,7 @@ class QuizzDTO { }()); return QuizzDTO( - questions: QuestionDTO.listFromJson(json[r'questions']) ?? const [], + questions: QuestionDTO.listFromJson(json[r'questions']), badLevel: QuizzDTOBadLevel.fromJson(json[r'bad_level']), mediumLevel: QuizzDTOBadLevel.fromJson(json[r'medium_level']), goodLevel: QuizzDTOBadLevel.fromJson(json[r'good_level']), @@ -99,7 +109,7 @@ class QuizzDTO { 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 QuizzDTO { 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 = QuizzDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = QuizzDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/quizz_dto_bad_level.dart b/manager_api/lib/model/quizz_dto_bad_level.dart index f18f478..af82dd0 100644 --- a/manager_api/lib/model/quizz_dto_bad_level.dart +++ b/manager_api/lib/model/quizz_dto_bad_level.dart @@ -41,17 +41,23 @@ class QuizzDTOBadLevel { String toString() => 'QuizzDTOBadLevel[label=$label, resourceId=$resourceId, source_=$source_]'; 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 (resourceId != null) { - _json[r'resourceId'] = resourceId; + if (this.resourceId != null) { + json[r'resourceId'] = this.resourceId; + } else { + json[r'resourceId'] = null; } - if (source_ != null) { - _json[r'source'] = source_; + if (this.source_ != null) { + json[r'source'] = this.source_; + } else { + json[r'source'] = null; } - return _json; + return json; } /// Returns a new [QuizzDTOBadLevel] instance and imports its values from @@ -73,7 +79,7 @@ class QuizzDTOBadLevel { }()); return QuizzDTOBadLevel( - label: TranslationDTO.listFromJson(json[r'label']) ?? const [], + label: TranslationDTO.listFromJson(json[r'label']), resourceId: mapValueOfType(json, r'resourceId'), source_: mapValueOfType(json, r'source'), ); @@ -81,7 +87,7 @@ class QuizzDTOBadLevel { 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 QuizzDTOBadLevel { 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 = QuizzDTOBadLevel.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = QuizzDTOBadLevel.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/resource_dto.dart b/manager_api/lib/model/resource_dto.dart index 72a3f52..551145c 100644 --- a/manager_api/lib/model/resource_dto.dart +++ b/manager_api/lib/model/resource_dto.dart @@ -68,26 +68,38 @@ class ResourceDTO { String toString() => 'ResourceDTO[id=$id, type=$type, label=$label, data=$data, dateCreation=$dateCreation, instanceId=$instanceId]'; 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 (label != null) { - _json[r'label'] = label; + if (this.label != null) { + json[r'label'] = this.label; + } else { + json[r'label'] = null; } - if (data != null) { - _json[r'data'] = data; + if (this.data != null) { + json[r'data'] = this.data; + } else { + json[r'data'] = 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 (instanceId != null) { - _json[r'instanceId'] = instanceId; + if (this.instanceId != null) { + json[r'instanceId'] = this.instanceId; + } else { + json[r'instanceId'] = null; } - return _json; + return json; } /// Returns a new [ResourceDTO] instance and imports its values from @@ -120,7 +132,7 @@ class ResourceDTO { 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 ResourceDTO { 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 = ResourceDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ResourceDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/resource_type.dart b/manager_api/lib/model/resource_type.dart index 5877e37..0d18dcf 100644 --- a/manager_api/lib/model/resource_type.dart +++ b/manager_api/lib/model/resource_type.dart @@ -40,7 +40,7 @@ class ResourceType { static ResourceType? fromJson(dynamic value) => ResourceTypeTypeTransformer().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) { diff --git a/manager_api/lib/model/response_dto.dart b/manager_api/lib/model/response_dto.dart index 266f6a9..df2f4cd 100644 --- a/manager_api/lib/model/response_dto.dart +++ b/manager_api/lib/model/response_dto.dart @@ -53,17 +53,23 @@ class ResponseDTO { String toString() => 'ResponseDTO[label=$label, isGood=$isGood, order=$order]'; 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 (isGood != null) { - _json[r'isGood'] = isGood; + if (this.isGood != null) { + json[r'isGood'] = this.isGood; + } else { + json[r'isGood'] = null; } - if (order != null) { - _json[r'order'] = order; + if (this.order != null) { + json[r'order'] = this.order; + } else { + json[r'order'] = null; } - return _json; + return json; } /// Returns a new [ResponseDTO] instance and imports its values from @@ -85,7 +91,7 @@ class ResponseDTO { }()); return ResponseDTO( - label: TranslationDTO.listFromJson(json[r'label']) ?? const [], + label: TranslationDTO.listFromJson(json[r'label']), isGood: mapValueOfType(json, r'isGood'), order: mapValueOfType(json, r'order'), ); @@ -93,7 +99,7 @@ class ResponseDTO { 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 ResponseDTO { 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 = ResponseDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = ResponseDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/section_dto.dart b/manager_api/lib/model/section_dto.dart index eea0ebf..977995c 100644 --- a/manager_api/lib/model/section_dto.dart +++ b/manager_api/lib/model/section_dto.dart @@ -100,7 +100,7 @@ class SectionDTO { /// bool? isBeacon; - String? beaconId; + int? beaconId; @override bool operator ==(Object other) => identical(this, other) || other is SectionDTO && @@ -151,65 +151,103 @@ class SectionDTO { String toString() => 'SectionDTO[id=$id, label=$label, title=$title, description=$description, imageId=$imageId, imageSource=$imageSource, configurationId=$configurationId, isSubSection=$isSubSection, parentId=$parentId, type=$type, data=$data, dateCreation=$dateCreation, order=$order, instanceId=$instanceId, latitude=$latitude, longitude=$longitude, meterZoneGPS=$meterZoneGPS, isBeacon=$isBeacon, beaconId=$beaconId]'; 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 (label != null) { - _json[r'label'] = label; + if (this.label != null) { + json[r'label'] = this.label; + } else { + json[r'label'] = null; } - if (title != null) { - _json[r'title'] = title; + if (this.title != null) { + json[r'title'] = this.title; + } else { + json[r'title'] = null; } - if (description != null) { - _json[r'description'] = description; + if (this.description != null) { + json[r'description'] = this.description; + } else { + json[r'description'] = null; } - if (imageId != null) { - _json[r'imageId'] = imageId; + if (this.imageId != null) { + json[r'imageId'] = this.imageId; + } else { + json[r'imageId'] = null; } - if (imageSource != null) { - _json[r'imageSource'] = imageSource; + if (this.imageSource != null) { + json[r'imageSource'] = this.imageSource; + } else { + json[r'imageSource'] = null; } - if (configurationId != null) { - _json[r'configurationId'] = configurationId; + if (this.configurationId != null) { + json[r'configurationId'] = this.configurationId; + } else { + json[r'configurationId'] = null; } - if (isSubSection != null) { - _json[r'isSubSection'] = isSubSection; + if (this.isSubSection != null) { + json[r'isSubSection'] = this.isSubSection; + } else { + json[r'isSubSection'] = null; } - if (parentId != null) { - _json[r'parentId'] = parentId; + if (this.parentId != null) { + json[r'parentId'] = this.parentId; + } else { + json[r'parentId'] = null; } - if (type != null) { - _json[r'type'] = type; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; } - if (data != null) { - _json[r'data'] = data; + if (this.data != null) { + json[r'data'] = this.data; + } else { + json[r'data'] = 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 (order != null) { - _json[r'order'] = order; + if (this.order != null) { + json[r'order'] = this.order; + } else { + json[r'order'] = null; } - if (instanceId != null) { - _json[r'instanceId'] = instanceId; + if (this.instanceId != null) { + json[r'instanceId'] = this.instanceId; + } else { + json[r'instanceId'] = null; } - if (latitude != null) { - _json[r'latitude'] = latitude; + 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 (meterZoneGPS != null) { - _json[r'meterZoneGPS'] = meterZoneGPS; + if (this.meterZoneGPS != null) { + json[r'meterZoneGPS'] = this.meterZoneGPS; + } else { + json[r'meterZoneGPS'] = null; } - if (isBeacon != null) { - _json[r'isBeacon'] = isBeacon; + if (this.isBeacon != null) { + json[r'isBeacon'] = this.isBeacon; + } else { + json[r'isBeacon'] = null; } - if (beaconId != null) { - _json[r'beaconId'] = beaconId; + if (this.beaconId != null) { + json[r'beaconId'] = this.beaconId; + } else { + json[r'beaconId'] = null; } - return _json; + return json; } /// Returns a new [SectionDTO] instance and imports its values from @@ -233,8 +271,8 @@ class SectionDTO { return SectionDTO( id: mapValueOfType(json, r'id'), label: mapValueOfType(json, r'label'), - title: TranslationDTO.listFromJson(json[r'title']) ?? const [], - description: TranslationDTO.listFromJson(json[r'description']) ?? const [], + title: TranslationDTO.listFromJson(json[r'title']), + description: TranslationDTO.listFromJson(json[r'description']), imageId: mapValueOfType(json, r'imageId'), imageSource: mapValueOfType(json, r'imageSource'), configurationId: mapValueOfType(json, r'configurationId'), @@ -249,13 +287,13 @@ class SectionDTO { longitude: mapValueOfType(json, r'longitude'), meterZoneGPS: mapValueOfType(json, r'meterZoneGPS'), isBeacon: mapValueOfType(json, r'isBeacon'), - beaconId: mapValueOfType(json, r'beaconId'), + beaconId: mapValueOfType(json, r'beaconId'), ); } 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) { @@ -286,12 +324,10 @@ class SectionDTO { 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 = SectionDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = SectionDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/section_type.dart b/manager_api/lib/model/section_type.dart index 5db06e6..d8e3733 100644 --- a/manager_api/lib/model/section_type.dart +++ b/manager_api/lib/model/section_type.dart @@ -44,7 +44,7 @@ class SectionType { static SectionType? fromJson(dynamic value) => SectionTypeTypeTransformer().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) { diff --git a/manager_api/lib/model/slider_dto.dart b/manager_api/lib/model/slider_dto.dart index f6ab5ec..6cf9a47 100644 --- a/manager_api/lib/model/slider_dto.dart +++ b/manager_api/lib/model/slider_dto.dart @@ -31,11 +31,13 @@ class SliderDTO { String toString() => 'SliderDTO[images=$images]'; Map toJson() { - final _json = {}; - if (images != null) { - _json[r'images'] = images; + final json = {}; + if (this.images != null) { + json[r'images'] = this.images; + } else { + json[r'images'] = null; } - return _json; + return json; } /// Returns a new [SliderDTO] instance and imports its values from @@ -57,13 +59,13 @@ class SliderDTO { }()); return SliderDTO( - images: ImageDTO.listFromJson(json[r'images']) ?? const [], + images: ImageDTO.listFromJson(json[r'images']), ); } 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 SliderDTO { 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 = SliderDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = SliderDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/token_dto.dart b/manager_api/lib/model/token_dto.dart index 5f89ba2..2f4456d 100644 --- a/manager_api/lib/model/token_dto.dart +++ b/manager_api/lib/model/token_dto.dart @@ -73,29 +73,43 @@ class TokenDTO { String toString() => 'TokenDTO[accessToken=$accessToken, refreshToken=$refreshToken, scope=$scope, tokenType=$tokenType, expiresIn=$expiresIn, expiration=$expiration, instanceId=$instanceId]'; 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; } - if (instanceId != null) { - _json[r'instanceId'] = instanceId; + if (this.instanceId != null) { + json[r'instanceId'] = this.instanceId; + } else { + json[r'instanceId'] = null; } - return _json; + return json; } /// Returns a new [TokenDTO] instance and imports its values from @@ -129,7 +143,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) { @@ -160,12 +174,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/manager_api/lib/model/translation_dto.dart b/manager_api/lib/model/translation_dto.dart index bc4c2da..4e324c2 100644 --- a/manager_api/lib/model/translation_dto.dart +++ b/manager_api/lib/model/translation_dto.dart @@ -36,14 +36,18 @@ class TranslationDTO { String toString() => 'TranslationDTO[language=$language, value=$value]'; Map toJson() { - final _json = {}; - if (language != null) { - _json[r'language'] = language; + final json = {}; + if (this.language != null) { + json[r'language'] = this.language; + } else { + json[r'language'] = 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 [TranslationDTO] instance and imports its values from @@ -72,7 +76,7 @@ class TranslationDTO { 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 TranslationDTO { 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 = TranslationDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = TranslationDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/user.dart b/manager_api/lib/model/user.dart index e50ca10..c3d7aad 100644 --- a/manager_api/lib/model/user.dart +++ b/manager_api/lib/model/user.dart @@ -72,32 +72,48 @@ class User { String toString() => 'User[id=$id, email=$email, password=$password, firstName=$firstName, lastName=$lastName, token=$token, dateCreation=$dateCreation, instanceId=$instanceId]'; 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 (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 (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 (instanceId != null) { - _json[r'instanceId'] = instanceId; + if (this.instanceId != null) { + json[r'instanceId'] = this.instanceId; + } else { + json[r'instanceId'] = null; } - return _json; + return json; } /// Returns a new [User] instance and imports its values from @@ -132,7 +148,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) { @@ -163,12 +179,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/manager_api/lib/model/user_detail_dto.dart b/manager_api/lib/model/user_detail_dto.dart index 33727ba..d0ce9cf 100644 --- a/manager_api/lib/model/user_detail_dto.dart +++ b/manager_api/lib/model/user_detail_dto.dart @@ -46,20 +46,28 @@ class UserDetailDTO { String toString() => 'UserDetailDTO[id=$id, email=$email, firstName=$firstName, lastName=$lastName]'; 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; } - return _json; + return json; } /// Returns a new [UserDetailDTO] instance and imports its values from @@ -90,7 +98,7 @@ class UserDetailDTO { 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 UserDetailDTO { 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 = UserDetailDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = UserDetailDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/video_dto.dart b/manager_api/lib/model/video_dto.dart index 49bceae..01540ef 100644 --- a/manager_api/lib/model/video_dto.dart +++ b/manager_api/lib/model/video_dto.dart @@ -31,11 +31,13 @@ class VideoDTO { String toString() => 'VideoDTO[source_=$source_]'; Map toJson() { - final _json = {}; - if (source_ != null) { - _json[r'source'] = source_; + final json = {}; + if (this.source_ != null) { + json[r'source'] = this.source_; + } else { + json[r'source'] = null; } - return _json; + return json; } /// Returns a new [VideoDTO] instance and imports its values from @@ -63,7 +65,7 @@ class VideoDTO { 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 VideoDTO { 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 = VideoDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = VideoDTO.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/manager_api/lib/model/web_dto.dart b/manager_api/lib/model/web_dto.dart index f5d6fa7..98d5c31 100644 --- a/manager_api/lib/model/web_dto.dart +++ b/manager_api/lib/model/web_dto.dart @@ -31,11 +31,13 @@ class WebDTO { String toString() => 'WebDTO[source_=$source_]'; Map toJson() { - final _json = {}; - if (source_ != null) { - _json[r'source'] = source_; + final json = {}; + if (this.source_ != null) { + json[r'source'] = this.source_; + } else { + json[r'source'] = null; } - return _json; + return json; } /// Returns a new [WebDTO] instance and imports its values from @@ -63,7 +65,7 @@ class WebDTO { 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 WebDTO { 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 = WebDTO.listFromJson(entry.value, growable: growable,); - if (value != null) { - map[entry.key] = value; - } + map[entry.key] = WebDTO.listFromJson(entry.value, growable: growable,); } } return map;