From acaaefd6a6d7ef7fe2ef1ff269db048e8592d8dd Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Wed, 1 Dec 2021 15:41:22 +0100 Subject: [PATCH 1/2] Update api generation --- mycore_api/.openapi-generator/FILES | 96 +- mycore_api/README.md | 97 +- mycore_api/doc/Action.md | 1 + mycore_api/doc/AlarmApi.md | 367 ++++ mycore_api/doc/AlarmMode.md | 28 + .../doc/AlarmModeCreateOrUpdateDetailDTO.md | 27 + .../AlarmModeCreateOrUpdateDetailDTOAllOf.md | 18 + mycore_api/doc/AlarmModeDTO.md | 23 + mycore_api/doc/AlarmModeDetailDTO.md | 27 + mycore_api/doc/AlarmModeDetailDTOAllOf.md | 18 + mycore_api/doc/AlarmTriggered.md | 17 + mycore_api/doc/AlarmType.md | 14 + mycore_api/doc/AuthenticationApi.md | 2 +- mycore_api/doc/AutomationApi.md | 50 +- mycore_api/doc/AutomationDTO.md | 2 +- mycore_api/doc/AutomationDetailDTO.md | 2 +- mycore_api/doc/AutomationTriggered.md | 16 + mycore_api/doc/AzureApi.md | 2 +- mycore_api/doc/BooksApi.md | 2 +- mycore_api/doc/CreateOrUpdateHomeDTO.md | 22 + mycore_api/doc/CreateOrUpdateHomeDTOAllOf.md | 15 + mycore_api/doc/DeviceApi.md | 78 +- mycore_api/doc/DeviceDetailDTO.md | 5 +- mycore_api/doc/DeviceState.md | 18 + mycore_api/doc/DeviceSummaryDTO.md | 5 +- mycore_api/doc/ElectricityProduction.md | 2 +- mycore_api/doc/EnergyApi.md | 10 +- mycore_api/doc/EventApi.md | 205 ++ mycore_api/doc/EventDTO.md | 19 + mycore_api/doc/EventDetailDTO.md | 22 + mycore_api/doc/EventDetailDTOAllOf.md | 17 + mycore_api/doc/EventType.md | 14 + mycore_api/doc/FacebookApi.md | 2 +- mycore_api/doc/GeolocalizedMode.md | 18 + mycore_api/doc/GoogleApi.md | 2 +- mycore_api/doc/GroupApi.md | 60 +- .../doc/GroupCreateOrUpdateDetailDTO.md | 2 +- mycore_api/doc/GroupDetailDTO.md | 2 +- mycore_api/doc/GroupSummaryDTO.md | 2 +- mycore_api/doc/HomeApi.md | 233 +++ mycore_api/doc/HomeDTO.md | 22 + mycore_api/doc/HomeDetailDTO.md | 27 + mycore_api/doc/HomeDetailDTOAllOf.md | 19 + mycore_api/doc/IOTApi.md | 2 +- mycore_api/doc/LayoutApi.md | 2 +- mycore_api/doc/MQTTApi.md | 2 +- mycore_api/doc/OddApi.md | 2 +- mycore_api/doc/ProgrammedMode.md | 21 + mycore_api/doc/ProviderApi.md | 14 +- mycore_api/doc/ProviderDTO.md | 4 +- mycore_api/doc/ProviderType.md | 14 + mycore_api/doc/RoomApi.md | 36 +- mycore_api/doc/RoomCreateOrUpdateDetailDTO.md | 2 +- mycore_api/doc/RoomDetailDTO.md | 2 +- mycore_api/doc/RoomSummaryDTO.md | 2 +- mycore_api/doc/ScreenDeviceApi.md | 2 +- mycore_api/doc/TimePeriodAlarm.md | 17 + mycore_api/doc/TokenApi.md | 2 +- mycore_api/doc/TwitterApi.md | 2 +- mycore_api/doc/UserApi.md | 2 +- mycore_api/doc/UserInfo.md | 7 +- mycore_api/doc/ValuesApi.md | 2 +- mycore_api/lib/api.dart | 35 +- mycore_api/lib/api/alarm_api.dart | 593 ++++++ mycore_api/lib/api/automation_api.dart | 88 +- mycore_api/lib/api/device_api.dart | 158 +- mycore_api/lib/api/energy_api.dart | 14 +- mycore_api/lib/api/event_api.dart | 360 ++++ mycore_api/lib/api/group_api.dart | 118 +- mycore_api/lib/api/home_api.dart | 372 ++++ mycore_api/lib/api/provider_api.dart | 26 +- mycore_api/lib/api/room_api.dart | 68 +- mycore_api/lib/api_client.dart | 69 +- mycore_api/lib/api_helper.dart | 9 + mycore_api/lib/model/action.dart | 15 +- mycore_api/lib/model/alarm_mode.dart | 194 ++ ...larm_mode_create_or_update_detail_dto.dart | 183 ++ ...de_create_or_update_detail_dto_all_of.dart | 98 + .../lib/model/alarm_mode_detail_dto.dart | 183 ++ .../model/alarm_mode_detail_dto_all_of.dart | 98 + mycore_api/lib/model/alarm_mode_dto.dart | 147 ++ mycore_api/lib/model/alarm_triggered.dart | 89 + mycore_api/lib/model/alarm_type.dart | 88 + .../lib/model/automation_detail_dto.dart | 16 +- mycore_api/lib/model/automation_dto.dart | 16 +- .../lib/model/automation_triggered.dart | 80 + mycore_api/lib/model/condition.dart | 4 +- .../lib/model/create_or_update_home_dto.dart | 140 ++ .../create_or_update_home_dto_all_of.dart | 73 + mycore_api/lib/model/device_detail_dto.dart | 39 +- mycore_api/lib/model/device_state.dart | 98 + mycore_api/lib/model/device_summary_dto.dart | 39 +- .../lib/model/electricity_production.dart | 16 +- mycore_api/lib/model/event_detail_dto.dart | 136 ++ .../lib/model/event_detail_dto_all_of.dart | 89 + mycore_api/lib/model/event_dto.dart | 109 + mycore_api/lib/model/event_type.dart | 79 + mycore_api/lib/model/geolocalized_mode.dart | 98 + .../group_create_or_update_detail_dto.dart | 16 +- mycore_api/lib/model/group_detail_dto.dart | 16 +- mycore_api/lib/model/group_summary_dto.dart | 16 +- mycore_api/lib/model/home_detail_dto.dart | 185 ++ .../lib/model/home_detail_dto_all_of.dart | 107 + mycore_api/lib/model/home_dto.dart | 140 ++ mycore_api/lib/model/odd_nice.dart | 4 +- mycore_api/lib/model/programmed_mode.dart | 125 ++ mycore_api/lib/model/provider_dto.dart | 20 +- mycore_api/lib/model/provider_type.dart | 82 + .../room_create_or_update_detail_dto.dart | 16 +- mycore_api/lib/model/room_detail_dto.dart | 16 +- mycore_api/lib/model/room_summary_dto.dart | 16 +- mycore_api/lib/model/time_period_alarm.dart | 89 + mycore_api/lib/model/user_info.dart | 71 +- mycore_api/swagger.yaml | 1789 ++++++++++++----- mycore_api/test/alarm_api_test.dart | 76 + ...eate_or_update_detail_dto_all_of_test.dart | 41 + ...mode_create_or_update_detail_dto_test.dart | 86 + .../alarm_mode_detail_dto_all_of_test.dart | 41 + .../test/alarm_mode_detail_dto_test.dart | 86 + mycore_api/test/alarm_mode_dto_test.dart | 66 + mycore_api/test/alarm_mode_test.dart | 91 + mycore_api/test/alarm_triggered_test.dart | 36 + mycore_api/test/alarm_type_test.dart | 20 + .../test/automation_triggered_test.dart | 31 + ...create_or_update_home_dto_all_of_test.dart | 26 + .../test/create_or_update_home_dto_test.dart | 61 + mycore_api/test/device_state_test.dart | 41 + mycore_api/test/event_api_test.dart | 48 + .../test/event_detail_dto_all_of_test.dart | 36 + mycore_api/test/event_detail_dto_test.dart | 61 + mycore_api/test/event_dto_test.dart | 46 + mycore_api/test/event_type_test.dart | 20 + mycore_api/test/geolocalized_mode_test.dart | 41 + mycore_api/test/home_api_test.dart | 55 + .../test/home_detail_dto_all_of_test.dart | 46 + mycore_api/test/home_detail_dto_test.dart | 86 + mycore_api/test/home_dto_test.dart | 61 + mycore_api/test/programmed_mode_test.dart | 56 + mycore_api/test/provider_type_test.dart | 20 + mycore_api/test/time_period_alarm_test.dart | 36 + 140 files changed, 8653 insertions(+), 1173 deletions(-) create mode 100644 mycore_api/doc/AlarmApi.md create mode 100644 mycore_api/doc/AlarmMode.md create mode 100644 mycore_api/doc/AlarmModeCreateOrUpdateDetailDTO.md create mode 100644 mycore_api/doc/AlarmModeCreateOrUpdateDetailDTOAllOf.md create mode 100644 mycore_api/doc/AlarmModeDTO.md create mode 100644 mycore_api/doc/AlarmModeDetailDTO.md create mode 100644 mycore_api/doc/AlarmModeDetailDTOAllOf.md create mode 100644 mycore_api/doc/AlarmTriggered.md create mode 100644 mycore_api/doc/AlarmType.md create mode 100644 mycore_api/doc/AutomationTriggered.md create mode 100644 mycore_api/doc/CreateOrUpdateHomeDTO.md create mode 100644 mycore_api/doc/CreateOrUpdateHomeDTOAllOf.md create mode 100644 mycore_api/doc/DeviceState.md create mode 100644 mycore_api/doc/EventApi.md create mode 100644 mycore_api/doc/EventDTO.md create mode 100644 mycore_api/doc/EventDetailDTO.md create mode 100644 mycore_api/doc/EventDetailDTOAllOf.md create mode 100644 mycore_api/doc/EventType.md create mode 100644 mycore_api/doc/GeolocalizedMode.md create mode 100644 mycore_api/doc/HomeApi.md create mode 100644 mycore_api/doc/HomeDTO.md create mode 100644 mycore_api/doc/HomeDetailDTO.md create mode 100644 mycore_api/doc/HomeDetailDTOAllOf.md create mode 100644 mycore_api/doc/ProgrammedMode.md create mode 100644 mycore_api/doc/ProviderType.md create mode 100644 mycore_api/doc/TimePeriodAlarm.md create mode 100644 mycore_api/lib/api/alarm_api.dart create mode 100644 mycore_api/lib/api/event_api.dart create mode 100644 mycore_api/lib/api/home_api.dart create mode 100644 mycore_api/lib/model/alarm_mode.dart create mode 100644 mycore_api/lib/model/alarm_mode_create_or_update_detail_dto.dart create mode 100644 mycore_api/lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart create mode 100644 mycore_api/lib/model/alarm_mode_detail_dto.dart create mode 100644 mycore_api/lib/model/alarm_mode_detail_dto_all_of.dart create mode 100644 mycore_api/lib/model/alarm_mode_dto.dart create mode 100644 mycore_api/lib/model/alarm_triggered.dart create mode 100644 mycore_api/lib/model/alarm_type.dart create mode 100644 mycore_api/lib/model/automation_triggered.dart create mode 100644 mycore_api/lib/model/create_or_update_home_dto.dart create mode 100644 mycore_api/lib/model/create_or_update_home_dto_all_of.dart create mode 100644 mycore_api/lib/model/device_state.dart create mode 100644 mycore_api/lib/model/event_detail_dto.dart create mode 100644 mycore_api/lib/model/event_detail_dto_all_of.dart create mode 100644 mycore_api/lib/model/event_dto.dart create mode 100644 mycore_api/lib/model/event_type.dart create mode 100644 mycore_api/lib/model/geolocalized_mode.dart create mode 100644 mycore_api/lib/model/home_detail_dto.dart create mode 100644 mycore_api/lib/model/home_detail_dto_all_of.dart create mode 100644 mycore_api/lib/model/home_dto.dart create mode 100644 mycore_api/lib/model/programmed_mode.dart create mode 100644 mycore_api/lib/model/provider_type.dart create mode 100644 mycore_api/lib/model/time_period_alarm.dart create mode 100644 mycore_api/test/alarm_api_test.dart create mode 100644 mycore_api/test/alarm_mode_create_or_update_detail_dto_all_of_test.dart create mode 100644 mycore_api/test/alarm_mode_create_or_update_detail_dto_test.dart create mode 100644 mycore_api/test/alarm_mode_detail_dto_all_of_test.dart create mode 100644 mycore_api/test/alarm_mode_detail_dto_test.dart create mode 100644 mycore_api/test/alarm_mode_dto_test.dart create mode 100644 mycore_api/test/alarm_mode_test.dart create mode 100644 mycore_api/test/alarm_triggered_test.dart create mode 100644 mycore_api/test/alarm_type_test.dart create mode 100644 mycore_api/test/automation_triggered_test.dart create mode 100644 mycore_api/test/create_or_update_home_dto_all_of_test.dart create mode 100644 mycore_api/test/create_or_update_home_dto_test.dart create mode 100644 mycore_api/test/device_state_test.dart create mode 100644 mycore_api/test/event_api_test.dart create mode 100644 mycore_api/test/event_detail_dto_all_of_test.dart create mode 100644 mycore_api/test/event_detail_dto_test.dart create mode 100644 mycore_api/test/event_dto_test.dart create mode 100644 mycore_api/test/event_type_test.dart create mode 100644 mycore_api/test/geolocalized_mode_test.dart create mode 100644 mycore_api/test/home_api_test.dart create mode 100644 mycore_api/test/home_detail_dto_all_of_test.dart create mode 100644 mycore_api/test/home_detail_dto_test.dart create mode 100644 mycore_api/test/home_dto_test.dart create mode 100644 mycore_api/test/programmed_mode_test.dart create mode 100644 mycore_api/test/provider_type_test.dart create mode 100644 mycore_api/test/time_period_alarm_test.dart diff --git a/mycore_api/.openapi-generator/FILES b/mycore_api/.openapi-generator/FILES index 16817c4..b7cb814 100644 --- a/mycore_api/.openapi-generator/FILES +++ b/mycore_api/.openapi-generator/FILES @@ -3,15 +3,22 @@ README.md doc/Action.md doc/ActionType.md +doc/AlarmApi.md +doc/AlarmMode.md +doc/AlarmModeCreateOrUpdateDetailDTO.md +doc/AlarmModeCreateOrUpdateDetailDTOAllOf.md +doc/AlarmModeDTO.md +doc/AlarmModeDetailDTO.md +doc/AlarmModeDetailDTOAllOf.md +doc/AlarmTriggered.md +doc/AlarmType.md doc/AuthenticationApi.md -doc/Automation.md doc/AutomationApi.md -doc/AutomationCreateOrUpdateDetailDTO.md -doc/AutomationCreateOrUpdateDetailDTOAllOf.md doc/AutomationDTO.md doc/AutomationDetailDTO.md doc/AutomationDetailDTOAllOf.md doc/AutomationState.md +doc/AutomationTriggered.md doc/AzureADAuthModel.md doc/AzureApi.md doc/Book.md @@ -20,25 +27,36 @@ doc/Condition.md doc/ConditionType.md doc/ConditionValue.md doc/ConnectionStatus.md -doc/Device.md +doc/CreateOrUpdateHomeDTO.md +doc/CreateOrUpdateHomeDTOAllOf.md doc/DeviceApi.md doc/DeviceDetailDTO.md doc/DeviceDetailDTOAllOf.md +doc/DeviceState.md doc/DeviceSummaryDTO.md doc/DeviceType.md doc/ElectricityProduction.md doc/EnergyApi.md +doc/EventApi.md +doc/EventDTO.md +doc/EventDetailDTO.md +doc/EventDetailDTOAllOf.md +doc/EventType.md doc/FacebookApi.md doc/FacebookAuthModel.md +doc/GeolocalizedMode.md doc/GoogleApi.md doc/GoogleAuthModel.md -doc/Group.md doc/GroupApi.md doc/GroupCreateOrUpdateDetailDTO.md doc/GroupCreateOrUpdateDetailDTOAllOf.md doc/GroupDetailDTO.md doc/GroupDetailDTOAllOf.md doc/GroupSummaryDTO.md +doc/HomeApi.md +doc/HomeDTO.md +doc/HomeDetailDTO.md +doc/HomeDetailDTOAllOf.md doc/IOTApi.md doc/LayoutApi.md doc/LoginDTO.md @@ -50,20 +68,19 @@ doc/OddNice.md doc/OddObject.md doc/PanelMenuItem.md doc/PanelSection.md -doc/PlaceDTO.md -doc/Provider.md +doc/ProgrammedMode.md doc/ProviderApi.md doc/ProviderDTO.md +doc/ProviderType.md doc/RoomApi.md doc/RoomCreateOrUpdateDetailDTO.md doc/RoomDetailDTO.md doc/RoomSummaryDTO.md -doc/ScreenConfiguration.md doc/ScreenDevice.md doc/ScreenDeviceApi.md -doc/ScreenWidget.md doc/SmartGardenMessage.md doc/SmartPrinterMessage.md +doc/TimePeriodAlarm.md doc/TokenApi.md doc/TokenDTO.md doc/Trigger.md @@ -78,15 +95,18 @@ doc/ValuesApi.md doc/ViewBy.md git_push.sh lib/api.dart +lib/api/alarm_api.dart lib/api/authentication_api.dart lib/api/automation_api.dart lib/api/azure_api.dart lib/api/books_api.dart lib/api/device_api.dart lib/api/energy_api.dart +lib/api/event_api.dart lib/api/facebook_api.dart lib/api/google_api.dart lib/api/group_api.dart +lib/api/home_api.dart lib/api/iot_api.dart lib/api/layout_api.dart lib/api/mqtt_api.dart @@ -108,33 +128,48 @@ lib/auth/http_bearer_auth.dart lib/auth/oauth.dart lib/model/action.dart lib/model/action_type.dart -lib/model/automation.dart -lib/model/automation_create_or_update_detail_dto.dart -lib/model/automation_create_or_update_detail_dto_all_of.dart +lib/model/alarm_mode.dart +lib/model/alarm_mode_create_or_update_detail_dto.dart +lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart +lib/model/alarm_mode_detail_dto.dart +lib/model/alarm_mode_detail_dto_all_of.dart +lib/model/alarm_mode_dto.dart +lib/model/alarm_triggered.dart +lib/model/alarm_type.dart lib/model/automation_detail_dto.dart lib/model/automation_detail_dto_all_of.dart lib/model/automation_dto.dart lib/model/automation_state.dart +lib/model/automation_triggered.dart lib/model/azure_ad_auth_model.dart lib/model/book.dart lib/model/condition.dart lib/model/condition_type.dart lib/model/condition_value.dart lib/model/connection_status.dart -lib/model/device.dart +lib/model/create_or_update_home_dto.dart +lib/model/create_or_update_home_dto_all_of.dart lib/model/device_detail_dto.dart lib/model/device_detail_dto_all_of.dart +lib/model/device_state.dart lib/model/device_summary_dto.dart lib/model/device_type.dart lib/model/electricity_production.dart +lib/model/event_detail_dto.dart +lib/model/event_detail_dto_all_of.dart +lib/model/event_dto.dart +lib/model/event_type.dart lib/model/facebook_auth_model.dart +lib/model/geolocalized_mode.dart lib/model/google_auth_model.dart -lib/model/group.dart lib/model/group_create_or_update_detail_dto.dart lib/model/group_create_or_update_detail_dto_all_of.dart lib/model/group_detail_dto.dart lib/model/group_detail_dto_all_of.dart lib/model/group_summary_dto.dart +lib/model/home_detail_dto.dart +lib/model/home_detail_dto_all_of.dart +lib/model/home_dto.dart lib/model/login_dto.dart lib/model/means_of_communication.dart lib/model/mqtt_message_dto.dart @@ -142,17 +177,16 @@ lib/model/odd_nice.dart lib/model/odd_object.dart lib/model/panel_menu_item.dart lib/model/panel_section.dart -lib/model/place_dto.dart -lib/model/provider.dart +lib/model/programmed_mode.dart lib/model/provider_dto.dart +lib/model/provider_type.dart lib/model/room_create_or_update_detail_dto.dart lib/model/room_detail_dto.dart lib/model/room_summary_dto.dart -lib/model/screen_configuration.dart lib/model/screen_device.dart -lib/model/screen_widget.dart lib/model/smart_garden_message.dart lib/model/smart_printer_message.dart +lib/model/time_period_alarm.dart lib/model/token_dto.dart lib/model/trigger.dart lib/model/trigger_type.dart @@ -162,3 +196,29 @@ lib/model/user_info.dart lib/model/user_info_detail_dto.dart lib/model/view_by.dart pubspec.yaml +test/alarm_api_test.dart +test/alarm_mode_create_or_update_detail_dto_all_of_test.dart +test/alarm_mode_create_or_update_detail_dto_test.dart +test/alarm_mode_detail_dto_all_of_test.dart +test/alarm_mode_detail_dto_test.dart +test/alarm_mode_dto_test.dart +test/alarm_mode_test.dart +test/alarm_triggered_test.dart +test/alarm_type_test.dart +test/automation_triggered_test.dart +test/create_or_update_home_dto_all_of_test.dart +test/create_or_update_home_dto_test.dart +test/device_state_test.dart +test/event_api_test.dart +test/event_detail_dto_all_of_test.dart +test/event_detail_dto_test.dart +test/event_dto_test.dart +test/event_type_test.dart +test/geolocalized_mode_test.dart +test/home_api_test.dart +test/home_detail_dto_all_of_test.dart +test/home_detail_dto_test.dart +test/home_dto_test.dart +test/programmed_mode_test.dart +test/provider_type_test.dart +test/time_period_alarm_test.dart diff --git a/mycore_api/README.md b/mycore_api/README.md index 78cf2a5..d29695f 100644 --- a/mycore_api/README.md +++ b/mycore_api/README.md @@ -42,34 +42,38 @@ import 'package:mycoreapi/api.dart'; // TODO Configure OAuth2 access token for authorization: bearer //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; -final api_instance = AuthenticationApi(); -final grantType = grantType_example; // String | -final username = username_example; // String | -final password = password_example; // String | -final clientId = clientId_example; // String | -final clientSecret = clientSecret_example; // String | +final api_instance = AlarmApi(); +final alarmModeId = alarmModeId_example; // String | Alarm mode to activate try { - final result = api_instance.authenticationAuthenticateWithForm(grantType, username, password, clientId, clientSecret); + final result = api_instance.alarmActivate(alarmModeId); print(result); } catch (e) { - print('Exception when calling AuthenticationApi->authenticationAuthenticateWithForm: $e\n'); + print('Exception when calling AlarmApi->alarmActivate: $e\n'); } ``` ## Documentation for API Endpoints -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*AlarmApi* | [**alarmActivate**](doc\/AlarmApi.md#alarmactivate) | **POST** /api/alarm/activate/{alarmModeId} | Activate current alarm mode +*AlarmApi* | [**alarmCreate**](doc\/AlarmApi.md#alarmcreate) | **POST** /api/alarm | Create an alarm mode +*AlarmApi* | [**alarmCreateDefaultAlarms**](doc\/AlarmApi.md#alarmcreatedefaultalarms) | **POST** /api/alarm/defaults/{homeId} | Create default alarm modes +*AlarmApi* | [**alarmDelete**](doc\/AlarmApi.md#alarmdelete) | **DELETE** /api/alarm/{alarmModeId} | Delete an alarm mode +*AlarmApi* | [**alarmDeleteAllForHome**](doc\/AlarmApi.md#alarmdeleteallforhome) | **DELETE** /api/alarm/home/{homeId} | Delete all alarm mode for a specified home +*AlarmApi* | [**alarmGetAll**](doc\/AlarmApi.md#alarmgetall) | **GET** /api/alarm/{homeId} | Get all alarm modes for the specified home +*AlarmApi* | [**alarmGetDetail**](doc\/AlarmApi.md#alarmgetdetail) | **GET** /api/alarm/detail/{alarmId} | Get detail info of a specified alarm mode +*AlarmApi* | [**alarmUpdate**](doc\/AlarmApi.md#alarmupdate) | **PUT** /api/alarm | Update an alarm mode *AuthenticationApi* | [**authenticationAuthenticateWithForm**](doc\/AuthenticationApi.md#authenticationauthenticatewithform) | **POST** /api/Authentication/Token | Authenticate with form parameters (used by Swagger test client) *AuthenticationApi* | [**authenticationAuthenticateWithJson**](doc\/AuthenticationApi.md#authenticationauthenticatewithjson) | **POST** /api/Authentication/Authenticate | Authenticate with Json parameters (used by most clients) *AutomationApi* | [**automationCreate**](doc\/AutomationApi.md#automationcreate) | **POST** /api/automation | Create an automation *AutomationApi* | [**automationDelete**](doc\/AutomationApi.md#automationdelete) | **DELETE** /api/automation/{automationId} | Delete an automation -*AutomationApi* | [**automationDeleteAllForUser**](doc\/AutomationApi.md#automationdeleteallforuser) | **DELETE** /api/automation/user/{userId} | Delete all automation for a specified -*AutomationApi* | [**automationGetAll**](doc\/AutomationApi.md#automationgetall) | **GET** /api/automation/{userId} | Get all automations for the specified user +*AutomationApi* | [**automationDeleteAllForHome**](doc\/AutomationApi.md#automationdeleteallforhome) | **DELETE** /api/automation/home/{homeId} | Delete all automation for a specified home +*AutomationApi* | [**automationGetAll**](doc\/AutomationApi.md#automationgetall) | **GET** /api/automation/{homeId} | Get all automations for the specified home *AutomationApi* | [**automationGetDetail**](doc\/AutomationApi.md#automationgetdetail) | **GET** /api/automation/detail/{automationId} | Get detail info of a specified automation *AutomationApi* | [**automationUpdate**](doc\/AutomationApi.md#automationupdate) | **PUT** /api/automation | Update an automation *AzureApi* | [**azureCreate**](doc\/AzureApi.md#azurecreate) | **POST** /azure | @@ -79,29 +83,38 @@ Class | Method | HTTP request | Description *BooksApi* | [**booksGetAll**](doc\/BooksApi.md#booksgetall) | **GET** /api/books | *BooksApi* | [**booksUpdate**](doc\/BooksApi.md#booksupdate) | **PUT** /api/books/{id} | *DeviceApi* | [**deviceCreate**](doc\/DeviceApi.md#devicecreate) | **POST** /api/device | Create a device -*DeviceApi* | [**deviceCreateDevicesFromProvider**](doc\/DeviceApi.md#devicecreatedevicesfromprovider) | **POST** /api/device/{userId}/fromProvider/{providerId} | Create devices from provider +*DeviceApi* | [**deviceCreateDevicesFromProvider**](doc\/DeviceApi.md#devicecreatedevicesfromprovider) | **POST** /api/device/{homeId}/fromProvider/{providerId} | Create devices from provider *DeviceApi* | [**deviceDelete**](doc\/DeviceApi.md#devicedelete) | **DELETE** /api/device/{deviceId} | Delete a device -*DeviceApi* | [**deviceDeleteAllForUser**](doc\/DeviceApi.md#devicedeleteallforuser) | **DELETE** /api/device/user/{userId} | Delete all device for a specified user -*DeviceApi* | [**deviceDeleteDevicesFromProvider**](doc\/DeviceApi.md#devicedeletedevicesfromprovider) | **DELETE** /api/device/{userId}/fromProvider/{providerId} | Delete devices from provider -*DeviceApi* | [**deviceGetAll**](doc\/DeviceApi.md#devicegetall) | **GET** /api/device/{userId} | Get all devices summary +*DeviceApi* | [**deviceDeleteAllForHome**](doc\/DeviceApi.md#devicedeleteallforhome) | **DELETE** /api/device/home/{homeId} | Delete all device for a specified home +*DeviceApi* | [**deviceDeleteDevicesFromProvider**](doc\/DeviceApi.md#devicedeletedevicesfromprovider) | **DELETE** /api/device/{homeId}/fromProvider/{providerId} | Delete devices from provider +*DeviceApi* | [**deviceGetAll**](doc\/DeviceApi.md#devicegetall) | **GET** /api/device/{homeId} | Get all devices summary *DeviceApi* | [**deviceGetDetail**](doc\/DeviceApi.md#devicegetdetail) | **GET** /api/device/detail/{deviceId} | Get a specific device info -*DeviceApi* | [**deviceGetDevicesByType**](doc\/DeviceApi.md#devicegetdevicesbytype) | **GET** /api/device/{userId}/type/{type} | Get list of devices from a type -*DeviceApi* | [**deviceGetDevicesFromProvider**](doc\/DeviceApi.md#devicegetdevicesfromprovider) | **GET** /api/device/{userId}/fromProvider/{providerId} | Get devices from provider -*DeviceApi* | [**deviceGetDevicesFromZigbee2Mqtt**](doc\/DeviceApi.md#devicegetdevicesfromzigbee2mqtt) | **GET** /api/device/zigbee2Mqtt/{userId} | Get all zigbee2Mqtt devices +*DeviceApi* | [**deviceGetDevicesByType**](doc\/DeviceApi.md#devicegetdevicesbytype) | **GET** /api/device/{homeId}/type/{type} | Get list of devices from a type +*DeviceApi* | [**deviceGetDevicesFromProvider**](doc\/DeviceApi.md#devicegetdevicesfromprovider) | **GET** /api/device/{homeId}/fromProvider/{providerId} | Get devices from provider +*DeviceApi* | [**deviceGetDevicesFromZigbee2Mqtt**](doc\/DeviceApi.md#devicegetdevicesfromzigbee2mqtt) | **GET** /api/device/zigbee2Mqtt/{homeId} | Get all zigbee2Mqtt devices *DeviceApi* | [**deviceUpdate**](doc\/DeviceApi.md#deviceupdate) | **PUT** /api/device/{deviceId} | Update a device *EnergyApi* | [**energyGetElectricityProduction**](doc\/EnergyApi.md#energygetelectricityproduction) | **GET** /api/energy/electricity | Get summary production of Kwh/Year +*EventApi* | [**eventDelete**](doc\/EventApi.md#eventdelete) | **DELETE** /api/event/{eventId} | Delete an event +*EventApi* | [**eventDeleteAllForHome**](doc\/EventApi.md#eventdeleteallforhome) | **DELETE** /api/event/home/{homeId} | Delete all events for a specified home +*EventApi* | [**eventGet**](doc\/EventApi.md#eventget) | **GET** /api/event/{homeId} | Get events for the specified home +*EventApi* | [**eventGetDetail**](doc\/EventApi.md#eventgetdetail) | **GET** /api/event/detail/{eventId} | Get detail info of a specified event *FacebookApi* | [**facebookCreate**](doc\/FacebookApi.md#facebookcreate) | **POST** /facebook | *GoogleApi* | [**googleCreate**](doc\/GoogleApi.md#googlecreate) | **POST** /google | *GroupApi* | [**groupCreate**](doc\/GroupApi.md#groupcreate) | **POST** /api/group | Create a group -*GroupApi* | [**groupCreateDevicesFromZigbee2Mqtt**](doc\/GroupApi.md#groupcreatedevicesfromzigbee2mqtt) | **POST** /api/group/{userId}/fromZigbee | Create groups from provider +*GroupApi* | [**groupCreateDevicesFromZigbee2Mqtt**](doc\/GroupApi.md#groupcreatedevicesfromzigbee2mqtt) | **POST** /api/group/{homeId}/fromZigbee | Create groups from provider *GroupApi* | [**groupDelete**](doc\/GroupApi.md#groupdelete) | **DELETE** /api/group/{groupId}/device/{deviceId} | Delete device from a group *GroupApi* | [**groupDelete2**](doc\/GroupApi.md#groupdelete2) | **DELETE** /api/group/{groupId} | Delete a group -*GroupApi* | [**groupDeleteAllForUser**](doc\/GroupApi.md#groupdeleteallforuser) | **DELETE** /api/group/user/{userId} | Delete all group for a specified -*GroupApi* | [**groupGetAll**](doc\/GroupApi.md#groupgetall) | **GET** /api/group/{userId} | Get all groups for the specified user +*GroupApi* | [**groupDeleteAllForHome**](doc\/GroupApi.md#groupdeleteallforhome) | **DELETE** /api/group/home/{homeId} | Delete all group for a specified home +*GroupApi* | [**groupGetAll**](doc\/GroupApi.md#groupgetall) | **GET** /api/group/{homeId} | Get all groups for the specified home *GroupApi* | [**groupGetDetail**](doc\/GroupApi.md#groupgetdetail) | **GET** /api/group/detail/{groupId} | Get detail info of a specified group -*GroupApi* | [**groupGetGroupsByType**](doc\/GroupApi.md#groupgetgroupsbytype) | **GET** /api/group/{userId}/type/{type} | Get list of group from a type -*GroupApi* | [**groupGetGroupsFromZigbee2Mqtt**](doc\/GroupApi.md#groupgetgroupsfromzigbee2mqtt) | **GET** /api/group/zigbee2Mqtt/{userId} | Get all zigbee2Mqtt groups +*GroupApi* | [**groupGetGroupsByType**](doc\/GroupApi.md#groupgetgroupsbytype) | **GET** /api/group/{homeId}/type/{type} | Get list of group from a type +*GroupApi* | [**groupGetGroupsFromZigbee2Mqtt**](doc\/GroupApi.md#groupgetgroupsfromzigbee2mqtt) | **GET** /api/group/zigbee2Mqtt/{homeId} | Get all zigbee2Mqtt groups *GroupApi* | [**groupUpdate**](doc\/GroupApi.md#groupupdate) | **PUT** /api/group | Update a group +*HomeApi* | [**homeCreate**](doc\/HomeApi.md#homecreate) | **POST** /api/home | Create a home +*HomeApi* | [**homeDelete**](doc\/HomeApi.md#homedelete) | **DELETE** /api/home/{homeId} | Delete a home +*HomeApi* | [**homeGetAll**](doc\/HomeApi.md#homegetall) | **GET** /api/home/{userId} | Get all home for specified user +*HomeApi* | [**homeGetDetail**](doc\/HomeApi.md#homegetdetail) | **GET** /api/home/detail/{homeId} | Get detail info of a specified home +*HomeApi* | [**homeUpdate**](doc\/HomeApi.md#homeupdate) | **PUT** /api/home | Update a home *IOTApi* | [**iOTGetSmartPrinterMessages**](doc\/IOTApi.md#iotgetsmartprintermessages) | **GET** /api/iot/smartprinter/{idDevice} | Retrieve all SmartPrinterMessage *IOTApi* | [**iOTPostToDBPrinter**](doc\/IOTApi.md#iotposttodbprinter) | **POST** /api/iot/smartprinter/{idDevice} | It's the method to post data from mqtt broker to Database (Thanks Rpi!) *IOTApi* | [**iOTPostToDBSmartGarden**](doc\/IOTApi.md#iotposttodbsmartgarden) | **POST** /api/iot/smartgarden/{idDevice} | It's the method to post data from mqtt broker to Database (Thanks Rpi!) @@ -111,13 +124,13 @@ Class | Method | HTTP request | Description *OddApi* | [**oddGetForCountry**](doc\/OddApi.md#oddgetforcountry) | **GET** /api/odd/country/{id}/{oddRequest} | Get odds for one country and one odd value maximum *ProviderApi* | [**providerCreate**](doc\/ProviderApi.md#providercreate) | **POST** /api/provider | Create a provider *ProviderApi* | [**providerDelete**](doc\/ProviderApi.md#providerdelete) | **DELETE** /api/provider/{providerId} | Delete a provider -*ProviderApi* | [**providerGetAll**](doc\/ProviderApi.md#providergetall) | **GET** /api/provider/{userId} | Get all user providers +*ProviderApi* | [**providerGetAll**](doc\/ProviderApi.md#providergetall) | **GET** /api/provider/{homeId} | Get all home providers *ProviderApi* | [**providerUpdate**](doc\/ProviderApi.md#providerupdate) | **PUT** /api/provider | Update a provider *RoomApi* | [**roomCreate**](doc\/RoomApi.md#roomcreate) | **POST** /api/room | Create a room *RoomApi* | [**roomDelete**](doc\/RoomApi.md#roomdelete) | **DELETE** /api/room/{roomId}/device/{deviceId} | Delete device from a room *RoomApi* | [**roomDelete2**](doc\/RoomApi.md#roomdelete2) | **DELETE** /api/room/{roomId} | Delete a room -*RoomApi* | [**roomDeleteAllForUser**](doc\/RoomApi.md#roomdeleteallforuser) | **DELETE** /api/room/user/{userId} | Delete all room for a specified user -*RoomApi* | [**roomGetAll**](doc\/RoomApi.md#roomgetall) | **GET** /api/room/{userId} | Get all rooms for the specified user +*RoomApi* | [**roomDeleteAllForHome**](doc\/RoomApi.md#roomdeleteallforhome) | **DELETE** /api/room/home/{homeId} | Delete all rooms for a specified home +*RoomApi* | [**roomGetAll**](doc\/RoomApi.md#roomgetall) | **GET** /api/room/{homeId} | Get all rooms for the specified home *RoomApi* | [**roomGetDetail**](doc\/RoomApi.md#roomgetdetail) | **GET** /api/room/detail/{roomId} | Get detail info of a specified room *RoomApi* | [**roomUpdate**](doc\/RoomApi.md#roomupdate) | **PUT** /api/room | Update a room *ScreenDeviceApi* | [**screenDeviceCreateDevice**](doc\/ScreenDeviceApi.md#screendevicecreatedevice) | **POST** /api/device/screen | Create screen device @@ -144,33 +157,48 @@ Class | Method | HTTP request | Description - [Action](doc\/Action.md) - [ActionType](doc\/ActionType.md) - - [Automation](doc\/Automation.md) - - [AutomationCreateOrUpdateDetailDTO](doc\/AutomationCreateOrUpdateDetailDTO.md) - - [AutomationCreateOrUpdateDetailDTOAllOf](doc\/AutomationCreateOrUpdateDetailDTOAllOf.md) + - [AlarmMode](doc\/AlarmMode.md) + - [AlarmModeCreateOrUpdateDetailDTO](doc\/AlarmModeCreateOrUpdateDetailDTO.md) + - [AlarmModeCreateOrUpdateDetailDTOAllOf](doc\/AlarmModeCreateOrUpdateDetailDTOAllOf.md) + - [AlarmModeDTO](doc\/AlarmModeDTO.md) + - [AlarmModeDetailDTO](doc\/AlarmModeDetailDTO.md) + - [AlarmModeDetailDTOAllOf](doc\/AlarmModeDetailDTOAllOf.md) + - [AlarmTriggered](doc\/AlarmTriggered.md) + - [AlarmType](doc\/AlarmType.md) - [AutomationDTO](doc\/AutomationDTO.md) - [AutomationDetailDTO](doc\/AutomationDetailDTO.md) - [AutomationDetailDTOAllOf](doc\/AutomationDetailDTOAllOf.md) - [AutomationState](doc\/AutomationState.md) + - [AutomationTriggered](doc\/AutomationTriggered.md) - [AzureADAuthModel](doc\/AzureADAuthModel.md) - [Book](doc\/Book.md) - [Condition](doc\/Condition.md) - [ConditionType](doc\/ConditionType.md) - [ConditionValue](doc\/ConditionValue.md) - [ConnectionStatus](doc\/ConnectionStatus.md) - - [Device](doc\/Device.md) + - [CreateOrUpdateHomeDTO](doc\/CreateOrUpdateHomeDTO.md) + - [CreateOrUpdateHomeDTOAllOf](doc\/CreateOrUpdateHomeDTOAllOf.md) - [DeviceDetailDTO](doc\/DeviceDetailDTO.md) - [DeviceDetailDTOAllOf](doc\/DeviceDetailDTOAllOf.md) + - [DeviceState](doc\/DeviceState.md) - [DeviceSummaryDTO](doc\/DeviceSummaryDTO.md) - [DeviceType](doc\/DeviceType.md) - [ElectricityProduction](doc\/ElectricityProduction.md) + - [EventDTO](doc\/EventDTO.md) + - [EventDetailDTO](doc\/EventDetailDTO.md) + - [EventDetailDTOAllOf](doc\/EventDetailDTOAllOf.md) + - [EventType](doc\/EventType.md) - [FacebookAuthModel](doc\/FacebookAuthModel.md) + - [GeolocalizedMode](doc\/GeolocalizedMode.md) - [GoogleAuthModel](doc\/GoogleAuthModel.md) - - [Group](doc\/Group.md) - [GroupCreateOrUpdateDetailDTO](doc\/GroupCreateOrUpdateDetailDTO.md) - [GroupCreateOrUpdateDetailDTOAllOf](doc\/GroupCreateOrUpdateDetailDTOAllOf.md) - [GroupDetailDTO](doc\/GroupDetailDTO.md) - [GroupDetailDTOAllOf](doc\/GroupDetailDTOAllOf.md) - [GroupSummaryDTO](doc\/GroupSummaryDTO.md) + - [HomeDTO](doc\/HomeDTO.md) + - [HomeDetailDTO](doc\/HomeDetailDTO.md) + - [HomeDetailDTOAllOf](doc\/HomeDetailDTOAllOf.md) - [LoginDTO](doc\/LoginDTO.md) - [MeansOfCommunication](doc\/MeansOfCommunication.md) - [MqttMessageDTO](doc\/MqttMessageDTO.md) @@ -178,17 +206,16 @@ Class | Method | HTTP request | Description - [OddObject](doc\/OddObject.md) - [PanelMenuItem](doc\/PanelMenuItem.md) - [PanelSection](doc\/PanelSection.md) - - [PlaceDTO](doc\/PlaceDTO.md) - - [Provider](doc\/Provider.md) + - [ProgrammedMode](doc\/ProgrammedMode.md) - [ProviderDTO](doc\/ProviderDTO.md) + - [ProviderType](doc\/ProviderType.md) - [RoomCreateOrUpdateDetailDTO](doc\/RoomCreateOrUpdateDetailDTO.md) - [RoomDetailDTO](doc\/RoomDetailDTO.md) - [RoomSummaryDTO](doc\/RoomSummaryDTO.md) - - [ScreenConfiguration](doc\/ScreenConfiguration.md) - [ScreenDevice](doc\/ScreenDevice.md) - - [ScreenWidget](doc\/ScreenWidget.md) - [SmartGardenMessage](doc\/SmartGardenMessage.md) - [SmartPrinterMessage](doc\/SmartPrinterMessage.md) + - [TimePeriodAlarm](doc\/TimePeriodAlarm.md) - [TokenDTO](doc\/TokenDTO.md) - [Trigger](doc\/Trigger.md) - [TriggerType](doc\/TriggerType.md) diff --git a/mycore_api/doc/Action.md b/mycore_api/doc/Action.md index 0b51014..82d2f28 100644 --- a/mycore_api/doc/Action.md +++ b/mycore_api/doc/Action.md @@ -14,6 +14,7 @@ Name | Type | Description | Notes **rawRequest** | **String** | | [optional] **providerId** | **String** | | [optional] **type** | [**ActionType**](ActionType.md) | | [optional] +**isForce** | **bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/mycore_api/doc/AlarmApi.md b/mycore_api/doc/AlarmApi.md new file mode 100644 index 0000000..79054b5 --- /dev/null +++ b/mycore_api/doc/AlarmApi.md @@ -0,0 +1,367 @@ +# mycoreapi.api.AlarmApi + +## Load the API package +```dart +import 'package:mycoreapi/api.dart'; +``` + +All URIs are relative to *http://192.168.31.140* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**alarmActivate**](AlarmApi.md#alarmactivate) | **POST** /api/alarm/activate/{alarmModeId} | Activate current alarm mode +[**alarmCreate**](AlarmApi.md#alarmcreate) | **POST** /api/alarm | Create an alarm mode +[**alarmCreateDefaultAlarms**](AlarmApi.md#alarmcreatedefaultalarms) | **POST** /api/alarm/defaults/{homeId} | Create default alarm modes +[**alarmDelete**](AlarmApi.md#alarmdelete) | **DELETE** /api/alarm/{alarmModeId} | Delete an alarm mode +[**alarmDeleteAllForHome**](AlarmApi.md#alarmdeleteallforhome) | **DELETE** /api/alarm/home/{homeId} | Delete all alarm mode for a specified home +[**alarmGetAll**](AlarmApi.md#alarmgetall) | **GET** /api/alarm/{homeId} | Get all alarm modes for the specified home +[**alarmGetDetail**](AlarmApi.md#alarmgetdetail) | **GET** /api/alarm/detail/{alarmId} | Get detail info of a specified alarm mode +[**alarmUpdate**](AlarmApi.md#alarmupdate) | **PUT** /api/alarm | Update an alarm mode + + +# **alarmActivate** +> String alarmActivate(alarmModeId) + +Activate current alarm mode + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = AlarmApi(); +final alarmModeId = alarmModeId_example; // String | Alarm mode to activate + +try { + final result = api_instance.alarmActivate(alarmModeId); + print(result); +} catch (e) { + print('Exception when calling AlarmApi->alarmActivate: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **alarmModeId** | **String**| Alarm mode to activate | + +### Return type + +**String** + +### 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) + +# **alarmCreate** +> AlarmModeDetailDTO alarmCreate(alarmModeCreateOrUpdateDetailDTO) + +Create an alarm mode + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = AlarmApi(); +final alarmModeCreateOrUpdateDetailDTO = AlarmModeCreateOrUpdateDetailDTO(); // AlarmModeCreateOrUpdateDetailDTO | Alarm mode to create + +try { + final result = api_instance.alarmCreate(alarmModeCreateOrUpdateDetailDTO); + print(result); +} catch (e) { + print('Exception when calling AlarmApi->alarmCreate: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **alarmModeCreateOrUpdateDetailDTO** | [**AlarmModeCreateOrUpdateDetailDTO**](AlarmModeCreateOrUpdateDetailDTO.md)| Alarm mode to create | + +### Return type + +[**AlarmModeDetailDTO**](AlarmModeDetailDTO.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **alarmCreateDefaultAlarms** +> bool alarmCreateDefaultAlarms(homeId) + +Create default alarm modes + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = AlarmApi(); +final homeId = homeId_example; // String | Home Id + +try { + final result = api_instance.alarmCreateDefaultAlarms(homeId); + print(result); +} catch (e) { + print('Exception when calling AlarmApi->alarmCreateDefaultAlarms: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **homeId** | **String**| Home Id | + +### Return type + +**bool** + +### 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) + +# **alarmDelete** +> String alarmDelete(alarmModeId) + +Delete an alarm mode + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = AlarmApi(); +final alarmModeId = alarmModeId_example; // String | Id of alarm mode to delete + +try { + final result = api_instance.alarmDelete(alarmModeId); + print(result); +} catch (e) { + print('Exception when calling AlarmApi->alarmDelete: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **alarmModeId** | **String**| Id of alarm mode to delete | + +### Return type + +**String** + +### 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) + +# **alarmDeleteAllForHome** +> String alarmDeleteAllForHome(homeId) + +Delete all alarm mode for a specified home + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = AlarmApi(); +final homeId = homeId_example; // String | Home Id + +try { + final result = api_instance.alarmDeleteAllForHome(homeId); + print(result); +} catch (e) { + print('Exception when calling AlarmApi->alarmDeleteAllForHome: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **homeId** | **String**| Home Id | + +### Return type + +**String** + +### 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) + +# **alarmGetAll** +> List alarmGetAll(homeId) + +Get all alarm modes for the specified home + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = AlarmApi(); +final homeId = homeId_example; // String | Home Id + +try { + final result = api_instance.alarmGetAll(homeId); + print(result); +} catch (e) { + print('Exception when calling AlarmApi->alarmGetAll: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **homeId** | **String**| Home Id | + +### Return type + +[**List**](AlarmModeDTO.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) + +# **alarmGetDetail** +> AlarmModeDetailDTO alarmGetDetail(alarmId, alarmModeId) + +Get detail info of a specified alarm mode + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = AlarmApi(); +final alarmId = alarmId_example; // String | +final alarmModeId = alarmModeId_example; // String | alarm id + +try { + final result = api_instance.alarmGetDetail(alarmId, alarmModeId); + print(result); +} catch (e) { + print('Exception when calling AlarmApi->alarmGetDetail: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **alarmId** | **String**| | + **alarmModeId** | **String**| alarm id | [optional] + +### Return type + +[**AlarmModeDetailDTO**](AlarmModeDetailDTO.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) + +# **alarmUpdate** +> AlarmModeDetailDTO alarmUpdate(alarmModeCreateOrUpdateDetailDTO) + +Update an alarm mode + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = AlarmApi(); +final alarmModeCreateOrUpdateDetailDTO = AlarmModeCreateOrUpdateDetailDTO(); // AlarmModeCreateOrUpdateDetailDTO | alarm mode to update + +try { + final result = api_instance.alarmUpdate(alarmModeCreateOrUpdateDetailDTO); + print(result); +} catch (e) { + print('Exception when calling AlarmApi->alarmUpdate: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **alarmModeCreateOrUpdateDetailDTO** | [**AlarmModeCreateOrUpdateDetailDTO**](AlarmModeCreateOrUpdateDetailDTO.md)| alarm mode to update | + +### Return type + +[**AlarmModeDetailDTO**](AlarmModeDetailDTO.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/mycore_api/doc/AlarmMode.md b/mycore_api/doc/AlarmMode.md new file mode 100644 index 0000000..983297e --- /dev/null +++ b/mycore_api/doc/AlarmMode.md @@ -0,0 +1,28 @@ +# mycoreapi.model.AlarmMode + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**homeId** | **String** | | [optional] +**name** | **String** | | [optional] +**activated** | **bool** | | [optional] +**isDefault** | **bool** | | [optional] +**notification** | **bool** | | [optional] +**createdDate** | [**DateTime**](DateTime.md) | | [optional] +**updatedDate** | [**DateTime**](DateTime.md) | | [optional] +**type** | [**AlarmType**](AlarmType.md) | | [optional] +**programmedMode** | [**OneOfProgrammedMode**](OneOfProgrammedMode.md) | | [optional] +**geolocalizedMode** | [**OneOfGeolocalizedMode**](OneOfGeolocalizedMode.md) | | [optional] +**triggers** | [**List**](Trigger.md) | | [optional] [default to const []] +**actions** | [**List**](Action.md) | | [optional] [default to const []] +**devicesIds** | **List** | | [optional] [default to const []] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTO.md b/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTO.md new file mode 100644 index 0000000..e0608f3 --- /dev/null +++ b/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTO.md @@ -0,0 +1,27 @@ +# mycoreapi.model.AlarmModeCreateOrUpdateDetailDTO + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**homeId** | **String** | | [optional] +**name** | **String** | | [optional] +**type** | [**AlarmType**](AlarmType.md) | | [optional] +**activated** | **bool** | | [optional] +**isDefault** | **bool** | | [optional] +**notification** | **bool** | | [optional] +**createdDate** | [**DateTime**](DateTime.md) | | [optional] +**updatedDate** | [**DateTime**](DateTime.md) | | [optional] +**triggers** | [**List**](Trigger.md) | | [optional] [default to const []] +**actions** | [**List**](Action.md) | | [optional] [default to const []] +**programmedMode** | [**OneOfProgrammedMode**](OneOfProgrammedMode.md) | | [optional] +**geolocalizedMode** | [**OneOfGeolocalizedMode**](OneOfGeolocalizedMode.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTOAllOf.md b/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTOAllOf.md new file mode 100644 index 0000000..d8dbab5 --- /dev/null +++ b/mycore_api/doc/AlarmModeCreateOrUpdateDetailDTOAllOf.md @@ -0,0 +1,18 @@ +# mycoreapi.model.AlarmModeCreateOrUpdateDetailDTOAllOf + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**triggers** | [**List**](Trigger.md) | | [optional] [default to const []] +**actions** | [**List**](Action.md) | | [optional] [default to const []] +**programmedMode** | [**OneOfProgrammedMode**](OneOfProgrammedMode.md) | | [optional] +**geolocalizedMode** | [**OneOfGeolocalizedMode**](OneOfGeolocalizedMode.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/AlarmModeDTO.md b/mycore_api/doc/AlarmModeDTO.md new file mode 100644 index 0000000..5a2da17 --- /dev/null +++ b/mycore_api/doc/AlarmModeDTO.md @@ -0,0 +1,23 @@ +# mycoreapi.model.AlarmModeDTO + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**homeId** | **String** | | [optional] +**name** | **String** | | [optional] +**type** | [**AlarmType**](AlarmType.md) | | [optional] +**activated** | **bool** | | [optional] +**isDefault** | **bool** | | [optional] +**notification** | **bool** | | [optional] +**createdDate** | [**DateTime**](DateTime.md) | | [optional] +**updatedDate** | [**DateTime**](DateTime.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/AlarmModeDetailDTO.md b/mycore_api/doc/AlarmModeDetailDTO.md new file mode 100644 index 0000000..7079e79 --- /dev/null +++ b/mycore_api/doc/AlarmModeDetailDTO.md @@ -0,0 +1,27 @@ +# mycoreapi.model.AlarmModeDetailDTO + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**homeId** | **String** | | [optional] +**name** | **String** | | [optional] +**type** | [**AlarmType**](AlarmType.md) | | [optional] +**activated** | **bool** | | [optional] +**isDefault** | **bool** | | [optional] +**notification** | **bool** | | [optional] +**createdDate** | [**DateTime**](DateTime.md) | | [optional] +**updatedDate** | [**DateTime**](DateTime.md) | | [optional] +**triggers** | [**List**](Trigger.md) | | [optional] [default to const []] +**devices** | [**List**](DeviceDetailDTO.md) | | [optional] [default to const []] +**programmedMode** | [**OneOfProgrammedMode**](OneOfProgrammedMode.md) | | [optional] +**geolocalizedMode** | [**OneOfGeolocalizedMode**](OneOfGeolocalizedMode.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/AlarmModeDetailDTOAllOf.md b/mycore_api/doc/AlarmModeDetailDTOAllOf.md new file mode 100644 index 0000000..9b4ab2b --- /dev/null +++ b/mycore_api/doc/AlarmModeDetailDTOAllOf.md @@ -0,0 +1,18 @@ +# mycoreapi.model.AlarmModeDetailDTOAllOf + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**triggers** | [**List**](Trigger.md) | | [optional] [default to const []] +**devices** | [**List**](DeviceDetailDTO.md) | | [optional] [default to const []] +**programmedMode** | [**OneOfProgrammedMode**](OneOfProgrammedMode.md) | | [optional] +**geolocalizedMode** | [**OneOfGeolocalizedMode**](OneOfGeolocalizedMode.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/AlarmTriggered.md b/mycore_api/doc/AlarmTriggered.md new file mode 100644 index 0000000..ce21e22 --- /dev/null +++ b/mycore_api/doc/AlarmTriggered.md @@ -0,0 +1,17 @@ +# mycoreapi.model.AlarmTriggered + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**alarmModeId** | **String** | | [optional] +**alarmModeName** | **String** | | [optional] +**type** | [**AlarmType**](AlarmType.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/AlarmType.md b/mycore_api/doc/AlarmType.md new file mode 100644 index 0000000..1f4bf4f --- /dev/null +++ b/mycore_api/doc/AlarmType.md @@ -0,0 +1,14 @@ +# mycoreapi.model.AlarmType + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/AuthenticationApi.md b/mycore_api/doc/AuthenticationApi.md index d322452..327c52c 100644 --- a/mycore_api/doc/AuthenticationApi.md +++ b/mycore_api/doc/AuthenticationApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/AutomationApi.md b/mycore_api/doc/AutomationApi.md index 3ed0854..0f8f01b 100644 --- a/mycore_api/doc/AutomationApi.md +++ b/mycore_api/doc/AutomationApi.md @@ -5,20 +5,20 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- [**automationCreate**](AutomationApi.md#automationcreate) | **POST** /api/automation | Create an automation [**automationDelete**](AutomationApi.md#automationdelete) | **DELETE** /api/automation/{automationId} | Delete an automation -[**automationDeleteAllForUser**](AutomationApi.md#automationdeleteallforuser) | **DELETE** /api/automation/user/{userId} | Delete all automation for a specified -[**automationGetAll**](AutomationApi.md#automationgetall) | **GET** /api/automation/{userId} | Get all automations for the specified user +[**automationDeleteAllForHome**](AutomationApi.md#automationdeleteallforhome) | **DELETE** /api/automation/home/{homeId} | Delete all automation for a specified home +[**automationGetAll**](AutomationApi.md#automationgetall) | **GET** /api/automation/{homeId} | Get all automations for the specified home [**automationGetDetail**](AutomationApi.md#automationgetdetail) | **GET** /api/automation/detail/{automationId} | Get detail info of a specified automation [**automationUpdate**](AutomationApi.md#automationupdate) | **PUT** /api/automation | Update an automation # **automationCreate** -> AutomationDTO automationCreate(automationCreateOrUpdateDetailDTO) +> AutomationDTO automationCreate(automationDetailDTO) Create an automation @@ -29,10 +29,10 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = AutomationApi(); -final automationCreateOrUpdateDetailDTO = AutomationCreateOrUpdateDetailDTO(); // AutomationCreateOrUpdateDetailDTO | Automation to create +final automationDetailDTO = AutomationDetailDTO(); // AutomationDetailDTO | Automation to create try { - final result = api_instance.automationCreate(automationCreateOrUpdateDetailDTO); + final result = api_instance.automationCreate(automationDetailDTO); print(result); } catch (e) { print('Exception when calling AutomationApi->automationCreate: $e\n'); @@ -43,7 +43,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **automationCreateOrUpdateDetailDTO** | [**AutomationCreateOrUpdateDetailDTO**](AutomationCreateOrUpdateDetailDTO.md)| Automation to create | + **automationDetailDTO** | [**AutomationDetailDTO**](AutomationDetailDTO.md)| Automation to create | ### Return type @@ -103,10 +103,10 @@ 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) -# **automationDeleteAllForUser** -> String automationDeleteAllForUser(userId) +# **automationDeleteAllForHome** +> String automationDeleteAllForHome(homeId) -Delete all automation for a specified +Delete all automation for a specified home ### Example ```dart @@ -115,13 +115,13 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = AutomationApi(); -final userId = userId_example; // String | Id of user +final homeId = homeId_example; // String | Home Id try { - final result = api_instance.automationDeleteAllForUser(userId); + final result = api_instance.automationDeleteAllForHome(homeId); print(result); } catch (e) { - print('Exception when calling AutomationApi->automationDeleteAllForUser: $e\n'); + print('Exception when calling AutomationApi->automationDeleteAllForHome: $e\n'); } ``` @@ -129,7 +129,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| Id of user | + **homeId** | **String**| Home Id | ### Return type @@ -147,9 +147,9 @@ 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) # **automationGetAll** -> List automationGetAll(userId) +> List automationGetAll(homeId) -Get all automations for the specified user +Get all automations for the specified home ### Example ```dart @@ -158,10 +158,10 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = AutomationApi(); -final userId = userId_example; // String | Id of user +final homeId = homeId_example; // String | Home Id try { - final result = api_instance.automationGetAll(userId); + final result = api_instance.automationGetAll(homeId); print(result); } catch (e) { print('Exception when calling AutomationApi->automationGetAll: $e\n'); @@ -172,11 +172,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| Id of user | + **homeId** | **String**| Home Id | ### Return type -[**List**](RoomSummaryDTO.md) +[**List**](AutomationDTO.md) ### Authorization @@ -233,7 +233,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) # **automationUpdate** -> AutomationCreateOrUpdateDetailDTO automationUpdate(automationCreateOrUpdateDetailDTO) +> AutomationDetailDTO automationUpdate(automationDetailDTO) Update an automation @@ -244,10 +244,10 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = AutomationApi(); -final automationCreateOrUpdateDetailDTO = AutomationCreateOrUpdateDetailDTO(); // AutomationCreateOrUpdateDetailDTO | automation to update +final automationDetailDTO = AutomationDetailDTO(); // AutomationDetailDTO | automation to update try { - final result = api_instance.automationUpdate(automationCreateOrUpdateDetailDTO); + final result = api_instance.automationUpdate(automationDetailDTO); print(result); } catch (e) { print('Exception when calling AutomationApi->automationUpdate: $e\n'); @@ -258,11 +258,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **automationCreateOrUpdateDetailDTO** | [**AutomationCreateOrUpdateDetailDTO**](AutomationCreateOrUpdateDetailDTO.md)| automation to update | + **automationDetailDTO** | [**AutomationDetailDTO**](AutomationDetailDTO.md)| automation to update | ### Return type -[**AutomationCreateOrUpdateDetailDTO**](AutomationCreateOrUpdateDetailDTO.md) +[**AutomationDetailDTO**](AutomationDetailDTO.md) ### Authorization diff --git a/mycore_api/doc/AutomationDTO.md b/mycore_api/doc/AutomationDTO.md index 5e17714..4d167e4 100644 --- a/mycore_api/doc/AutomationDTO.md +++ b/mycore_api/doc/AutomationDTO.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **id** | **String** | | [optional] **name** | **String** | | [optional] **active** | **bool** | | [optional] -**userId** | **String** | | [optional] +**homeId** | **String** | | [optional] **createdDate** | [**DateTime**](DateTime.md) | | [optional] **updatedDate** | [**DateTime**](DateTime.md) | | [optional] diff --git a/mycore_api/doc/AutomationDetailDTO.md b/mycore_api/doc/AutomationDetailDTO.md index 0ad0030..5c95094 100644 --- a/mycore_api/doc/AutomationDetailDTO.md +++ b/mycore_api/doc/AutomationDetailDTO.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **id** | **String** | | [optional] **name** | **String** | | [optional] **active** | **bool** | | [optional] -**userId** | **String** | | [optional] +**homeId** | **String** | | [optional] **createdDate** | [**DateTime**](DateTime.md) | | [optional] **updatedDate** | [**DateTime**](DateTime.md) | | [optional] **triggers** | [**List**](Trigger.md) | | [optional] [default to const []] diff --git a/mycore_api/doc/AutomationTriggered.md b/mycore_api/doc/AutomationTriggered.md new file mode 100644 index 0000000..12a5484 --- /dev/null +++ b/mycore_api/doc/AutomationTriggered.md @@ -0,0 +1,16 @@ +# mycoreapi.model.AutomationTriggered + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**automationId** | **String** | | [optional] +**automationName** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/AzureApi.md b/mycore_api/doc/AzureApi.md index fddaa58..53812e2 100644 --- a/mycore_api/doc/AzureApi.md +++ b/mycore_api/doc/AzureApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/BooksApi.md b/mycore_api/doc/BooksApi.md index 640b94a..f3af77f 100644 --- a/mycore_api/doc/BooksApi.md +++ b/mycore_api/doc/BooksApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/CreateOrUpdateHomeDTO.md b/mycore_api/doc/CreateOrUpdateHomeDTO.md new file mode 100644 index 0000000..537a60d --- /dev/null +++ b/mycore_api/doc/CreateOrUpdateHomeDTO.md @@ -0,0 +1,22 @@ +# mycoreapi.model.CreateOrUpdateHomeDTO + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**isAlarm** | **bool** | | [optional] +**isDefault** | **bool** | | [optional] +**currentAlarmMode** | [**OneOfAlarmModeDTO**](OneOfAlarmModeDTO.md) | | [optional] +**createdDate** | [**DateTime**](DateTime.md) | | [optional] +**updatedDate** | [**DateTime**](DateTime.md) | | [optional] +**usersIds** | **List** | | [optional] [default to const []] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/CreateOrUpdateHomeDTOAllOf.md b/mycore_api/doc/CreateOrUpdateHomeDTOAllOf.md new file mode 100644 index 0000000..b34361e --- /dev/null +++ b/mycore_api/doc/CreateOrUpdateHomeDTOAllOf.md @@ -0,0 +1,15 @@ +# mycoreapi.model.CreateOrUpdateHomeDTOAllOf + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**usersIds** | **List** | | [optional] [default to const []] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/DeviceApi.md b/mycore_api/doc/DeviceApi.md index 2af1629..f477f52 100644 --- a/mycore_api/doc/DeviceApi.md +++ b/mycore_api/doc/DeviceApi.md @@ -5,20 +5,20 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- [**deviceCreate**](DeviceApi.md#devicecreate) | **POST** /api/device | Create a device -[**deviceCreateDevicesFromProvider**](DeviceApi.md#devicecreatedevicesfromprovider) | **POST** /api/device/{userId}/fromProvider/{providerId} | Create devices from provider +[**deviceCreateDevicesFromProvider**](DeviceApi.md#devicecreatedevicesfromprovider) | **POST** /api/device/{homeId}/fromProvider/{providerId} | Create devices from provider [**deviceDelete**](DeviceApi.md#devicedelete) | **DELETE** /api/device/{deviceId} | Delete a device -[**deviceDeleteAllForUser**](DeviceApi.md#devicedeleteallforuser) | **DELETE** /api/device/user/{userId} | Delete all device for a specified user -[**deviceDeleteDevicesFromProvider**](DeviceApi.md#devicedeletedevicesfromprovider) | **DELETE** /api/device/{userId}/fromProvider/{providerId} | Delete devices from provider -[**deviceGetAll**](DeviceApi.md#devicegetall) | **GET** /api/device/{userId} | Get all devices summary +[**deviceDeleteAllForHome**](DeviceApi.md#devicedeleteallforhome) | **DELETE** /api/device/home/{homeId} | Delete all device for a specified home +[**deviceDeleteDevicesFromProvider**](DeviceApi.md#devicedeletedevicesfromprovider) | **DELETE** /api/device/{homeId}/fromProvider/{providerId} | Delete devices from provider +[**deviceGetAll**](DeviceApi.md#devicegetall) | **GET** /api/device/{homeId} | Get all devices summary [**deviceGetDetail**](DeviceApi.md#devicegetdetail) | **GET** /api/device/detail/{deviceId} | Get a specific device info -[**deviceGetDevicesByType**](DeviceApi.md#devicegetdevicesbytype) | **GET** /api/device/{userId}/type/{type} | Get list of devices from a type -[**deviceGetDevicesFromProvider**](DeviceApi.md#devicegetdevicesfromprovider) | **GET** /api/device/{userId}/fromProvider/{providerId} | Get devices from provider -[**deviceGetDevicesFromZigbee2Mqtt**](DeviceApi.md#devicegetdevicesfromzigbee2mqtt) | **GET** /api/device/zigbee2Mqtt/{userId} | Get all zigbee2Mqtt devices +[**deviceGetDevicesByType**](DeviceApi.md#devicegetdevicesbytype) | **GET** /api/device/{homeId}/type/{type} | Get list of devices from a type +[**deviceGetDevicesFromProvider**](DeviceApi.md#devicegetdevicesfromprovider) | **GET** /api/device/{homeId}/fromProvider/{providerId} | Get devices from provider +[**deviceGetDevicesFromZigbee2Mqtt**](DeviceApi.md#devicegetdevicesfromzigbee2mqtt) | **GET** /api/device/zigbee2Mqtt/{homeId} | Get all zigbee2Mqtt devices [**deviceUpdate**](DeviceApi.md#deviceupdate) | **PUT** /api/device/{deviceId} | Update a device @@ -66,7 +66,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) # **deviceCreateDevicesFromProvider** -> List deviceCreateDevicesFromProvider(userId, providerId) +> List deviceCreateDevicesFromProvider(homeId, providerId) Create devices from provider @@ -77,11 +77,11 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = DeviceApi(); -final userId = userId_example; // String | User Id +final homeId = homeId_example; // String | Home Id final providerId = providerId_example; // String | Id of Provider try { - final result = api_instance.deviceCreateDevicesFromProvider(userId, providerId); + final result = api_instance.deviceCreateDevicesFromProvider(homeId, providerId); print(result); } catch (e) { print('Exception when calling DeviceApi->deviceCreateDevicesFromProvider: $e\n'); @@ -92,7 +92,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| User Id | + **homeId** | **String**| Home Id | **providerId** | **String**| Id of Provider | ### Return type @@ -153,10 +153,10 @@ 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) -# **deviceDeleteAllForUser** -> String deviceDeleteAllForUser(userId) +# **deviceDeleteAllForHome** +> String deviceDeleteAllForHome(homeId) -Delete all device for a specified user +Delete all device for a specified home ### Example ```dart @@ -165,13 +165,13 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = DeviceApi(); -final userId = userId_example; // String | Id of user +final homeId = homeId_example; // String | Id of home try { - final result = api_instance.deviceDeleteAllForUser(userId); + final result = api_instance.deviceDeleteAllForHome(homeId); print(result); } catch (e) { - print('Exception when calling DeviceApi->deviceDeleteAllForUser: $e\n'); + print('Exception when calling DeviceApi->deviceDeleteAllForHome: $e\n'); } ``` @@ -179,7 +179,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| Id of user | + **homeId** | **String**| Id of home | ### Return type @@ -197,7 +197,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) # **deviceDeleteDevicesFromProvider** -> String deviceDeleteDevicesFromProvider(userId, providerId) +> String deviceDeleteDevicesFromProvider(homeId, providerId) Delete devices from provider @@ -208,11 +208,11 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = DeviceApi(); -final userId = userId_example; // String | User Id +final homeId = homeId_example; // String | Home Id final providerId = providerId_example; // String | Id of Provider try { - final result = api_instance.deviceDeleteDevicesFromProvider(userId, providerId); + final result = api_instance.deviceDeleteDevicesFromProvider(homeId, providerId); print(result); } catch (e) { print('Exception when calling DeviceApi->deviceDeleteDevicesFromProvider: $e\n'); @@ -223,7 +223,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| User Id | + **homeId** | **String**| Home Id | **providerId** | **String**| Id of Provider | ### Return type @@ -242,7 +242,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) # **deviceGetAll** -> List deviceGetAll(userId) +> List deviceGetAll(homeId) Get all devices summary @@ -253,10 +253,10 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = DeviceApi(); -final userId = userId_example; // String | Id of user +final homeId = homeId_example; // String | Home Id try { - final result = api_instance.deviceGetAll(userId); + final result = api_instance.deviceGetAll(homeId); print(result); } catch (e) { print('Exception when calling DeviceApi->deviceGetAll: $e\n'); @@ -267,7 +267,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| Id of user | + **homeId** | **String**| Home Id | ### Return type @@ -328,7 +328,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) # **deviceGetDevicesByType** -> List deviceGetDevicesByType(userId, type) +> List deviceGetDevicesByType(homeId, type) Get list of devices from a type @@ -339,11 +339,11 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = DeviceApi(); -final userId = userId_example; // String | user Id +final homeId = homeId_example; // String | Home Id final type = ; // DeviceType | device type try { - final result = api_instance.deviceGetDevicesByType(userId, type); + final result = api_instance.deviceGetDevicesByType(homeId, type); print(result); } catch (e) { print('Exception when calling DeviceApi->deviceGetDevicesByType: $e\n'); @@ -354,7 +354,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| user Id | + **homeId** | **String**| Home Id | **type** | [**DeviceType**](.md)| device type | ### Return type @@ -373,7 +373,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) # **deviceGetDevicesFromProvider** -> List deviceGetDevicesFromProvider(userId, providerId) +> List deviceGetDevicesFromProvider(homeId, providerId) Get devices from provider @@ -384,11 +384,11 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = DeviceApi(); -final userId = userId_example; // String | User Id +final homeId = homeId_example; // String | Home Id final providerId = providerId_example; // String | Id of Provider try { - final result = api_instance.deviceGetDevicesFromProvider(userId, providerId); + final result = api_instance.deviceGetDevicesFromProvider(homeId, providerId); print(result); } catch (e) { print('Exception when calling DeviceApi->deviceGetDevicesFromProvider: $e\n'); @@ -399,7 +399,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| User Id | + **homeId** | **String**| Home Id | **providerId** | **String**| Id of Provider | ### Return type @@ -418,7 +418,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) # **deviceGetDevicesFromZigbee2Mqtt** -> List deviceGetDevicesFromZigbee2Mqtt(userId) +> List deviceGetDevicesFromZigbee2Mqtt(homeId) Get all zigbee2Mqtt devices @@ -429,10 +429,10 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = DeviceApi(); -final userId = userId_example; // String | User Id +final homeId = homeId_example; // String | Home Id try { - final result = api_instance.deviceGetDevicesFromZigbee2Mqtt(userId); + final result = api_instance.deviceGetDevicesFromZigbee2Mqtt(homeId); print(result); } catch (e) { print('Exception when calling DeviceApi->deviceGetDevicesFromZigbee2Mqtt: $e\n'); @@ -443,7 +443,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| User Id | + **homeId** | **String**| Home Id | ### Return type diff --git a/mycore_api/doc/DeviceDetailDTO.md b/mycore_api/doc/DeviceDetailDTO.md index dd56035..ea98169 100644 --- a/mycore_api/doc/DeviceDetailDTO.md +++ b/mycore_api/doc/DeviceDetailDTO.md @@ -9,17 +9,16 @@ import 'package:mycoreapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] -**userId** | **String** | | [optional] +**homeId** | **String** | | [optional] **description** | **String** | | [optional] **name** | **String** | | [optional] **model** | **String** | | [optional] **type** | [**DeviceType**](DeviceType.md) | | [optional] **status** | **bool** | | [optional] **connectionStatus** | [**ConnectionStatus**](ConnectionStatus.md) | | [optional] -**locationId** | **String** | | [optional] +**roomId** | **String** | | [optional] **providerId** | **String** | | [optional] **providerName** | **String** | | [optional] -**location** | [**OneOfPlaceDTO**](OneOfPlaceDTO.md) | | [optional] **lastStateDate** | [**DateTime**](DateTime.md) | | [optional] **battery** | **bool** | | [optional] **batteryStatus** | **int** | | [optional] diff --git a/mycore_api/doc/DeviceState.md b/mycore_api/doc/DeviceState.md new file mode 100644 index 0000000..930d187 --- /dev/null +++ b/mycore_api/doc/DeviceState.md @@ -0,0 +1,18 @@ +# mycoreapi.model.DeviceState + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**deviceId** | **String** | | [optional] +**deviceName** | **String** | | [optional] +**message** | **String** | | [optional] +**deviceType** | [**DeviceType**](DeviceType.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/DeviceSummaryDTO.md b/mycore_api/doc/DeviceSummaryDTO.md index c642a75..34560ab 100644 --- a/mycore_api/doc/DeviceSummaryDTO.md +++ b/mycore_api/doc/DeviceSummaryDTO.md @@ -9,17 +9,16 @@ import 'package:mycoreapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] -**userId** | **String** | | [optional] +**homeId** | **String** | | [optional] **description** | **String** | | [optional] **name** | **String** | | [optional] **model** | **String** | | [optional] **type** | [**DeviceType**](DeviceType.md) | | [optional] **status** | **bool** | | [optional] **connectionStatus** | [**ConnectionStatus**](ConnectionStatus.md) | | [optional] -**locationId** | **String** | | [optional] +**roomId** | **String** | | [optional] **providerId** | **String** | | [optional] **providerName** | **String** | | [optional] -**location** | [**OneOfPlaceDTO**](OneOfPlaceDTO.md) | | [optional] **lastStateDate** | [**DateTime**](DateTime.md) | | [optional] **battery** | **bool** | | [optional] **batteryStatus** | **int** | | [optional] diff --git a/mycore_api/doc/ElectricityProduction.md b/mycore_api/doc/ElectricityProduction.md index c362d02..208fd2e 100644 --- a/mycore_api/doc/ElectricityProduction.md +++ b/mycore_api/doc/ElectricityProduction.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] **deviceId** | **String** | | [optional] -**userId** | **String** | | [optional] +**homeId** | **String** | | [optional] **watt** | **double** | | [optional] **ampere** | **double** | | [optional] **timestamp** | [**DateTime**](DateTime.md) | | [optional] diff --git a/mycore_api/doc/EnergyApi.md b/mycore_api/doc/EnergyApi.md index bc037ab..a96eb19 100644 --- a/mycore_api/doc/EnergyApi.md +++ b/mycore_api/doc/EnergyApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -13,7 +13,7 @@ Method | HTTP request | Description # **energyGetElectricityProduction** -> List energyGetElectricityProduction(userId, viewBy) +> List energyGetElectricityProduction(homeId, viewBy) Get summary production of Kwh/Year @@ -24,11 +24,11 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = EnergyApi(); -final userId = userId_example; // String | +final homeId = homeId_example; // String | final viewBy = ; // ViewBy | try { - final result = api_instance.energyGetElectricityProduction(userId, viewBy); + final result = api_instance.energyGetElectricityProduction(homeId, viewBy); print(result); } catch (e) { print('Exception when calling EnergyApi->energyGetElectricityProduction: $e\n'); @@ -39,7 +39,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| | [optional] + **homeId** | **String**| | [optional] **viewBy** | [**ViewBy**](.md)| | [optional] ### Return type diff --git a/mycore_api/doc/EventApi.md b/mycore_api/doc/EventApi.md new file mode 100644 index 0000000..5944a55 --- /dev/null +++ b/mycore_api/doc/EventApi.md @@ -0,0 +1,205 @@ +# mycoreapi.api.EventApi + +## Load the API package +```dart +import 'package:mycoreapi/api.dart'; +``` + +All URIs are relative to *http://192.168.31.140* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**eventDelete**](EventApi.md#eventdelete) | **DELETE** /api/event/{eventId} | Delete an event +[**eventDeleteAllForHome**](EventApi.md#eventdeleteallforhome) | **DELETE** /api/event/home/{homeId} | Delete all events for a specified home +[**eventGet**](EventApi.md#eventget) | **GET** /api/event/{homeId} | Get events for the specified home +[**eventGetDetail**](EventApi.md#eventgetdetail) | **GET** /api/event/detail/{eventId} | Get detail info of a specified event + + +# **eventDelete** +> String eventDelete(eventId) + +Delete an event + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = EventApi(); +final eventId = eventId_example; // String | Id of event to delete + +try { + final result = api_instance.eventDelete(eventId); + print(result); +} catch (e) { + print('Exception when calling EventApi->eventDelete: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **eventId** | **String**| Id of event to delete | + +### Return type + +**String** + +### 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) + +# **eventDeleteAllForHome** +> String eventDeleteAllForHome(homeId) + +Delete all events for a specified home + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = EventApi(); +final homeId = homeId_example; // String | Home Id + +try { + final result = api_instance.eventDeleteAllForHome(homeId); + print(result); +} catch (e) { + print('Exception when calling EventApi->eventDeleteAllForHome: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **homeId** | **String**| Home Id | + +### Return type + +**String** + +### 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) + +# **eventGet** +> List eventGet(homeId, deviceId, roomId, startIndex, count, dateStart, dateEnd, eventType, deviceType) + +Get events for the specified home + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = EventApi(); +final homeId = homeId_example; // String | Home Id +final deviceId = deviceId_example; // String | +final roomId = roomId_example; // String | +final startIndex = 56; // int | +final count = 56; // int | +final dateStart = 2013-10-20T19:20:30+01:00; // DateTime | +final dateEnd = 2013-10-20T19:20:30+01:00; // DateTime | +final eventType = ; // OneOfEventType | +final deviceType = ; // OneOfDeviceType | + +try { + final result = api_instance.eventGet(homeId, deviceId, roomId, startIndex, count, dateStart, dateEnd, eventType, deviceType); + print(result); +} catch (e) { + print('Exception when calling EventApi->eventGet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **homeId** | **String**| Home Id | + **deviceId** | **String**| | [optional] + **roomId** | **String**| | [optional] + **startIndex** | **int**| | [optional] + **count** | **int**| | [optional] + **dateStart** | **DateTime**| | [optional] + **dateEnd** | **DateTime**| | [optional] + **eventType** | [**OneOfEventType**](.md)| | [optional] + **deviceType** | [**OneOfDeviceType**](.md)| | [optional] + +### Return type + +[**List**](EventDetailDTO.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) + +# **eventGetDetail** +> EventDetailDTO eventGetDetail(eventId) + +Get detail info of a specified event + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = EventApi(); +final eventId = eventId_example; // String | event id + +try { + final result = api_instance.eventGetDetail(eventId); + print(result); +} catch (e) { + print('Exception when calling EventApi->eventGetDetail: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **eventId** | **String**| event id | + +### Return type + +[**EventDetailDTO**](EventDetailDTO.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) + diff --git a/mycore_api/doc/EventDTO.md b/mycore_api/doc/EventDTO.md new file mode 100644 index 0000000..12ff11c --- /dev/null +++ b/mycore_api/doc/EventDTO.md @@ -0,0 +1,19 @@ +# mycoreapi.model.EventDTO + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**homeId** | **String** | | [optional] +**date** | [**DateTime**](DateTime.md) | | [optional] +**type** | [**EventType**](EventType.md) | | [optional] +**roomId** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/EventDetailDTO.md b/mycore_api/doc/EventDetailDTO.md new file mode 100644 index 0000000..2b065ea --- /dev/null +++ b/mycore_api/doc/EventDetailDTO.md @@ -0,0 +1,22 @@ +# mycoreapi.model.EventDetailDTO + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**homeId** | **String** | | [optional] +**date** | [**DateTime**](DateTime.md) | | [optional] +**type** | [**EventType**](EventType.md) | | [optional] +**roomId** | **String** | | [optional] +**deviceState** | [**OneOfDeviceState**](OneOfDeviceState.md) | | [optional] +**automationTriggered** | [**OneOfAutomationTriggered**](OneOfAutomationTriggered.md) | | [optional] +**alarmTriggered** | [**OneOfAlarmTriggered**](OneOfAlarmTriggered.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/EventDetailDTOAllOf.md b/mycore_api/doc/EventDetailDTOAllOf.md new file mode 100644 index 0000000..9abd25a --- /dev/null +++ b/mycore_api/doc/EventDetailDTOAllOf.md @@ -0,0 +1,17 @@ +# mycoreapi.model.EventDetailDTOAllOf + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**deviceState** | [**OneOfDeviceState**](OneOfDeviceState.md) | | [optional] +**automationTriggered** | [**OneOfAutomationTriggered**](OneOfAutomationTriggered.md) | | [optional] +**alarmTriggered** | [**OneOfAlarmTriggered**](OneOfAlarmTriggered.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/EventType.md b/mycore_api/doc/EventType.md new file mode 100644 index 0000000..e2b757d --- /dev/null +++ b/mycore_api/doc/EventType.md @@ -0,0 +1,14 @@ +# mycoreapi.model.EventType + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/FacebookApi.md b/mycore_api/doc/FacebookApi.md index 6683ab2..189a21b 100644 --- a/mycore_api/doc/FacebookApi.md +++ b/mycore_api/doc/FacebookApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/GeolocalizedMode.md b/mycore_api/doc/GeolocalizedMode.md new file mode 100644 index 0000000..6756db9 --- /dev/null +++ b/mycore_api/doc/GeolocalizedMode.md @@ -0,0 +1,18 @@ +# mycoreapi.model.GeolocalizedMode + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**latitude** | **String** | | [optional] +**longitude** | **String** | | [optional] +**homeMode** | [**OneOfAlarmMode**](OneOfAlarmMode.md) | | [optional] +**absentMode** | [**OneOfAlarmMode**](OneOfAlarmMode.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/GoogleApi.md b/mycore_api/doc/GoogleApi.md index 783c600..29e2edb 100644 --- a/mycore_api/doc/GoogleApi.md +++ b/mycore_api/doc/GoogleApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/GroupApi.md b/mycore_api/doc/GroupApi.md index bcf716e..916e373 100644 --- a/mycore_api/doc/GroupApi.md +++ b/mycore_api/doc/GroupApi.md @@ -5,19 +5,19 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- [**groupCreate**](GroupApi.md#groupcreate) | **POST** /api/group | Create a group -[**groupCreateDevicesFromZigbee2Mqtt**](GroupApi.md#groupcreatedevicesfromzigbee2mqtt) | **POST** /api/group/{userId}/fromZigbee | Create groups from provider +[**groupCreateDevicesFromZigbee2Mqtt**](GroupApi.md#groupcreatedevicesfromzigbee2mqtt) | **POST** /api/group/{homeId}/fromZigbee | Create groups from provider [**groupDelete**](GroupApi.md#groupdelete) | **DELETE** /api/group/{groupId}/device/{deviceId} | Delete device from a group [**groupDelete2**](GroupApi.md#groupdelete2) | **DELETE** /api/group/{groupId} | Delete a group -[**groupDeleteAllForUser**](GroupApi.md#groupdeleteallforuser) | **DELETE** /api/group/user/{userId} | Delete all group for a specified -[**groupGetAll**](GroupApi.md#groupgetall) | **GET** /api/group/{userId} | Get all groups for the specified user +[**groupDeleteAllForHome**](GroupApi.md#groupdeleteallforhome) | **DELETE** /api/group/home/{homeId} | Delete all group for a specified home +[**groupGetAll**](GroupApi.md#groupgetall) | **GET** /api/group/{homeId} | Get all groups for the specified home [**groupGetDetail**](GroupApi.md#groupgetdetail) | **GET** /api/group/detail/{groupId} | Get detail info of a specified group -[**groupGetGroupsByType**](GroupApi.md#groupgetgroupsbytype) | **GET** /api/group/{userId}/type/{type} | Get list of group from a type -[**groupGetGroupsFromZigbee2Mqtt**](GroupApi.md#groupgetgroupsfromzigbee2mqtt) | **GET** /api/group/zigbee2Mqtt/{userId} | Get all zigbee2Mqtt groups +[**groupGetGroupsByType**](GroupApi.md#groupgetgroupsbytype) | **GET** /api/group/{homeId}/type/{type} | Get list of group from a type +[**groupGetGroupsFromZigbee2Mqtt**](GroupApi.md#groupgetgroupsfromzigbee2mqtt) | **GET** /api/group/zigbee2Mqtt/{homeId} | Get all zigbee2Mqtt groups [**groupUpdate**](GroupApi.md#groupupdate) | **PUT** /api/group | Update a group @@ -65,7 +65,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) # **groupCreateDevicesFromZigbee2Mqtt** -> List groupCreateDevicesFromZigbee2Mqtt(userId) +> List groupCreateDevicesFromZigbee2Mqtt(homeId) Create groups from provider @@ -76,10 +76,10 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = GroupApi(); -final userId = userId_example; // String | User Id +final homeId = homeId_example; // String | Home Id try { - final result = api_instance.groupCreateDevicesFromZigbee2Mqtt(userId); + final result = api_instance.groupCreateDevicesFromZigbee2Mqtt(homeId); print(result); } catch (e) { print('Exception when calling GroupApi->groupCreateDevicesFromZigbee2Mqtt: $e\n'); @@ -90,7 +90,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| User Id | + **homeId** | **String**| Home Id | ### Return type @@ -195,10 +195,10 @@ 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) -# **groupDeleteAllForUser** -> String groupDeleteAllForUser(userId) +# **groupDeleteAllForHome** +> String groupDeleteAllForHome(homeId) -Delete all group for a specified +Delete all group for a specified home ### Example ```dart @@ -207,13 +207,13 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = GroupApi(); -final userId = userId_example; // String | Id of user +final homeId = homeId_example; // String | Home Id try { - final result = api_instance.groupDeleteAllForUser(userId); + final result = api_instance.groupDeleteAllForHome(homeId); print(result); } catch (e) { - print('Exception when calling GroupApi->groupDeleteAllForUser: $e\n'); + print('Exception when calling GroupApi->groupDeleteAllForHome: $e\n'); } ``` @@ -221,7 +221,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| Id of user | + **homeId** | **String**| Home Id | ### Return type @@ -239,9 +239,9 @@ 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) # **groupGetAll** -> List groupGetAll(userId) +> List groupGetAll(homeId) -Get all groups for the specified user +Get all groups for the specified home ### Example ```dart @@ -250,10 +250,10 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = GroupApi(); -final userId = userId_example; // String | Id of user +final homeId = homeId_example; // String | Home Id try { - final result = api_instance.groupGetAll(userId); + final result = api_instance.groupGetAll(homeId); print(result); } catch (e) { print('Exception when calling GroupApi->groupGetAll: $e\n'); @@ -264,7 +264,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| Id of user | + **homeId** | **String**| Home Id | ### Return type @@ -325,7 +325,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) # **groupGetGroupsByType** -> List groupGetGroupsByType(userId, type) +> List groupGetGroupsByType(homeId, type) Get list of group from a type @@ -336,11 +336,11 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = GroupApi(); -final userId = userId_example; // String | user Id +final homeId = homeId_example; // String | home Id final type = type_example; // String | group type try { - final result = api_instance.groupGetGroupsByType(userId, type); + final result = api_instance.groupGetGroupsByType(homeId, type); print(result); } catch (e) { print('Exception when calling GroupApi->groupGetGroupsByType: $e\n'); @@ -351,7 +351,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| user Id | + **homeId** | **String**| home Id | **type** | **String**| group type | ### Return type @@ -370,7 +370,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) # **groupGetGroupsFromZigbee2Mqtt** -> List groupGetGroupsFromZigbee2Mqtt(userId) +> List groupGetGroupsFromZigbee2Mqtt(homeId) Get all zigbee2Mqtt groups @@ -381,10 +381,10 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = GroupApi(); -final userId = userId_example; // String | User Id +final homeId = homeId_example; // String | Home Id try { - final result = api_instance.groupGetGroupsFromZigbee2Mqtt(userId); + final result = api_instance.groupGetGroupsFromZigbee2Mqtt(homeId); print(result); } catch (e) { print('Exception when calling GroupApi->groupGetGroupsFromZigbee2Mqtt: $e\n'); @@ -395,7 +395,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| User Id | + **homeId** | **String**| Home Id | ### Return type diff --git a/mycore_api/doc/GroupCreateOrUpdateDetailDTO.md b/mycore_api/doc/GroupCreateOrUpdateDetailDTO.md index 3b60497..257392f 100644 --- a/mycore_api/doc/GroupCreateOrUpdateDetailDTO.md +++ b/mycore_api/doc/GroupCreateOrUpdateDetailDTO.md @@ -9,7 +9,7 @@ import 'package:mycoreapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] -**userId** | **String** | | [optional] +**homeId** | **String** | | [optional] **name** | **String** | | [optional] **type** | **String** | | [optional] **isAlarm** | **bool** | | [optional] diff --git a/mycore_api/doc/GroupDetailDTO.md b/mycore_api/doc/GroupDetailDTO.md index 3512ac6..288905c 100644 --- a/mycore_api/doc/GroupDetailDTO.md +++ b/mycore_api/doc/GroupDetailDTO.md @@ -9,7 +9,7 @@ import 'package:mycoreapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] -**userId** | **String** | | [optional] +**homeId** | **String** | | [optional] **name** | **String** | | [optional] **type** | **String** | | [optional] **isAlarm** | **bool** | | [optional] diff --git a/mycore_api/doc/GroupSummaryDTO.md b/mycore_api/doc/GroupSummaryDTO.md index 677b077..1e5caf5 100644 --- a/mycore_api/doc/GroupSummaryDTO.md +++ b/mycore_api/doc/GroupSummaryDTO.md @@ -9,7 +9,7 @@ import 'package:mycoreapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] -**userId** | **String** | | [optional] +**homeId** | **String** | | [optional] **name** | **String** | | [optional] **type** | **String** | | [optional] **isAlarm** | **bool** | | [optional] diff --git a/mycore_api/doc/HomeApi.md b/mycore_api/doc/HomeApi.md new file mode 100644 index 0000000..889a713 --- /dev/null +++ b/mycore_api/doc/HomeApi.md @@ -0,0 +1,233 @@ +# mycoreapi.api.HomeApi + +## Load the API package +```dart +import 'package:mycoreapi/api.dart'; +``` + +All URIs are relative to *http://192.168.31.140* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**homeCreate**](HomeApi.md#homecreate) | **POST** /api/home | Create a home +[**homeDelete**](HomeApi.md#homedelete) | **DELETE** /api/home/{homeId} | Delete a home +[**homeGetAll**](HomeApi.md#homegetall) | **GET** /api/home/{userId} | Get all home for specified user +[**homeGetDetail**](HomeApi.md#homegetdetail) | **GET** /api/home/detail/{homeId} | Get detail info of a specified home +[**homeUpdate**](HomeApi.md#homeupdate) | **PUT** /api/home | Update a home + + +# **homeCreate** +> HomeDTO homeCreate(createOrUpdateHomeDTO) + +Create a home + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = HomeApi(); +final createOrUpdateHomeDTO = CreateOrUpdateHomeDTO(); // CreateOrUpdateHomeDTO | Home to create + +try { + final result = api_instance.homeCreate(createOrUpdateHomeDTO); + print(result); +} catch (e) { + print('Exception when calling HomeApi->homeCreate: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **createOrUpdateHomeDTO** | [**CreateOrUpdateHomeDTO**](CreateOrUpdateHomeDTO.md)| Home to create | + +### Return type + +[**HomeDTO**](HomeDTO.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **homeDelete** +> String homeDelete(homeId) + +Delete a home + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = HomeApi(); +final homeId = homeId_example; // String | Id of home to delete + +try { + final result = api_instance.homeDelete(homeId); + print(result); +} catch (e) { + print('Exception when calling HomeApi->homeDelete: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **homeId** | **String**| Id of home to delete | + +### Return type + +**String** + +### 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) + +# **homeGetAll** +> List homeGetAll(userId) + +Get all home for specified user + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = HomeApi(); +final userId = userId_example; // String | User Id + +try { + final result = api_instance.homeGetAll(userId); + print(result); +} catch (e) { + print('Exception when calling HomeApi->homeGetAll: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **userId** | **String**| User Id | + +### Return type + +[**List**](HomeDTO.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) + +# **homeGetDetail** +> HomeDetailDTO homeGetDetail(homeId) + +Get detail info of a specified home + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = HomeApi(); +final homeId = homeId_example; // String | home id + +try { + final result = api_instance.homeGetDetail(homeId); + print(result); +} catch (e) { + print('Exception when calling HomeApi->homeGetDetail: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **homeId** | **String**| home id | + +### Return type + +[**HomeDetailDTO**](HomeDetailDTO.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) + +# **homeUpdate** +> HomeDTO homeUpdate(createOrUpdateHomeDTO) + +Update a home + +### Example +```dart +import 'package:mycoreapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = HomeApi(); +final createOrUpdateHomeDTO = CreateOrUpdateHomeDTO(); // CreateOrUpdateHomeDTO | Home to update + +try { + final result = api_instance.homeUpdate(createOrUpdateHomeDTO); + print(result); +} catch (e) { + print('Exception when calling HomeApi->homeUpdate: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **createOrUpdateHomeDTO** | [**CreateOrUpdateHomeDTO**](CreateOrUpdateHomeDTO.md)| Home to update | + +### Return type + +[**HomeDTO**](HomeDTO.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/mycore_api/doc/HomeDTO.md b/mycore_api/doc/HomeDTO.md new file mode 100644 index 0000000..177cc58 --- /dev/null +++ b/mycore_api/doc/HomeDTO.md @@ -0,0 +1,22 @@ +# mycoreapi.model.HomeDTO + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**isAlarm** | **bool** | | [optional] +**isDefault** | **bool** | | [optional] +**currentAlarmMode** | [**OneOfAlarmModeDTO**](OneOfAlarmModeDTO.md) | | [optional] +**createdDate** | [**DateTime**](DateTime.md) | | [optional] +**updatedDate** | [**DateTime**](DateTime.md) | | [optional] +**usersIds** | **List** | | [optional] [default to const []] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/HomeDetailDTO.md b/mycore_api/doc/HomeDetailDTO.md new file mode 100644 index 0000000..a3ee022 --- /dev/null +++ b/mycore_api/doc/HomeDetailDTO.md @@ -0,0 +1,27 @@ +# mycoreapi.model.HomeDetailDTO + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**isAlarm** | **bool** | | [optional] +**isDefault** | **bool** | | [optional] +**currentAlarmMode** | [**OneOfAlarmModeDTO**](OneOfAlarmModeDTO.md) | | [optional] +**createdDate** | [**DateTime**](DateTime.md) | | [optional] +**updatedDate** | [**DateTime**](DateTime.md) | | [optional] +**usersIds** | **List** | | [optional] [default to const []] +**users** | [**List**](UserInfoDetailDTO.md) | | [optional] [default to const []] +**devices** | [**List**](DeviceSummaryDTO.md) | | [optional] [default to const []] +**automations** | [**List**](AutomationDTO.md) | | [optional] [default to const []] +**providers** | [**List**](ProviderDTO.md) | | [optional] [default to const []] +**groups** | [**List**](GroupSummaryDTO.md) | | [optional] [default to const []] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/HomeDetailDTOAllOf.md b/mycore_api/doc/HomeDetailDTOAllOf.md new file mode 100644 index 0000000..beccd35 --- /dev/null +++ b/mycore_api/doc/HomeDetailDTOAllOf.md @@ -0,0 +1,19 @@ +# mycoreapi.model.HomeDetailDTOAllOf + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**users** | [**List**](UserInfoDetailDTO.md) | | [optional] [default to const []] +**devices** | [**List**](DeviceSummaryDTO.md) | | [optional] [default to const []] +**automations** | [**List**](AutomationDTO.md) | | [optional] [default to const []] +**providers** | [**List**](ProviderDTO.md) | | [optional] [default to const []] +**groups** | [**List**](GroupSummaryDTO.md) | | [optional] [default to const []] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/IOTApi.md b/mycore_api/doc/IOTApi.md index 519e912..c999c1f 100644 --- a/mycore_api/doc/IOTApi.md +++ b/mycore_api/doc/IOTApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/LayoutApi.md b/mycore_api/doc/LayoutApi.md index dd7d018..facfb02 100644 --- a/mycore_api/doc/LayoutApi.md +++ b/mycore_api/doc/LayoutApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/MQTTApi.md b/mycore_api/doc/MQTTApi.md index e8ca3ed..4d42331 100644 --- a/mycore_api/doc/MQTTApi.md +++ b/mycore_api/doc/MQTTApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/OddApi.md b/mycore_api/doc/OddApi.md index 307d47e..64f416c 100644 --- a/mycore_api/doc/OddApi.md +++ b/mycore_api/doc/OddApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/ProgrammedMode.md b/mycore_api/doc/ProgrammedMode.md new file mode 100644 index 0000000..e3fd09b --- /dev/null +++ b/mycore_api/doc/ProgrammedMode.md @@ -0,0 +1,21 @@ +# mycoreapi.model.ProgrammedMode + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**monday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] +**tuesday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] +**wednesday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] +**thursday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] +**friday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] +**saturday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] +**sunday** | [**List**](TimePeriodAlarm.md) | | [optional] [default to const []] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/ProviderApi.md b/mycore_api/doc/ProviderApi.md index 96068a7..bd1ecb6 100644 --- a/mycore_api/doc/ProviderApi.md +++ b/mycore_api/doc/ProviderApi.md @@ -5,13 +5,13 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- [**providerCreate**](ProviderApi.md#providercreate) | **POST** /api/provider | Create a provider [**providerDelete**](ProviderApi.md#providerdelete) | **DELETE** /api/provider/{providerId} | Delete a provider -[**providerGetAll**](ProviderApi.md#providergetall) | **GET** /api/provider/{userId} | Get all user providers +[**providerGetAll**](ProviderApi.md#providergetall) | **GET** /api/provider/{homeId} | Get all home providers [**providerUpdate**](ProviderApi.md#providerupdate) | **PUT** /api/provider | Update a provider @@ -102,9 +102,9 @@ 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) # **providerGetAll** -> List providerGetAll(userId) +> List providerGetAll(homeId) -Get all user providers +Get all home providers ### Example ```dart @@ -113,10 +113,10 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = ProviderApi(); -final userId = userId_example; // String | Id of user +final homeId = homeId_example; // String | Home Id try { - final result = api_instance.providerGetAll(userId); + final result = api_instance.providerGetAll(homeId); print(result); } catch (e) { print('Exception when calling ProviderApi->providerGetAll: $e\n'); @@ -127,7 +127,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| Id of user | + **homeId** | **String**| Home Id | ### Return type diff --git a/mycore_api/doc/ProviderDTO.md b/mycore_api/doc/ProviderDTO.md index 1c82d23..fe1e9cf 100644 --- a/mycore_api/doc/ProviderDTO.md +++ b/mycore_api/doc/ProviderDTO.md @@ -10,8 +10,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] **name** | **String** | | [optional] -**type** | **String** | | [optional] -**userId** | **String** | | [optional] +**type** | [**ProviderType**](ProviderType.md) | | [optional] +**homeId** | **String** | | [optional] **endpoint** | **String** | | [optional] **username** | **String** | | [optional] **password** | **String** | | [optional] diff --git a/mycore_api/doc/ProviderType.md b/mycore_api/doc/ProviderType.md new file mode 100644 index 0000000..2c1cccb --- /dev/null +++ b/mycore_api/doc/ProviderType.md @@ -0,0 +1,14 @@ +# mycoreapi.model.ProviderType + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/RoomApi.md b/mycore_api/doc/RoomApi.md index 77f2099..18d5321 100644 --- a/mycore_api/doc/RoomApi.md +++ b/mycore_api/doc/RoomApi.md @@ -5,15 +5,15 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- [**roomCreate**](RoomApi.md#roomcreate) | **POST** /api/room | Create a room [**roomDelete**](RoomApi.md#roomdelete) | **DELETE** /api/room/{roomId}/device/{deviceId} | Delete device from a room [**roomDelete2**](RoomApi.md#roomdelete2) | **DELETE** /api/room/{roomId} | Delete a room -[**roomDeleteAllForUser**](RoomApi.md#roomdeleteallforuser) | **DELETE** /api/room/user/{userId} | Delete all room for a specified user -[**roomGetAll**](RoomApi.md#roomgetall) | **GET** /api/room/{userId} | Get all rooms for the specified user +[**roomDeleteAllForHome**](RoomApi.md#roomdeleteallforhome) | **DELETE** /api/room/home/{homeId} | Delete all rooms for a specified home +[**roomGetAll**](RoomApi.md#roomgetall) | **GET** /api/room/{homeId} | Get all rooms for the specified home [**roomGetDetail**](RoomApi.md#roomgetdetail) | **GET** /api/room/detail/{roomId} | Get detail info of a specified room [**roomUpdate**](RoomApi.md#roomupdate) | **PUT** /api/room | Update a room @@ -149,10 +149,10 @@ 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) -# **roomDeleteAllForUser** -> String roomDeleteAllForUser(userId) +# **roomDeleteAllForHome** +> String roomDeleteAllForHome(homeId) -Delete all room for a specified user +Delete all rooms for a specified home ### Example ```dart @@ -161,13 +161,13 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = RoomApi(); -final userId = userId_example; // String | Id of user +final homeId = homeId_example; // String | Home Id try { - final result = api_instance.roomDeleteAllForUser(userId); + final result = api_instance.roomDeleteAllForHome(homeId); print(result); } catch (e) { - print('Exception when calling RoomApi->roomDeleteAllForUser: $e\n'); + print('Exception when calling RoomApi->roomDeleteAllForHome: $e\n'); } ``` @@ -175,7 +175,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| Id of user | + **homeId** | **String**| Home Id | ### Return type @@ -193,9 +193,9 @@ 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) # **roomGetAll** -> List roomGetAll(userId) +> List roomGetAll(homeId) -Get all rooms for the specified user +Get all rooms for the specified home ### Example ```dart @@ -204,10 +204,10 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = RoomApi(); -final userId = userId_example; // String | Id of user +final homeId = homeId_example; // String | Home Id try { - final result = api_instance.roomGetAll(userId); + final result = api_instance.roomGetAll(homeId); print(result); } catch (e) { print('Exception when calling RoomApi->roomGetAll: $e\n'); @@ -218,7 +218,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| Id of user | + **homeId** | **String**| Home Id | ### Return type @@ -236,7 +236,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) # **roomGetDetail** -> RoomDetailDTO roomGetDetail(roomId, userId) +> RoomDetailDTO roomGetDetail(roomId) Get detail info of a specified room @@ -248,10 +248,9 @@ import 'package:mycoreapi/api.dart'; final api_instance = RoomApi(); final roomId = roomId_example; // String | room id -final userId = userId_example; // String | user id try { - final result = api_instance.roomGetDetail(roomId, userId); + final result = api_instance.roomGetDetail(roomId); print(result); } catch (e) { print('Exception when calling RoomApi->roomGetDetail: $e\n'); @@ -263,7 +262,6 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **roomId** | **String**| room id | - **userId** | **String**| user id | [optional] ### Return type diff --git a/mycore_api/doc/RoomCreateOrUpdateDetailDTO.md b/mycore_api/doc/RoomCreateOrUpdateDetailDTO.md index d2f99ca..afd96b0 100644 --- a/mycore_api/doc/RoomCreateOrUpdateDetailDTO.md +++ b/mycore_api/doc/RoomCreateOrUpdateDetailDTO.md @@ -9,7 +9,7 @@ import 'package:mycoreapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] -**userId** | **String** | | [optional] +**homeId** | **String** | | [optional] **name** | **String** | | [optional] **deviceIds** | **List** | | [optional] [default to const []] diff --git a/mycore_api/doc/RoomDetailDTO.md b/mycore_api/doc/RoomDetailDTO.md index 521c2ed..84d671a 100644 --- a/mycore_api/doc/RoomDetailDTO.md +++ b/mycore_api/doc/RoomDetailDTO.md @@ -9,7 +9,7 @@ import 'package:mycoreapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] -**userId** | **String** | | [optional] +**homeId** | **String** | | [optional] **name** | **String** | | [optional] **createdDate** | [**DateTime**](DateTime.md) | | [optional] **updatedDate** | [**DateTime**](DateTime.md) | | [optional] diff --git a/mycore_api/doc/RoomSummaryDTO.md b/mycore_api/doc/RoomSummaryDTO.md index fa55021..d80c8f9 100644 --- a/mycore_api/doc/RoomSummaryDTO.md +++ b/mycore_api/doc/RoomSummaryDTO.md @@ -9,7 +9,7 @@ import 'package:mycoreapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] -**userId** | **String** | | [optional] +**homeId** | **String** | | [optional] **name** | **String** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/mycore_api/doc/ScreenDeviceApi.md b/mycore_api/doc/ScreenDeviceApi.md index c5bfa26..f142d2d 100644 --- a/mycore_api/doc/ScreenDeviceApi.md +++ b/mycore_api/doc/ScreenDeviceApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/TimePeriodAlarm.md b/mycore_api/doc/TimePeriodAlarm.md new file mode 100644 index 0000000..88eb586 --- /dev/null +++ b/mycore_api/doc/TimePeriodAlarm.md @@ -0,0 +1,17 @@ +# mycoreapi.model.TimePeriodAlarm + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start** | **String** | | [optional] +**end** | **String** | | [optional] +**alarmMode** | [**OneOfAlarmMode**](OneOfAlarmMode.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mycore_api/doc/TokenApi.md b/mycore_api/doc/TokenApi.md index abfebff..1ae62e6 100644 --- a/mycore_api/doc/TokenApi.md +++ b/mycore_api/doc/TokenApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/TwitterApi.md b/mycore_api/doc/TwitterApi.md index daf0096..04bf6e5 100644 --- a/mycore_api/doc/TwitterApi.md +++ b/mycore_api/doc/TwitterApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/UserApi.md b/mycore_api/doc/UserApi.md index 5d5208f..2a2ea1a 100644 --- a/mycore_api/doc/UserApi.md +++ b/mycore_api/doc/UserApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/doc/UserInfo.md b/mycore_api/doc/UserInfo.md index f1560a4..e17644a 100644 --- a/mycore_api/doc/UserInfo.md +++ b/mycore_api/doc/UserInfo.md @@ -16,6 +16,7 @@ Name | Type | Description | Notes **lastName** | **String** | | [optional] **token** | **String** | | [optional] **birthday** | [**DateTime**](DateTime.md) | | [optional] +**homeIds** | **List** | | [optional] [default to const []] **dateCreation** | [**DateTime**](DateTime.md) | | [optional] **address** | **String** | | [optional] **city** | **String** | | [optional] @@ -24,12 +25,6 @@ Name | Type | Description | Notes **language** | **String** | | [optional] **timeZone** | **String** | | [optional] **postalCode** | **int** | | [optional] -**automations** | [**List**](Automation.md) | | [optional] [default to const []] -**devices** | [**List**](Device.md) | | [optional] [default to const []] -**providers** | [**List**](Provider.md) | | [optional] [default to const []] -**groups** | [**List**](Group.md) | | [optional] [default to const []] -**screenConfigurationIds** | [**List**](ScreenConfiguration.md) | | [optional] [default to const []] -**deviceIds** | [**List**](ScreenDevice.md) | | [optional] [default to const []] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/mycore_api/doc/ValuesApi.md b/mycore_api/doc/ValuesApi.md index 2ee67e6..170a923 100644 --- a/mycore_api/doc/ValuesApi.md +++ b/mycore_api/doc/ValuesApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://localhost:25049* +All URIs are relative to *http://192.168.31.140* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/mycore_api/lib/api.dart b/mycore_api/lib/api.dart index 59d3152..c8fdc6a 100644 --- a/mycore_api/lib/api.dart +++ b/mycore_api/lib/api.dart @@ -27,15 +27,18 @@ part 'auth/oauth.dart'; part 'auth/http_basic_auth.dart'; part 'auth/http_bearer_auth.dart'; +part 'api/alarm_api.dart'; part 'api/authentication_api.dart'; part 'api/automation_api.dart'; part 'api/azure_api.dart'; part 'api/books_api.dart'; part 'api/device_api.dart'; part 'api/energy_api.dart'; +part 'api/event_api.dart'; part 'api/facebook_api.dart'; part 'api/google_api.dart'; part 'api/group_api.dart'; +part 'api/home_api.dart'; part 'api/iot_api.dart'; part 'api/layout_api.dart'; part 'api/mqtt_api.dart'; @@ -50,33 +53,48 @@ part 'api/values_api.dart'; part 'model/action.dart'; part 'model/action_type.dart'; -part 'model/automation.dart'; -part 'model/automation_create_or_update_detail_dto.dart'; -part 'model/automation_create_or_update_detail_dto_all_of.dart'; +part 'model/alarm_mode.dart'; +part 'model/alarm_mode_create_or_update_detail_dto.dart'; +part 'model/alarm_mode_create_or_update_detail_dto_all_of.dart'; +part 'model/alarm_mode_dto.dart'; +part 'model/alarm_mode_detail_dto.dart'; +part 'model/alarm_mode_detail_dto_all_of.dart'; +part 'model/alarm_triggered.dart'; +part 'model/alarm_type.dart'; part 'model/automation_dto.dart'; part 'model/automation_detail_dto.dart'; part 'model/automation_detail_dto_all_of.dart'; part 'model/automation_state.dart'; +part 'model/automation_triggered.dart'; part 'model/azure_ad_auth_model.dart'; part 'model/book.dart'; part 'model/condition.dart'; part 'model/condition_type.dart'; part 'model/condition_value.dart'; part 'model/connection_status.dart'; -part 'model/device.dart'; +part 'model/create_or_update_home_dto.dart'; +part 'model/create_or_update_home_dto_all_of.dart'; part 'model/device_detail_dto.dart'; part 'model/device_detail_dto_all_of.dart'; +part 'model/device_state.dart'; part 'model/device_summary_dto.dart'; part 'model/device_type.dart'; part 'model/electricity_production.dart'; +part 'model/event_dto.dart'; +part 'model/event_detail_dto.dart'; +part 'model/event_detail_dto_all_of.dart'; +part 'model/event_type.dart'; part 'model/facebook_auth_model.dart'; +part 'model/geolocalized_mode.dart'; part 'model/google_auth_model.dart'; -part 'model/group.dart'; part 'model/group_create_or_update_detail_dto.dart'; part 'model/group_create_or_update_detail_dto_all_of.dart'; part 'model/group_detail_dto.dart'; part 'model/group_detail_dto_all_of.dart'; part 'model/group_summary_dto.dart'; +part 'model/home_dto.dart'; +part 'model/home_detail_dto.dart'; +part 'model/home_detail_dto_all_of.dart'; part 'model/login_dto.dart'; part 'model/means_of_communication.dart'; part 'model/mqtt_message_dto.dart'; @@ -84,17 +102,16 @@ part 'model/odd_nice.dart'; part 'model/odd_object.dart'; part 'model/panel_menu_item.dart'; part 'model/panel_section.dart'; -part 'model/place_dto.dart'; -part 'model/provider.dart'; +part 'model/programmed_mode.dart'; part 'model/provider_dto.dart'; +part 'model/provider_type.dart'; part 'model/room_create_or_update_detail_dto.dart'; part 'model/room_detail_dto.dart'; part 'model/room_summary_dto.dart'; -part 'model/screen_configuration.dart'; part 'model/screen_device.dart'; -part 'model/screen_widget.dart'; part 'model/smart_garden_message.dart'; part 'model/smart_printer_message.dart'; +part 'model/time_period_alarm.dart'; part 'model/token_dto.dart'; part 'model/trigger.dart'; part 'model/trigger_type.dart'; diff --git a/mycore_api/lib/api/alarm_api.dart b/mycore_api/lib/api/alarm_api.dart new file mode 100644 index 0000000..2f8c384 --- /dev/null +++ b/mycore_api/lib/api/alarm_api.dart @@ -0,0 +1,593 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class AlarmApi { + AlarmApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Activate current alarm mode + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] alarmModeId (required): + /// Alarm mode to activate + Future alarmActivateWithHttpInfo(String alarmModeId) async { + // Verify required params are set. + if (alarmModeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: alarmModeId'); + } + + final path = r'/api/alarm/activate/{alarmModeId}' + .replaceAll('{' + 'alarmModeId' + '}', alarmModeId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Activate current alarm mode + /// + /// Parameters: + /// + /// * [String] alarmModeId (required): + /// Alarm mode to activate + Future alarmActivate(String alarmModeId) async { + final response = await alarmActivateWithHttpInfo(alarmModeId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; + } + return Future.value(null); + } + + /// Create an alarm mode + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [AlarmModeCreateOrUpdateDetailDTO] alarmModeCreateOrUpdateDetailDTO (required): + /// Alarm mode to create + Future alarmCreateWithHttpInfo(AlarmModeCreateOrUpdateDetailDTO alarmModeCreateOrUpdateDetailDTO) async { + // Verify required params are set. + if (alarmModeCreateOrUpdateDetailDTO == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: alarmModeCreateOrUpdateDetailDTO'); + } + + final path = r'/api/alarm'; + + Object postBody = alarmModeCreateOrUpdateDetailDTO; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Create an alarm mode + /// + /// Parameters: + /// + /// * [AlarmModeCreateOrUpdateDetailDTO] alarmModeCreateOrUpdateDetailDTO (required): + /// Alarm mode to create + Future alarmCreate(AlarmModeCreateOrUpdateDetailDTO alarmModeCreateOrUpdateDetailDTO) async { + final response = await alarmCreateWithHttpInfo(alarmModeCreateOrUpdateDetailDTO); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'AlarmModeDetailDTO') as AlarmModeDetailDTO; + } + return Future.value(null); + } + + /// Create default alarm modes + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// Home Id + Future alarmCreateDefaultAlarmsWithHttpInfo(String homeId) async { + // Verify required params are set. + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); + } + + final path = r'/api/alarm/defaults/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Create default alarm modes + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// Home Id + Future alarmCreateDefaultAlarms(String homeId) async { + final response = await alarmCreateDefaultAlarmsWithHttpInfo(homeId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'bool') as bool; + } + return Future.value(null); + } + + /// Delete an alarm mode + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] alarmModeId (required): + /// Id of alarm mode to delete + Future alarmDeleteWithHttpInfo(String alarmModeId) async { + // Verify required params are set. + if (alarmModeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: alarmModeId'); + } + + final path = r'/api/alarm/{alarmModeId}' + .replaceAll('{' + 'alarmModeId' + '}', alarmModeId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Delete an alarm mode + /// + /// Parameters: + /// + /// * [String] alarmModeId (required): + /// Id of alarm mode to delete + Future alarmDelete(String alarmModeId) async { + final response = await alarmDeleteWithHttpInfo(alarmModeId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; + } + return Future.value(null); + } + + /// Delete all alarm mode for a specified home + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// Home Id + Future alarmDeleteAllForHomeWithHttpInfo(String homeId) async { + // Verify required params are set. + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); + } + + final path = r'/api/alarm/home/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Delete all alarm mode for a specified home + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// Home Id + Future alarmDeleteAllForHome(String homeId) async { + final response = await alarmDeleteAllForHomeWithHttpInfo(homeId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; + } + return Future.value(null); + } + + /// Get all alarm modes for the specified home + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// Home Id + Future alarmGetAllWithHttpInfo(String homeId) async { + // Verify required params are set. + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); + } + + final path = r'/api/alarm/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Get all alarm modes for the specified home + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// Home Id + Future> alarmGetAll(String homeId) async { + final response = await alarmGetAllWithHttpInfo(homeId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) + .cast() + .toList(growable: false); + } + return Future>.value(null); + } + + /// Get detail info of a specified alarm mode + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] alarmId (required): + /// + /// * [String] alarmModeId: + /// alarm id + Future alarmGetDetailWithHttpInfo(String alarmId, { String alarmModeId }) async { + // Verify required params are set. + if (alarmId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: alarmId'); + } + + final path = r'/api/alarm/detail/{alarmId}' + .replaceAll('{' + 'alarmId' + '}', alarmId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (alarmModeId != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'alarmModeId', alarmModeId)); + } + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Get detail info of a specified alarm mode + /// + /// Parameters: + /// + /// * [String] alarmId (required): + /// + /// * [String] alarmModeId: + /// alarm id + Future alarmGetDetail(String alarmId, { String alarmModeId }) async { + final response = await alarmGetDetailWithHttpInfo(alarmId, alarmModeId: alarmModeId ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'AlarmModeDetailDTO') as AlarmModeDetailDTO; + } + return Future.value(null); + } + + /// Update an alarm mode + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [AlarmModeCreateOrUpdateDetailDTO] alarmModeCreateOrUpdateDetailDTO (required): + /// alarm mode to update + Future alarmUpdateWithHttpInfo(AlarmModeCreateOrUpdateDetailDTO alarmModeCreateOrUpdateDetailDTO) async { + // Verify required params are set. + if (alarmModeCreateOrUpdateDetailDTO == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: alarmModeCreateOrUpdateDetailDTO'); + } + + final path = r'/api/alarm'; + + Object postBody = alarmModeCreateOrUpdateDetailDTO; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Update an alarm mode + /// + /// Parameters: + /// + /// * [AlarmModeCreateOrUpdateDetailDTO] alarmModeCreateOrUpdateDetailDTO (required): + /// alarm mode to update + Future alarmUpdate(AlarmModeCreateOrUpdateDetailDTO alarmModeCreateOrUpdateDetailDTO) async { + final response = await alarmUpdateWithHttpInfo(alarmModeCreateOrUpdateDetailDTO); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'AlarmModeDetailDTO') as AlarmModeDetailDTO; + } + return Future.value(null); + } +} diff --git a/mycore_api/lib/api/automation_api.dart b/mycore_api/lib/api/automation_api.dart index ef6cf41..70fe930 100644 --- a/mycore_api/lib/api/automation_api.dart +++ b/mycore_api/lib/api/automation_api.dart @@ -21,17 +21,17 @@ class AutomationApi { /// /// Parameters: /// - /// * [AutomationCreateOrUpdateDetailDTO] automationCreateOrUpdateDetailDTO (required): + /// * [AutomationDetailDTO] automationDetailDTO (required): /// Automation to create - Future automationCreateWithHttpInfo(AutomationCreateOrUpdateDetailDTO automationCreateOrUpdateDetailDTO) async { + Future automationCreateWithHttpInfo(AutomationDetailDTO automationDetailDTO) async { // Verify required params are set. - if (automationCreateOrUpdateDetailDTO == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: automationCreateOrUpdateDetailDTO'); + if (automationDetailDTO == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: automationDetailDTO'); } final path = r'/api/automation'; - Object postBody = automationCreateOrUpdateDetailDTO; + Object postBody = automationDetailDTO; final queryParams = []; final headerParams = {}; @@ -69,10 +69,10 @@ class AutomationApi { /// /// Parameters: /// - /// * [AutomationCreateOrUpdateDetailDTO] automationCreateOrUpdateDetailDTO (required): + /// * [AutomationDetailDTO] automationDetailDTO (required): /// Automation to create - Future automationCreate(AutomationCreateOrUpdateDetailDTO automationCreateOrUpdateDetailDTO) async { - final response = await automationCreateWithHttpInfo(automationCreateOrUpdateDetailDTO); + Future automationCreate(AutomationDetailDTO automationDetailDTO) async { + final response = await automationCreateWithHttpInfo(automationDetailDTO); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -156,22 +156,22 @@ class AutomationApi { return Future.value(null); } - /// Delete all automation for a specified + /// Delete all automation for a specified home /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future automationDeleteAllForUserWithHttpInfo(String userId) async { + /// * [String] homeId (required): + /// Home Id + Future automationDeleteAllForHomeWithHttpInfo(String homeId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } - final path = r'/api/automation/user/{userId}' - .replaceAll('{' + 'userId' + '}', userId.toString()); + final path = r'/api/automation/home/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); Object postBody; @@ -207,14 +207,14 @@ class AutomationApi { ); } - /// Delete all automation for a specified + /// Delete all automation for a specified home /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future automationDeleteAllForUser(String userId) async { - final response = await automationDeleteAllForUserWithHttpInfo(userId); + /// * [String] homeId (required): + /// Home Id + Future automationDeleteAllForHome(String homeId) async { + final response = await automationDeleteAllForHomeWithHttpInfo(homeId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -227,22 +227,22 @@ class AutomationApi { return Future.value(null); } - /// Get all automations for the specified user + /// Get all automations for the specified home /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future automationGetAllWithHttpInfo(String userId) async { + /// * [String] homeId (required): + /// Home Id + Future automationGetAllWithHttpInfo(String homeId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } - final path = r'/api/automation/{userId}' - .replaceAll('{' + 'userId' + '}', userId.toString()); + final path = r'/api/automation/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); Object postBody; @@ -278,14 +278,14 @@ class AutomationApi { ); } - /// Get all automations for the specified user + /// Get all automations for the specified home /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future> automationGetAll(String userId) async { - final response = await automationGetAllWithHttpInfo(userId); + /// * [String] homeId (required): + /// Home Id + Future> automationGetAll(String homeId) async { + final response = await automationGetAllWithHttpInfo(homeId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -377,17 +377,17 @@ class AutomationApi { /// /// Parameters: /// - /// * [AutomationCreateOrUpdateDetailDTO] automationCreateOrUpdateDetailDTO (required): + /// * [AutomationDetailDTO] automationDetailDTO (required): /// automation to update - Future automationUpdateWithHttpInfo(AutomationCreateOrUpdateDetailDTO automationCreateOrUpdateDetailDTO) async { + Future automationUpdateWithHttpInfo(AutomationDetailDTO automationDetailDTO) async { // Verify required params are set. - if (automationCreateOrUpdateDetailDTO == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: automationCreateOrUpdateDetailDTO'); + if (automationDetailDTO == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: automationDetailDTO'); } final path = r'/api/automation'; - Object postBody = automationCreateOrUpdateDetailDTO; + Object postBody = automationDetailDTO; final queryParams = []; final headerParams = {}; @@ -425,10 +425,10 @@ class AutomationApi { /// /// Parameters: /// - /// * [AutomationCreateOrUpdateDetailDTO] automationCreateOrUpdateDetailDTO (required): + /// * [AutomationDetailDTO] automationDetailDTO (required): /// automation to update - Future automationUpdate(AutomationCreateOrUpdateDetailDTO automationCreateOrUpdateDetailDTO) async { - final response = await automationUpdateWithHttpInfo(automationCreateOrUpdateDetailDTO); + Future automationUpdate(AutomationDetailDTO automationDetailDTO) async { + final response = await automationUpdateWithHttpInfo(automationDetailDTO); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -436,8 +436,8 @@ class AutomationApi { // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { - return apiClient.deserialize(_decodeBodyBytes(response), 'AutomationCreateOrUpdateDetailDTO') as AutomationCreateOrUpdateDetailDTO; + return apiClient.deserialize(_decodeBodyBytes(response), 'AutomationDetailDTO') as AutomationDetailDTO; } - return Future.value(null); + return Future.value(null); } } diff --git a/mycore_api/lib/api/device_api.dart b/mycore_api/lib/api/device_api.dart index 2d8054d..b03389a 100644 --- a/mycore_api/lib/api/device_api.dart +++ b/mycore_api/lib/api/device_api.dart @@ -91,22 +91,22 @@ class DeviceApi { /// /// Parameters: /// - /// * [String] userId (required): - /// User Id + /// * [String] homeId (required): + /// Home Id /// /// * [String] providerId (required): /// Id of Provider - Future deviceCreateDevicesFromProviderWithHttpInfo(String userId, String providerId) async { + Future deviceCreateDevicesFromProviderWithHttpInfo(String homeId, String providerId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } if (providerId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: providerId'); } - final path = r'/api/device/{userId}/fromProvider/{providerId}' - .replaceAll('{' + 'userId' + '}', userId.toString()) + final path = r'/api/device/{homeId}/fromProvider/{providerId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()) .replaceAll('{' + 'providerId' + '}', providerId.toString()); Object postBody; @@ -147,13 +147,13 @@ class DeviceApi { /// /// Parameters: /// - /// * [String] userId (required): - /// User Id + /// * [String] homeId (required): + /// Home Id /// /// * [String] providerId (required): /// Id of Provider - Future> deviceCreateDevicesFromProvider(String userId, String providerId) async { - final response = await deviceCreateDevicesFromProviderWithHttpInfo(userId, providerId); + Future> deviceCreateDevicesFromProvider(String homeId, String providerId) async { + final response = await deviceCreateDevicesFromProviderWithHttpInfo(homeId, providerId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -239,22 +239,22 @@ class DeviceApi { return Future.value(null); } - /// Delete all device for a specified user + /// Delete all device for a specified home /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future deviceDeleteAllForUserWithHttpInfo(String userId) async { + /// * [String] homeId (required): + /// Id of home + Future deviceDeleteAllForHomeWithHttpInfo(String homeId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } - final path = r'/api/device/user/{userId}' - .replaceAll('{' + 'userId' + '}', userId.toString()); + final path = r'/api/device/home/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); Object postBody; @@ -290,14 +290,14 @@ class DeviceApi { ); } - /// Delete all device for a specified user + /// Delete all device for a specified home /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future deviceDeleteAllForUser(String userId) async { - final response = await deviceDeleteAllForUserWithHttpInfo(userId); + /// * [String] homeId (required): + /// Id of home + Future deviceDeleteAllForHome(String homeId) async { + final response = await deviceDeleteAllForHomeWithHttpInfo(homeId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -316,22 +316,22 @@ class DeviceApi { /// /// Parameters: /// - /// * [String] userId (required): - /// User Id + /// * [String] homeId (required): + /// Home Id /// /// * [String] providerId (required): /// Id of Provider - Future deviceDeleteDevicesFromProviderWithHttpInfo(String userId, String providerId) async { + Future deviceDeleteDevicesFromProviderWithHttpInfo(String homeId, String providerId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } if (providerId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: providerId'); } - final path = r'/api/device/{userId}/fromProvider/{providerId}' - .replaceAll('{' + 'userId' + '}', userId.toString()) + final path = r'/api/device/{homeId}/fromProvider/{providerId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()) .replaceAll('{' + 'providerId' + '}', providerId.toString()); Object postBody; @@ -372,13 +372,13 @@ class DeviceApi { /// /// Parameters: /// - /// * [String] userId (required): - /// User Id + /// * [String] homeId (required): + /// Home Id /// /// * [String] providerId (required): /// Id of Provider - Future deviceDeleteDevicesFromProvider(String userId, String providerId) async { - final response = await deviceDeleteDevicesFromProviderWithHttpInfo(userId, providerId); + Future deviceDeleteDevicesFromProvider(String homeId, String providerId) async { + final response = await deviceDeleteDevicesFromProviderWithHttpInfo(homeId, providerId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -397,16 +397,16 @@ class DeviceApi { /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future deviceGetAllWithHttpInfo(String userId) async { + /// * [String] homeId (required): + /// Home Id + Future deviceGetAllWithHttpInfo(String homeId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } - final path = r'/api/device/{userId}' - .replaceAll('{' + 'userId' + '}', userId.toString()); + final path = r'/api/device/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); Object postBody; @@ -446,10 +446,10 @@ class DeviceApi { /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future> deviceGetAll(String userId) async { - final response = await deviceGetAllWithHttpInfo(userId); + /// * [String] homeId (required): + /// Home Id + Future> deviceGetAll(String homeId) async { + final response = await deviceGetAllWithHttpInfo(homeId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -541,22 +541,22 @@ class DeviceApi { /// /// Parameters: /// - /// * [String] userId (required): - /// user Id + /// * [String] homeId (required): + /// Home Id /// /// * [DeviceType] type (required): /// device type - Future deviceGetDevicesByTypeWithHttpInfo(String userId, DeviceType type) async { + Future deviceGetDevicesByTypeWithHttpInfo(String homeId, DeviceType type) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } if (type == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: type'); } - final path = r'/api/device/{userId}/type/{type}' - .replaceAll('{' + 'userId' + '}', userId.toString()) + final path = r'/api/device/{homeId}/type/{type}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()) .replaceAll('{' + 'type' + '}', type.toString()); Object postBody; @@ -597,13 +597,13 @@ class DeviceApi { /// /// Parameters: /// - /// * [String] userId (required): - /// user Id + /// * [String] homeId (required): + /// Home Id /// /// * [DeviceType] type (required): /// device type - Future> deviceGetDevicesByType(String userId, DeviceType type) async { - final response = await deviceGetDevicesByTypeWithHttpInfo(userId, type); + Future> deviceGetDevicesByType(String homeId, DeviceType type) async { + final response = await deviceGetDevicesByTypeWithHttpInfo(homeId, type); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -624,22 +624,22 @@ class DeviceApi { /// /// Parameters: /// - /// * [String] userId (required): - /// User Id + /// * [String] homeId (required): + /// Home Id /// /// * [String] providerId (required): /// Id of Provider - Future deviceGetDevicesFromProviderWithHttpInfo(String userId, String providerId) async { + Future deviceGetDevicesFromProviderWithHttpInfo(String homeId, String providerId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } if (providerId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: providerId'); } - final path = r'/api/device/{userId}/fromProvider/{providerId}' - .replaceAll('{' + 'userId' + '}', userId.toString()) + final path = r'/api/device/{homeId}/fromProvider/{providerId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()) .replaceAll('{' + 'providerId' + '}', providerId.toString()); Object postBody; @@ -680,13 +680,13 @@ class DeviceApi { /// /// Parameters: /// - /// * [String] userId (required): - /// User Id + /// * [String] homeId (required): + /// Home Id /// /// * [String] providerId (required): /// Id of Provider - Future> deviceGetDevicesFromProvider(String userId, String providerId) async { - final response = await deviceGetDevicesFromProviderWithHttpInfo(userId, providerId); + Future> deviceGetDevicesFromProvider(String homeId, String providerId) async { + final response = await deviceGetDevicesFromProviderWithHttpInfo(homeId, providerId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -707,16 +707,16 @@ class DeviceApi { /// /// Parameters: /// - /// * [String] userId (required): - /// User Id - Future deviceGetDevicesFromZigbee2MqttWithHttpInfo(String userId) async { + /// * [String] homeId (required): + /// Home Id + Future deviceGetDevicesFromZigbee2MqttWithHttpInfo(String homeId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } - final path = r'/api/device/zigbee2Mqtt/{userId}' - .replaceAll('{' + 'userId' + '}', userId.toString()); + final path = r'/api/device/zigbee2Mqtt/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); Object postBody; @@ -756,10 +756,10 @@ class DeviceApi { /// /// Parameters: /// - /// * [String] userId (required): - /// User Id - Future> deviceGetDevicesFromZigbee2Mqtt(String userId) async { - final response = await deviceGetDevicesFromZigbee2MqttWithHttpInfo(userId); + /// * [String] homeId (required): + /// Home Id + Future> deviceGetDevicesFromZigbee2Mqtt(String homeId) async { + final response = await deviceGetDevicesFromZigbee2MqttWithHttpInfo(homeId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } diff --git a/mycore_api/lib/api/energy_api.dart b/mycore_api/lib/api/energy_api.dart index be16150..431e6d2 100644 --- a/mycore_api/lib/api/energy_api.dart +++ b/mycore_api/lib/api/energy_api.dart @@ -21,10 +21,10 @@ class EnergyApi { /// /// Parameters: /// - /// * [String] userId: + /// * [String] homeId: /// /// * [ViewBy] viewBy: - Future energyGetElectricityProductionWithHttpInfo({ String userId, ViewBy viewBy }) async { + Future energyGetElectricityProductionWithHttpInfo({ String homeId, ViewBy viewBy }) async { // Verify required params are set. final path = r'/api/energy/electricity'; @@ -35,8 +35,8 @@ class EnergyApi { final headerParams = {}; final formParams = {}; - if (userId != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'userId', userId)); + if (homeId != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'homeId', homeId)); } if (viewBy != null) { queryParams.addAll(_convertParametersForCollectionFormat('', 'viewBy', viewBy)); @@ -74,11 +74,11 @@ class EnergyApi { /// /// Parameters: /// - /// * [String] userId: + /// * [String] homeId: /// /// * [ViewBy] viewBy: - Future> energyGetElectricityProduction({ String userId, ViewBy viewBy }) async { - final response = await energyGetElectricityProductionWithHttpInfo( userId: userId, viewBy: viewBy ); + Future> energyGetElectricityProduction({ String homeId, ViewBy viewBy }) async { + final response = await energyGetElectricityProductionWithHttpInfo( homeId: homeId, viewBy: viewBy ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } diff --git a/mycore_api/lib/api/event_api.dart b/mycore_api/lib/api/event_api.dart new file mode 100644 index 0000000..7be6547 --- /dev/null +++ b/mycore_api/lib/api/event_api.dart @@ -0,0 +1,360 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class EventApi { + EventApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Delete an event + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] eventId (required): + /// Id of event to delete + Future eventDeleteWithHttpInfo(String eventId) async { + // Verify required params are set. + if (eventId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: eventId'); + } + + final path = r'/api/event/{eventId}' + .replaceAll('{' + 'eventId' + '}', eventId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Delete an event + /// + /// Parameters: + /// + /// * [String] eventId (required): + /// Id of event to delete + Future eventDelete(String eventId) async { + final response = await eventDeleteWithHttpInfo(eventId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; + } + return Future.value(null); + } + + /// Delete all events for a specified home + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// Home Id + Future eventDeleteAllForHomeWithHttpInfo(String homeId) async { + // Verify required params are set. + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); + } + + final path = r'/api/event/home/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Delete all events for a specified home + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// Home Id + Future eventDeleteAllForHome(String homeId) async { + final response = await eventDeleteAllForHomeWithHttpInfo(homeId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; + } + return Future.value(null); + } + + /// Get events for the specified home + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// Home Id + /// + /// * [String] deviceId: + /// + /// * [String] roomId: + /// + /// * [int] startIndex: + /// + /// * [int] count: + /// + /// * [DateTime] dateStart: + /// + /// * [DateTime] dateEnd: + /// + /// * [OneOfEventType] eventType: + /// + /// * [OneOfDeviceType] deviceType: + Future eventGetWithHttpInfo(String homeId, { String deviceId, String roomId, int startIndex, int count, DateTime dateStart, DateTime dateEnd, OneOfEventType eventType, OneOfDeviceType deviceType }) async { + // Verify required params are set. + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); + } + + final path = r'/api/event/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (deviceId != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'DeviceId', deviceId)); + } + if (roomId != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'RoomId', roomId)); + } + if (startIndex != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'StartIndex', startIndex)); + } + if (count != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'Count', count)); + } + if (dateStart != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'DateStart', dateStart)); + } + if (dateEnd != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'DateEnd', dateEnd)); + } + if (eventType != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'EventType', eventType)); + } + if (deviceType != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'DeviceType', deviceType)); + } + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Get events for the specified home + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// Home Id + /// + /// * [String] deviceId: + /// + /// * [String] roomId: + /// + /// * [int] startIndex: + /// + /// * [int] count: + /// + /// * [DateTime] dateStart: + /// + /// * [DateTime] dateEnd: + /// + /// * [OneOfEventType] eventType: + /// + /// * [OneOfDeviceType] deviceType: + Future> eventGet(String homeId, { String deviceId, String roomId, int startIndex, int count, DateTime dateStart, DateTime dateEnd, OneOfEventType eventType, OneOfDeviceType deviceType }) async { + final response = await eventGetWithHttpInfo(homeId, deviceId: deviceId, roomId: roomId, startIndex: startIndex, count: count, dateStart: dateStart, dateEnd: dateEnd, eventType: eventType, deviceType: deviceType ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) + .cast() + .toList(growable: false); + } + return Future>.value(null); + } + + /// Get detail info of a specified event + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] eventId (required): + /// event id + Future eventGetDetailWithHttpInfo(String eventId) async { + // Verify required params are set. + if (eventId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: eventId'); + } + + final path = r'/api/event/detail/{eventId}' + .replaceAll('{' + 'eventId' + '}', eventId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Get detail info of a specified event + /// + /// Parameters: + /// + /// * [String] eventId (required): + /// event id + Future eventGetDetail(String eventId) async { + final response = await eventGetDetailWithHttpInfo(eventId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'EventDetailDTO') as EventDetailDTO; + } + return Future.value(null); + } +} diff --git a/mycore_api/lib/api/group_api.dart b/mycore_api/lib/api/group_api.dart index dcbf5a7..020e8f1 100644 --- a/mycore_api/lib/api/group_api.dart +++ b/mycore_api/lib/api/group_api.dart @@ -91,16 +91,16 @@ class GroupApi { /// /// Parameters: /// - /// * [String] userId (required): - /// User Id - Future groupCreateDevicesFromZigbee2MqttWithHttpInfo(String userId) async { + /// * [String] homeId (required): + /// Home Id + Future groupCreateDevicesFromZigbee2MqttWithHttpInfo(String homeId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } - final path = r'/api/group/{userId}/fromZigbee' - .replaceAll('{' + 'userId' + '}', userId.toString()); + final path = r'/api/group/{homeId}/fromZigbee' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); Object postBody; @@ -140,10 +140,10 @@ class GroupApi { /// /// Parameters: /// - /// * [String] userId (required): - /// User Id - Future> groupCreateDevicesFromZigbee2Mqtt(String userId) async { - final response = await groupCreateDevicesFromZigbee2MqttWithHttpInfo(userId); + /// * [String] homeId (required): + /// Home Id + Future> groupCreateDevicesFromZigbee2Mqtt(String homeId) async { + final response = await groupCreateDevicesFromZigbee2MqttWithHttpInfo(homeId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -310,22 +310,22 @@ class GroupApi { return Future.value(null); } - /// Delete all group for a specified + /// Delete all group for a specified home /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future groupDeleteAllForUserWithHttpInfo(String userId) async { + /// * [String] homeId (required): + /// Home Id + Future groupDeleteAllForHomeWithHttpInfo(String homeId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } - final path = r'/api/group/user/{userId}' - .replaceAll('{' + 'userId' + '}', userId.toString()); + final path = r'/api/group/home/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); Object postBody; @@ -361,14 +361,14 @@ class GroupApi { ); } - /// Delete all group for a specified + /// Delete all group for a specified home /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future groupDeleteAllForUser(String userId) async { - final response = await groupDeleteAllForUserWithHttpInfo(userId); + /// * [String] homeId (required): + /// Home Id + Future groupDeleteAllForHome(String homeId) async { + final response = await groupDeleteAllForHomeWithHttpInfo(homeId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -381,22 +381,22 @@ class GroupApi { return Future.value(null); } - /// Get all groups for the specified user + /// Get all groups for the specified home /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future groupGetAllWithHttpInfo(String userId) async { + /// * [String] homeId (required): + /// Home Id + Future groupGetAllWithHttpInfo(String homeId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } - final path = r'/api/group/{userId}' - .replaceAll('{' + 'userId' + '}', userId.toString()); + final path = r'/api/group/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); Object postBody; @@ -432,14 +432,14 @@ class GroupApi { ); } - /// Get all groups for the specified user + /// Get all groups for the specified home /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future> groupGetAll(String userId) async { - final response = await groupGetAllWithHttpInfo(userId); + /// * [String] homeId (required): + /// Home Id + Future> groupGetAll(String homeId) async { + final response = await groupGetAllWithHttpInfo(homeId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -531,22 +531,22 @@ class GroupApi { /// /// Parameters: /// - /// * [String] userId (required): - /// user Id + /// * [String] homeId (required): + /// home Id /// /// * [String] type (required): /// group type - Future groupGetGroupsByTypeWithHttpInfo(String userId, String type) async { + Future groupGetGroupsByTypeWithHttpInfo(String homeId, String type) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } if (type == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: type'); } - final path = r'/api/group/{userId}/type/{type}' - .replaceAll('{' + 'userId' + '}', userId.toString()) + final path = r'/api/group/{homeId}/type/{type}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()) .replaceAll('{' + 'type' + '}', type.toString()); Object postBody; @@ -587,13 +587,13 @@ class GroupApi { /// /// Parameters: /// - /// * [String] userId (required): - /// user Id + /// * [String] homeId (required): + /// home Id /// /// * [String] type (required): /// group type - Future> groupGetGroupsByType(String userId, String type) async { - final response = await groupGetGroupsByTypeWithHttpInfo(userId, type); + Future> groupGetGroupsByType(String homeId, String type) async { + final response = await groupGetGroupsByTypeWithHttpInfo(homeId, type); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -614,16 +614,16 @@ class GroupApi { /// /// Parameters: /// - /// * [String] userId (required): - /// User Id - Future groupGetGroupsFromZigbee2MqttWithHttpInfo(String userId) async { + /// * [String] homeId (required): + /// Home Id + Future groupGetGroupsFromZigbee2MqttWithHttpInfo(String homeId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } - final path = r'/api/group/zigbee2Mqtt/{userId}' - .replaceAll('{' + 'userId' + '}', userId.toString()); + final path = r'/api/group/zigbee2Mqtt/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); Object postBody; @@ -663,10 +663,10 @@ class GroupApi { /// /// Parameters: /// - /// * [String] userId (required): - /// User Id - Future> groupGetGroupsFromZigbee2Mqtt(String userId) async { - final response = await groupGetGroupsFromZigbee2MqttWithHttpInfo(userId); + /// * [String] homeId (required): + /// Home Id + Future> groupGetGroupsFromZigbee2Mqtt(String homeId) async { + final response = await groupGetGroupsFromZigbee2MqttWithHttpInfo(homeId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } diff --git a/mycore_api/lib/api/home_api.dart b/mycore_api/lib/api/home_api.dart new file mode 100644 index 0000000..64dbdd8 --- /dev/null +++ b/mycore_api/lib/api/home_api.dart @@ -0,0 +1,372 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class HomeApi { + HomeApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Create a home + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [CreateOrUpdateHomeDTO] createOrUpdateHomeDTO (required): + /// Home to create + Future homeCreateWithHttpInfo(CreateOrUpdateHomeDTO createOrUpdateHomeDTO) async { + // Verify required params are set. + if (createOrUpdateHomeDTO == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: createOrUpdateHomeDTO'); + } + + final path = r'/api/home'; + + Object postBody = createOrUpdateHomeDTO; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Create a home + /// + /// Parameters: + /// + /// * [CreateOrUpdateHomeDTO] createOrUpdateHomeDTO (required): + /// Home to create + Future homeCreate(CreateOrUpdateHomeDTO createOrUpdateHomeDTO) async { + final response = await homeCreateWithHttpInfo(createOrUpdateHomeDTO); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'HomeDTO') as HomeDTO; + } + return Future.value(null); + } + + /// Delete a home + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// Id of home to delete + Future homeDeleteWithHttpInfo(String homeId) async { + // Verify required params are set. + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); + } + + final path = r'/api/home/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Delete a home + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// Id of home to delete + Future homeDelete(String homeId) async { + final response = await homeDeleteWithHttpInfo(homeId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; + } + return Future.value(null); + } + + /// Get all home for specified user + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] userId (required): + /// User Id + Future homeGetAllWithHttpInfo(String userId) async { + // Verify required params are set. + if (userId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + } + + final path = r'/api/home/{userId}' + .replaceAll('{' + 'userId' + '}', userId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Get all home for specified user + /// + /// Parameters: + /// + /// * [String] userId (required): + /// User Id + Future> homeGetAll(String userId) async { + final response = await homeGetAllWithHttpInfo(userId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) + .cast() + .toList(growable: false); + } + return Future>.value(null); + } + + /// Get detail info of a specified home + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// home id + Future homeGetDetailWithHttpInfo(String homeId) async { + // Verify required params are set. + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); + } + + final path = r'/api/home/detail/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Get detail info of a specified home + /// + /// Parameters: + /// + /// * [String] homeId (required): + /// home id + Future homeGetDetail(String homeId) async { + final response = await homeGetDetailWithHttpInfo(homeId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'HomeDetailDTO') as HomeDetailDTO; + } + return Future.value(null); + } + + /// Update a home + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [CreateOrUpdateHomeDTO] createOrUpdateHomeDTO (required): + /// Home to update + Future homeUpdateWithHttpInfo(CreateOrUpdateHomeDTO createOrUpdateHomeDTO) async { + // Verify required params are set. + if (createOrUpdateHomeDTO == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: createOrUpdateHomeDTO'); + } + + final path = r'/api/home'; + + Object postBody = createOrUpdateHomeDTO; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Update a home + /// + /// Parameters: + /// + /// * [CreateOrUpdateHomeDTO] createOrUpdateHomeDTO (required): + /// Home to update + Future homeUpdate(CreateOrUpdateHomeDTO createOrUpdateHomeDTO) async { + final response = await homeUpdateWithHttpInfo(createOrUpdateHomeDTO); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'HomeDTO') as HomeDTO; + } + return Future.value(null); + } +} diff --git a/mycore_api/lib/api/provider_api.dart b/mycore_api/lib/api/provider_api.dart index f642d34..03bfdde 100644 --- a/mycore_api/lib/api/provider_api.dart +++ b/mycore_api/lib/api/provider_api.dart @@ -156,22 +156,22 @@ class ProviderApi { return Future.value(null); } - /// Get all user providers + /// Get all home providers /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future providerGetAllWithHttpInfo(String userId) async { + /// * [String] homeId (required): + /// Home Id + Future providerGetAllWithHttpInfo(String homeId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } - final path = r'/api/provider/{userId}' - .replaceAll('{' + 'userId' + '}', userId.toString()); + final path = r'/api/provider/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); Object postBody; @@ -207,14 +207,14 @@ class ProviderApi { ); } - /// Get all user providers + /// Get all home providers /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future> providerGetAll(String userId) async { - final response = await providerGetAllWithHttpInfo(userId); + /// * [String] homeId (required): + /// Home Id + Future> providerGetAll(String homeId) async { + final response = await providerGetAllWithHttpInfo(homeId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } diff --git a/mycore_api/lib/api/room_api.dart b/mycore_api/lib/api/room_api.dart index 1ec88b4..091d0b4 100644 --- a/mycore_api/lib/api/room_api.dart +++ b/mycore_api/lib/api/room_api.dart @@ -237,22 +237,22 @@ class RoomApi { return Future.value(null); } - /// Delete all room for a specified user + /// Delete all rooms for a specified home /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future roomDeleteAllForUserWithHttpInfo(String userId) async { + /// * [String] homeId (required): + /// Home Id + Future roomDeleteAllForHomeWithHttpInfo(String homeId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } - final path = r'/api/room/user/{userId}' - .replaceAll('{' + 'userId' + '}', userId.toString()); + final path = r'/api/room/home/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); Object postBody; @@ -288,14 +288,14 @@ class RoomApi { ); } - /// Delete all room for a specified user + /// Delete all rooms for a specified home /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future roomDeleteAllForUser(String userId) async { - final response = await roomDeleteAllForUserWithHttpInfo(userId); + /// * [String] homeId (required): + /// Home Id + Future roomDeleteAllForHome(String homeId) async { + final response = await roomDeleteAllForHomeWithHttpInfo(homeId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -308,22 +308,22 @@ class RoomApi { return Future.value(null); } - /// Get all rooms for the specified user + /// Get all rooms for the specified home /// /// Note: This method returns the HTTP [Response]. /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future roomGetAllWithHttpInfo(String userId) async { + /// * [String] homeId (required): + /// Home Id + Future roomGetAllWithHttpInfo(String homeId) async { // Verify required params are set. - if (userId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: userId'); + if (homeId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); } - final path = r'/api/room/{userId}' - .replaceAll('{' + 'userId' + '}', userId.toString()); + final path = r'/api/room/{homeId}' + .replaceAll('{' + 'homeId' + '}', homeId.toString()); Object postBody; @@ -359,14 +359,14 @@ class RoomApi { ); } - /// Get all rooms for the specified user + /// Get all rooms for the specified home /// /// Parameters: /// - /// * [String] userId (required): - /// Id of user - Future> roomGetAll(String userId) async { - final response = await roomGetAllWithHttpInfo(userId); + /// * [String] homeId (required): + /// Home Id + Future> roomGetAll(String homeId) async { + final response = await roomGetAllWithHttpInfo(homeId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -389,10 +389,7 @@ class RoomApi { /// /// * [String] roomId (required): /// room id - /// - /// * [String] userId: - /// user id - Future roomGetDetailWithHttpInfo(String roomId, { String userId }) async { + Future roomGetDetailWithHttpInfo(String roomId) async { // Verify required params are set. if (roomId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: roomId'); @@ -407,10 +404,6 @@ class RoomApi { final headerParams = {}; final formParams = {}; - if (userId != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'userId', userId)); - } - final contentTypes = []; final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer']; @@ -445,11 +438,8 @@ class RoomApi { /// /// * [String] roomId (required): /// room id - /// - /// * [String] userId: - /// user id - Future roomGetDetail(String roomId, { String userId }) async { - final response = await roomGetDetailWithHttpInfo(roomId, userId: userId ); + Future roomGetDetail(String roomId) async { + final response = await roomGetDetailWithHttpInfo(roomId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } diff --git a/mycore_api/lib/api_client.dart b/mycore_api/lib/api_client.dart index 94d433d..9f081a4 100644 --- a/mycore_api/lib/api_client.dart +++ b/mycore_api/lib/api_client.dart @@ -10,7 +10,7 @@ part of openapi.api; class ApiClient { - ApiClient({this.basePath = 'http://localhost:25049'}) { + ApiClient({this.basePath = 'http://192.168.31.140'}) { // Setup authentications (key: authentication name, value: authentication). _authentications[r'bearer'] = OAuth(); } @@ -161,12 +161,23 @@ class ApiClient { case 'ActionType': return ActionTypeTypeTransformer().decode(value); - case 'Automation': - return Automation.fromJson(value); - case 'AutomationCreateOrUpdateDetailDTO': - return AutomationCreateOrUpdateDetailDTO.fromJson(value); - case 'AutomationCreateOrUpdateDetailDTOAllOf': - return AutomationCreateOrUpdateDetailDTOAllOf.fromJson(value); + case 'AlarmMode': + return AlarmMode.fromJson(value); + case 'AlarmModeCreateOrUpdateDetailDTO': + return AlarmModeCreateOrUpdateDetailDTO.fromJson(value); + case 'AlarmModeCreateOrUpdateDetailDTOAllOf': + return AlarmModeCreateOrUpdateDetailDTOAllOf.fromJson(value); + case 'AlarmModeDTO': + return AlarmModeDTO.fromJson(value); + case 'AlarmModeDetailDTO': + return AlarmModeDetailDTO.fromJson(value); + case 'AlarmModeDetailDTOAllOf': + return AlarmModeDetailDTOAllOf.fromJson(value); + case 'AlarmTriggered': + return AlarmTriggered.fromJson(value); + case 'AlarmType': + return AlarmTypeTypeTransformer().decode(value); + case 'AutomationDTO': return AutomationDTO.fromJson(value); case 'AutomationDetailDTO': @@ -175,6 +186,8 @@ class ApiClient { return AutomationDetailDTOAllOf.fromJson(value); case 'AutomationState': return AutomationState.fromJson(value); + case 'AutomationTriggered': + return AutomationTriggered.fromJson(value); case 'AzureADAuthModel': return AzureADAuthModel.fromJson(value); case 'Book': @@ -190,12 +203,16 @@ class ApiClient { case 'ConnectionStatus': return ConnectionStatusTypeTransformer().decode(value); - case 'Device': - return Device.fromJson(value); + case 'CreateOrUpdateHomeDTO': + return CreateOrUpdateHomeDTO.fromJson(value); + case 'CreateOrUpdateHomeDTOAllOf': + return CreateOrUpdateHomeDTOAllOf.fromJson(value); case 'DeviceDetailDTO': return DeviceDetailDTO.fromJson(value); case 'DeviceDetailDTOAllOf': return DeviceDetailDTOAllOf.fromJson(value); + case 'DeviceState': + return DeviceState.fromJson(value); case 'DeviceSummaryDTO': return DeviceSummaryDTO.fromJson(value); case 'DeviceType': @@ -203,12 +220,21 @@ class ApiClient { case 'ElectricityProduction': return ElectricityProduction.fromJson(value); + case 'EventDTO': + return EventDTO.fromJson(value); + case 'EventDetailDTO': + return EventDetailDTO.fromJson(value); + case 'EventDetailDTOAllOf': + return EventDetailDTOAllOf.fromJson(value); + case 'EventType': + return EventTypeTypeTransformer().decode(value); + case 'FacebookAuthModel': return FacebookAuthModel.fromJson(value); + case 'GeolocalizedMode': + return GeolocalizedMode.fromJson(value); case 'GoogleAuthModel': return GoogleAuthModel.fromJson(value); - case 'Group': - return Group.fromJson(value); case 'GroupCreateOrUpdateDetailDTO': return GroupCreateOrUpdateDetailDTO.fromJson(value); case 'GroupCreateOrUpdateDetailDTOAllOf': @@ -219,6 +245,12 @@ class ApiClient { return GroupDetailDTOAllOf.fromJson(value); case 'GroupSummaryDTO': return GroupSummaryDTO.fromJson(value); + case 'HomeDTO': + return HomeDTO.fromJson(value); + case 'HomeDetailDTO': + return HomeDetailDTO.fromJson(value); + case 'HomeDetailDTOAllOf': + return HomeDetailDTOAllOf.fromJson(value); case 'LoginDTO': return LoginDTO.fromJson(value); case 'MeansOfCommunication': @@ -234,28 +266,27 @@ class ApiClient { return PanelMenuItem.fromJson(value); case 'PanelSection': return PanelSection.fromJson(value); - case 'PlaceDTO': - return PlaceDTO.fromJson(value); - case 'Provider': - return Provider.fromJson(value); + case 'ProgrammedMode': + return ProgrammedMode.fromJson(value); case 'ProviderDTO': return ProviderDTO.fromJson(value); + case 'ProviderType': + return ProviderTypeTypeTransformer().decode(value); + case 'RoomCreateOrUpdateDetailDTO': return RoomCreateOrUpdateDetailDTO.fromJson(value); case 'RoomDetailDTO': return RoomDetailDTO.fromJson(value); case 'RoomSummaryDTO': return RoomSummaryDTO.fromJson(value); - case 'ScreenConfiguration': - return ScreenConfiguration.fromJson(value); case 'ScreenDevice': return ScreenDevice.fromJson(value); - case 'ScreenWidget': - return ScreenWidget.fromJson(value); case 'SmartGardenMessage': return SmartGardenMessage.fromJson(value); case 'SmartPrinterMessage': return SmartPrinterMessage.fromJson(value); + case 'TimePeriodAlarm': + return TimePeriodAlarm.fromJson(value); case 'TokenDTO': return TokenDTO.fromJson(value); case 'Trigger': diff --git a/mycore_api/lib/api_helper.dart b/mycore_api/lib/api_helper.dart index 23aae53..54c52a6 100644 --- a/mycore_api/lib/api_helper.dart +++ b/mycore_api/lib/api_helper.dart @@ -61,6 +61,9 @@ String parameterToString(dynamic value) { if (value is ActionType) { return ActionTypeTypeTransformer().encode(value).toString(); } + if (value is AlarmType) { + return AlarmTypeTypeTransformer().encode(value).toString(); + } if (value is ConditionType) { return ConditionTypeTypeTransformer().encode(value).toString(); } @@ -73,9 +76,15 @@ String parameterToString(dynamic value) { if (value is DeviceType) { return DeviceTypeTypeTransformer().encode(value).toString(); } + if (value is EventType) { + return EventTypeTypeTransformer().encode(value).toString(); + } if (value is MeansOfCommunication) { return MeansOfCommunicationTypeTransformer().encode(value).toString(); } + if (value is ProviderType) { + return ProviderTypeTypeTransformer().encode(value).toString(); + } if (value is TriggerType) { return TriggerTypeTypeTransformer().encode(value).toString(); } diff --git a/mycore_api/lib/model/action.dart b/mycore_api/lib/model/action.dart index 3d0b9d3..57dff7c 100644 --- a/mycore_api/lib/model/action.dart +++ b/mycore_api/lib/model/action.dart @@ -18,6 +18,7 @@ class Action { this.rawRequest, this.providerId, this.type, + this.isForce, }); String groupId; @@ -32,6 +33,8 @@ class Action { ActionType type; + bool isForce; + @override bool operator ==(Object other) => identical(this, other) || other is Action && other.groupId == groupId && @@ -39,7 +42,8 @@ class Action { other.states == states && other.rawRequest == rawRequest && other.providerId == providerId && - other.type == type; + other.type == type && + other.isForce == isForce; @override int get hashCode => @@ -48,10 +52,11 @@ class Action { (states == null ? 0 : states.hashCode) + (rawRequest == null ? 0 : rawRequest.hashCode) + (providerId == null ? 0 : providerId.hashCode) + - (type == null ? 0 : type.hashCode); + (type == null ? 0 : type.hashCode) + + (isForce == null ? 0 : isForce.hashCode); @override - String toString() => 'Action[groupId=$groupId, deviceId=$deviceId, states=$states, rawRequest=$rawRequest, providerId=$providerId, type=$type]'; + String toString() => 'Action[groupId=$groupId, deviceId=$deviceId, states=$states, rawRequest=$rawRequest, providerId=$providerId, type=$type, isForce=$isForce]'; Map toJson() { final json = {}; @@ -73,6 +78,9 @@ class Action { if (type != null) { json[r'type'] = type; } + if (isForce != null) { + json[r'isForce'] = isForce; + } return json; } @@ -87,6 +95,7 @@ class Action { rawRequest: json[r'rawRequest'], providerId: json[r'providerId'], type: ActionType.fromJson(json[r'type']), + isForce: json[r'isForce'], ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/mycore_api/lib/model/alarm_mode.dart b/mycore_api/lib/model/alarm_mode.dart new file mode 100644 index 0000000..d4d7b05 --- /dev/null +++ b/mycore_api/lib/model/alarm_mode.dart @@ -0,0 +1,194 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AlarmMode { + /// Returns a new [AlarmMode] instance. + AlarmMode({ + this.id, + this.homeId, + this.name, + this.activated, + this.isDefault, + this.notification, + this.createdDate, + this.updatedDate, + this.type, + this.programmedMode, + this.geolocalizedMode, + this.triggers, + this.actions, + this.devicesIds, + }); + + String id; + + String homeId; + + String name; + + bool activated; + + bool isDefault; + + bool notification; + + DateTime createdDate; + + DateTime updatedDate; + + AlarmType type; + + OneOfProgrammedMode programmedMode; + + OneOfGeolocalizedMode geolocalizedMode; + + List triggers; + + List actions; + + List devicesIds; + + @override + bool operator ==(Object other) => identical(this, other) || other is AlarmMode && + other.id == id && + other.homeId == homeId && + other.name == name && + other.activated == activated && + other.isDefault == isDefault && + other.notification == notification && + other.createdDate == createdDate && + other.updatedDate == updatedDate && + other.type == type && + other.programmedMode == programmedMode && + other.geolocalizedMode == geolocalizedMode && + other.triggers == triggers && + other.actions == actions && + other.devicesIds == devicesIds; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + + (name == null ? 0 : name.hashCode) + + (activated == null ? 0 : activated.hashCode) + + (isDefault == null ? 0 : isDefault.hashCode) + + (notification == null ? 0 : notification.hashCode) + + (createdDate == null ? 0 : createdDate.hashCode) + + (updatedDate == null ? 0 : updatedDate.hashCode) + + (type == null ? 0 : type.hashCode) + + (programmedMode == null ? 0 : programmedMode.hashCode) + + (geolocalizedMode == null ? 0 : geolocalizedMode.hashCode) + + (triggers == null ? 0 : triggers.hashCode) + + (actions == null ? 0 : actions.hashCode) + + (devicesIds == null ? 0 : devicesIds.hashCode); + + @override + String toString() => 'AlarmMode[id=$id, homeId=$homeId, name=$name, activated=$activated, isDefault=$isDefault, notification=$notification, createdDate=$createdDate, updatedDate=$updatedDate, type=$type, programmedMode=$programmedMode, geolocalizedMode=$geolocalizedMode, triggers=$triggers, actions=$actions, devicesIds=$devicesIds]'; + + Map toJson() { + final json = {}; + if (id != null) { + json[r'id'] = id; + } + if (homeId != null) { + json[r'homeId'] = homeId; + } + if (name != null) { + json[r'name'] = name; + } + if (activated != null) { + json[r'activated'] = activated; + } + if (isDefault != null) { + json[r'isDefault'] = isDefault; + } + if (notification != null) { + json[r'notification'] = notification; + } + if (createdDate != null) { + json[r'createdDate'] = createdDate.toUtc().toIso8601String(); + } + if (updatedDate != null) { + json[r'updatedDate'] = updatedDate.toUtc().toIso8601String(); + } + if (type != null) { + json[r'type'] = type; + } + if (programmedMode != null) { + json[r'programmedMode'] = programmedMode; + } + if (geolocalizedMode != null) { + json[r'geolocalizedMode'] = geolocalizedMode; + } + if (triggers != null) { + json[r'triggers'] = triggers; + } + if (actions != null) { + json[r'actions'] = actions; + } + if (devicesIds != null) { + json[r'devicesIds'] = devicesIds; + } + return json; + } + + /// Returns a new [AlarmMode] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static AlarmMode fromJson(Map json) => json == null + ? null + : AlarmMode( + id: json[r'id'], + homeId: json[r'homeId'], + name: json[r'name'], + activated: json[r'activated'], + isDefault: json[r'isDefault'], + notification: json[r'notification'], + createdDate: json[r'createdDate'] == null + ? null + : DateTime.parse(json[r'createdDate']), + updatedDate: json[r'updatedDate'] == null + ? null + : DateTime.parse(json[r'updatedDate']), + type: AlarmType.fromJson(json[r'type']), + programmedMode: OneOfProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: OneOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), + triggers: Trigger.listFromJson(json[r'triggers']), + actions: Action.listFromJson(json[r'actions']), + devicesIds: json[r'devicesIds'] == null + ? null + : (json[r'devicesIds'] as List).cast(), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => AlarmMode.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = AlarmMode.fromJson(v)); + } + return map; + } + + // maps a json object with a list of AlarmMode-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = AlarmMode.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto.dart b/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto.dart new file mode 100644 index 0000000..9a4c5cc --- /dev/null +++ b/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto.dart @@ -0,0 +1,183 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AlarmModeCreateOrUpdateDetailDTO { + /// Returns a new [AlarmModeCreateOrUpdateDetailDTO] instance. + AlarmModeCreateOrUpdateDetailDTO({ + this.id, + this.homeId, + this.name, + this.type, + this.activated, + this.isDefault, + this.notification, + this.createdDate, + this.updatedDate, + this.triggers, + this.actions, + this.programmedMode, + this.geolocalizedMode, + }); + + String id; + + String homeId; + + String name; + + AlarmType type; + + bool activated; + + bool isDefault; + + bool notification; + + DateTime createdDate; + + DateTime updatedDate; + + List triggers; + + List actions; + + OneOfProgrammedMode programmedMode; + + OneOfGeolocalizedMode geolocalizedMode; + + @override + bool operator ==(Object other) => identical(this, other) || other is AlarmModeCreateOrUpdateDetailDTO && + other.id == id && + other.homeId == homeId && + other.name == name && + other.type == type && + other.activated == activated && + other.isDefault == isDefault && + other.notification == notification && + other.createdDate == createdDate && + other.updatedDate == updatedDate && + other.triggers == triggers && + other.actions == actions && + other.programmedMode == programmedMode && + other.geolocalizedMode == geolocalizedMode; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + + (name == null ? 0 : name.hashCode) + + (type == null ? 0 : type.hashCode) + + (activated == null ? 0 : activated.hashCode) + + (isDefault == null ? 0 : isDefault.hashCode) + + (notification == null ? 0 : notification.hashCode) + + (createdDate == null ? 0 : createdDate.hashCode) + + (updatedDate == null ? 0 : updatedDate.hashCode) + + (triggers == null ? 0 : triggers.hashCode) + + (actions == null ? 0 : actions.hashCode) + + (programmedMode == null ? 0 : programmedMode.hashCode) + + (geolocalizedMode == null ? 0 : geolocalizedMode.hashCode); + + @override + String toString() => 'AlarmModeCreateOrUpdateDetailDTO[id=$id, homeId=$homeId, name=$name, type=$type, activated=$activated, isDefault=$isDefault, notification=$notification, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, actions=$actions, programmedMode=$programmedMode, geolocalizedMode=$geolocalizedMode]'; + + Map toJson() { + final json = {}; + if (id != null) { + json[r'id'] = id; + } + if (homeId != null) { + json[r'homeId'] = homeId; + } + if (name != null) { + json[r'name'] = name; + } + if (type != null) { + json[r'type'] = type; + } + if (activated != null) { + json[r'activated'] = activated; + } + if (isDefault != null) { + json[r'isDefault'] = isDefault; + } + if (notification != null) { + json[r'notification'] = notification; + } + if (createdDate != null) { + json[r'createdDate'] = createdDate.toUtc().toIso8601String(); + } + if (updatedDate != null) { + json[r'updatedDate'] = updatedDate.toUtc().toIso8601String(); + } + if (triggers != null) { + json[r'triggers'] = triggers; + } + if (actions != null) { + json[r'actions'] = actions; + } + if (programmedMode != null) { + json[r'programmedMode'] = programmedMode; + } + if (geolocalizedMode != null) { + json[r'geolocalizedMode'] = geolocalizedMode; + } + return json; + } + + /// Returns a new [AlarmModeCreateOrUpdateDetailDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static AlarmModeCreateOrUpdateDetailDTO fromJson(Map json) => json == null + ? null + : AlarmModeCreateOrUpdateDetailDTO( + id: json[r'id'], + homeId: json[r'homeId'], + name: json[r'name'], + type: AlarmType.fromJson(json[r'type']), + activated: json[r'activated'], + isDefault: json[r'isDefault'], + notification: json[r'notification'], + createdDate: json[r'createdDate'] == null + ? null + : DateTime.parse(json[r'createdDate']), + updatedDate: json[r'updatedDate'] == null + ? null + : DateTime.parse(json[r'updatedDate']), + triggers: Trigger.listFromJson(json[r'triggers']), + actions: Action.listFromJson(json[r'actions']), + programmedMode: OneOfProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: OneOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => AlarmModeCreateOrUpdateDetailDTO.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = AlarmModeCreateOrUpdateDetailDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of AlarmModeCreateOrUpdateDetailDTO-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = AlarmModeCreateOrUpdateDetailDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart b/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart new file mode 100644 index 0000000..8360120 --- /dev/null +++ b/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart @@ -0,0 +1,98 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AlarmModeCreateOrUpdateDetailDTOAllOf { + /// Returns a new [AlarmModeCreateOrUpdateDetailDTOAllOf] instance. + AlarmModeCreateOrUpdateDetailDTOAllOf({ + this.triggers, + this.actions, + this.programmedMode, + this.geolocalizedMode, + }); + + List triggers; + + List actions; + + OneOfProgrammedMode programmedMode; + + OneOfGeolocalizedMode geolocalizedMode; + + @override + bool operator ==(Object other) => identical(this, other) || other is AlarmModeCreateOrUpdateDetailDTOAllOf && + other.triggers == triggers && + other.actions == actions && + other.programmedMode == programmedMode && + other.geolocalizedMode == geolocalizedMode; + + @override + int get hashCode => + (triggers == null ? 0 : triggers.hashCode) + + (actions == null ? 0 : actions.hashCode) + + (programmedMode == null ? 0 : programmedMode.hashCode) + + (geolocalizedMode == null ? 0 : geolocalizedMode.hashCode); + + @override + String toString() => 'AlarmModeCreateOrUpdateDetailDTOAllOf[triggers=$triggers, actions=$actions, programmedMode=$programmedMode, geolocalizedMode=$geolocalizedMode]'; + + Map toJson() { + final json = {}; + if (triggers != null) { + json[r'triggers'] = triggers; + } + if (actions != null) { + json[r'actions'] = actions; + } + if (programmedMode != null) { + json[r'programmedMode'] = programmedMode; + } + if (geolocalizedMode != null) { + json[r'geolocalizedMode'] = geolocalizedMode; + } + return json; + } + + /// Returns a new [AlarmModeCreateOrUpdateDetailDTOAllOf] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static AlarmModeCreateOrUpdateDetailDTOAllOf fromJson(Map json) => json == null + ? null + : AlarmModeCreateOrUpdateDetailDTOAllOf( + triggers: Trigger.listFromJson(json[r'triggers']), + actions: Action.listFromJson(json[r'actions']), + programmedMode: OneOfProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: OneOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => AlarmModeCreateOrUpdateDetailDTOAllOf.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = AlarmModeCreateOrUpdateDetailDTOAllOf.fromJson(v)); + } + return map; + } + + // maps a json object with a list of AlarmModeCreateOrUpdateDetailDTOAllOf-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = AlarmModeCreateOrUpdateDetailDTOAllOf.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/alarm_mode_detail_dto.dart b/mycore_api/lib/model/alarm_mode_detail_dto.dart new file mode 100644 index 0000000..8dafa38 --- /dev/null +++ b/mycore_api/lib/model/alarm_mode_detail_dto.dart @@ -0,0 +1,183 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AlarmModeDetailDTO { + /// Returns a new [AlarmModeDetailDTO] instance. + AlarmModeDetailDTO({ + this.id, + this.homeId, + this.name, + this.type, + this.activated, + this.isDefault, + this.notification, + this.createdDate, + this.updatedDate, + this.triggers, + this.devices, + this.programmedMode, + this.geolocalizedMode, + }); + + String id; + + String homeId; + + String name; + + AlarmType type; + + bool activated; + + bool isDefault; + + bool notification; + + DateTime createdDate; + + DateTime updatedDate; + + List triggers; + + List devices; + + OneOfProgrammedMode programmedMode; + + OneOfGeolocalizedMode geolocalizedMode; + + @override + bool operator ==(Object other) => identical(this, other) || other is AlarmModeDetailDTO && + other.id == id && + other.homeId == homeId && + other.name == name && + other.type == type && + other.activated == activated && + other.isDefault == isDefault && + other.notification == notification && + other.createdDate == createdDate && + other.updatedDate == updatedDate && + other.triggers == triggers && + other.devices == devices && + other.programmedMode == programmedMode && + other.geolocalizedMode == geolocalizedMode; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + + (name == null ? 0 : name.hashCode) + + (type == null ? 0 : type.hashCode) + + (activated == null ? 0 : activated.hashCode) + + (isDefault == null ? 0 : isDefault.hashCode) + + (notification == null ? 0 : notification.hashCode) + + (createdDate == null ? 0 : createdDate.hashCode) + + (updatedDate == null ? 0 : updatedDate.hashCode) + + (triggers == null ? 0 : triggers.hashCode) + + (devices == null ? 0 : devices.hashCode) + + (programmedMode == null ? 0 : programmedMode.hashCode) + + (geolocalizedMode == null ? 0 : geolocalizedMode.hashCode); + + @override + String toString() => 'AlarmModeDetailDTO[id=$id, homeId=$homeId, name=$name, type=$type, activated=$activated, isDefault=$isDefault, notification=$notification, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, devices=$devices, programmedMode=$programmedMode, geolocalizedMode=$geolocalizedMode]'; + + Map toJson() { + final json = {}; + if (id != null) { + json[r'id'] = id; + } + if (homeId != null) { + json[r'homeId'] = homeId; + } + if (name != null) { + json[r'name'] = name; + } + if (type != null) { + json[r'type'] = type; + } + if (activated != null) { + json[r'activated'] = activated; + } + if (isDefault != null) { + json[r'isDefault'] = isDefault; + } + if (notification != null) { + json[r'notification'] = notification; + } + if (createdDate != null) { + json[r'createdDate'] = createdDate.toUtc().toIso8601String(); + } + if (updatedDate != null) { + json[r'updatedDate'] = updatedDate.toUtc().toIso8601String(); + } + if (triggers != null) { + json[r'triggers'] = triggers; + } + if (devices != null) { + json[r'devices'] = devices; + } + if (programmedMode != null) { + json[r'programmedMode'] = programmedMode; + } + if (geolocalizedMode != null) { + json[r'geolocalizedMode'] = geolocalizedMode; + } + return json; + } + + /// Returns a new [AlarmModeDetailDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static AlarmModeDetailDTO fromJson(Map json) => json == null + ? null + : AlarmModeDetailDTO( + id: json[r'id'], + homeId: json[r'homeId'], + name: json[r'name'], + type: AlarmType.fromJson(json[r'type']), + activated: json[r'activated'], + isDefault: json[r'isDefault'], + notification: json[r'notification'], + createdDate: json[r'createdDate'] == null + ? null + : DateTime.parse(json[r'createdDate']), + updatedDate: json[r'updatedDate'] == null + ? null + : DateTime.parse(json[r'updatedDate']), + triggers: Trigger.listFromJson(json[r'triggers']), + devices: DeviceDetailDTO.listFromJson(json[r'devices']), + programmedMode: OneOfProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: OneOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => AlarmModeDetailDTO.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = AlarmModeDetailDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of AlarmModeDetailDTO-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = AlarmModeDetailDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/alarm_mode_detail_dto_all_of.dart b/mycore_api/lib/model/alarm_mode_detail_dto_all_of.dart new file mode 100644 index 0000000..a8b1949 --- /dev/null +++ b/mycore_api/lib/model/alarm_mode_detail_dto_all_of.dart @@ -0,0 +1,98 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AlarmModeDetailDTOAllOf { + /// Returns a new [AlarmModeDetailDTOAllOf] instance. + AlarmModeDetailDTOAllOf({ + this.triggers, + this.devices, + this.programmedMode, + this.geolocalizedMode, + }); + + List triggers; + + List devices; + + OneOfProgrammedMode programmedMode; + + OneOfGeolocalizedMode geolocalizedMode; + + @override + bool operator ==(Object other) => identical(this, other) || other is AlarmModeDetailDTOAllOf && + other.triggers == triggers && + other.devices == devices && + other.programmedMode == programmedMode && + other.geolocalizedMode == geolocalizedMode; + + @override + int get hashCode => + (triggers == null ? 0 : triggers.hashCode) + + (devices == null ? 0 : devices.hashCode) + + (programmedMode == null ? 0 : programmedMode.hashCode) + + (geolocalizedMode == null ? 0 : geolocalizedMode.hashCode); + + @override + String toString() => 'AlarmModeDetailDTOAllOf[triggers=$triggers, devices=$devices, programmedMode=$programmedMode, geolocalizedMode=$geolocalizedMode]'; + + Map toJson() { + final json = {}; + if (triggers != null) { + json[r'triggers'] = triggers; + } + if (devices != null) { + json[r'devices'] = devices; + } + if (programmedMode != null) { + json[r'programmedMode'] = programmedMode; + } + if (geolocalizedMode != null) { + json[r'geolocalizedMode'] = geolocalizedMode; + } + return json; + } + + /// Returns a new [AlarmModeDetailDTOAllOf] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static AlarmModeDetailDTOAllOf fromJson(Map json) => json == null + ? null + : AlarmModeDetailDTOAllOf( + triggers: Trigger.listFromJson(json[r'triggers']), + devices: DeviceDetailDTO.listFromJson(json[r'devices']), + programmedMode: OneOfProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: OneOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => AlarmModeDetailDTOAllOf.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = AlarmModeDetailDTOAllOf.fromJson(v)); + } + return map; + } + + // maps a json object with a list of AlarmModeDetailDTOAllOf-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = AlarmModeDetailDTOAllOf.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/alarm_mode_dto.dart b/mycore_api/lib/model/alarm_mode_dto.dart new file mode 100644 index 0000000..86f85cf --- /dev/null +++ b/mycore_api/lib/model/alarm_mode_dto.dart @@ -0,0 +1,147 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AlarmModeDTO { + /// Returns a new [AlarmModeDTO] instance. + AlarmModeDTO({ + this.id, + this.homeId, + this.name, + this.type, + this.activated, + this.isDefault, + this.notification, + this.createdDate, + this.updatedDate, + }); + + String id; + + String homeId; + + String name; + + AlarmType type; + + bool activated; + + bool isDefault; + + bool notification; + + DateTime createdDate; + + DateTime updatedDate; + + @override + bool operator ==(Object other) => identical(this, other) || other is AlarmModeDTO && + other.id == id && + other.homeId == homeId && + other.name == name && + other.type == type && + other.activated == activated && + other.isDefault == isDefault && + other.notification == notification && + other.createdDate == createdDate && + other.updatedDate == updatedDate; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + + (name == null ? 0 : name.hashCode) + + (type == null ? 0 : type.hashCode) + + (activated == null ? 0 : activated.hashCode) + + (isDefault == null ? 0 : isDefault.hashCode) + + (notification == null ? 0 : notification.hashCode) + + (createdDate == null ? 0 : createdDate.hashCode) + + (updatedDate == null ? 0 : updatedDate.hashCode); + + @override + String toString() => 'AlarmModeDTO[id=$id, homeId=$homeId, name=$name, type=$type, activated=$activated, isDefault=$isDefault, notification=$notification, createdDate=$createdDate, updatedDate=$updatedDate]'; + + Map toJson() { + final json = {}; + if (id != null) { + json[r'id'] = id; + } + if (homeId != null) { + json[r'homeId'] = homeId; + } + if (name != null) { + json[r'name'] = name; + } + if (type != null) { + json[r'type'] = type; + } + if (activated != null) { + json[r'activated'] = activated; + } + if (isDefault != null) { + json[r'isDefault'] = isDefault; + } + if (notification != null) { + json[r'notification'] = notification; + } + if (createdDate != null) { + json[r'createdDate'] = createdDate.toUtc().toIso8601String(); + } + if (updatedDate != null) { + json[r'updatedDate'] = updatedDate.toUtc().toIso8601String(); + } + return json; + } + + /// Returns a new [AlarmModeDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static AlarmModeDTO fromJson(Map json) => json == null + ? null + : AlarmModeDTO( + id: json[r'id'], + homeId: json[r'homeId'], + name: json[r'name'], + type: AlarmType.fromJson(json[r'type']), + activated: json[r'activated'], + isDefault: json[r'isDefault'], + notification: json[r'notification'], + createdDate: json[r'createdDate'] == null + ? null + : DateTime.parse(json[r'createdDate']), + updatedDate: json[r'updatedDate'] == null + ? null + : DateTime.parse(json[r'updatedDate']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => AlarmModeDTO.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = AlarmModeDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of AlarmModeDTO-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = AlarmModeDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/alarm_triggered.dart b/mycore_api/lib/model/alarm_triggered.dart new file mode 100644 index 0000000..04e52c8 --- /dev/null +++ b/mycore_api/lib/model/alarm_triggered.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AlarmTriggered { + /// Returns a new [AlarmTriggered] instance. + AlarmTriggered({ + this.alarmModeId, + this.alarmModeName, + this.type, + }); + + String alarmModeId; + + String alarmModeName; + + AlarmType type; + + @override + bool operator ==(Object other) => identical(this, other) || other is AlarmTriggered && + other.alarmModeId == alarmModeId && + other.alarmModeName == alarmModeName && + other.type == type; + + @override + int get hashCode => + (alarmModeId == null ? 0 : alarmModeId.hashCode) + + (alarmModeName == null ? 0 : alarmModeName.hashCode) + + (type == null ? 0 : type.hashCode); + + @override + String toString() => 'AlarmTriggered[alarmModeId=$alarmModeId, alarmModeName=$alarmModeName, type=$type]'; + + Map toJson() { + final json = {}; + if (alarmModeId != null) { + json[r'alarmModeId'] = alarmModeId; + } + if (alarmModeName != null) { + json[r'alarmModeName'] = alarmModeName; + } + if (type != null) { + json[r'type'] = type; + } + return json; + } + + /// Returns a new [AlarmTriggered] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static AlarmTriggered fromJson(Map json) => json == null + ? null + : AlarmTriggered( + alarmModeId: json[r'alarmModeId'], + alarmModeName: json[r'alarmModeName'], + type: AlarmType.fromJson(json[r'type']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => AlarmTriggered.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = AlarmTriggered.fromJson(v)); + } + return map; + } + + // maps a json object with a list of AlarmTriggered-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = AlarmTriggered.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/alarm_type.dart b/mycore_api/lib/model/alarm_type.dart new file mode 100644 index 0000000..3cbbc37 --- /dev/null +++ b/mycore_api/lib/model/alarm_type.dart @@ -0,0 +1,88 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class AlarmType { + /// Instantiate a new enum with the provided [value]. + const AlarmType._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const home = AlarmType._(r'Home'); + static const absent = AlarmType._(r'Absent'); + static const geolocalized = AlarmType._(r'Geolocalized'); + static const programmed = AlarmType._(r'Programmed'); + static const desarmed = AlarmType._(r'Desarmed'); + static const custom = AlarmType._(r'Custom'); + + /// List of all possible values in this [enum][AlarmType]. + static const values = [ + home, + absent, + geolocalized, + programmed, + desarmed, + custom, + ]; + + static AlarmType fromJson(dynamic value) => + AlarmTypeTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => AlarmType.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [AlarmType] to String, +/// and [decode] dynamic data back to [AlarmType]. +class AlarmTypeTypeTransformer { + const AlarmTypeTypeTransformer._(); + + factory AlarmTypeTypeTransformer() => _instance ??= AlarmTypeTypeTransformer._(); + + String encode(AlarmType data) => data.value; + + /// Decodes a [dynamic value][data] to a AlarmType. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + AlarmType decode(dynamic data, {bool allowNull}) { + switch (data) { + case r'Home': return AlarmType.home; + case r'Absent': return AlarmType.absent; + case r'Geolocalized': return AlarmType.geolocalized; + case r'Programmed': return AlarmType.programmed; + case r'Desarmed': return AlarmType.desarmed; + case r'Custom': return AlarmType.custom; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [AlarmTypeTypeTransformer] instance. + static AlarmTypeTypeTransformer _instance; +} diff --git a/mycore_api/lib/model/automation_detail_dto.dart b/mycore_api/lib/model/automation_detail_dto.dart index 46371cd..1e3d4cf 100644 --- a/mycore_api/lib/model/automation_detail_dto.dart +++ b/mycore_api/lib/model/automation_detail_dto.dart @@ -15,7 +15,7 @@ class AutomationDetailDTO { this.id, this.name, this.active, - this.userId, + this.homeId, this.createdDate, this.updatedDate, this.triggers, @@ -30,7 +30,7 @@ class AutomationDetailDTO { bool active; - String userId; + String homeId; DateTime createdDate; @@ -49,7 +49,7 @@ class AutomationDetailDTO { other.id == id && other.name == name && other.active == active && - other.userId == userId && + other.homeId == homeId && other.createdDate == createdDate && other.updatedDate == updatedDate && other.triggers == triggers && @@ -62,7 +62,7 @@ class AutomationDetailDTO { (id == null ? 0 : id.hashCode) + (name == null ? 0 : name.hashCode) + (active == null ? 0 : active.hashCode) + - (userId == null ? 0 : userId.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + (createdDate == null ? 0 : createdDate.hashCode) + (updatedDate == null ? 0 : updatedDate.hashCode) + (triggers == null ? 0 : triggers.hashCode) + @@ -71,7 +71,7 @@ class AutomationDetailDTO { (devicesIds == null ? 0 : devicesIds.hashCode); @override - String toString() => 'AutomationDetailDTO[id=$id, name=$name, active=$active, userId=$userId, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, conditions=$conditions, actions=$actions, devicesIds=$devicesIds]'; + String toString() => 'AutomationDetailDTO[id=$id, name=$name, active=$active, homeId=$homeId, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, conditions=$conditions, actions=$actions, devicesIds=$devicesIds]'; Map toJson() { final json = {}; @@ -84,8 +84,8 @@ class AutomationDetailDTO { if (active != null) { json[r'active'] = active; } - if (userId != null) { - json[r'userId'] = userId; + if (homeId != null) { + json[r'homeId'] = homeId; } if (createdDate != null) { json[r'createdDate'] = createdDate.toUtc().toIso8601String(); @@ -116,7 +116,7 @@ class AutomationDetailDTO { id: json[r'id'], name: json[r'name'], active: json[r'active'], - userId: json[r'userId'], + homeId: json[r'homeId'], createdDate: json[r'createdDate'] == null ? null : DateTime.parse(json[r'createdDate']), diff --git a/mycore_api/lib/model/automation_dto.dart b/mycore_api/lib/model/automation_dto.dart index 779c392..1a94deb 100644 --- a/mycore_api/lib/model/automation_dto.dart +++ b/mycore_api/lib/model/automation_dto.dart @@ -15,7 +15,7 @@ class AutomationDTO { this.id, this.name, this.active, - this.userId, + this.homeId, this.createdDate, this.updatedDate, }); @@ -26,7 +26,7 @@ class AutomationDTO { bool active; - String userId; + String homeId; DateTime createdDate; @@ -37,7 +37,7 @@ class AutomationDTO { other.id == id && other.name == name && other.active == active && - other.userId == userId && + other.homeId == homeId && other.createdDate == createdDate && other.updatedDate == updatedDate; @@ -46,12 +46,12 @@ class AutomationDTO { (id == null ? 0 : id.hashCode) + (name == null ? 0 : name.hashCode) + (active == null ? 0 : active.hashCode) + - (userId == null ? 0 : userId.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + (createdDate == null ? 0 : createdDate.hashCode) + (updatedDate == null ? 0 : updatedDate.hashCode); @override - String toString() => 'AutomationDTO[id=$id, name=$name, active=$active, userId=$userId, createdDate=$createdDate, updatedDate=$updatedDate]'; + String toString() => 'AutomationDTO[id=$id, name=$name, active=$active, homeId=$homeId, createdDate=$createdDate, updatedDate=$updatedDate]'; Map toJson() { final json = {}; @@ -64,8 +64,8 @@ class AutomationDTO { if (active != null) { json[r'active'] = active; } - if (userId != null) { - json[r'userId'] = userId; + if (homeId != null) { + json[r'homeId'] = homeId; } if (createdDate != null) { json[r'createdDate'] = createdDate.toUtc().toIso8601String(); @@ -84,7 +84,7 @@ class AutomationDTO { id: json[r'id'], name: json[r'name'], active: json[r'active'], - userId: json[r'userId'], + homeId: json[r'homeId'], createdDate: json[r'createdDate'] == null ? null : DateTime.parse(json[r'createdDate']), diff --git a/mycore_api/lib/model/automation_triggered.dart b/mycore_api/lib/model/automation_triggered.dart new file mode 100644 index 0000000..8fcecbc --- /dev/null +++ b/mycore_api/lib/model/automation_triggered.dart @@ -0,0 +1,80 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AutomationTriggered { + /// Returns a new [AutomationTriggered] instance. + AutomationTriggered({ + this.automationId, + this.automationName, + }); + + String automationId; + + String automationName; + + @override + bool operator ==(Object other) => identical(this, other) || other is AutomationTriggered && + other.automationId == automationId && + other.automationName == automationName; + + @override + int get hashCode => + (automationId == null ? 0 : automationId.hashCode) + + (automationName == null ? 0 : automationName.hashCode); + + @override + String toString() => 'AutomationTriggered[automationId=$automationId, automationName=$automationName]'; + + Map toJson() { + final json = {}; + if (automationId != null) { + json[r'automationId'] = automationId; + } + if (automationName != null) { + json[r'automationName'] = automationName; + } + return json; + } + + /// Returns a new [AutomationTriggered] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static AutomationTriggered fromJson(Map json) => json == null + ? null + : AutomationTriggered( + automationId: json[r'automationId'], + automationName: json[r'automationName'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => AutomationTriggered.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = AutomationTriggered.fromJson(v)); + } + return map; + } + + // maps a json object with a list of AutomationTriggered-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = AutomationTriggered.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/condition.dart b/mycore_api/lib/model/condition.dart index 390b350..6c78806 100644 --- a/mycore_api/lib/model/condition.dart +++ b/mycore_api/lib/model/condition.dart @@ -22,7 +22,7 @@ class Condition { String deviceId; - AutomationState state; + OneOfAutomationState state; String startTime; @@ -82,7 +82,7 @@ class Condition { ? null : Condition( deviceId: json[r'deviceId'], - state: AutomationState.fromJson(json[r'state']), + state: OneOfAutomationState.fromJson(json[r'state']), startTime: json[r'startTime'], endTime: json[r'endTime'], type: ConditionType.fromJson(json[r'type']), diff --git a/mycore_api/lib/model/create_or_update_home_dto.dart b/mycore_api/lib/model/create_or_update_home_dto.dart new file mode 100644 index 0000000..91c5c8d --- /dev/null +++ b/mycore_api/lib/model/create_or_update_home_dto.dart @@ -0,0 +1,140 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class CreateOrUpdateHomeDTO { + /// Returns a new [CreateOrUpdateHomeDTO] instance. + CreateOrUpdateHomeDTO({ + this.id, + this.name, + this.isAlarm, + this.isDefault, + this.currentAlarmMode, + this.createdDate, + this.updatedDate, + this.usersIds, + }); + + String id; + + String name; + + bool isAlarm; + + bool isDefault; + + OneOfAlarmModeDTO currentAlarmMode; + + DateTime createdDate; + + DateTime updatedDate; + + List usersIds; + + @override + bool operator ==(Object other) => identical(this, other) || other is CreateOrUpdateHomeDTO && + other.id == id && + other.name == name && + other.isAlarm == isAlarm && + other.isDefault == isDefault && + other.currentAlarmMode == currentAlarmMode && + other.createdDate == createdDate && + other.updatedDate == updatedDate && + other.usersIds == usersIds; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (name == null ? 0 : name.hashCode) + + (isAlarm == null ? 0 : isAlarm.hashCode) + + (isDefault == null ? 0 : isDefault.hashCode) + + (currentAlarmMode == null ? 0 : currentAlarmMode.hashCode) + + (createdDate == null ? 0 : createdDate.hashCode) + + (updatedDate == null ? 0 : updatedDate.hashCode) + + (usersIds == null ? 0 : usersIds.hashCode); + + @override + String toString() => 'CreateOrUpdateHomeDTO[id=$id, name=$name, isAlarm=$isAlarm, isDefault=$isDefault, currentAlarmMode=$currentAlarmMode, createdDate=$createdDate, updatedDate=$updatedDate, usersIds=$usersIds]'; + + Map toJson() { + final json = {}; + if (id != null) { + json[r'id'] = id; + } + if (name != null) { + json[r'name'] = name; + } + if (isAlarm != null) { + json[r'isAlarm'] = isAlarm; + } + if (isDefault != null) { + json[r'isDefault'] = isDefault; + } + if (currentAlarmMode != null) { + json[r'currentAlarmMode'] = currentAlarmMode; + } + if (createdDate != null) { + json[r'createdDate'] = createdDate.toUtc().toIso8601String(); + } + if (updatedDate != null) { + json[r'updatedDate'] = updatedDate.toUtc().toIso8601String(); + } + if (usersIds != null) { + json[r'usersIds'] = usersIds; + } + return json; + } + + /// Returns a new [CreateOrUpdateHomeDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static CreateOrUpdateHomeDTO fromJson(Map json) => json == null + ? null + : CreateOrUpdateHomeDTO( + id: json[r'id'], + name: json[r'name'], + isAlarm: json[r'isAlarm'], + isDefault: json[r'isDefault'], + currentAlarmMode: OneOfAlarmModeDTO.fromJson(json[r'currentAlarmMode']), + createdDate: json[r'createdDate'] == null + ? null + : DateTime.parse(json[r'createdDate']), + updatedDate: json[r'updatedDate'] == null + ? null + : DateTime.parse(json[r'updatedDate']), + usersIds: json[r'usersIds'] == null + ? null + : (json[r'usersIds'] as List).cast(), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => CreateOrUpdateHomeDTO.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = CreateOrUpdateHomeDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of CreateOrUpdateHomeDTO-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = CreateOrUpdateHomeDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/create_or_update_home_dto_all_of.dart b/mycore_api/lib/model/create_or_update_home_dto_all_of.dart new file mode 100644 index 0000000..fb66ebf --- /dev/null +++ b/mycore_api/lib/model/create_or_update_home_dto_all_of.dart @@ -0,0 +1,73 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class CreateOrUpdateHomeDTOAllOf { + /// Returns a new [CreateOrUpdateHomeDTOAllOf] instance. + CreateOrUpdateHomeDTOAllOf({ + this.usersIds, + }); + + List usersIds; + + @override + bool operator ==(Object other) => identical(this, other) || other is CreateOrUpdateHomeDTOAllOf && + other.usersIds == usersIds; + + @override + int get hashCode => + (usersIds == null ? 0 : usersIds.hashCode); + + @override + String toString() => 'CreateOrUpdateHomeDTOAllOf[usersIds=$usersIds]'; + + Map toJson() { + final json = {}; + if (usersIds != null) { + json[r'usersIds'] = usersIds; + } + return json; + } + + /// Returns a new [CreateOrUpdateHomeDTOAllOf] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static CreateOrUpdateHomeDTOAllOf fromJson(Map json) => json == null + ? null + : CreateOrUpdateHomeDTOAllOf( + usersIds: json[r'usersIds'] == null + ? null + : (json[r'usersIds'] as List).cast(), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => CreateOrUpdateHomeDTOAllOf.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = CreateOrUpdateHomeDTOAllOf.fromJson(v)); + } + return map; + } + + // maps a json object with a list of CreateOrUpdateHomeDTOAllOf-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = CreateOrUpdateHomeDTOAllOf.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/device_detail_dto.dart b/mycore_api/lib/model/device_detail_dto.dart index 5178692..3f24293 100644 --- a/mycore_api/lib/model/device_detail_dto.dart +++ b/mycore_api/lib/model/device_detail_dto.dart @@ -13,17 +13,16 @@ class DeviceDetailDTO { /// Returns a new [DeviceDetailDTO] instance. DeviceDetailDTO({ this.id, - this.userId, + this.homeId, this.description, this.name, this.model, this.type, this.status, this.connectionStatus, - this.locationId, + this.roomId, this.providerId, this.providerName, - this.location, this.lastStateDate, this.battery, this.batteryStatus, @@ -44,7 +43,7 @@ class DeviceDetailDTO { String id; - String userId; + String homeId; String description; @@ -58,14 +57,12 @@ class DeviceDetailDTO { ConnectionStatus connectionStatus; - String locationId; + String roomId; String providerId; String providerName; - PlaceDTO location; - DateTime lastStateDate; bool battery; @@ -101,17 +98,16 @@ class DeviceDetailDTO { @override bool operator ==(Object other) => identical(this, other) || other is DeviceDetailDTO && other.id == id && - other.userId == userId && + other.homeId == homeId && other.description == description && other.name == name && other.model == model && other.type == type && other.status == status && other.connectionStatus == connectionStatus && - other.locationId == locationId && + other.roomId == roomId && other.providerId == providerId && other.providerName == providerName && - other.location == location && other.lastStateDate == lastStateDate && other.battery == battery && other.batteryStatus == batteryStatus && @@ -132,17 +128,16 @@ class DeviceDetailDTO { @override int get hashCode => (id == null ? 0 : id.hashCode) + - (userId == null ? 0 : userId.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + (description == null ? 0 : description.hashCode) + (name == null ? 0 : name.hashCode) + (model == null ? 0 : model.hashCode) + (type == null ? 0 : type.hashCode) + (status == null ? 0 : status.hashCode) + (connectionStatus == null ? 0 : connectionStatus.hashCode) + - (locationId == null ? 0 : locationId.hashCode) + + (roomId == null ? 0 : roomId.hashCode) + (providerId == null ? 0 : providerId.hashCode) + (providerName == null ? 0 : providerName.hashCode) + - (location == null ? 0 : location.hashCode) + (lastStateDate == null ? 0 : lastStateDate.hashCode) + (battery == null ? 0 : battery.hashCode) + (batteryStatus == null ? 0 : batteryStatus.hashCode) + @@ -161,15 +156,15 @@ class DeviceDetailDTO { (supportedOperations == null ? 0 : supportedOperations.hashCode); @override - String toString() => 'DeviceDetailDTO[id=$id, userId=$userId, description=$description, name=$name, model=$model, type=$type, status=$status, connectionStatus=$connectionStatus, locationId=$locationId, providerId=$providerId, providerName=$providerName, location=$location, lastStateDate=$lastStateDate, battery=$battery, batteryStatus=$batteryStatus, firmwareVersion=$firmwareVersion, hardwareVersion=$hardwareVersion, port=$port, meansOfCommunications=$meansOfCommunications, createdDate=$createdDate, updatedDate=$updatedDate, lastState=$lastState, ipAddress=$ipAddress, serviceIdentification=$serviceIdentification, manufacturerName=$manufacturerName, groupIds=$groupIds, properties=$properties, supportedOperations=$supportedOperations]'; + String toString() => 'DeviceDetailDTO[id=$id, homeId=$homeId, description=$description, name=$name, model=$model, type=$type, status=$status, connectionStatus=$connectionStatus, roomId=$roomId, providerId=$providerId, providerName=$providerName, lastStateDate=$lastStateDate, battery=$battery, batteryStatus=$batteryStatus, firmwareVersion=$firmwareVersion, hardwareVersion=$hardwareVersion, port=$port, meansOfCommunications=$meansOfCommunications, createdDate=$createdDate, updatedDate=$updatedDate, lastState=$lastState, ipAddress=$ipAddress, serviceIdentification=$serviceIdentification, manufacturerName=$manufacturerName, groupIds=$groupIds, properties=$properties, supportedOperations=$supportedOperations]'; Map toJson() { final json = {}; if (id != null) { json[r'id'] = id; } - if (userId != null) { - json[r'userId'] = userId; + if (homeId != null) { + json[r'homeId'] = homeId; } if (description != null) { json[r'description'] = description; @@ -189,8 +184,8 @@ class DeviceDetailDTO { if (connectionStatus != null) { json[r'connectionStatus'] = connectionStatus; } - if (locationId != null) { - json[r'locationId'] = locationId; + if (roomId != null) { + json[r'roomId'] = roomId; } if (providerId != null) { json[r'providerId'] = providerId; @@ -198,9 +193,6 @@ class DeviceDetailDTO { if (providerName != null) { json[r'providerName'] = providerName; } - if (location != null) { - json[r'location'] = location; - } if (lastStateDate != null) { json[r'lastStateDate'] = lastStateDate.toUtc().toIso8601String(); } @@ -258,17 +250,16 @@ class DeviceDetailDTO { ? null : DeviceDetailDTO( id: json[r'id'], - userId: json[r'userId'], + homeId: json[r'homeId'], description: json[r'description'], name: json[r'name'], model: json[r'model'], type: DeviceType.fromJson(json[r'type']), status: json[r'status'], connectionStatus: ConnectionStatus.fromJson(json[r'connectionStatus']), - locationId: json[r'locationId'], + roomId: json[r'roomId'], providerId: json[r'providerId'], providerName: json[r'providerName'], - location: PlaceDTO.fromJson(json[r'location']), lastStateDate: json[r'lastStateDate'] == null ? null : DateTime.parse(json[r'lastStateDate']), diff --git a/mycore_api/lib/model/device_state.dart b/mycore_api/lib/model/device_state.dart new file mode 100644 index 0000000..f5b19a0 --- /dev/null +++ b/mycore_api/lib/model/device_state.dart @@ -0,0 +1,98 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class DeviceState { + /// Returns a new [DeviceState] instance. + DeviceState({ + this.deviceId, + this.deviceName, + this.message, + this.deviceType, + }); + + String deviceId; + + String deviceName; + + String message; + + DeviceType deviceType; + + @override + bool operator ==(Object other) => identical(this, other) || other is DeviceState && + other.deviceId == deviceId && + other.deviceName == deviceName && + other.message == message && + other.deviceType == deviceType; + + @override + int get hashCode => + (deviceId == null ? 0 : deviceId.hashCode) + + (deviceName == null ? 0 : deviceName.hashCode) + + (message == null ? 0 : message.hashCode) + + (deviceType == null ? 0 : deviceType.hashCode); + + @override + String toString() => 'DeviceState[deviceId=$deviceId, deviceName=$deviceName, message=$message, deviceType=$deviceType]'; + + Map toJson() { + final json = {}; + if (deviceId != null) { + json[r'deviceId'] = deviceId; + } + if (deviceName != null) { + json[r'deviceName'] = deviceName; + } + if (message != null) { + json[r'message'] = message; + } + if (deviceType != null) { + json[r'deviceType'] = deviceType; + } + return json; + } + + /// Returns a new [DeviceState] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static DeviceState fromJson(Map json) => json == null + ? null + : DeviceState( + deviceId: json[r'deviceId'], + deviceName: json[r'deviceName'], + message: json[r'message'], + deviceType: DeviceType.fromJson(json[r'deviceType']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => DeviceState.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = DeviceState.fromJson(v)); + } + return map; + } + + // maps a json object with a list of DeviceState-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = DeviceState.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/device_summary_dto.dart b/mycore_api/lib/model/device_summary_dto.dart index 6280915..c4c1806 100644 --- a/mycore_api/lib/model/device_summary_dto.dart +++ b/mycore_api/lib/model/device_summary_dto.dart @@ -13,17 +13,16 @@ class DeviceSummaryDTO { /// Returns a new [DeviceSummaryDTO] instance. DeviceSummaryDTO({ this.id, - this.userId, + this.homeId, this.description, this.name, this.model, this.type, this.status, this.connectionStatus, - this.locationId, + this.roomId, this.providerId, this.providerName, - this.location, this.lastStateDate, this.battery, this.batteryStatus, @@ -31,7 +30,7 @@ class DeviceSummaryDTO { String id; - String userId; + String homeId; String description; @@ -45,14 +44,12 @@ class DeviceSummaryDTO { ConnectionStatus connectionStatus; - String locationId; + String roomId; String providerId; String providerName; - PlaceDTO location; - DateTime lastStateDate; bool battery; @@ -62,17 +59,16 @@ class DeviceSummaryDTO { @override bool operator ==(Object other) => identical(this, other) || other is DeviceSummaryDTO && other.id == id && - other.userId == userId && + other.homeId == homeId && other.description == description && other.name == name && other.model == model && other.type == type && other.status == status && other.connectionStatus == connectionStatus && - other.locationId == locationId && + other.roomId == roomId && other.providerId == providerId && other.providerName == providerName && - other.location == location && other.lastStateDate == lastStateDate && other.battery == battery && other.batteryStatus == batteryStatus; @@ -80,31 +76,30 @@ class DeviceSummaryDTO { @override int get hashCode => (id == null ? 0 : id.hashCode) + - (userId == null ? 0 : userId.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + (description == null ? 0 : description.hashCode) + (name == null ? 0 : name.hashCode) + (model == null ? 0 : model.hashCode) + (type == null ? 0 : type.hashCode) + (status == null ? 0 : status.hashCode) + (connectionStatus == null ? 0 : connectionStatus.hashCode) + - (locationId == null ? 0 : locationId.hashCode) + + (roomId == null ? 0 : roomId.hashCode) + (providerId == null ? 0 : providerId.hashCode) + (providerName == null ? 0 : providerName.hashCode) + - (location == null ? 0 : location.hashCode) + (lastStateDate == null ? 0 : lastStateDate.hashCode) + (battery == null ? 0 : battery.hashCode) + (batteryStatus == null ? 0 : batteryStatus.hashCode); @override - String toString() => 'DeviceSummaryDTO[id=$id, userId=$userId, description=$description, name=$name, model=$model, type=$type, status=$status, connectionStatus=$connectionStatus, locationId=$locationId, providerId=$providerId, providerName=$providerName, location=$location, lastStateDate=$lastStateDate, battery=$battery, batteryStatus=$batteryStatus]'; + String toString() => 'DeviceSummaryDTO[id=$id, homeId=$homeId, description=$description, name=$name, model=$model, type=$type, status=$status, connectionStatus=$connectionStatus, roomId=$roomId, providerId=$providerId, providerName=$providerName, lastStateDate=$lastStateDate, battery=$battery, batteryStatus=$batteryStatus]'; Map toJson() { final json = {}; if (id != null) { json[r'id'] = id; } - if (userId != null) { - json[r'userId'] = userId; + if (homeId != null) { + json[r'homeId'] = homeId; } if (description != null) { json[r'description'] = description; @@ -124,8 +119,8 @@ class DeviceSummaryDTO { if (connectionStatus != null) { json[r'connectionStatus'] = connectionStatus; } - if (locationId != null) { - json[r'locationId'] = locationId; + if (roomId != null) { + json[r'roomId'] = roomId; } if (providerId != null) { json[r'providerId'] = providerId; @@ -133,9 +128,6 @@ class DeviceSummaryDTO { if (providerName != null) { json[r'providerName'] = providerName; } - if (location != null) { - json[r'location'] = location; - } if (lastStateDate != null) { json[r'lastStateDate'] = lastStateDate.toUtc().toIso8601String(); } @@ -154,17 +146,16 @@ class DeviceSummaryDTO { ? null : DeviceSummaryDTO( id: json[r'id'], - userId: json[r'userId'], + homeId: json[r'homeId'], description: json[r'description'], name: json[r'name'], model: json[r'model'], type: DeviceType.fromJson(json[r'type']), status: json[r'status'], connectionStatus: ConnectionStatus.fromJson(json[r'connectionStatus']), - locationId: json[r'locationId'], + roomId: json[r'roomId'], providerId: json[r'providerId'], providerName: json[r'providerName'], - location: PlaceDTO.fromJson(json[r'location']), lastStateDate: json[r'lastStateDate'] == null ? null : DateTime.parse(json[r'lastStateDate']), diff --git a/mycore_api/lib/model/electricity_production.dart b/mycore_api/lib/model/electricity_production.dart index 020518a..372673c 100644 --- a/mycore_api/lib/model/electricity_production.dart +++ b/mycore_api/lib/model/electricity_production.dart @@ -14,7 +14,7 @@ class ElectricityProduction { ElectricityProduction({ this.id, this.deviceId, - this.userId, + this.homeId, this.watt, this.ampere, this.timestamp, @@ -24,7 +24,7 @@ class ElectricityProduction { String deviceId; - String userId; + String homeId; double watt; @@ -36,7 +36,7 @@ class ElectricityProduction { bool operator ==(Object other) => identical(this, other) || other is ElectricityProduction && other.id == id && other.deviceId == deviceId && - other.userId == userId && + other.homeId == homeId && other.watt == watt && other.ampere == ampere && other.timestamp == timestamp; @@ -45,13 +45,13 @@ class ElectricityProduction { int get hashCode => (id == null ? 0 : id.hashCode) + (deviceId == null ? 0 : deviceId.hashCode) + - (userId == null ? 0 : userId.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + (watt == null ? 0 : watt.hashCode) + (ampere == null ? 0 : ampere.hashCode) + (timestamp == null ? 0 : timestamp.hashCode); @override - String toString() => 'ElectricityProduction[id=$id, deviceId=$deviceId, userId=$userId, watt=$watt, ampere=$ampere, timestamp=$timestamp]'; + String toString() => 'ElectricityProduction[id=$id, deviceId=$deviceId, homeId=$homeId, watt=$watt, ampere=$ampere, timestamp=$timestamp]'; Map toJson() { final json = {}; @@ -61,8 +61,8 @@ class ElectricityProduction { if (deviceId != null) { json[r'deviceId'] = deviceId; } - if (userId != null) { - json[r'userId'] = userId; + if (homeId != null) { + json[r'homeId'] = homeId; } if (watt != null) { json[r'watt'] = watt; @@ -83,7 +83,7 @@ class ElectricityProduction { : ElectricityProduction( id: json[r'id'], deviceId: json[r'deviceId'], - userId: json[r'userId'], + homeId: json[r'homeId'], watt: json[r'watt'], ampere: json[r'ampere'], timestamp: json[r'timestamp'] == null diff --git a/mycore_api/lib/model/event_detail_dto.dart b/mycore_api/lib/model/event_detail_dto.dart new file mode 100644 index 0000000..8aebcd6 --- /dev/null +++ b/mycore_api/lib/model/event_detail_dto.dart @@ -0,0 +1,136 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class EventDetailDTO { + /// Returns a new [EventDetailDTO] instance. + EventDetailDTO({ + this.id, + this.homeId, + this.date, + this.type, + this.roomId, + this.deviceState, + this.automationTriggered, + this.alarmTriggered, + }); + + String id; + + String homeId; + + DateTime date; + + EventType type; + + String roomId; + + OneOfDeviceState deviceState; + + OneOfAutomationTriggered automationTriggered; + + OneOfAlarmTriggered alarmTriggered; + + @override + bool operator ==(Object other) => identical(this, other) || other is EventDetailDTO && + other.id == id && + other.homeId == homeId && + other.date == date && + other.type == type && + other.roomId == roomId && + other.deviceState == deviceState && + other.automationTriggered == automationTriggered && + other.alarmTriggered == alarmTriggered; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + + (date == null ? 0 : date.hashCode) + + (type == null ? 0 : type.hashCode) + + (roomId == null ? 0 : roomId.hashCode) + + (deviceState == null ? 0 : deviceState.hashCode) + + (automationTriggered == null ? 0 : automationTriggered.hashCode) + + (alarmTriggered == null ? 0 : alarmTriggered.hashCode); + + @override + String toString() => 'EventDetailDTO[id=$id, homeId=$homeId, date=$date, type=$type, roomId=$roomId, deviceState=$deviceState, automationTriggered=$automationTriggered, alarmTriggered=$alarmTriggered]'; + + Map toJson() { + final json = {}; + if (id != null) { + json[r'id'] = id; + } + if (homeId != null) { + json[r'homeId'] = homeId; + } + if (date != null) { + json[r'date'] = date.toUtc().toIso8601String(); + } + if (type != null) { + json[r'type'] = type; + } + if (roomId != null) { + json[r'roomId'] = roomId; + } + if (deviceState != null) { + json[r'deviceState'] = deviceState; + } + if (automationTriggered != null) { + json[r'automationTriggered'] = automationTriggered; + } + if (alarmTriggered != null) { + json[r'alarmTriggered'] = alarmTriggered; + } + return json; + } + + /// Returns a new [EventDetailDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static EventDetailDTO fromJson(Map json) => json == null + ? null + : EventDetailDTO( + id: json[r'id'], + homeId: json[r'homeId'], + date: json[r'date'] == null + ? null + : DateTime.parse(json[r'date']), + type: EventType.fromJson(json[r'type']), + roomId: json[r'roomId'], + deviceState: OneOfDeviceState.fromJson(json[r'deviceState']), + automationTriggered: OneOfAutomationTriggered.fromJson(json[r'automationTriggered']), + alarmTriggered: OneOfAlarmTriggered.fromJson(json[r'alarmTriggered']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => EventDetailDTO.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = EventDetailDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of EventDetailDTO-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = EventDetailDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/event_detail_dto_all_of.dart b/mycore_api/lib/model/event_detail_dto_all_of.dart new file mode 100644 index 0000000..46464c5 --- /dev/null +++ b/mycore_api/lib/model/event_detail_dto_all_of.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class EventDetailDTOAllOf { + /// Returns a new [EventDetailDTOAllOf] instance. + EventDetailDTOAllOf({ + this.deviceState, + this.automationTriggered, + this.alarmTriggered, + }); + + OneOfDeviceState deviceState; + + OneOfAutomationTriggered automationTriggered; + + OneOfAlarmTriggered alarmTriggered; + + @override + bool operator ==(Object other) => identical(this, other) || other is EventDetailDTOAllOf && + other.deviceState == deviceState && + other.automationTriggered == automationTriggered && + other.alarmTriggered == alarmTriggered; + + @override + int get hashCode => + (deviceState == null ? 0 : deviceState.hashCode) + + (automationTriggered == null ? 0 : automationTriggered.hashCode) + + (alarmTriggered == null ? 0 : alarmTriggered.hashCode); + + @override + String toString() => 'EventDetailDTOAllOf[deviceState=$deviceState, automationTriggered=$automationTriggered, alarmTriggered=$alarmTriggered]'; + + Map toJson() { + final json = {}; + if (deviceState != null) { + json[r'deviceState'] = deviceState; + } + if (automationTriggered != null) { + json[r'automationTriggered'] = automationTriggered; + } + if (alarmTriggered != null) { + json[r'alarmTriggered'] = alarmTriggered; + } + return json; + } + + /// Returns a new [EventDetailDTOAllOf] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static EventDetailDTOAllOf fromJson(Map json) => json == null + ? null + : EventDetailDTOAllOf( + deviceState: OneOfDeviceState.fromJson(json[r'deviceState']), + automationTriggered: OneOfAutomationTriggered.fromJson(json[r'automationTriggered']), + alarmTriggered: OneOfAlarmTriggered.fromJson(json[r'alarmTriggered']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => EventDetailDTOAllOf.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = EventDetailDTOAllOf.fromJson(v)); + } + return map; + } + + // maps a json object with a list of EventDetailDTOAllOf-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = EventDetailDTOAllOf.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/event_dto.dart b/mycore_api/lib/model/event_dto.dart new file mode 100644 index 0000000..5b946e8 --- /dev/null +++ b/mycore_api/lib/model/event_dto.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class EventDTO { + /// Returns a new [EventDTO] instance. + EventDTO({ + this.id, + this.homeId, + this.date, + this.type, + this.roomId, + }); + + String id; + + String homeId; + + DateTime date; + + EventType type; + + String roomId; + + @override + bool operator ==(Object other) => identical(this, other) || other is EventDTO && + other.id == id && + other.homeId == homeId && + other.date == date && + other.type == type && + other.roomId == roomId; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + + (date == null ? 0 : date.hashCode) + + (type == null ? 0 : type.hashCode) + + (roomId == null ? 0 : roomId.hashCode); + + @override + String toString() => 'EventDTO[id=$id, homeId=$homeId, date=$date, type=$type, roomId=$roomId]'; + + Map toJson() { + final json = {}; + if (id != null) { + json[r'id'] = id; + } + if (homeId != null) { + json[r'homeId'] = homeId; + } + if (date != null) { + json[r'date'] = date.toUtc().toIso8601String(); + } + if (type != null) { + json[r'type'] = type; + } + if (roomId != null) { + json[r'roomId'] = roomId; + } + return json; + } + + /// Returns a new [EventDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static EventDTO fromJson(Map json) => json == null + ? null + : EventDTO( + id: json[r'id'], + homeId: json[r'homeId'], + date: json[r'date'] == null + ? null + : DateTime.parse(json[r'date']), + type: EventType.fromJson(json[r'type']), + roomId: json[r'roomId'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => EventDTO.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = EventDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of EventDTO-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = EventDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/event_type.dart b/mycore_api/lib/model/event_type.dart new file mode 100644 index 0000000..40bbe60 --- /dev/null +++ b/mycore_api/lib/model/event_type.dart @@ -0,0 +1,79 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class EventType { + /// Instantiate a new enum with the provided [value]. + const EventType._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const deviceState = EventType._(r'DeviceState'); + static const automationTriggered = EventType._(r'AutomationTriggered'); + static const alarmTriggered = EventType._(r'AlarmTriggered'); + + /// List of all possible values in this [enum][EventType]. + static const values = [ + deviceState, + automationTriggered, + alarmTriggered, + ]; + + static EventType fromJson(dynamic value) => + EventTypeTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => EventType.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [EventType] to String, +/// and [decode] dynamic data back to [EventType]. +class EventTypeTypeTransformer { + const EventTypeTypeTransformer._(); + + factory EventTypeTypeTransformer() => _instance ??= EventTypeTypeTransformer._(); + + String encode(EventType data) => data.value; + + /// Decodes a [dynamic value][data] to a EventType. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EventType decode(dynamic data, {bool allowNull}) { + switch (data) { + case r'DeviceState': return EventType.deviceState; + case r'AutomationTriggered': return EventType.automationTriggered; + case r'AlarmTriggered': return EventType.alarmTriggered; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [EventTypeTypeTransformer] instance. + static EventTypeTypeTransformer _instance; +} diff --git a/mycore_api/lib/model/geolocalized_mode.dart b/mycore_api/lib/model/geolocalized_mode.dart new file mode 100644 index 0000000..73c14ea --- /dev/null +++ b/mycore_api/lib/model/geolocalized_mode.dart @@ -0,0 +1,98 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class GeolocalizedMode { + /// Returns a new [GeolocalizedMode] instance. + GeolocalizedMode({ + this.latitude, + this.longitude, + this.homeMode, + this.absentMode, + }); + + String latitude; + + String longitude; + + OneOfAlarmMode homeMode; + + OneOfAlarmMode absentMode; + + @override + bool operator ==(Object other) => identical(this, other) || other is GeolocalizedMode && + other.latitude == latitude && + other.longitude == longitude && + other.homeMode == homeMode && + other.absentMode == absentMode; + + @override + int get hashCode => + (latitude == null ? 0 : latitude.hashCode) + + (longitude == null ? 0 : longitude.hashCode) + + (homeMode == null ? 0 : homeMode.hashCode) + + (absentMode == null ? 0 : absentMode.hashCode); + + @override + String toString() => 'GeolocalizedMode[latitude=$latitude, longitude=$longitude, homeMode=$homeMode, absentMode=$absentMode]'; + + Map toJson() { + final json = {}; + if (latitude != null) { + json[r'latitude'] = latitude; + } + if (longitude != null) { + json[r'longitude'] = longitude; + } + if (homeMode != null) { + json[r'homeMode'] = homeMode; + } + if (absentMode != null) { + json[r'absentMode'] = absentMode; + } + return json; + } + + /// Returns a new [GeolocalizedMode] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static GeolocalizedMode fromJson(Map json) => json == null + ? null + : GeolocalizedMode( + latitude: json[r'latitude'], + longitude: json[r'longitude'], + homeMode: OneOfAlarmMode.fromJson(json[r'homeMode']), + absentMode: OneOfAlarmMode.fromJson(json[r'absentMode']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => GeolocalizedMode.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = GeolocalizedMode.fromJson(v)); + } + return map; + } + + // maps a json object with a list of GeolocalizedMode-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = GeolocalizedMode.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/group_create_or_update_detail_dto.dart b/mycore_api/lib/model/group_create_or_update_detail_dto.dart index 34b4dbf..fd468a0 100644 --- a/mycore_api/lib/model/group_create_or_update_detail_dto.dart +++ b/mycore_api/lib/model/group_create_or_update_detail_dto.dart @@ -13,7 +13,7 @@ class GroupCreateOrUpdateDetailDTO { /// Returns a new [GroupCreateOrUpdateDetailDTO] instance. GroupCreateOrUpdateDetailDTO({ this.id, - this.userId, + this.homeId, this.name, this.type, this.isAlarm, @@ -22,7 +22,7 @@ class GroupCreateOrUpdateDetailDTO { String id; - String userId; + String homeId; String name; @@ -35,7 +35,7 @@ class GroupCreateOrUpdateDetailDTO { @override bool operator ==(Object other) => identical(this, other) || other is GroupCreateOrUpdateDetailDTO && other.id == id && - other.userId == userId && + other.homeId == homeId && other.name == name && other.type == type && other.isAlarm == isAlarm && @@ -44,22 +44,22 @@ class GroupCreateOrUpdateDetailDTO { @override int get hashCode => (id == null ? 0 : id.hashCode) + - (userId == null ? 0 : userId.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + (name == null ? 0 : name.hashCode) + (type == null ? 0 : type.hashCode) + (isAlarm == null ? 0 : isAlarm.hashCode) + (deviceIds == null ? 0 : deviceIds.hashCode); @override - String toString() => 'GroupCreateOrUpdateDetailDTO[id=$id, userId=$userId, name=$name, type=$type, isAlarm=$isAlarm, deviceIds=$deviceIds]'; + String toString() => 'GroupCreateOrUpdateDetailDTO[id=$id, homeId=$homeId, name=$name, type=$type, isAlarm=$isAlarm, deviceIds=$deviceIds]'; Map toJson() { final json = {}; if (id != null) { json[r'id'] = id; } - if (userId != null) { - json[r'userId'] = userId; + if (homeId != null) { + json[r'homeId'] = homeId; } if (name != null) { json[r'name'] = name; @@ -82,7 +82,7 @@ class GroupCreateOrUpdateDetailDTO { ? null : GroupCreateOrUpdateDetailDTO( id: json[r'id'], - userId: json[r'userId'], + homeId: json[r'homeId'], name: json[r'name'], type: json[r'type'], isAlarm: json[r'isAlarm'], diff --git a/mycore_api/lib/model/group_detail_dto.dart b/mycore_api/lib/model/group_detail_dto.dart index 369c171..af908d0 100644 --- a/mycore_api/lib/model/group_detail_dto.dart +++ b/mycore_api/lib/model/group_detail_dto.dart @@ -13,7 +13,7 @@ class GroupDetailDTO { /// Returns a new [GroupDetailDTO] instance. GroupDetailDTO({ this.id, - this.userId, + this.homeId, this.name, this.type, this.isAlarm, @@ -24,7 +24,7 @@ class GroupDetailDTO { String id; - String userId; + String homeId; String name; @@ -41,7 +41,7 @@ class GroupDetailDTO { @override bool operator ==(Object other) => identical(this, other) || other is GroupDetailDTO && other.id == id && - other.userId == userId && + other.homeId == homeId && other.name == name && other.type == type && other.isAlarm == isAlarm && @@ -52,7 +52,7 @@ class GroupDetailDTO { @override int get hashCode => (id == null ? 0 : id.hashCode) + - (userId == null ? 0 : userId.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + (name == null ? 0 : name.hashCode) + (type == null ? 0 : type.hashCode) + (isAlarm == null ? 0 : isAlarm.hashCode) + @@ -61,15 +61,15 @@ class GroupDetailDTO { (devices == null ? 0 : devices.hashCode); @override - String toString() => 'GroupDetailDTO[id=$id, userId=$userId, name=$name, type=$type, isAlarm=$isAlarm, createdDate=$createdDate, updatedDate=$updatedDate, devices=$devices]'; + String toString() => 'GroupDetailDTO[id=$id, homeId=$homeId, name=$name, type=$type, isAlarm=$isAlarm, createdDate=$createdDate, updatedDate=$updatedDate, devices=$devices]'; Map toJson() { final json = {}; if (id != null) { json[r'id'] = id; } - if (userId != null) { - json[r'userId'] = userId; + if (homeId != null) { + json[r'homeId'] = homeId; } if (name != null) { json[r'name'] = name; @@ -98,7 +98,7 @@ class GroupDetailDTO { ? null : GroupDetailDTO( id: json[r'id'], - userId: json[r'userId'], + homeId: json[r'homeId'], name: json[r'name'], type: json[r'type'], isAlarm: json[r'isAlarm'], diff --git a/mycore_api/lib/model/group_summary_dto.dart b/mycore_api/lib/model/group_summary_dto.dart index 9e74a23..9cd29b8 100644 --- a/mycore_api/lib/model/group_summary_dto.dart +++ b/mycore_api/lib/model/group_summary_dto.dart @@ -13,7 +13,7 @@ class GroupSummaryDTO { /// Returns a new [GroupSummaryDTO] instance. GroupSummaryDTO({ this.id, - this.userId, + this.homeId, this.name, this.type, this.isAlarm, @@ -21,7 +21,7 @@ class GroupSummaryDTO { String id; - String userId; + String homeId; String name; @@ -32,7 +32,7 @@ class GroupSummaryDTO { @override bool operator ==(Object other) => identical(this, other) || other is GroupSummaryDTO && other.id == id && - other.userId == userId && + other.homeId == homeId && other.name == name && other.type == type && other.isAlarm == isAlarm; @@ -40,21 +40,21 @@ class GroupSummaryDTO { @override int get hashCode => (id == null ? 0 : id.hashCode) + - (userId == null ? 0 : userId.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + (name == null ? 0 : name.hashCode) + (type == null ? 0 : type.hashCode) + (isAlarm == null ? 0 : isAlarm.hashCode); @override - String toString() => 'GroupSummaryDTO[id=$id, userId=$userId, name=$name, type=$type, isAlarm=$isAlarm]'; + String toString() => 'GroupSummaryDTO[id=$id, homeId=$homeId, name=$name, type=$type, isAlarm=$isAlarm]'; Map toJson() { final json = {}; if (id != null) { json[r'id'] = id; } - if (userId != null) { - json[r'userId'] = userId; + if (homeId != null) { + json[r'homeId'] = homeId; } if (name != null) { json[r'name'] = name; @@ -74,7 +74,7 @@ class GroupSummaryDTO { ? null : GroupSummaryDTO( id: json[r'id'], - userId: json[r'userId'], + homeId: json[r'homeId'], name: json[r'name'], type: json[r'type'], isAlarm: json[r'isAlarm'], diff --git a/mycore_api/lib/model/home_detail_dto.dart b/mycore_api/lib/model/home_detail_dto.dart new file mode 100644 index 0000000..80810de --- /dev/null +++ b/mycore_api/lib/model/home_detail_dto.dart @@ -0,0 +1,185 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class HomeDetailDTO { + /// Returns a new [HomeDetailDTO] instance. + HomeDetailDTO({ + this.id, + this.name, + this.isAlarm, + this.isDefault, + this.currentAlarmMode, + this.createdDate, + this.updatedDate, + this.usersIds, + this.users, + this.devices, + this.automations, + this.providers, + this.groups, + }); + + String id; + + String name; + + bool isAlarm; + + bool isDefault; + + OneOfAlarmModeDTO currentAlarmMode; + + DateTime createdDate; + + DateTime updatedDate; + + List usersIds; + + List users; + + List devices; + + List automations; + + List providers; + + List groups; + + @override + bool operator ==(Object other) => identical(this, other) || other is HomeDetailDTO && + other.id == id && + other.name == name && + other.isAlarm == isAlarm && + other.isDefault == isDefault && + other.currentAlarmMode == currentAlarmMode && + other.createdDate == createdDate && + other.updatedDate == updatedDate && + other.usersIds == usersIds && + other.users == users && + other.devices == devices && + other.automations == automations && + other.providers == providers && + other.groups == groups; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (name == null ? 0 : name.hashCode) + + (isAlarm == null ? 0 : isAlarm.hashCode) + + (isDefault == null ? 0 : isDefault.hashCode) + + (currentAlarmMode == null ? 0 : currentAlarmMode.hashCode) + + (createdDate == null ? 0 : createdDate.hashCode) + + (updatedDate == null ? 0 : updatedDate.hashCode) + + (usersIds == null ? 0 : usersIds.hashCode) + + (users == null ? 0 : users.hashCode) + + (devices == null ? 0 : devices.hashCode) + + (automations == null ? 0 : automations.hashCode) + + (providers == null ? 0 : providers.hashCode) + + (groups == null ? 0 : groups.hashCode); + + @override + String toString() => 'HomeDetailDTO[id=$id, name=$name, isAlarm=$isAlarm, isDefault=$isDefault, currentAlarmMode=$currentAlarmMode, createdDate=$createdDate, updatedDate=$updatedDate, usersIds=$usersIds, users=$users, devices=$devices, automations=$automations, providers=$providers, groups=$groups]'; + + Map toJson() { + final json = {}; + if (id != null) { + json[r'id'] = id; + } + if (name != null) { + json[r'name'] = name; + } + if (isAlarm != null) { + json[r'isAlarm'] = isAlarm; + } + if (isDefault != null) { + json[r'isDefault'] = isDefault; + } + if (currentAlarmMode != null) { + json[r'currentAlarmMode'] = currentAlarmMode; + } + if (createdDate != null) { + json[r'createdDate'] = createdDate.toUtc().toIso8601String(); + } + if (updatedDate != null) { + json[r'updatedDate'] = updatedDate.toUtc().toIso8601String(); + } + if (usersIds != null) { + json[r'usersIds'] = usersIds; + } + if (users != null) { + json[r'users'] = users; + } + if (devices != null) { + json[r'devices'] = devices; + } + if (automations != null) { + json[r'automations'] = automations; + } + if (providers != null) { + json[r'providers'] = providers; + } + if (groups != null) { + json[r'groups'] = groups; + } + return json; + } + + /// Returns a new [HomeDetailDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static HomeDetailDTO fromJson(Map json) => json == null + ? null + : HomeDetailDTO( + id: json[r'id'], + name: json[r'name'], + isAlarm: json[r'isAlarm'], + isDefault: json[r'isDefault'], + currentAlarmMode: OneOfAlarmModeDTO.fromJson(json[r'currentAlarmMode']), + createdDate: json[r'createdDate'] == null + ? null + : DateTime.parse(json[r'createdDate']), + updatedDate: json[r'updatedDate'] == null + ? null + : DateTime.parse(json[r'updatedDate']), + usersIds: json[r'usersIds'] == null + ? null + : (json[r'usersIds'] as List).cast(), + users: UserInfoDetailDTO.listFromJson(json[r'users']), + devices: DeviceSummaryDTO.listFromJson(json[r'devices']), + automations: AutomationDTO.listFromJson(json[r'automations']), + providers: ProviderDTO.listFromJson(json[r'providers']), + groups: GroupSummaryDTO.listFromJson(json[r'groups']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => HomeDetailDTO.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = HomeDetailDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of HomeDetailDTO-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = HomeDetailDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/home_detail_dto_all_of.dart b/mycore_api/lib/model/home_detail_dto_all_of.dart new file mode 100644 index 0000000..206bc6b --- /dev/null +++ b/mycore_api/lib/model/home_detail_dto_all_of.dart @@ -0,0 +1,107 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class HomeDetailDTOAllOf { + /// Returns a new [HomeDetailDTOAllOf] instance. + HomeDetailDTOAllOf({ + this.users, + this.devices, + this.automations, + this.providers, + this.groups, + }); + + List users; + + List devices; + + List automations; + + List providers; + + List groups; + + @override + bool operator ==(Object other) => identical(this, other) || other is HomeDetailDTOAllOf && + other.users == users && + other.devices == devices && + other.automations == automations && + other.providers == providers && + other.groups == groups; + + @override + int get hashCode => + (users == null ? 0 : users.hashCode) + + (devices == null ? 0 : devices.hashCode) + + (automations == null ? 0 : automations.hashCode) + + (providers == null ? 0 : providers.hashCode) + + (groups == null ? 0 : groups.hashCode); + + @override + String toString() => 'HomeDetailDTOAllOf[users=$users, devices=$devices, automations=$automations, providers=$providers, groups=$groups]'; + + Map toJson() { + final json = {}; + if (users != null) { + json[r'users'] = users; + } + if (devices != null) { + json[r'devices'] = devices; + } + if (automations != null) { + json[r'automations'] = automations; + } + if (providers != null) { + json[r'providers'] = providers; + } + if (groups != null) { + json[r'groups'] = groups; + } + return json; + } + + /// Returns a new [HomeDetailDTOAllOf] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static HomeDetailDTOAllOf fromJson(Map json) => json == null + ? null + : HomeDetailDTOAllOf( + users: UserInfoDetailDTO.listFromJson(json[r'users']), + devices: DeviceSummaryDTO.listFromJson(json[r'devices']), + automations: AutomationDTO.listFromJson(json[r'automations']), + providers: ProviderDTO.listFromJson(json[r'providers']), + groups: GroupSummaryDTO.listFromJson(json[r'groups']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => HomeDetailDTOAllOf.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = HomeDetailDTOAllOf.fromJson(v)); + } + return map; + } + + // maps a json object with a list of HomeDetailDTOAllOf-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = HomeDetailDTOAllOf.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/home_dto.dart b/mycore_api/lib/model/home_dto.dart new file mode 100644 index 0000000..d040356 --- /dev/null +++ b/mycore_api/lib/model/home_dto.dart @@ -0,0 +1,140 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class HomeDTO { + /// Returns a new [HomeDTO] instance. + HomeDTO({ + this.id, + this.name, + this.isAlarm, + this.isDefault, + this.currentAlarmMode, + this.createdDate, + this.updatedDate, + this.usersIds, + }); + + String id; + + String name; + + bool isAlarm; + + bool isDefault; + + OneOfAlarmModeDTO currentAlarmMode; + + DateTime createdDate; + + DateTime updatedDate; + + List usersIds; + + @override + bool operator ==(Object other) => identical(this, other) || other is HomeDTO && + other.id == id && + other.name == name && + other.isAlarm == isAlarm && + other.isDefault == isDefault && + other.currentAlarmMode == currentAlarmMode && + other.createdDate == createdDate && + other.updatedDate == updatedDate && + other.usersIds == usersIds; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (name == null ? 0 : name.hashCode) + + (isAlarm == null ? 0 : isAlarm.hashCode) + + (isDefault == null ? 0 : isDefault.hashCode) + + (currentAlarmMode == null ? 0 : currentAlarmMode.hashCode) + + (createdDate == null ? 0 : createdDate.hashCode) + + (updatedDate == null ? 0 : updatedDate.hashCode) + + (usersIds == null ? 0 : usersIds.hashCode); + + @override + String toString() => 'HomeDTO[id=$id, name=$name, isAlarm=$isAlarm, isDefault=$isDefault, currentAlarmMode=$currentAlarmMode, createdDate=$createdDate, updatedDate=$updatedDate, usersIds=$usersIds]'; + + Map toJson() { + final json = {}; + if (id != null) { + json[r'id'] = id; + } + if (name != null) { + json[r'name'] = name; + } + if (isAlarm != null) { + json[r'isAlarm'] = isAlarm; + } + if (isDefault != null) { + json[r'isDefault'] = isDefault; + } + if (currentAlarmMode != null) { + json[r'currentAlarmMode'] = currentAlarmMode; + } + if (createdDate != null) { + json[r'createdDate'] = createdDate.toUtc().toIso8601String(); + } + if (updatedDate != null) { + json[r'updatedDate'] = updatedDate.toUtc().toIso8601String(); + } + if (usersIds != null) { + json[r'usersIds'] = usersIds; + } + return json; + } + + /// Returns a new [HomeDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static HomeDTO fromJson(Map json) => json == null + ? null + : HomeDTO( + id: json[r'id'], + name: json[r'name'], + isAlarm: json[r'isAlarm'], + isDefault: json[r'isDefault'], + currentAlarmMode: OneOfAlarmModeDTO.fromJson(json[r'currentAlarmMode']), + createdDate: json[r'createdDate'] == null + ? null + : DateTime.parse(json[r'createdDate']), + updatedDate: json[r'updatedDate'] == null + ? null + : DateTime.parse(json[r'updatedDate']), + usersIds: json[r'usersIds'] == null + ? null + : (json[r'usersIds'] as List).cast(), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => HomeDTO.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = HomeDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of HomeDTO-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = HomeDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/odd_nice.dart b/mycore_api/lib/model/odd_nice.dart index 71390a4..8d48e9f 100644 --- a/mycore_api/lib/model/odd_nice.dart +++ b/mycore_api/lib/model/odd_nice.dart @@ -24,7 +24,7 @@ class OddNice { String homeTeam; - OddObject odds; + OneOfOddObject odds; @override bool operator ==(Object other) => identical(this, other) || other is OddNice && @@ -70,7 +70,7 @@ class OddNice { : (json[r'teams'] as List).cast(), commenceTime: json[r'commence_time'], homeTeam: json[r'home_team'], - odds: OddObject.fromJson(json[r'odds']), + odds: OneOfOddObject.fromJson(json[r'odds']), ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/mycore_api/lib/model/programmed_mode.dart b/mycore_api/lib/model/programmed_mode.dart new file mode 100644 index 0000000..04796b3 --- /dev/null +++ b/mycore_api/lib/model/programmed_mode.dart @@ -0,0 +1,125 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ProgrammedMode { + /// Returns a new [ProgrammedMode] instance. + ProgrammedMode({ + this.monday, + this.tuesday, + this.wednesday, + this.thursday, + this.friday, + this.saturday, + this.sunday, + }); + + List monday; + + List tuesday; + + List wednesday; + + List thursday; + + List friday; + + List saturday; + + List sunday; + + @override + bool operator ==(Object other) => identical(this, other) || other is ProgrammedMode && + other.monday == monday && + other.tuesday == tuesday && + other.wednesday == wednesday && + other.thursday == thursday && + other.friday == friday && + other.saturday == saturday && + other.sunday == sunday; + + @override + int get hashCode => + (monday == null ? 0 : monday.hashCode) + + (tuesday == null ? 0 : tuesday.hashCode) + + (wednesday == null ? 0 : wednesday.hashCode) + + (thursday == null ? 0 : thursday.hashCode) + + (friday == null ? 0 : friday.hashCode) + + (saturday == null ? 0 : saturday.hashCode) + + (sunday == null ? 0 : sunday.hashCode); + + @override + String toString() => 'ProgrammedMode[monday=$monday, tuesday=$tuesday, wednesday=$wednesday, thursday=$thursday, friday=$friday, saturday=$saturday, sunday=$sunday]'; + + Map toJson() { + final json = {}; + if (monday != null) { + json[r'monday'] = monday; + } + if (tuesday != null) { + json[r'tuesday'] = tuesday; + } + if (wednesday != null) { + json[r'wednesday'] = wednesday; + } + if (thursday != null) { + json[r'thursday'] = thursday; + } + if (friday != null) { + json[r'friday'] = friday; + } + if (saturday != null) { + json[r'saturday'] = saturday; + } + if (sunday != null) { + json[r'sunday'] = sunday; + } + return json; + } + + /// Returns a new [ProgrammedMode] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static ProgrammedMode fromJson(Map json) => json == null + ? null + : ProgrammedMode( + monday: TimePeriodAlarm.listFromJson(json[r'monday']), + tuesday: TimePeriodAlarm.listFromJson(json[r'tuesday']), + wednesday: TimePeriodAlarm.listFromJson(json[r'wednesday']), + thursday: TimePeriodAlarm.listFromJson(json[r'thursday']), + friday: TimePeriodAlarm.listFromJson(json[r'friday']), + saturday: TimePeriodAlarm.listFromJson(json[r'saturday']), + sunday: TimePeriodAlarm.listFromJson(json[r'sunday']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => ProgrammedMode.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = ProgrammedMode.fromJson(v)); + } + return map; + } + + // maps a json object with a list of ProgrammedMode-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = ProgrammedMode.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/provider_dto.dart b/mycore_api/lib/model/provider_dto.dart index 1a2b874..6941fe4 100644 --- a/mycore_api/lib/model/provider_dto.dart +++ b/mycore_api/lib/model/provider_dto.dart @@ -15,7 +15,7 @@ class ProviderDTO { this.id, this.name, this.type, - this.userId, + this.homeId, this.endpoint, this.username, this.password, @@ -27,9 +27,9 @@ class ProviderDTO { String name; - String type; + ProviderType type; - String userId; + String homeId; String endpoint; @@ -46,7 +46,7 @@ class ProviderDTO { other.id == id && other.name == name && other.type == type && - other.userId == userId && + other.homeId == homeId && other.endpoint == endpoint && other.username == username && other.password == password && @@ -58,7 +58,7 @@ class ProviderDTO { (id == null ? 0 : id.hashCode) + (name == null ? 0 : name.hashCode) + (type == null ? 0 : type.hashCode) + - (userId == null ? 0 : userId.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + (endpoint == null ? 0 : endpoint.hashCode) + (username == null ? 0 : username.hashCode) + (password == null ? 0 : password.hashCode) + @@ -66,7 +66,7 @@ class ProviderDTO { (active == null ? 0 : active.hashCode); @override - String toString() => 'ProviderDTO[id=$id, name=$name, type=$type, userId=$userId, endpoint=$endpoint, username=$username, password=$password, apiKey=$apiKey, active=$active]'; + String toString() => 'ProviderDTO[id=$id, name=$name, type=$type, homeId=$homeId, endpoint=$endpoint, username=$username, password=$password, apiKey=$apiKey, active=$active]'; Map toJson() { final json = {}; @@ -79,8 +79,8 @@ class ProviderDTO { if (type != null) { json[r'type'] = type; } - if (userId != null) { - json[r'userId'] = userId; + if (homeId != null) { + json[r'homeId'] = homeId; } if (endpoint != null) { json[r'endpoint'] = endpoint; @@ -107,8 +107,8 @@ class ProviderDTO { : ProviderDTO( id: json[r'id'], name: json[r'name'], - type: json[r'type'], - userId: json[r'userId'], + type: ProviderType.fromJson(json[r'type']), + homeId: json[r'homeId'], endpoint: json[r'endpoint'], username: json[r'username'], password: json[r'password'], diff --git a/mycore_api/lib/model/provider_type.dart b/mycore_api/lib/model/provider_type.dart new file mode 100644 index 0000000..67f806b --- /dev/null +++ b/mycore_api/lib/model/provider_type.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class ProviderType { + /// Instantiate a new enum with the provided [value]. + const ProviderType._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const arlo = ProviderType._(r'arlo'); + static const meross = ProviderType._(r'meross'); + static const yeelight = ProviderType._(r'yeelight'); + static const zigbee2mqtt = ProviderType._(r'zigbee2mqtt'); + + /// List of all possible values in this [enum][ProviderType]. + static const values = [ + arlo, + meross, + yeelight, + zigbee2mqtt, + ]; + + static ProviderType fromJson(dynamic value) => + ProviderTypeTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => ProviderType.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [ProviderType] to String, +/// and [decode] dynamic data back to [ProviderType]. +class ProviderTypeTypeTransformer { + const ProviderTypeTypeTransformer._(); + + factory ProviderTypeTypeTransformer() => _instance ??= ProviderTypeTypeTransformer._(); + + String encode(ProviderType data) => data.value; + + /// Decodes a [dynamic value][data] to a ProviderType. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + ProviderType decode(dynamic data, {bool allowNull}) { + switch (data) { + case r'arlo': return ProviderType.arlo; + case r'meross': return ProviderType.meross; + case r'yeelight': return ProviderType.yeelight; + case r'zigbee2mqtt': return ProviderType.zigbee2mqtt; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [ProviderTypeTypeTransformer] instance. + static ProviderTypeTypeTransformer _instance; +} diff --git a/mycore_api/lib/model/room_create_or_update_detail_dto.dart b/mycore_api/lib/model/room_create_or_update_detail_dto.dart index eb9ba8f..f953861 100644 --- a/mycore_api/lib/model/room_create_or_update_detail_dto.dart +++ b/mycore_api/lib/model/room_create_or_update_detail_dto.dart @@ -13,14 +13,14 @@ class RoomCreateOrUpdateDetailDTO { /// Returns a new [RoomCreateOrUpdateDetailDTO] instance. RoomCreateOrUpdateDetailDTO({ this.id, - this.userId, + this.homeId, this.name, this.deviceIds, }); String id; - String userId; + String homeId; String name; @@ -29,27 +29,27 @@ class RoomCreateOrUpdateDetailDTO { @override bool operator ==(Object other) => identical(this, other) || other is RoomCreateOrUpdateDetailDTO && other.id == id && - other.userId == userId && + other.homeId == homeId && other.name == name && other.deviceIds == deviceIds; @override int get hashCode => (id == null ? 0 : id.hashCode) + - (userId == null ? 0 : userId.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + (name == null ? 0 : name.hashCode) + (deviceIds == null ? 0 : deviceIds.hashCode); @override - String toString() => 'RoomCreateOrUpdateDetailDTO[id=$id, userId=$userId, name=$name, deviceIds=$deviceIds]'; + String toString() => 'RoomCreateOrUpdateDetailDTO[id=$id, homeId=$homeId, name=$name, deviceIds=$deviceIds]'; Map toJson() { final json = {}; if (id != null) { json[r'id'] = id; } - if (userId != null) { - json[r'userId'] = userId; + if (homeId != null) { + json[r'homeId'] = homeId; } if (name != null) { json[r'name'] = name; @@ -66,7 +66,7 @@ class RoomCreateOrUpdateDetailDTO { ? null : RoomCreateOrUpdateDetailDTO( id: json[r'id'], - userId: json[r'userId'], + homeId: json[r'homeId'], name: json[r'name'], deviceIds: json[r'deviceIds'] == null ? null diff --git a/mycore_api/lib/model/room_detail_dto.dart b/mycore_api/lib/model/room_detail_dto.dart index e42cd0e..cc0b387 100644 --- a/mycore_api/lib/model/room_detail_dto.dart +++ b/mycore_api/lib/model/room_detail_dto.dart @@ -13,7 +13,7 @@ class RoomDetailDTO { /// Returns a new [RoomDetailDTO] instance. RoomDetailDTO({ this.id, - this.userId, + this.homeId, this.name, this.createdDate, this.updatedDate, @@ -22,7 +22,7 @@ class RoomDetailDTO { String id; - String userId; + String homeId; String name; @@ -35,7 +35,7 @@ class RoomDetailDTO { @override bool operator ==(Object other) => identical(this, other) || other is RoomDetailDTO && other.id == id && - other.userId == userId && + other.homeId == homeId && other.name == name && other.createdDate == createdDate && other.updatedDate == updatedDate && @@ -44,22 +44,22 @@ class RoomDetailDTO { @override int get hashCode => (id == null ? 0 : id.hashCode) + - (userId == null ? 0 : userId.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + (name == null ? 0 : name.hashCode) + (createdDate == null ? 0 : createdDate.hashCode) + (updatedDate == null ? 0 : updatedDate.hashCode) + (devices == null ? 0 : devices.hashCode); @override - String toString() => 'RoomDetailDTO[id=$id, userId=$userId, name=$name, createdDate=$createdDate, updatedDate=$updatedDate, devices=$devices]'; + String toString() => 'RoomDetailDTO[id=$id, homeId=$homeId, name=$name, createdDate=$createdDate, updatedDate=$updatedDate, devices=$devices]'; Map toJson() { final json = {}; if (id != null) { json[r'id'] = id; } - if (userId != null) { - json[r'userId'] = userId; + if (homeId != null) { + json[r'homeId'] = homeId; } if (name != null) { json[r'name'] = name; @@ -82,7 +82,7 @@ class RoomDetailDTO { ? null : RoomDetailDTO( id: json[r'id'], - userId: json[r'userId'], + homeId: json[r'homeId'], name: json[r'name'], createdDate: json[r'createdDate'] == null ? null diff --git a/mycore_api/lib/model/room_summary_dto.dart b/mycore_api/lib/model/room_summary_dto.dart index 62f25c9..ea9ca95 100644 --- a/mycore_api/lib/model/room_summary_dto.dart +++ b/mycore_api/lib/model/room_summary_dto.dart @@ -13,38 +13,38 @@ class RoomSummaryDTO { /// Returns a new [RoomSummaryDTO] instance. RoomSummaryDTO({ this.id, - this.userId, + this.homeId, this.name, }); String id; - String userId; + String homeId; String name; @override bool operator ==(Object other) => identical(this, other) || other is RoomSummaryDTO && other.id == id && - other.userId == userId && + other.homeId == homeId && other.name == name; @override int get hashCode => (id == null ? 0 : id.hashCode) + - (userId == null ? 0 : userId.hashCode) + + (homeId == null ? 0 : homeId.hashCode) + (name == null ? 0 : name.hashCode); @override - String toString() => 'RoomSummaryDTO[id=$id, userId=$userId, name=$name]'; + String toString() => 'RoomSummaryDTO[id=$id, homeId=$homeId, name=$name]'; Map toJson() { final json = {}; if (id != null) { json[r'id'] = id; } - if (userId != null) { - json[r'userId'] = userId; + if (homeId != null) { + json[r'homeId'] = homeId; } if (name != null) { json[r'name'] = name; @@ -58,7 +58,7 @@ class RoomSummaryDTO { ? null : RoomSummaryDTO( id: json[r'id'], - userId: json[r'userId'], + homeId: json[r'homeId'], name: json[r'name'], ); diff --git a/mycore_api/lib/model/time_period_alarm.dart b/mycore_api/lib/model/time_period_alarm.dart new file mode 100644 index 0000000..a4e67c2 --- /dev/null +++ b/mycore_api/lib/model/time_period_alarm.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class TimePeriodAlarm { + /// Returns a new [TimePeriodAlarm] instance. + TimePeriodAlarm({ + this.start, + this.end, + this.alarmMode, + }); + + String start; + + String end; + + OneOfAlarmMode alarmMode; + + @override + bool operator ==(Object other) => identical(this, other) || other is TimePeriodAlarm && + other.start == start && + other.end == end && + other.alarmMode == alarmMode; + + @override + int get hashCode => + (start == null ? 0 : start.hashCode) + + (end == null ? 0 : end.hashCode) + + (alarmMode == null ? 0 : alarmMode.hashCode); + + @override + String toString() => 'TimePeriodAlarm[start=$start, end=$end, alarmMode=$alarmMode]'; + + Map toJson() { + final json = {}; + if (start != null) { + json[r'start'] = start; + } + if (end != null) { + json[r'end'] = end; + } + if (alarmMode != null) { + json[r'alarmMode'] = alarmMode; + } + return json; + } + + /// Returns a new [TimePeriodAlarm] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static TimePeriodAlarm fromJson(Map json) => json == null + ? null + : TimePeriodAlarm( + start: json[r'start'], + end: json[r'end'], + alarmMode: OneOfAlarmMode.fromJson(json[r'alarmMode']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => TimePeriodAlarm.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = TimePeriodAlarm.fromJson(v)); + } + return map; + } + + // maps a json object with a list of TimePeriodAlarm-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = TimePeriodAlarm.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/mycore_api/lib/model/user_info.dart b/mycore_api/lib/model/user_info.dart index 7c1beb6..81876bd 100644 --- a/mycore_api/lib/model/user_info.dart +++ b/mycore_api/lib/model/user_info.dart @@ -20,6 +20,7 @@ class UserInfo { this.lastName, this.token, this.birthday, + this.homeIds, this.dateCreation, this.address, this.city, @@ -28,12 +29,6 @@ class UserInfo { this.language, this.timeZone, this.postalCode, - this.automations, - this.devices, - this.providers, - this.groups, - this.screenConfigurationIds, - this.deviceIds, }); String id; @@ -52,6 +47,8 @@ class UserInfo { DateTime birthday; + List homeIds; + DateTime dateCreation; String address; @@ -68,18 +65,6 @@ class UserInfo { int postalCode; - List automations; - - List devices; - - List providers; - - List groups; - - List screenConfigurationIds; - - List deviceIds; - @override bool operator ==(Object other) => identical(this, other) || other is UserInfo && other.id == id && @@ -90,6 +75,7 @@ class UserInfo { other.lastName == lastName && other.token == token && other.birthday == birthday && + other.homeIds == homeIds && other.dateCreation == dateCreation && other.address == address && other.city == city && @@ -97,13 +83,7 @@ class UserInfo { other.country == country && other.language == language && other.timeZone == timeZone && - other.postalCode == postalCode && - other.automations == automations && - other.devices == devices && - other.providers == providers && - other.groups == groups && - other.screenConfigurationIds == screenConfigurationIds && - other.deviceIds == deviceIds; + other.postalCode == postalCode; @override int get hashCode => @@ -115,6 +95,7 @@ class UserInfo { (lastName == null ? 0 : lastName.hashCode) + (token == null ? 0 : token.hashCode) + (birthday == null ? 0 : birthday.hashCode) + + (homeIds == null ? 0 : homeIds.hashCode) + (dateCreation == null ? 0 : dateCreation.hashCode) + (address == null ? 0 : address.hashCode) + (city == null ? 0 : city.hashCode) + @@ -122,16 +103,10 @@ class UserInfo { (country == null ? 0 : country.hashCode) + (language == null ? 0 : language.hashCode) + (timeZone == null ? 0 : timeZone.hashCode) + - (postalCode == null ? 0 : postalCode.hashCode) + - (automations == null ? 0 : automations.hashCode) + - (devices == null ? 0 : devices.hashCode) + - (providers == null ? 0 : providers.hashCode) + - (groups == null ? 0 : groups.hashCode) + - (screenConfigurationIds == null ? 0 : screenConfigurationIds.hashCode) + - (deviceIds == null ? 0 : deviceIds.hashCode); + (postalCode == null ? 0 : postalCode.hashCode); @override - String toString() => 'UserInfo[id=$id, role=$role, email=$email, password=$password, firstName=$firstName, lastName=$lastName, token=$token, birthday=$birthday, dateCreation=$dateCreation, address=$address, city=$city, state=$state, country=$country, language=$language, timeZone=$timeZone, postalCode=$postalCode, automations=$automations, devices=$devices, providers=$providers, groups=$groups, screenConfigurationIds=$screenConfigurationIds, deviceIds=$deviceIds]'; + String toString() => 'UserInfo[id=$id, role=$role, email=$email, password=$password, firstName=$firstName, lastName=$lastName, token=$token, birthday=$birthday, homeIds=$homeIds, dateCreation=$dateCreation, address=$address, city=$city, state=$state, country=$country, language=$language, timeZone=$timeZone, postalCode=$postalCode]'; Map toJson() { final json = {}; @@ -159,6 +134,9 @@ class UserInfo { if (birthday != null) { json[r'birthday'] = birthday.toUtc().toIso8601String(); } + if (homeIds != null) { + json[r'homeIds'] = homeIds; + } if (dateCreation != null) { json[r'dateCreation'] = dateCreation.toUtc().toIso8601String(); } @@ -183,24 +161,6 @@ class UserInfo { if (postalCode != null) { json[r'postalCode'] = postalCode; } - if (automations != null) { - json[r'automations'] = automations; - } - if (devices != null) { - json[r'devices'] = devices; - } - if (providers != null) { - json[r'providers'] = providers; - } - if (groups != null) { - json[r'groups'] = groups; - } - if (screenConfigurationIds != null) { - json[r'screenConfigurationIds'] = screenConfigurationIds; - } - if (deviceIds != null) { - json[r'deviceIds'] = deviceIds; - } return json; } @@ -219,6 +179,9 @@ class UserInfo { birthday: json[r'birthday'] == null ? null : DateTime.parse(json[r'birthday']), + homeIds: json[r'homeIds'] == null + ? null + : (json[r'homeIds'] as List).cast(), dateCreation: json[r'dateCreation'] == null ? null : DateTime.parse(json[r'dateCreation']), @@ -229,12 +192,6 @@ class UserInfo { language: json[r'language'], timeZone: json[r'timeZone'], postalCode: json[r'postalCode'], - automations: Automation.listFromJson(json[r'automations']), - devices: Device.listFromJson(json[r'devices']), - providers: Provider.listFromJson(json[r'providers']), - groups: Group.listFromJson(json[r'groups']), - screenConfigurationIds: ScreenConfiguration.listFromJson(json[r'screenConfigurationIds']), - deviceIds: ScreenDevice.listFromJson(json[r'deviceIds']), ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/mycore_api/swagger.yaml b/mycore_api/swagger.yaml index 209777e..fb96382 100644 --- a/mycore_api/swagger.yaml +++ b/mycore_api/swagger.yaml @@ -5,7 +5,7 @@ info: description: API description version: Version Pre-Alpha servers: - - url: 'http://localhost:25049' + - url: http://192.168.31.140 paths: /api/books: get: @@ -44,7 +44,7 @@ paths: $ref: '#/components/schemas/Book' security: - bearer: [] - '/api/books/{id}': + /api/books/{id}: get: tags: - Books @@ -118,17 +118,17 @@ paths: format: binary security: - bearer: [] - '/api/device/{userId}': + /api/device/{homeId}: get: tags: - Device summary: Get all devices summary operationId: Device_GetAll parameters: - - name: userId + - name: homeId in: path required: true - description: Id of user + description: Home Id schema: type: string nullable: true @@ -150,7 +150,7 @@ paths: type: string security: - bearer: [] - '/api/device/detail/{deviceId}': + /api/device/detail/{deviceId}: get: tags: - Device @@ -192,17 +192,17 @@ paths: type: string security: - bearer: [] - '/api/device/{userId}/type/{type}': + /api/device/{homeId}/type/{type}: get: tags: - Device summary: Get list of devices from a type operationId: Device_GetDevicesByType parameters: - - name: userId + - name: homeId in: path required: true - description: user Id + description: Home Id schema: type: string nullable: true @@ -285,17 +285,17 @@ paths: type: string security: - bearer: [] - '/api/device/{userId}/fromProvider/{providerId}': + /api/device/{homeId}/fromProvider/{providerId}: post: tags: - Device summary: Create devices from provider operationId: Device_CreateDevicesFromProvider parameters: - - name: userId + - name: homeId in: path required: true - description: User Id + description: Home Id schema: type: string nullable: true @@ -355,10 +355,10 @@ paths: summary: Get devices from provider operationId: Device_GetDevicesFromProvider parameters: - - name: userId + - name: homeId in: path required: true - description: User Id + description: Home Id schema: type: string nullable: true @@ -406,10 +406,10 @@ paths: summary: Delete devices from provider operationId: Device_DeleteDevicesFromProvider parameters: - - name: userId + - name: homeId in: path required: true - description: User Id + description: Home Id schema: type: string nullable: true @@ -449,17 +449,17 @@ paths: type: string security: - bearer: [] - '/api/device/zigbee2Mqtt/{userId}': + /api/device/zigbee2Mqtt/{homeId}: get: tags: - Device summary: Get all zigbee2Mqtt devices operationId: Device_GetDevicesFromZigbee2Mqtt parameters: - - name: userId + - name: homeId in: path required: true - description: User Id + description: Home Id schema: type: string nullable: true @@ -493,7 +493,7 @@ paths: type: string security: - bearer: [] - '/api/device/{deviceId}': + /api/device/{deviceId}: put: tags: - Device @@ -577,17 +577,17 @@ paths: type: string security: - bearer: [] - '/api/device/user/{userId}': + /api/device/home/{homeId}: delete: tags: - Device - summary: Delete all device for a specified user - operationId: Device_DeleteAllForUser + summary: Delete all device for a specified home + operationId: Device_DeleteAllForHome parameters: - - name: userId + - name: homeId in: path required: true - description: Id of user + description: Id of home schema: type: string nullable: true @@ -626,7 +626,7 @@ paths: summary: Get summary production of Kwh/Year operationId: Energy_GetElectricityProduction parameters: - - name: userId + - name: homeId in: query schema: type: string @@ -648,7 +648,7 @@ paths: $ref: '#/components/schemas/ElectricityProduction' security: - bearer: [] - '/api/iot/smartprinter/{idDevice}': + /api/iot/smartprinter/{idDevice}: get: tags: - IOT @@ -714,7 +714,7 @@ paths: format: binary security: - bearer: [] - '/api/iot/smartgarden/{idDevice}': + /api/iot/smartgarden/{idDevice}: post: tags: - IOT @@ -748,7 +748,7 @@ paths: format: binary security: - bearer: [] - '/api/odd/country/{id}/{oddRequest}': + /api/odd/country/{id}/{oddRequest}: get: tags: - Odd @@ -758,7 +758,7 @@ paths: - name: id in: path required: true - description: 'id of country, e.g = BE for Belgium' + description: id of country, e.g = BE for Belgium schema: type: string nullable: true @@ -798,7 +798,7 @@ paths: application/json: schema: type: string - '/api/odd/{oddRequest}': + /api/odd/{oddRequest}: get: tags: - Odd @@ -836,17 +836,17 @@ paths: type: string security: - bearer: [] - '/api/provider/{userId}': + /api/provider/{homeId}: get: tags: - Provider - summary: 'Get all user providers ' + summary: 'Get all home providers ' operationId: Provider_GetAll parameters: - - name: userId + - name: homeId in: path required: true - description: Id of user + description: Home Id schema: type: string nullable: true @@ -969,7 +969,7 @@ paths: type: string security: - bearer: [] - '/api/provider/{providerId}': + /api/provider/{providerId}: delete: tags: - Provider @@ -1104,7 +1104,7 @@ paths: type: string security: - bearer: [] - '/api/device/screen/{screenDeviceId}': + /api/device/screen/{screenDeviceId}: get: tags: - ScreenDevice @@ -1146,7 +1146,7 @@ paths: type: string security: - bearer: [] - '/api/device/screen/{deviceId}': + /api/device/screen/{deviceId}: delete: tags: - ScreenDevice @@ -1376,7 +1376,7 @@ paths: type: string security: - bearer: [] - '/api/user/{id}': + /api/user/{id}: get: tags: - User @@ -1485,7 +1485,7 @@ paths: description: '' security: - bearer: [] - '/api/test/{id}': + /api/test/{id}: get: tags: - Values @@ -1549,6 +1549,342 @@ paths: description: '' security: - bearer: [] + /api/alarm/{homeId}: + get: + tags: + - Alarm + summary: Get all alarm modes for the specified home + operationId: Alarm_GetAll + parameters: + - name: homeId + in: path + required: true + description: Home Id + schema: + type: string + nullable: true + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/AlarmModeDTO' + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/alarm/detail/{alarmId}: + get: + tags: + - Alarm + summary: Get detail info of a specified alarm mode + operationId: Alarm_GetDetail + parameters: + - name: alarmModeId + in: query + description: alarm id + schema: + type: string + nullable: true + x-position: 1 + - name: alarmId + in: path + required: true + schema: + type: string + x-position: 2 + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/AlarmModeDetailDTO' + '400': + description: '' + content: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/alarm: + post: + tags: + - Alarm + summary: Create an alarm mode + operationId: Alarm_Create + requestBody: + x-name: alarmModeCreateOrUpdateDetailDTO + description: Alarm mode to create + content: + application/json: + schema: + $ref: '#/components/schemas/AlarmModeCreateOrUpdateDetailDTO' + required: true + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/AlarmModeDetailDTO' + '400': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + put: + tags: + - Alarm + summary: Update an alarm mode + operationId: Alarm_Update + requestBody: + x-name: alarmModeCreateOrUpdateDetailDTO + description: alarm mode to update + content: + application/json: + schema: + $ref: '#/components/schemas/AlarmModeCreateOrUpdateDetailDTO' + required: true + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/AlarmModeDetailDTO' + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/alarm/defaults/{homeId}: + post: + tags: + - Alarm + summary: Create default alarm modes + operationId: Alarm_CreateDefaultAlarms + parameters: + - name: homeId + in: path + required: true + description: Home Id + schema: + type: string + nullable: true + x-position: 1 + responses: + '202': + description: '' + content: + application/json: + schema: + type: boolean + '400': + description: '' + content: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '409': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/alarm/activate/{alarmModeId}: + post: + tags: + - Alarm + summary: Activate current alarm mode + operationId: Alarm_Activate + parameters: + - name: alarmModeId + in: path + required: true + description: Alarm mode to activate + schema: + type: string + nullable: true + x-position: 1 + responses: + '202': + description: '' + content: + application/json: + schema: + type: string + '400': + description: '' + content: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '409': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/alarm/{alarmModeId}: + delete: + tags: + - Alarm + summary: Delete an alarm mode + operationId: Alarm_Delete + parameters: + - name: alarmModeId + in: path + required: true + description: Id of alarm mode to delete + schema: + type: string + nullable: true + x-position: 1 + responses: + '202': + description: '' + content: + application/json: + schema: + type: string + '400': + description: '' + content: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '405': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/alarm/home/{homeId}: + delete: + tags: + - Alarm + summary: Delete all alarm mode for a specified home + operationId: Alarm_DeleteAllForHome + parameters: + - name: homeId + in: path + required: true + description: Home Id + schema: + type: string + nullable: true + x-position: 1 + responses: + '202': + description: '' + content: + application/json: + schema: + type: string + '400': + description: '' + content: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] /api/Authentication/Token: post: tags: @@ -1628,17 +1964,17 @@ paths: application/json: schema: type: string - '/api/automation/{userId}': + /api/automation/{homeId}: get: tags: - Automation - summary: Get all automations for the specified user + summary: Get all automations for the specified home operationId: Automation_GetAll parameters: - - name: userId + - name: homeId in: path required: true - description: Id of user + description: Home Id schema: type: string nullable: true @@ -1651,7 +1987,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/RoomSummaryDTO' + $ref: '#/components/schemas/AutomationDTO' '500': description: '' content: @@ -1660,7 +1996,7 @@ paths: type: string security: - bearer: [] - '/api/automation/detail/{automationId}': + /api/automation/detail/{automationId}: get: tags: - Automation @@ -1709,12 +2045,12 @@ paths: summary: Create an automation operationId: Automation_Create requestBody: - x-name: automationCreateOrUpdateDetail + x-name: automationDetailDTO description: Automation to create content: application/json: schema: - $ref: '#/components/schemas/AutomationCreateOrUpdateDetailDTO' + $ref: '#/components/schemas/AutomationDetailDTO' required: true x-position: 1 responses: @@ -1744,12 +2080,12 @@ paths: summary: Update an automation operationId: Automation_Update requestBody: - x-name: automationCreateOrUpdateDetail + x-name: automationDetailDTO description: automation to update content: application/json: schema: - $ref: '#/components/schemas/AutomationCreateOrUpdateDetailDTO' + $ref: '#/components/schemas/AutomationDetailDTO' required: true x-position: 1 responses: @@ -1758,7 +2094,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AutomationCreateOrUpdateDetailDTO' + $ref: '#/components/schemas/AutomationDetailDTO' '400': description: '' content: @@ -1779,7 +2115,7 @@ paths: type: string security: - bearer: [] - '/api/automation/{automationId}': + /api/automation/{automationId}: delete: tags: - Automation @@ -1821,17 +2157,17 @@ paths: type: string security: - bearer: [] - '/api/automation/user/{userId}': + /api/automation/home/{homeId}: delete: tags: - Automation - summary: Delete all automation for a specified - operationId: Automation_DeleteAllForUser + summary: Delete all automation for a specified home + operationId: Automation_DeleteAllForHome parameters: - - name: userId + - name: homeId in: path required: true - description: Id of user + description: Home Id schema: type: string nullable: true @@ -1863,17 +2199,227 @@ paths: type: string security: - bearer: [] - '/api/group/{userId}': + /api/event/{homeId}: + get: + tags: + - Event + summary: 'Get events for the specified home ' + operationId: Event_Get + parameters: + - name: homeId + in: path + required: true + description: Home Id + schema: + type: string + nullable: true + x-position: 1 + - name: DeviceId + in: query + schema: + type: string + nullable: true + x-position: 2 + - name: RoomId + in: query + schema: + type: string + nullable: true + x-position: 3 + - name: StartIndex + in: query + schema: + type: integer + format: int32 + x-position: 4 + - name: Count + in: query + schema: + type: integer + format: int32 + x-position: 5 + - name: DateStart + in: query + schema: + type: string + format: date-time + nullable: true + x-position: 6 + - name: DateEnd + in: query + schema: + type: string + format: date-time + nullable: true + x-position: 7 + - name: EventType + in: query + schema: + nullable: true + oneOf: + - $ref: '#/components/schemas/EventType' + x-position: 8 + - name: DeviceType + in: query + schema: + nullable: true + oneOf: + - $ref: '#/components/schemas/DeviceType' + x-position: 9 + responses: + '200': + description: '' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/EventDetailDTO' + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/event/detail/{eventId}: + get: + tags: + - Event + summary: Get detail info of a specified event + operationId: Event_GetDetail + parameters: + - name: eventId + in: path + required: true + description: event id + schema: + type: string + nullable: true + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/EventDetailDTO' + '400': + description: '' + content: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/event/{eventId}: + delete: + tags: + - Event + summary: Delete an event + operationId: Event_Delete + parameters: + - name: eventId + in: path + required: true + description: Id of event to delete + schema: + type: string + nullable: true + x-position: 1 + responses: + '202': + description: '' + content: + application/json: + schema: + type: string + '400': + description: '' + content: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/event/home/{homeId}: + delete: + tags: + - Event + summary: Delete all events for a specified home + operationId: Event_DeleteAllForHome + parameters: + - name: homeId + in: path + required: true + description: Home Id + schema: + type: string + nullable: true + x-position: 1 + responses: + '202': + description: '' + content: + application/json: + schema: + type: string + '400': + description: '' + content: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/group/{homeId}: get: tags: - Group - summary: Get all groups for the specified user + summary: Get all groups for the specified home operationId: Group_GetAll parameters: - - name: userId + - name: homeId in: path required: true - description: Id of user + description: Home Id schema: type: string nullable: true @@ -1901,7 +2447,7 @@ paths: type: string security: - bearer: [] - '/api/group/detail/{groupId}': + /api/group/detail/{groupId}: get: tags: - Group @@ -1943,17 +2489,17 @@ paths: type: string security: - bearer: [] - '/api/group/{userId}/type/{type}': + /api/group/{homeId}/type/{type}: get: tags: - Group summary: Get list of group from a type operationId: Group_GetGroupsByType parameters: - - name: userId + - name: homeId in: path required: true - description: user Id + description: home Id schema: type: string nullable: true @@ -1989,17 +2535,17 @@ paths: type: string security: - bearer: [] - '/api/group/zigbee2Mqtt/{userId}': + /api/group/zigbee2Mqtt/{homeId}: get: tags: - Group summary: Get all zigbee2Mqtt groups operationId: Group_GetGroupsFromZigbee2Mqtt parameters: - - name: userId + - name: homeId in: path required: true - description: User Id + description: Home Id schema: type: string nullable: true @@ -2110,17 +2656,17 @@ paths: type: string security: - bearer: [] - '/api/group/{userId}/fromZigbee': + /api/group/{homeId}/fromZigbee: post: tags: - Group summary: Create groups from provider operationId: Group_CreateDevicesFromZigbee2Mqtt parameters: - - name: userId + - name: homeId in: path required: true - description: User Id + description: Home Id schema: type: string nullable: true @@ -2154,7 +2700,7 @@ paths: type: string security: - bearer: [] - '/api/group/{groupId}/device/{deviceId}': + /api/group/{groupId}/device/{deviceId}: delete: tags: - Group @@ -2204,7 +2750,7 @@ paths: type: string security: - bearer: [] - '/api/group/{groupId}': + /api/group/{groupId}: delete: tags: - Group @@ -2246,17 +2792,17 @@ paths: type: string security: - bearer: [] - '/api/group/user/{userId}': + /api/group/home/{homeId}: delete: tags: - Group - summary: Delete all group for a specified - operationId: Group_DeleteAllForUser + summary: Delete all group for a specified home + operationId: Group_DeleteAllForHome parameters: - - name: userId + - name: homeId in: path required: true - description: Id of user + description: Home Id schema: type: string nullable: true @@ -2288,17 +2834,216 @@ paths: type: string security: - bearer: [] - '/api/room/{userId}': + /api/home/{userId}: get: tags: - - Room - summary: Get all rooms for the specified user - operationId: Room_GetAll + - Home + summary: Get all home for specified user + operationId: Home_GetAll parameters: - name: userId in: path required: true - description: Id of user + description: User Id + schema: + type: string + nullable: true + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/HomeDTO' + '400': + description: '' + content: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/home/detail/{homeId}: + get: + tags: + - Home + summary: Get detail info of a specified home + operationId: Home_GetDetail + parameters: + - name: homeId + in: path + required: true + description: home id + schema: + type: string + nullable: true + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/HomeDetailDTO' + '400': + description: '' + content: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/home: + post: + tags: + - Home + summary: Create a home + operationId: Home_Create + requestBody: + x-name: createOrUpdateHomeDTO + description: Home to create + content: + application/json: + schema: + $ref: '#/components/schemas/CreateOrUpdateHomeDTO' + required: true + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/HomeDTO' + '400': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + put: + tags: + - Home + summary: Update a home + operationId: Home_Update + requestBody: + x-name: createOrUpdateHomeDTO + description: Home to update + content: + application/json: + schema: + $ref: '#/components/schemas/CreateOrUpdateHomeDTO' + required: true + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/HomeDTO' + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/home/{homeId}: + delete: + tags: + - Home + summary: Delete a home + operationId: Home_Delete + parameters: + - name: homeId + in: path + required: true + description: Id of home to delete + schema: + type: string + nullable: true + x-position: 1 + responses: + '202': + description: '' + content: + application/json: + schema: + type: string + '400': + description: '' + content: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + /api/room/{homeId}: + get: + tags: + - Room + summary: Get all rooms for the specified home + operationId: Room_GetAll + parameters: + - name: homeId + in: path + required: true + description: Home Id schema: type: string nullable: true @@ -2320,20 +3065,13 @@ paths: type: string security: - bearer: [] - '/api/room/detail/{roomId}': + /api/room/detail/{roomId}: get: tags: - Room summary: Get detail info of a specified room operationId: Room_GetDetail parameters: - - name: userId - in: query - description: user id - schema: - type: string - nullable: true - x-position: 1 - name: roomId in: path required: true @@ -2341,7 +3079,7 @@ paths: schema: type: string nullable: true - x-position: 2 + x-position: 1 responses: '200': description: '' @@ -2440,7 +3178,7 @@ paths: type: string security: - bearer: [] - '/api/room/{roomId}/device/{deviceId}': + /api/room/{roomId}/device/{deviceId}: delete: tags: - Room @@ -2490,7 +3228,7 @@ paths: type: string security: - bearer: [] - '/api/room/{roomId}': + /api/room/{roomId}: delete: tags: - Room @@ -2532,17 +3270,17 @@ paths: type: string security: - bearer: [] - '/api/room/user/{userId}': + /api/room/home/{homeId}: delete: tags: - Room - summary: Delete all room for a specified user - operationId: Room_DeleteAllForUser + summary: Delete all rooms for a specified home + operationId: Room_DeleteAllForHome parameters: - - name: userId + - name: homeId in: path required: true - description: Id of user + description: Home Id schema: type: string nullable: true @@ -2707,7 +3445,7 @@ components: id: type: string nullable: true - userId: + homeId: type: string nullable: true description: @@ -2725,7 +3463,7 @@ components: type: boolean connectionStatus: $ref: '#/components/schemas/ConnectionStatus' - locationId: + roomId: type: string nullable: true providerId: @@ -2734,10 +3472,6 @@ components: providerName: type: string nullable: true - location: - nullable: true - oneOf: - - $ref: '#/components/schemas/PlaceDTO' lastStateDate: type: string format: date-time @@ -2792,16 +3526,6 @@ components: - Connected - Disconnected - Unknown - PlaceDTO: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - name: - type: string - nullable: true DeviceDetailDTO: allOf: - $ref: '#/components/schemas/DeviceSummaryDTO' @@ -2876,7 +3600,7 @@ components: deviceId: type: string nullable: true - userId: + homeId: type: string nullable: true watt: @@ -2992,9 +3716,8 @@ components: type: string nullable: true type: - type: string - nullable: true - userId: + $ref: '#/components/schemas/ProviderType' + homeId: type: string nullable: true endpoint: @@ -3011,6 +3734,19 @@ components: nullable: true active: type: boolean + ProviderType: + type: string + description: '' + x-enumNames: + - arlo + - meross + - yeelight + - zigbee2mqtt + enum: + - arlo + - meross + - yeelight + - zigbee2mqtt ScreenDevice: type: object additionalProperties: false @@ -3124,6 +3860,11 @@ components: birthday: type: string format: date-time + homeIds: + type: array + nullable: true + items: + type: string dateCreation: type: string format: date-time @@ -3148,50 +3889,52 @@ components: postalCode: type: integer format: int32 - automations: - type: array + LoginDTO: + type: object + additionalProperties: false + properties: + email: + type: string nullable: true - items: - $ref: '#/components/schemas/Automation' - devices: - type: array + password: + type: string nullable: true - items: - $ref: '#/components/schemas/Device' - providers: - type: array - nullable: true - items: - $ref: '#/components/schemas/Provider' - groups: - type: array - nullable: true - items: - $ref: '#/components/schemas/Group' - screenConfigurationIds: - type: array - nullable: true - items: - $ref: '#/components/schemas/ScreenConfiguration' - deviceIds: - type: array - nullable: true - items: - $ref: '#/components/schemas/ScreenDevice' - Automation: + UserInfoDetailDTO: type: object additionalProperties: false properties: id: type: string nullable: true - userId: + email: + type: string + nullable: true + firstName: + type: string + nullable: true + lastName: + type: string + nullable: true + AlarmModeDTO: + type: object + additionalProperties: false + properties: + id: + type: string + nullable: true + homeId: type: string nullable: true name: type: string nullable: true - active: + type: + $ref: '#/components/schemas/AlarmType' + activated: + type: boolean + isDefault: + type: boolean + notification: type: boolean createdDate: type: string @@ -3199,26 +3942,47 @@ components: updatedDate: type: string format: date-time - triggers: - type: array - nullable: true - items: - $ref: '#/components/schemas/Trigger' - conditions: - type: array - nullable: true - items: - $ref: '#/components/schemas/Condition' - actions: - type: array - nullable: true - items: - $ref: '#/components/schemas/Action' - devicesIds: - type: array - nullable: true - items: - type: string + AlarmType: + type: string + description: '' + x-enumNames: + - Home + - Absent + - Geolocalized + - Programmed + - Desarmed + - Custom + enum: + - Home + - Absent + - Geolocalized + - Programmed + - Desarmed + - Custom + AlarmModeDetailDTO: + allOf: + - $ref: '#/components/schemas/AlarmModeDTO' + - type: object + additionalProperties: false + properties: + triggers: + type: array + nullable: true + items: + $ref: '#/components/schemas/Trigger' + devices: + type: array + nullable: true + items: + $ref: '#/components/schemas/DeviceDetailDTO' + programmedMode: + nullable: true + oneOf: + - $ref: '#/components/schemas/ProgrammedMode' + geolocalizedMode: + nullable: true + oneOf: + - $ref: '#/components/schemas/GeolocalizedMode' Trigger: type: object additionalProperties: false @@ -3248,63 +4012,127 @@ components: - MQTT - WEB - TIME - Condition: + ProgrammedMode: type: object additionalProperties: false properties: - deviceId: + monday: + type: array + nullable: true + items: + $ref: '#/components/schemas/TimePeriodAlarm' + tuesday: + type: array + nullable: true + items: + $ref: '#/components/schemas/TimePeriodAlarm' + wednesday: + type: array + nullable: true + items: + $ref: '#/components/schemas/TimePeriodAlarm' + thursday: + type: array + nullable: true + items: + $ref: '#/components/schemas/TimePeriodAlarm' + friday: + type: array + nullable: true + items: + $ref: '#/components/schemas/TimePeriodAlarm' + saturday: + type: array + nullable: true + items: + $ref: '#/components/schemas/TimePeriodAlarm' + sunday: + type: array + nullable: true + items: + $ref: '#/components/schemas/TimePeriodAlarm' + TimePeriodAlarm: + type: object + additionalProperties: false + properties: + start: type: string nullable: true - state: + end: + type: string + nullable: true + alarmMode: nullable: true oneOf: - - $ref: '#/components/schemas/AutomationState' - startTime: - type: string - nullable: true - endTime: - type: string - nullable: true - type: - $ref: '#/components/schemas/ConditionType' - value: - $ref: '#/components/schemas/ConditionValue' - AutomationState: + - $ref: '#/components/schemas/AlarmMode' + AlarmMode: type: object additionalProperties: false properties: + id: + type: string + nullable: true + homeId: + type: string + nullable: true name: type: string nullable: true - value: + activated: + type: boolean + isDefault: + type: boolean + notification: + type: boolean + createdDate: + type: string + format: date-time + updatedDate: + type: string + format: date-time + type: + $ref: '#/components/schemas/AlarmType' + programmedMode: + nullable: true + oneOf: + - $ref: '#/components/schemas/ProgrammedMode' + geolocalizedMode: + nullable: true + oneOf: + - $ref: '#/components/schemas/GeolocalizedMode' + triggers: + type: array + nullable: true + items: + $ref: '#/components/schemas/Trigger' + actions: + type: array + nullable: true + items: + $ref: '#/components/schemas/Action' + devicesIds: + type: array + nullable: true + items: + type: string + GeolocalizedMode: + type: object + additionalProperties: false + properties: + latitude: type: string nullable: true - ConditionType: - type: string - description: '' - x-enumNames: - - STATE - - TIME - enum: - - STATE - - TIME - ConditionValue: - type: string - description: '' - x-enumNames: - - EQUAL - - NOT_EQUAL - - BIGGER - - BIGGEST - - SMALLER - - SMALLEST - enum: - - EQUAL - - NOT_EQUAL - - BIGGER - - BIGGEST - - SMALLER - - SMALLEST + longitude: + type: string + nullable: true + homeMode: + nullable: true + oneOf: + - $ref: '#/components/schemas/AlarmMode' + absentMode: + nullable: true + oneOf: + - $ref: '#/components/schemas/AlarmMode' Action: type: object additionalProperties: false @@ -3328,6 +4156,18 @@ components: nullable: true type: $ref: '#/components/schemas/ActionType' + isForce: + type: boolean + AutomationState: + type: object + additionalProperties: false + properties: + name: + type: string + nullable: true + value: + type: string + nullable: true ActionType: type: string description: '' @@ -3345,247 +4185,30 @@ components: - ZIGBEE2MQTT - MQTT - GROUP - Device: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - userId: - type: string - nullable: true - name: - type: string - nullable: true - description: - type: string - nullable: true - model: - type: string - nullable: true - port: - type: integer - format: int32 - firmwareVersion: - type: string - nullable: true - hardwareVersion: - type: string - nullable: true - status: - type: boolean - type: - $ref: '#/components/schemas/DeviceType' - connectionStatus: - $ref: '#/components/schemas/ConnectionStatus' - locationId: - type: string - nullable: true - meansOfCommunications: - type: array - nullable: true - items: - $ref: '#/components/schemas/MeansOfCommunication' - createdDate: - type: string - format: date-time - updatedDate: - type: string - format: date-time - lastState: - type: string - nullable: true - lastStateDate: - type: string - format: date-time - ipAddress: - type: string - nullable: true - serviceIdentification: - type: string - nullable: true - battery: - type: boolean - batteryStatus: - type: integer - format: int32 - providerId: - type: string - nullable: true - manufacturerName: - type: string - nullable: true - groupIds: - type: array - nullable: true - items: - type: string - properties: - type: string - nullable: true - supportedOperations: - type: array - nullable: true - items: - type: string - Provider: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - userId: - type: string - nullable: true - name: - type: string - nullable: true - type: - type: string - nullable: true - username: - type: string - nullable: true - password: - type: string - nullable: true - endpoint: - type: string - nullable: true - apiKey: - type: string - nullable: true - value: - type: string - nullable: true - active: - type: boolean - Group: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - userId: - type: string - nullable: true - name: - type: string - nullable: true - type: - type: string - nullable: true - serviceIdentification: - type: integer - format: int32 - isAlarm: - type: boolean - createdDate: - type: string - format: date-time - updatedDate: - type: string - format: date-time - devicesIds: - type: array - nullable: true - items: - type: string - ScreenConfiguration: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - name: - type: string - nullable: true - type: - type: string - nullable: true - widgets: - type: array - nullable: true - items: - $ref: '#/components/schemas/ScreenWidget' - height: - type: integer - format: int32 - width: - type: integer - format: int32 - ScreenWidget: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - name: - type: string - nullable: true - displayName: - type: string - nullable: true - type: - type: string - nullable: true - activated: - type: boolean - form: - type: string - nullable: true - font: - type: string - nullable: true - color: - type: string - nullable: true - size: - type: string - nullable: true - width: - type: integer - format: int32 - height: - type: integer - format: int32 - positionX: - type: integer - format: int32 - positionY: - type: integer - format: int32 - LoginDTO: - type: object - additionalProperties: false - properties: - email: - type: string - nullable: true - password: - type: string - nullable: true - UserInfoDetailDTO: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - email: - type: string - nullable: true - firstName: - type: string - nullable: true - lastName: - type: string - nullable: true + AlarmModeCreateOrUpdateDetailDTO: + allOf: + - $ref: '#/components/schemas/AlarmModeDTO' + - type: object + additionalProperties: false + properties: + triggers: + type: array + nullable: true + items: + $ref: '#/components/schemas/Trigger' + actions: + type: array + nullable: true + items: + $ref: '#/components/schemas/Action' + programmedMode: + nullable: true + oneOf: + - $ref: '#/components/schemas/ProgrammedMode' + geolocalizedMode: + nullable: true + oneOf: + - $ref: '#/components/schemas/GeolocalizedMode' TokenDTO: type: object additionalProperties: false @@ -3608,19 +4231,27 @@ components: expiration: type: string format: date-time - RoomSummaryDTO: + AutomationDTO: type: object additionalProperties: false properties: id: type: string nullable: true - userId: - type: string - nullable: true name: type: string nullable: true + active: + type: boolean + homeId: + type: string + nullable: true + createdDate: + type: string + format: date-time + updatedDate: + type: string + format: date-time AutomationDetailDTO: allOf: - $ref: '#/components/schemas/AutomationDTO' @@ -3647,53 +4278,137 @@ components: nullable: true items: type: string - AutomationDTO: + Condition: + type: object + additionalProperties: false + properties: + deviceId: + type: string + nullable: true + state: + nullable: true + oneOf: + - $ref: '#/components/schemas/AutomationState' + startTime: + type: string + nullable: true + endTime: + type: string + nullable: true + type: + $ref: '#/components/schemas/ConditionType' + value: + $ref: '#/components/schemas/ConditionValue' + ConditionType: + type: string + description: '' + x-enumNames: + - STATE + - TIME + enum: + - STATE + - TIME + ConditionValue: + type: string + description: '' + x-enumNames: + - EQUAL + - NOT_EQUAL + - BIGGER + - BIGGEST + - SMALLER + - SMALLEST + enum: + - EQUAL + - NOT_EQUAL + - BIGGER + - BIGGEST + - SMALLER + - SMALLEST + EventDetailDTO: + allOf: + - $ref: '#/components/schemas/EventDTO' + - type: object + additionalProperties: false + properties: + deviceState: + nullable: true + oneOf: + - $ref: '#/components/schemas/DeviceState' + automationTriggered: + nullable: true + oneOf: + - $ref: '#/components/schemas/AutomationTriggered' + alarmTriggered: + nullable: true + oneOf: + - $ref: '#/components/schemas/AlarmTriggered' + DeviceState: + type: object + additionalProperties: false + properties: + deviceId: + type: string + nullable: true + deviceName: + type: string + nullable: true + message: + type: string + nullable: true + deviceType: + $ref: '#/components/schemas/DeviceType' + AutomationTriggered: + type: object + additionalProperties: false + properties: + automationId: + type: string + nullable: true + automationName: + type: string + nullable: true + AlarmTriggered: + type: object + additionalProperties: false + properties: + alarmModeId: + type: string + nullable: true + alarmModeName: + type: string + nullable: true + type: + $ref: '#/components/schemas/AlarmType' + EventDTO: type: object additionalProperties: false properties: id: type: string nullable: true - name: + homeId: type: string nullable: true - active: - type: boolean - userId: + date: + type: string + format: date-time + type: + $ref: '#/components/schemas/EventType' + roomId: type: string nullable: true - createdDate: - type: string - format: date-time - updatedDate: - type: string - format: date-time - AutomationCreateOrUpdateDetailDTO: - allOf: - - $ref: '#/components/schemas/AutomationDTO' - - type: object - additionalProperties: false - properties: - triggers: - type: array - nullable: true - items: - $ref: '#/components/schemas/Trigger' - conditions: - type: array - nullable: true - items: - $ref: '#/components/schemas/Condition' - actions: - type: array - nullable: true - items: - $ref: '#/components/schemas/Action' - deviceIds: - type: array - nullable: true - items: - type: string + EventType: + type: string + description: '' + x-enumNames: + - DeviceState + - AutomationTriggered + - AlarmTriggered + enum: + - DeviceState + - AutomationTriggered + - AlarmTriggered GroupSummaryDTO: type: object additionalProperties: false @@ -3701,7 +4416,7 @@ components: id: type: string nullable: true - userId: + homeId: type: string nullable: true name: @@ -3740,6 +4455,90 @@ components: nullable: true items: type: string + HomeDTO: + type: object + additionalProperties: false + properties: + id: + type: string + nullable: true + name: + type: string + nullable: true + isAlarm: + type: boolean + isDefault: + type: boolean + currentAlarmMode: + nullable: true + oneOf: + - $ref: '#/components/schemas/AlarmModeDTO' + createdDate: + type: string + format: date-time + updatedDate: + type: string + format: date-time + usersIds: + type: array + nullable: true + items: + type: string + HomeDetailDTO: + allOf: + - $ref: '#/components/schemas/HomeDTO' + - type: object + additionalProperties: false + properties: + users: + type: array + nullable: true + items: + $ref: '#/components/schemas/UserInfoDetailDTO' + devices: + type: array + nullable: true + items: + $ref: '#/components/schemas/DeviceSummaryDTO' + automations: + type: array + nullable: true + items: + $ref: '#/components/schemas/AutomationDTO' + providers: + type: array + nullable: true + items: + $ref: '#/components/schemas/ProviderDTO' + groups: + type: array + nullable: true + items: + $ref: '#/components/schemas/GroupSummaryDTO' + CreateOrUpdateHomeDTO: + allOf: + - $ref: '#/components/schemas/HomeDTO' + - type: object + additionalProperties: false + properties: + usersIds: + type: array + nullable: true + items: + type: string + RoomSummaryDTO: + type: object + additionalProperties: false + properties: + id: + type: string + nullable: true + homeId: + type: string + nullable: true + name: + type: string + nullable: true RoomDetailDTO: allOf: - $ref: '#/components/schemas/RoomSummaryDTO' diff --git a/mycore_api/test/alarm_api_test.dart b/mycore_api/test/alarm_api_test.dart new file mode 100644 index 0000000..57c92e7 --- /dev/null +++ b/mycore_api/test/alarm_api_test.dart @@ -0,0 +1,76 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for AlarmApi +void main() { + final instance = AlarmApi(); + + group('tests for AlarmApi', () { + // Activate current alarm mode + // + //Future alarmActivate(String alarmModeId) async + test('test alarmActivate', () async { + // TODO + }); + + // Create an alarm mode + // + //Future alarmCreate(AlarmModeCreateOrUpdateDetailDTO alarmModeCreateOrUpdateDetailDTO) async + test('test alarmCreate', () async { + // TODO + }); + + // Create default alarm modes + // + //Future alarmCreateDefaultAlarms(String homeId) async + test('test alarmCreateDefaultAlarms', () async { + // TODO + }); + + // Delete an alarm mode + // + //Future alarmDelete(String alarmModeId) async + test('test alarmDelete', () async { + // TODO + }); + + // Delete all alarm mode for a specified home + // + //Future alarmDeleteAllForHome(String homeId) async + test('test alarmDeleteAllForHome', () async { + // TODO + }); + + // Get all alarm modes for the specified home + // + //Future> alarmGetAll(String homeId) async + test('test alarmGetAll', () async { + // TODO + }); + + // Get detail info of a specified alarm mode + // + //Future alarmGetDetail(String alarmId, { String alarmModeId }) async + test('test alarmGetDetail', () async { + // TODO + }); + + // Update an alarm mode + // + //Future alarmUpdate(AlarmModeCreateOrUpdateDetailDTO alarmModeCreateOrUpdateDetailDTO) async + test('test alarmUpdate', () async { + // TODO + }); + + }); +} diff --git a/mycore_api/test/alarm_mode_create_or_update_detail_dto_all_of_test.dart b/mycore_api/test/alarm_mode_create_or_update_detail_dto_all_of_test.dart new file mode 100644 index 0000000..3152fe5 --- /dev/null +++ b/mycore_api/test/alarm_mode_create_or_update_detail_dto_all_of_test.dart @@ -0,0 +1,41 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AlarmModeCreateOrUpdateDetailDTOAllOf +void main() { + final instance = AlarmModeCreateOrUpdateDetailDTOAllOf(); + + group('test AlarmModeCreateOrUpdateDetailDTOAllOf', () { + // List triggers (default value: const []) + test('to test the property `triggers`', () async { + // TODO + }); + + // List actions (default value: const []) + test('to test the property `actions`', () async { + // TODO + }); + + // OneOfProgrammedMode programmedMode + test('to test the property `programmedMode`', () async { + // TODO + }); + + // OneOfGeolocalizedMode geolocalizedMode + test('to test the property `geolocalizedMode`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/alarm_mode_create_or_update_detail_dto_test.dart b/mycore_api/test/alarm_mode_create_or_update_detail_dto_test.dart new file mode 100644 index 0000000..c3ffe13 --- /dev/null +++ b/mycore_api/test/alarm_mode_create_or_update_detail_dto_test.dart @@ -0,0 +1,86 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AlarmModeCreateOrUpdateDetailDTO +void main() { + final instance = AlarmModeCreateOrUpdateDetailDTO(); + + group('test AlarmModeCreateOrUpdateDetailDTO', () { + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String homeId + test('to test the property `homeId`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // AlarmType type + test('to test the property `type`', () async { + // TODO + }); + + // bool activated + test('to test the property `activated`', () async { + // TODO + }); + + // bool isDefault + test('to test the property `isDefault`', () async { + // TODO + }); + + // bool notification + test('to test the property `notification`', () async { + // TODO + }); + + // DateTime createdDate + test('to test the property `createdDate`', () async { + // TODO + }); + + // DateTime updatedDate + test('to test the property `updatedDate`', () async { + // TODO + }); + + // List triggers (default value: const []) + test('to test the property `triggers`', () async { + // TODO + }); + + // List actions (default value: const []) + test('to test the property `actions`', () async { + // TODO + }); + + // OneOfProgrammedMode programmedMode + test('to test the property `programmedMode`', () async { + // TODO + }); + + // OneOfGeolocalizedMode geolocalizedMode + test('to test the property `geolocalizedMode`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/alarm_mode_detail_dto_all_of_test.dart b/mycore_api/test/alarm_mode_detail_dto_all_of_test.dart new file mode 100644 index 0000000..c9776e5 --- /dev/null +++ b/mycore_api/test/alarm_mode_detail_dto_all_of_test.dart @@ -0,0 +1,41 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AlarmModeDetailDTOAllOf +void main() { + final instance = AlarmModeDetailDTOAllOf(); + + group('test AlarmModeDetailDTOAllOf', () { + // List triggers (default value: const []) + test('to test the property `triggers`', () async { + // TODO + }); + + // List devices (default value: const []) + test('to test the property `devices`', () async { + // TODO + }); + + // OneOfProgrammedMode programmedMode + test('to test the property `programmedMode`', () async { + // TODO + }); + + // OneOfGeolocalizedMode geolocalizedMode + test('to test the property `geolocalizedMode`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/alarm_mode_detail_dto_test.dart b/mycore_api/test/alarm_mode_detail_dto_test.dart new file mode 100644 index 0000000..8c886aa --- /dev/null +++ b/mycore_api/test/alarm_mode_detail_dto_test.dart @@ -0,0 +1,86 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AlarmModeDetailDTO +void main() { + final instance = AlarmModeDetailDTO(); + + group('test AlarmModeDetailDTO', () { + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String homeId + test('to test the property `homeId`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // AlarmType type + test('to test the property `type`', () async { + // TODO + }); + + // bool activated + test('to test the property `activated`', () async { + // TODO + }); + + // bool isDefault + test('to test the property `isDefault`', () async { + // TODO + }); + + // bool notification + test('to test the property `notification`', () async { + // TODO + }); + + // DateTime createdDate + test('to test the property `createdDate`', () async { + // TODO + }); + + // DateTime updatedDate + test('to test the property `updatedDate`', () async { + // TODO + }); + + // List triggers (default value: const []) + test('to test the property `triggers`', () async { + // TODO + }); + + // List devices (default value: const []) + test('to test the property `devices`', () async { + // TODO + }); + + // OneOfProgrammedMode programmedMode + test('to test the property `programmedMode`', () async { + // TODO + }); + + // OneOfGeolocalizedMode geolocalizedMode + test('to test the property `geolocalizedMode`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/alarm_mode_dto_test.dart b/mycore_api/test/alarm_mode_dto_test.dart new file mode 100644 index 0000000..5ee6258 --- /dev/null +++ b/mycore_api/test/alarm_mode_dto_test.dart @@ -0,0 +1,66 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AlarmModeDTO +void main() { + final instance = AlarmModeDTO(); + + group('test AlarmModeDTO', () { + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String homeId + test('to test the property `homeId`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // AlarmType type + test('to test the property `type`', () async { + // TODO + }); + + // bool activated + test('to test the property `activated`', () async { + // TODO + }); + + // bool isDefault + test('to test the property `isDefault`', () async { + // TODO + }); + + // bool notification + test('to test the property `notification`', () async { + // TODO + }); + + // DateTime createdDate + test('to test the property `createdDate`', () async { + // TODO + }); + + // DateTime updatedDate + test('to test the property `updatedDate`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/alarm_mode_test.dart b/mycore_api/test/alarm_mode_test.dart new file mode 100644 index 0000000..82856c2 --- /dev/null +++ b/mycore_api/test/alarm_mode_test.dart @@ -0,0 +1,91 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AlarmMode +void main() { + final instance = AlarmMode(); + + group('test AlarmMode', () { + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String homeId + test('to test the property `homeId`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // bool activated + test('to test the property `activated`', () async { + // TODO + }); + + // bool isDefault + test('to test the property `isDefault`', () async { + // TODO + }); + + // bool notification + test('to test the property `notification`', () async { + // TODO + }); + + // DateTime createdDate + test('to test the property `createdDate`', () async { + // TODO + }); + + // DateTime updatedDate + test('to test the property `updatedDate`', () async { + // TODO + }); + + // AlarmType type + test('to test the property `type`', () async { + // TODO + }); + + // OneOfProgrammedMode programmedMode + test('to test the property `programmedMode`', () async { + // TODO + }); + + // OneOfGeolocalizedMode geolocalizedMode + test('to test the property `geolocalizedMode`', () async { + // TODO + }); + + // List triggers (default value: const []) + test('to test the property `triggers`', () async { + // TODO + }); + + // List actions (default value: const []) + test('to test the property `actions`', () async { + // TODO + }); + + // List devicesIds (default value: const []) + test('to test the property `devicesIds`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/alarm_triggered_test.dart b/mycore_api/test/alarm_triggered_test.dart new file mode 100644 index 0000000..afb0001 --- /dev/null +++ b/mycore_api/test/alarm_triggered_test.dart @@ -0,0 +1,36 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AlarmTriggered +void main() { + final instance = AlarmTriggered(); + + group('test AlarmTriggered', () { + // String alarmModeId + test('to test the property `alarmModeId`', () async { + // TODO + }); + + // String alarmModeName + test('to test the property `alarmModeName`', () async { + // TODO + }); + + // AlarmType type + test('to test the property `type`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/alarm_type_test.dart b/mycore_api/test/alarm_type_test.dart new file mode 100644 index 0000000..a37cbb6 --- /dev/null +++ b/mycore_api/test/alarm_type_test.dart @@ -0,0 +1,20 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AlarmType +void main() { + + group('test AlarmType', () { + + }); + +} diff --git a/mycore_api/test/automation_triggered_test.dart b/mycore_api/test/automation_triggered_test.dart new file mode 100644 index 0000000..7ead09b --- /dev/null +++ b/mycore_api/test/automation_triggered_test.dart @@ -0,0 +1,31 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AutomationTriggered +void main() { + final instance = AutomationTriggered(); + + group('test AutomationTriggered', () { + // String automationId + test('to test the property `automationId`', () async { + // TODO + }); + + // String automationName + test('to test the property `automationName`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/create_or_update_home_dto_all_of_test.dart b/mycore_api/test/create_or_update_home_dto_all_of_test.dart new file mode 100644 index 0000000..32e11d2 --- /dev/null +++ b/mycore_api/test/create_or_update_home_dto_all_of_test.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for CreateOrUpdateHomeDTOAllOf +void main() { + final instance = CreateOrUpdateHomeDTOAllOf(); + + group('test CreateOrUpdateHomeDTOAllOf', () { + // List usersIds (default value: const []) + test('to test the property `usersIds`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/create_or_update_home_dto_test.dart b/mycore_api/test/create_or_update_home_dto_test.dart new file mode 100644 index 0000000..c4e08bc --- /dev/null +++ b/mycore_api/test/create_or_update_home_dto_test.dart @@ -0,0 +1,61 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for CreateOrUpdateHomeDTO +void main() { + final instance = CreateOrUpdateHomeDTO(); + + group('test CreateOrUpdateHomeDTO', () { + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // bool isAlarm + test('to test the property `isAlarm`', () async { + // TODO + }); + + // bool isDefault + test('to test the property `isDefault`', () async { + // TODO + }); + + // OneOfAlarmModeDTO currentAlarmMode + test('to test the property `currentAlarmMode`', () async { + // TODO + }); + + // DateTime createdDate + test('to test the property `createdDate`', () async { + // TODO + }); + + // DateTime updatedDate + test('to test the property `updatedDate`', () async { + // TODO + }); + + // List usersIds (default value: const []) + test('to test the property `usersIds`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/device_state_test.dart b/mycore_api/test/device_state_test.dart new file mode 100644 index 0000000..fcb572f --- /dev/null +++ b/mycore_api/test/device_state_test.dart @@ -0,0 +1,41 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for DeviceState +void main() { + final instance = DeviceState(); + + group('test DeviceState', () { + // String deviceId + test('to test the property `deviceId`', () async { + // TODO + }); + + // String deviceName + test('to test the property `deviceName`', () async { + // TODO + }); + + // String message + test('to test the property `message`', () async { + // TODO + }); + + // DeviceType deviceType + test('to test the property `deviceType`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/event_api_test.dart b/mycore_api/test/event_api_test.dart new file mode 100644 index 0000000..3c7170a --- /dev/null +++ b/mycore_api/test/event_api_test.dart @@ -0,0 +1,48 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for EventApi +void main() { + final instance = EventApi(); + + group('tests for EventApi', () { + // Delete an event + // + //Future eventDelete(String eventId) async + test('test eventDelete', () async { + // TODO + }); + + // Delete all events for a specified home + // + //Future eventDeleteAllForHome(String homeId) async + test('test eventDeleteAllForHome', () async { + // TODO + }); + + // Get events for the specified home + // + //Future> eventGet(String homeId, { String deviceId, String roomId, int startIndex, int count, DateTime dateStart, DateTime dateEnd, OneOfEventType eventType, OneOfDeviceType deviceType }) async + test('test eventGet', () async { + // TODO + }); + + // Get detail info of a specified event + // + //Future eventGetDetail(String eventId) async + test('test eventGetDetail', () async { + // TODO + }); + + }); +} diff --git a/mycore_api/test/event_detail_dto_all_of_test.dart b/mycore_api/test/event_detail_dto_all_of_test.dart new file mode 100644 index 0000000..535224d --- /dev/null +++ b/mycore_api/test/event_detail_dto_all_of_test.dart @@ -0,0 +1,36 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for EventDetailDTOAllOf +void main() { + final instance = EventDetailDTOAllOf(); + + group('test EventDetailDTOAllOf', () { + // OneOfDeviceState deviceState + test('to test the property `deviceState`', () async { + // TODO + }); + + // OneOfAutomationTriggered automationTriggered + test('to test the property `automationTriggered`', () async { + // TODO + }); + + // OneOfAlarmTriggered alarmTriggered + test('to test the property `alarmTriggered`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/event_detail_dto_test.dart b/mycore_api/test/event_detail_dto_test.dart new file mode 100644 index 0000000..5bebf78 --- /dev/null +++ b/mycore_api/test/event_detail_dto_test.dart @@ -0,0 +1,61 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for EventDetailDTO +void main() { + final instance = EventDetailDTO(); + + group('test EventDetailDTO', () { + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String homeId + test('to test the property `homeId`', () async { + // TODO + }); + + // DateTime date + test('to test the property `date`', () async { + // TODO + }); + + // EventType type + test('to test the property `type`', () async { + // TODO + }); + + // String roomId + test('to test the property `roomId`', () async { + // TODO + }); + + // OneOfDeviceState deviceState + test('to test the property `deviceState`', () async { + // TODO + }); + + // OneOfAutomationTriggered automationTriggered + test('to test the property `automationTriggered`', () async { + // TODO + }); + + // OneOfAlarmTriggered alarmTriggered + test('to test the property `alarmTriggered`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/event_dto_test.dart b/mycore_api/test/event_dto_test.dart new file mode 100644 index 0000000..8f33ab0 --- /dev/null +++ b/mycore_api/test/event_dto_test.dart @@ -0,0 +1,46 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for EventDTO +void main() { + final instance = EventDTO(); + + group('test EventDTO', () { + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String homeId + test('to test the property `homeId`', () async { + // TODO + }); + + // DateTime date + test('to test the property `date`', () async { + // TODO + }); + + // EventType type + test('to test the property `type`', () async { + // TODO + }); + + // String roomId + test('to test the property `roomId`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/event_type_test.dart b/mycore_api/test/event_type_test.dart new file mode 100644 index 0000000..4cf4c36 --- /dev/null +++ b/mycore_api/test/event_type_test.dart @@ -0,0 +1,20 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for EventType +void main() { + + group('test EventType', () { + + }); + +} diff --git a/mycore_api/test/geolocalized_mode_test.dart b/mycore_api/test/geolocalized_mode_test.dart new file mode 100644 index 0000000..80de9be --- /dev/null +++ b/mycore_api/test/geolocalized_mode_test.dart @@ -0,0 +1,41 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for GeolocalizedMode +void main() { + final instance = GeolocalizedMode(); + + group('test GeolocalizedMode', () { + // String latitude + test('to test the property `latitude`', () async { + // TODO + }); + + // String longitude + test('to test the property `longitude`', () async { + // TODO + }); + + // OneOfAlarmMode homeMode + test('to test the property `homeMode`', () async { + // TODO + }); + + // OneOfAlarmMode absentMode + test('to test the property `absentMode`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/home_api_test.dart b/mycore_api/test/home_api_test.dart new file mode 100644 index 0000000..134e5ed --- /dev/null +++ b/mycore_api/test/home_api_test.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for HomeApi +void main() { + final instance = HomeApi(); + + group('tests for HomeApi', () { + // Create a home + // + //Future homeCreate(CreateOrUpdateHomeDTO createOrUpdateHomeDTO) async + test('test homeCreate', () async { + // TODO + }); + + // Delete a home + // + //Future homeDelete(String homeId) async + test('test homeDelete', () async { + // TODO + }); + + // Get all home for specified user + // + //Future> homeGetAll(String userId) async + test('test homeGetAll', () async { + // TODO + }); + + // Get detail info of a specified home + // + //Future homeGetDetail(String homeId) async + test('test homeGetDetail', () async { + // TODO + }); + + // Update a home + // + //Future homeUpdate(CreateOrUpdateHomeDTO createOrUpdateHomeDTO) async + test('test homeUpdate', () async { + // TODO + }); + + }); +} diff --git a/mycore_api/test/home_detail_dto_all_of_test.dart b/mycore_api/test/home_detail_dto_all_of_test.dart new file mode 100644 index 0000000..018efe6 --- /dev/null +++ b/mycore_api/test/home_detail_dto_all_of_test.dart @@ -0,0 +1,46 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for HomeDetailDTOAllOf +void main() { + final instance = HomeDetailDTOAllOf(); + + group('test HomeDetailDTOAllOf', () { + // List users (default value: const []) + test('to test the property `users`', () async { + // TODO + }); + + // List devices (default value: const []) + test('to test the property `devices`', () async { + // TODO + }); + + // List automations (default value: const []) + test('to test the property `automations`', () async { + // TODO + }); + + // List providers (default value: const []) + test('to test the property `providers`', () async { + // TODO + }); + + // List groups (default value: const []) + test('to test the property `groups`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/home_detail_dto_test.dart b/mycore_api/test/home_detail_dto_test.dart new file mode 100644 index 0000000..d99cd0a --- /dev/null +++ b/mycore_api/test/home_detail_dto_test.dart @@ -0,0 +1,86 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for HomeDetailDTO +void main() { + final instance = HomeDetailDTO(); + + group('test HomeDetailDTO', () { + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // bool isAlarm + test('to test the property `isAlarm`', () async { + // TODO + }); + + // bool isDefault + test('to test the property `isDefault`', () async { + // TODO + }); + + // OneOfAlarmModeDTO currentAlarmMode + test('to test the property `currentAlarmMode`', () async { + // TODO + }); + + // DateTime createdDate + test('to test the property `createdDate`', () async { + // TODO + }); + + // DateTime updatedDate + test('to test the property `updatedDate`', () async { + // TODO + }); + + // List usersIds (default value: const []) + test('to test the property `usersIds`', () async { + // TODO + }); + + // List users (default value: const []) + test('to test the property `users`', () async { + // TODO + }); + + // List devices (default value: const []) + test('to test the property `devices`', () async { + // TODO + }); + + // List automations (default value: const []) + test('to test the property `automations`', () async { + // TODO + }); + + // List providers (default value: const []) + test('to test the property `providers`', () async { + // TODO + }); + + // List groups (default value: const []) + test('to test the property `groups`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/home_dto_test.dart b/mycore_api/test/home_dto_test.dart new file mode 100644 index 0000000..33474fa --- /dev/null +++ b/mycore_api/test/home_dto_test.dart @@ -0,0 +1,61 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for HomeDTO +void main() { + final instance = HomeDTO(); + + group('test HomeDTO', () { + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // bool isAlarm + test('to test the property `isAlarm`', () async { + // TODO + }); + + // bool isDefault + test('to test the property `isDefault`', () async { + // TODO + }); + + // OneOfAlarmModeDTO currentAlarmMode + test('to test the property `currentAlarmMode`', () async { + // TODO + }); + + // DateTime createdDate + test('to test the property `createdDate`', () async { + // TODO + }); + + // DateTime updatedDate + test('to test the property `updatedDate`', () async { + // TODO + }); + + // List usersIds (default value: const []) + test('to test the property `usersIds`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/programmed_mode_test.dart b/mycore_api/test/programmed_mode_test.dart new file mode 100644 index 0000000..ba6ed2d --- /dev/null +++ b/mycore_api/test/programmed_mode_test.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ProgrammedMode +void main() { + final instance = ProgrammedMode(); + + group('test ProgrammedMode', () { + // List monday (default value: const []) + test('to test the property `monday`', () async { + // TODO + }); + + // List tuesday (default value: const []) + test('to test the property `tuesday`', () async { + // TODO + }); + + // List wednesday (default value: const []) + test('to test the property `wednesday`', () async { + // TODO + }); + + // List thursday (default value: const []) + test('to test the property `thursday`', () async { + // TODO + }); + + // List friday (default value: const []) + test('to test the property `friday`', () async { + // TODO + }); + + // List saturday (default value: const []) + test('to test the property `saturday`', () async { + // TODO + }); + + // List sunday (default value: const []) + test('to test the property `sunday`', () async { + // TODO + }); + + + }); + +} diff --git a/mycore_api/test/provider_type_test.dart b/mycore_api/test/provider_type_test.dart new file mode 100644 index 0000000..ef2c296 --- /dev/null +++ b/mycore_api/test/provider_type_test.dart @@ -0,0 +1,20 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ProviderType +void main() { + + group('test ProviderType', () { + + }); + +} diff --git a/mycore_api/test/time_period_alarm_test.dart b/mycore_api/test/time_period_alarm_test.dart new file mode 100644 index 0000000..624d417 --- /dev/null +++ b/mycore_api/test/time_period_alarm_test.dart @@ -0,0 +1,36 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:mycoreapi/api.dart'; +import 'package:test/test.dart'; + +// tests for TimePeriodAlarm +void main() { + final instance = TimePeriodAlarm(); + + group('test TimePeriodAlarm', () { + // String start + test('to test the property `start`', () async { + // TODO + }); + + // String end + test('to test the property `end`', () async { + // TODO + }); + + // OneOfAlarmMode alarmMode + test('to test the property `alarmMode`', () async { + // TODO + }); + + + }); + +} From 10965da18400e735c8ec45716cd0ba399a851913 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Wed, 1 Dec 2021 17:52:27 +0100 Subject: [PATCH 2/2] Add login page + connect to api, update api code + add debug page to test (wip) --- lib/Components/Buttons/rounded_button.dart | 38 +++ lib/Components/rounded_input_field.dart | 46 +++ lib/Components/rounded_password_field.dart | 34 +++ lib/Components/text_field_container.dart | 27 ++ lib/Helpers/DatabaseHelper.dart | 107 +++++++ lib/Helpers/MQTTHelper.dart | 121 ++++++++ lib/Models/homieContext.dart | 48 ++++ lib/Screens/Debug/DebugPage.dart | 47 ++++ lib/Screens/Home/HomePage.dart | 155 +++++++++++ lib/Screens/Login/components/background.dart | 40 +++ lib/Screens/Login/components/body.dart | 188 +++++++++++++ lib/Screens/Login/login_screen.dart | 11 + lib/app_context.dart | 18 ++ lib/client.dart | 16 +- lib/main.dart | 263 ++++-------------- macos/Flutter/GeneratedPluginRegistrant.swift | 4 +- mycore_api/lib/api.dart | 1 + mycore_api/lib/api/event_api.dart | 4 +- mycore_api/lib/model/alarm_mode.dart | 8 +- ...larm_mode_create_or_update_detail_dto.dart | 8 +- ...de_create_or_update_detail_dto_all_of.dart | 8 +- .../lib/model/alarm_mode_detail_dto.dart | 8 +- .../model/alarm_mode_detail_dto_all_of.dart | 8 +- mycore_api/lib/model/condition.dart | 4 +- .../lib/model/create_or_update_home_dto.dart | 4 +- mycore_api/lib/model/event_detail_dto.dart | 12 +- .../lib/model/event_detail_dto_all_of.dart | 12 +- mycore_api/lib/model/geolocalized_mode.dart | 8 +- mycore_api/lib/model/home_detail_dto.dart | 4 +- mycore_api/lib/model/home_dto.dart | 4 +- mycore_api/lib/model/odd_nice.dart | 4 +- mycore_api/lib/model/time_period_alarm.dart | 4 +- pubspec.lock | 76 ++++- pubspec.yaml | 4 + 34 files changed, 1067 insertions(+), 277 deletions(-) create mode 100644 lib/Components/Buttons/rounded_button.dart create mode 100644 lib/Components/rounded_input_field.dart create mode 100644 lib/Components/rounded_password_field.dart create mode 100644 lib/Components/text_field_container.dart create mode 100644 lib/Helpers/DatabaseHelper.dart create mode 100644 lib/Helpers/MQTTHelper.dart create mode 100644 lib/Models/homieContext.dart create mode 100644 lib/Screens/Debug/DebugPage.dart create mode 100644 lib/Screens/Home/HomePage.dart create mode 100644 lib/Screens/Login/components/background.dart create mode 100644 lib/Screens/Login/components/body.dart create mode 100644 lib/Screens/Login/login_screen.dart create mode 100644 lib/app_context.dart diff --git a/lib/Components/Buttons/rounded_button.dart b/lib/Components/Buttons/rounded_button.dart new file mode 100644 index 0000000..4005aa6 --- /dev/null +++ b/lib/Components/Buttons/rounded_button.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; +import 'package:myhomie_app/constants.dart'; + +class RoundedButton extends StatelessWidget { + final String text; + final Function press; + final Color color, textColor; + final double fontSize; + + const RoundedButton({ + Key key, + this.text, + this.press, + this.color = kBodyTextColor, // TODO + this.textColor = Colors.white, + this.fontSize + }) : super(key: key); + + @override + Widget build(BuildContext context) { + Size size = MediaQuery.of(context).size; + return FlatButton( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(35.0), + //side: BorderSide(color: kSubTitleColor) + ), + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 25), + color: color, + onPressed: () => { + press() + }, + child: Text( + text, + style: new TextStyle(color: textColor, fontSize: fontSize, fontWeight: FontWeight.w400), + ), + ); + } +} \ No newline at end of file diff --git a/lib/Components/rounded_input_field.dart b/lib/Components/rounded_input_field.dart new file mode 100644 index 0000000..be53d64 --- /dev/null +++ b/lib/Components/rounded_input_field.dart @@ -0,0 +1,46 @@ +import 'package:flutter/material.dart'; +import 'package:myhomie_app/Components/text_field_container.dart'; +import 'package:myhomie_app/constants.dart'; + +class RoundedInputField extends StatelessWidget { + final String hintText; + final IconData icon; + final ValueChanged onChanged; + final String initialValue; + final Color color, textColor, iconColor; + final int maxLength; + const RoundedInputField({ + Key key, + this.hintText, + this.initialValue, + this.icon, + this.color = kTitleTextColor, // TODO + this.textColor = kBodyTextColor, // TODO + this.iconColor = kTitleTextColor, // TODO + this.onChanged, + this.maxLength, // 50 + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return TextFieldContainer( + color: color, + child: TextFormField ( + onChanged: onChanged, + initialValue: initialValue, + cursorColor: textColor, + maxLength: maxLength, + style: TextStyle(fontSize: 20, color: textColor), + decoration: InputDecoration( + icon: icon != null ? Icon( + icon, + color: iconColor, + ): null, + hintText: hintText, + hintStyle: TextStyle(fontSize: 20.0, color: textColor), + border: InputBorder.none, + ) + ), + ); + } +} diff --git a/lib/Components/rounded_password_field.dart b/lib/Components/rounded_password_field.dart new file mode 100644 index 0000000..7bbac63 --- /dev/null +++ b/lib/Components/rounded_password_field.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +import 'package:myhomie_app/Components/text_field_container.dart'; +import 'package:myhomie_app/constants.dart'; + +class RoundedPasswordField extends StatelessWidget { + final ValueChanged onChanged; + const RoundedPasswordField({ + Key key, + this.onChanged, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return TextFieldContainer( + child: TextField( + obscureText: true, + onChanged: onChanged, + cursorColor: kBodyTextColor, // TODO + decoration: InputDecoration( + hintText: "Password", + icon: Icon( + Icons.lock, + color: kBodyTextColor, // TODO + ), + suffixIcon: Icon( + Icons.visibility, + color: kBodyTextColor, // TODO + ), + border: InputBorder.none, + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/Components/text_field_container.dart b/lib/Components/text_field_container.dart new file mode 100644 index 0000000..e97bffc --- /dev/null +++ b/lib/Components/text_field_container.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; +import 'package:myhomie_app/constants.dart'; + +class TextFieldContainer extends StatelessWidget { + final Widget child; + final Color color; + const TextFieldContainer({ + Key key, + this.child, + this.color = kBackgroundColor, // TODO + }) : super(key: key); + + @override + Widget build(BuildContext context) { + Size size = MediaQuery.of(context).size; + return Container( + margin: EdgeInsets.symmetric(vertical: 10), + padding: EdgeInsets.symmetric(horizontal: 20, vertical: 5), + width: size.width * 0.8, + decoration: BoxDecoration( + color: color, + borderRadius: BorderRadius.circular(29), + ), + child: child, + ); + } +} \ No newline at end of file diff --git a/lib/Helpers/DatabaseHelper.dart b/lib/Helpers/DatabaseHelper.dart new file mode 100644 index 0000000..57f0981 --- /dev/null +++ b/lib/Helpers/DatabaseHelper.dart @@ -0,0 +1,107 @@ +import 'dart:convert'; + +import 'package:myhomie_app/Models/homieContext.dart'; +import 'package:path/path.dart'; +import 'package:sqflite/sqflite.dart'; + +class DatabaseHelper { + static final _databaseName = "homie_database.db"; + static final _databaseVersion = 1; + + static final table = 'homieAppContext'; + + static final columnId = 'id'; + static final columnUserId = 'deviceId'; + static final columnHomeId = 'homeId'; + static final columnToken = 'token'; + static final columnHost = 'host'; + static final columnLanguage = 'language'; + + DatabaseHelper._privateConstructor(); + static final DatabaseHelper instance = DatabaseHelper._privateConstructor(); + + static Database _database; + Future get database async { + if (_database != null) return _database; + _database = await _initDatabase(); + return _database; + } + + _initDatabase() async { + String path = join(await getDatabasesPath(), _databaseName); + return await openDatabase(path, + version: _databaseVersion, onCreate: _onCreate); + } + + // SQL code to create the database table + Future _onCreate(Database db, int version) async { + await db.execute(''' + CREATE TABLE $table ( + $columnId TEXT NOT NULL PRIMARY KEY, + $columnUserId TEXT NOT NULL, + $columnToken TEXT NOT NULL, + $columnHomeId TEXT NOT NULL, + $columnHost TEXT NOT NULL, + $columnLanguage TEXT NOT NULL + ) + '''); + } + + Future insert(HomieAppContext tabletAppContext) async { + Database db = await instance.database; + + var res = await db.insert(table, tabletAppContext.toMap()); + return res; + } + + Future update(HomieAppContext tabletAppContext) async { + // Get a reference to the database. + final db = await instance.database; + + await db.update( + 'tabletAppContext', + tabletAppContext.toMap(), + where: "id = ?", + whereArgs: [tabletAppContext.id], + ); + } + + Future>> queryAllRows() async { + Database db = await instance.database; + var res = await db.query(table, orderBy: "$columnId DESC"); + return res; + } + + Future delete(String email) async { + Database db = await instance.database; + return await db.delete(table, where: '$columnId = ?', whereArgs: [email]); + } + + Future clearTable() async { + Database db = await instance.database; + return await db.rawQuery("DELETE FROM $table"); + } + + Future getData() async { + HomieAppContext homieAppContext; + + await DatabaseHelper.instance.queryAllRows().then((value) { + value.forEach((element) { + print("DB - CONTEXT --- "); + + homieAppContext = HomieAppContext( + id: element["id"], + userId: element["userId"], + token: element["token"], + host: element["host"], + homeId: element["homeId"], + language: element["language"] + ); + }); + }).catchError((error) { + print(error); + }); + + return homieAppContext; + } +} \ No newline at end of file diff --git a/lib/Helpers/MQTTHelper.dart b/lib/Helpers/MQTTHelper.dart new file mode 100644 index 0000000..01d988b --- /dev/null +++ b/lib/Helpers/MQTTHelper.dart @@ -0,0 +1,121 @@ +import 'dart:convert'; + +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:mqtt_client/mqtt_client.dart'; +import 'package:mqtt_client/mqtt_server_client.dart'; +import 'package:myhomie_app/Models/homieContext.dart'; + + +class MQTTHelper { + MQTTHelper._privateConstructor(); + bool isInstantiated = false; + static final MQTTHelper instance = MQTTHelper._privateConstructor(); + String lastMessage; + + void onConnected(dynamic appContext) { + print('Connected !!!!!!!!!!!! ----------------------------------'); + HomieAppContext homieAppContext = appContext.getContext(); + + homieAppContext.clientMQTT.subscribe("#", MqttQos.atLeastOnce); + + print(homieAppContext.clientMQTT); + + homieAppContext.clientMQTT.updates.listen((List> c) async { + print("IN Received message"); + final MqttPublishMessage message = c[0].payload; + final payload = MqttPublishPayload.bytesToStringAsString(message.payload.message); + print('Received message:$payload from topic: ${c[0].topic}'); + + lastMessage = 'Received message:$payload from topic: ${c[0].topic}'; + + var topic = c[0].topic.split('/')[0]; + + switch(topic) { + case "config": + print('Get message in topic config = $payload'); + break; + case "player": + print('Get message in topic player = $payload'); + // refresh device info + try { + } + catch(e) { + print('Error = $e'); + } + break; + } + }); + } + + // unconnected + void onDisconnected() { + print('Disconnected'); + } + + // subscribe to topic succeeded + void onSubscribed(String topic) { + print('Subscribed topic: $topic'); + } + + // subscribe to topic failed + void onSubscribeFail(String topic) { + print('Failed to subscribe $topic'); + } + + // unsubscribe succeeded + void onUnsubscribed(String topic) { + print('Unsubscribed topic: $topic'); + } + + String getLastMessage() { + print("LAST MESSAAAGE"); + print(lastMessage); + return lastMessage; + } + + Future connect(dynamic appContext) async { + HomieAppContext homieAppContext = appContext.getContext(); + + if (homieAppContext == null) { + homieAppContext = new HomieAppContext(host: '192.168.31.140', userId: 'TODO'); + } // TO DEBUG + + if(homieAppContext.host != null) { + homieAppContext.clientMQTT = MqttServerClient.withPort(homieAppContext.host.replaceAll('http://', ''), 'homie_app_'+homieAppContext.userId, 1883); + isInstantiated = true; + + homieAppContext.clientMQTT.logging(on: false); + homieAppContext.clientMQTT.keepAlivePeriod = 20; + homieAppContext.clientMQTT.onDisconnected = onDisconnected; + homieAppContext.clientMQTT.onConnected = () => onConnected(appContext); + homieAppContext.clientMQTT.onSubscribed = onSubscribed; + + var message = { + "userId": homieAppContext.userId, + "connected": false + }; + + final connMessage = MqttConnectMessage().authenticateAs('user', 'user') // TODO ONLINE + .keepAliveFor(60) + .withWillTopic('player/status') + .withWillMessage(jsonEncode(message)) + .withClientIdentifier('tablet_app_'+homieAppContext.userId) + .startClean() + .withWillQos(MqttQos.atLeastOnce); + + homieAppContext.clientMQTT.connectionMessage = connMessage; + homieAppContext.clientMQTT.autoReconnect = true; + try { + await homieAppContext.clientMQTT.connect(); + + } catch (e) { + print('Exception: $e'); + homieAppContext.clientMQTT.disconnect(); + } + appContext.setContext(homieAppContext); // TODO CLEAN + + return homieAppContext.clientMQTT; + } + return null; + } +} \ No newline at end of file diff --git a/lib/Models/homieContext.dart b/lib/Models/homieContext.dart new file mode 100644 index 0000000..d978acd --- /dev/null +++ b/lib/Models/homieContext.dart @@ -0,0 +1,48 @@ +import 'package:flutter/material.dart'; +import 'package:mqtt_client/mqtt_server_client.dart'; +import 'dart:convert'; + +import 'package:myhomie_app/client.dart'; + + +class HomieAppContext with ChangeNotifier{ + Client clientAPI; + MqttServerClient clientMQTT; + String id; + String host; + String language; + String userId; + String homeId; + String token; + + + HomieAppContext({this.id, this.userId, this.homeId, this.host, this.language, this.token}); + + Map toMap() { + return { + 'id': id, + 'userId': userId, + 'homeId': homeId, + 'host': host, + 'language': language, + 'token': token, + }; + } + + factory HomieAppContext.fromJson(Map json) { + return new HomieAppContext( + id: json['id'] as String, + userId: json['userId'] as String, + host: json['host'] as String, + homeId: json['homeId'] as String, + language: json['language'] as String, + token: json['token'] as String + ); + } + + // Implement toString to make it easier to see information about + @override + String toString() { + return 'TabletAppContext{id: $id, userId: $userId, homeId: $homeId, language: $language, host: $host}'; + } +} \ No newline at end of file diff --git a/lib/Screens/Debug/DebugPage.dart b/lib/Screens/Debug/DebugPage.dart new file mode 100644 index 0000000..75ab7cf --- /dev/null +++ b/lib/Screens/Debug/DebugPage.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; +import 'package:myhomie_app/Helpers/MQTTHelper.dart'; +import 'package:myhomie_app/app_context.dart'; +import 'package:provider/provider.dart'; + +class DebugPage extends StatefulWidget { + DebugPage({Key key}) : super(key: key); + + @override + _DebugPageState createState() => _DebugPageState(); +} + +class _DebugPageState extends State { + + @override + Widget build(BuildContext context) { + final appContext = Provider.of(context); + String lastMessage = "test"; + + //lastMessage = MQTTHelper.instance.getLastMessage() == null ? "rien" : MQTTHelper.instance.getLastMessage(); + + return Scaffold( + appBar: AppBar( + title: Text("Debug TODO"), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Last Message", + ), + Text( + MQTTHelper.instance.getLastMessage() == null ? "rien" : MQTTHelper.instance.getLastMessage(), + style: Theme.of(context).textTheme.headline4, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: () => {}, + tooltip: 'Increment', + child: Icon(Icons.add), + ), + ); + } +} \ No newline at end of file diff --git a/lib/Screens/Home/HomePage.dart b/lib/Screens/Home/HomePage.dart new file mode 100644 index 0000000..f560220 --- /dev/null +++ b/lib/Screens/Home/HomePage.dart @@ -0,0 +1,155 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/services.dart'; +import 'package:mqtt_client/mqtt_client.dart'; +import 'package:mqtt_client/mqtt_server_client.dart'; +import 'package:mycoreapi/api.dart'; +import 'package:myhomie_app/Helpers/MQTTHelper.dart'; +import 'package:myhomie_app/Screens/Debug/DebugPage.dart'; +import 'package:myhomie_app/app_context.dart'; +import 'package:myhomie_app/client.dart'; +import 'package:provider/provider.dart'; + +class HomePage extends StatefulWidget { + HomePage({Key key}) : super(key: key); + + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + int _counter = 0; + final MqttServerClient client = MqttServerClient.withPort('192.168.31.140', 'flutter_client', 1883); // TODO Add switch button or check online connexion if local broker available + //final MqttServerClient client = MqttServerClient.withPort('myhomie.be', 'flutter_client00', 1883); // TODO ONLINE + + void _incrementCounter() { + setState(() { + _counter++; + + print("client.connectionStatus !!! ==" + client.connectionStatus.toString()); + if (client.connectionStatus.state == MqttConnectionState.connected) { + const pubTopic = 'topic/test'; + final builder = MqttClientPayloadBuilder(); + builder.addString('Hello MQTT'); + client.publishMessage(pubTopic, MqttQos.atLeastOnce, builder.payload); + } + }); + } + + // connection succeeded + void onConnected() { + print('Connected !!!!!!!!!!!! ----------------------------------'); + + client.updates.listen((List> c) { + final MqttPublishMessage message = c[0].payload; + final payload = MqttPublishPayload.bytesToStringAsString(message.payload.message); + print('Received message:$payload from topic: ${c[0].topic}>'); + }); + } + +// unconnected + void onDisconnected() { + print('Disconnected'); + } + +// subscribe to topic succeeded + void onSubscribed(String topic) { + print('Subscribed topic: $topic'); + } + +// subscribe to topic failed + void onSubscribeFail(String topic) { + print('Failed to subscribe $topic'); + } + +// unsubscribe succeeded + void onUnsubscribed(String topic) { + print('Unsubscribed topic: $topic'); + } + + Future connect() async { + client.logging(on: false); + client.keepAlivePeriod = 20; + client.onDisconnected = onDisconnected; + client.onConnected = onConnected; + client.onSubscribed = onSubscribed; + + /// Security context + /*SecurityContext context = new SecurityContext() + ..useCertificateChain('path/to/my_cert.pem') + ..usePrivateKey('path/to/my_key.pem', password: 'key_password') + ..setClientAuthorities('path/to/client.crt', password: 'password');*/ + //client.setProtocolV31(); + //client.secure = true; + //client.securityContext = context; + + final connMessage = MqttConnectMessage() + .authenticateAs('thomas', 'MyCore,1') // TODO ONLINE + /*.keepAliveFor(60) + .withWillTopic('willtopic') + .withWillMessage('Will message')*/ + .withClientIdentifier("TESSST") + .startClean(); + //.withWillQos(MqttQos.atLeastOnce); + //client.secure = true; + client.connectionMessage = connMessage; + client.autoReconnect = true; + try { + await client.connect(); + } catch (e) { + print('Exception: $e'); + client.disconnect(); + } + + client.subscribe("#", MqttQos.atLeastOnce); + + return client; + return null; + } + + @override + Widget build(BuildContext context) { + final appContext = Provider.of(context); + + if (!MQTTHelper.instance.isInstantiated) + { + print("MQTT NOT INSTANTIATED"); + MQTTHelper.instance.connect(appContext); + } + + + return Scaffold( + appBar: AppBar( + title: Text("HomePage TODO"), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'You have pushed the button this many times:', + ), + Text( + '$_counter', + style: Theme.of(context).textTheme.headline4, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: () => { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return DebugPage(); + }, + ) + ) + }, + tooltip: 'Increment', + child: Icon(Icons.add), + ), + ); + } +} \ No newline at end of file diff --git a/lib/Screens/Login/components/background.dart b/lib/Screens/Login/components/background.dart new file mode 100644 index 0000000..cb5512b --- /dev/null +++ b/lib/Screens/Login/components/background.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; + +class Background extends StatelessWidget { + final Widget child; + const Background({ + Key key, + @required this.child, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + Size size = MediaQuery.of(context).size; + return Container( + width: double.infinity, + height: size.height, + child: Stack( + alignment: Alignment.center, + children: [ + /*Positioned( + top: 0, + left: 0, + child: Image.asset( + "assets/images/main_top.png", + width: size.width * 0.35, + ), + ),*/ + /*Positioned( + bottom: 0, + right: 0, + child: Image.asset( + "assets/images/login_bottom.png", + width: size.width * 0.4, + ), + ),*/ + child, + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/Screens/Login/components/body.dart b/lib/Screens/Login/components/body.dart new file mode 100644 index 0000000..81d5c66 --- /dev/null +++ b/lib/Screens/Login/components/body.dart @@ -0,0 +1,188 @@ +import 'package:flutter/material.dart'; +import 'package:mqtt_client/mqtt_server_client.dart'; +import 'package:mycoreapi/api.dart'; +import 'package:myhomie_app/Components/Buttons/rounded_button.dart'; +import 'package:myhomie_app/Components/rounded_input_field.dart'; +import 'package:myhomie_app/Components/rounded_password_field.dart'; +import 'package:myhomie_app/Models/homieContext.dart'; +import 'package:myhomie_app/Screens/Home/HomePage.dart'; +import 'package:myhomie_app/Screens/Login/components/background.dart'; +import 'package:myhomie_app/app_context.dart'; +import 'package:myhomie_app/client.dart'; +import 'package:provider/provider.dart'; + + +class Body extends StatefulWidget { + const Body({ + Key key, + }) : super(key: key); + + @override + State createState() => _BodyState(); +} + +class _BodyState extends State { + final clientAPI = Client('http://192.168.31.140'); // TODO field + + @override + Widget build(BuildContext context) { + final appContext = Provider.of(context); + Size size = MediaQuery.of(context).size; + return Background( + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "LOGIN", + style: TextStyle(fontWeight: FontWeight.bold), + ), + SizedBox(height: size.height * 0.03), + /*SvgPicture.asset( + "assets/icons/login.svg", + height: size.height * 0.35, + ),*/ + SizedBox(height: size.height * 0.03), + RoundedInputField( + hintText: "Your Email", + onChanged: (value) {}, + ), + RoundedPasswordField( + onChanged: (value) {}, + ), + RoundedButton( + text: "LOGIN", + press: () async { + // TODO check login etc + var connected = await authenticateTRY(); + if (connected) { + HomieAppContext homieAppContext = new HomieAppContext(); + homieAppContext.host = "http://192.168.31.140";// TODO + homieAppContext.clientMQTT = new MqttServerClient(homieAppContext.host.replaceAll('http://', ''),'tablet_app_'+'TODODODO'); + // homieAppContext.clientAPI = client; // TODO + homieAppContext.userId = "TODO"; // TODO + + setState(() { + appContext.setContext(homieAppContext); + }); + + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute( + builder: (context) { + return HomePage(); + }, + ), + (Route route) => false + ); + } + }, + ), + SizedBox(height: size.height * 0.03), + // TODO + /*AlreadyHaveAnAccountCheck( + press: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + //return SignUpScreen(); + // TODODODO + }, + ), + ); + }, + ),*/ + ], + ), + ), + ); + } + + Future authenticateTRY() async { + print("try auth.. "); + + // if () {} // Add if token exist and not null + not expired + var isConnected = false; + try { + //LoginDTO loginDTO = new LoginDTO(email: "test@email.be", password: "kljqsdkljqsd"); + LoginDTO loginDTO = new LoginDTO(email: "", password: ""); + TokenDTO token = await clientAPI.authenticationApi.authenticationAuthenticateWithJson(loginDTO); + print("Token ??"); + print(token); + print(token.accessToken); + setAccessToken(token.accessToken); + isConnected = true; // TODO update context + db + } + catch (e) { + print("error auth"); + } + + return isConnected; + + /*if (!isError) { + UserInfoDetailDTO user = await clientAPI.userApi.userGet("6182c472e20a6dbcfe8fe82c"); + print("user values ??"); + print(user.email); + print(user.id); + + List homes = await clientAPI.homeApi.homeGetAll(user.id); + print("number of homes " + homes.length.toString()); + homes.forEach((element) { + print(element); + }); + + HomeDTO home = homes[0]; // TODO + + List rooms = await clientAPI.roomApi.roomGetAll(home.id); + print("number of rooms " + rooms.length.toString()); + rooms.forEach((element) { + print(element); + }); + + List providers = await clientAPI.providerApi.providerGetAll(home.id); + print("number of providers " + providers.length.toString()); + providers.forEach((element) { + print(element); + }); + + List devices = await clientAPI.deviceApi.deviceGetAll(home.id); + print("number of devices " + devices.length.toString()); + /*devices.forEach((element) { + print(element); + });*/ + + List alarms = await clientAPI.alarmApi.alarmGetAll(home.id); + print("number of alarms " + alarms.length.toString()); + alarms.forEach((element) { + print(element); + }); + + /*List lastEvents = await clientAPI.eventApi.eventGet(home.id); + print("number of events " + lastEvents.length.toString()); + lastEvents.forEach((element) { + print(element); + });*/ + + List automations = await clientAPI.automationApi.automationGetAll(home.id); + print("number of automations " + automations.length.toString()); + automations.forEach((element) { + print(element); + }); + + List groups = await clientAPI.groupApi.groupGetAll(home.id); + print("number of groups " + groups.length.toString()); + groups.forEach((element) { + print(element); + }); + }*/ + } + + void setAccessToken(String accessToken) { + clientAPI.apiApi.authentications.forEach((key, auth) { + if (auth is OAuth) { + auth.accessToken = accessToken; + } + }); + } +} \ No newline at end of file diff --git a/lib/Screens/Login/login_screen.dart b/lib/Screens/Login/login_screen.dart new file mode 100644 index 0000000..4fbc104 --- /dev/null +++ b/lib/Screens/Login/login_screen.dart @@ -0,0 +1,11 @@ +import 'package:flutter/material.dart'; +import 'package:myhomie_app/Screens/Login/components/body.dart'; + +class LoginScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Body(), + ); + } +} \ No newline at end of file diff --git a/lib/app_context.dart b/lib/app_context.dart new file mode 100644 index 0000000..cdbb662 --- /dev/null +++ b/lib/app_context.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; +import 'package:myhomie_app/client.dart'; + +import 'Models/homieContext.dart'; + +class AppContext with ChangeNotifier { + HomieAppContext _homieContext; + Client clientAPI; + + AppContext(this._homieContext); + + getContext() => _homieContext; + setContext(HomieAppContext appContext) async { + _homieContext = appContext; + + notifyListeners(); + } +} diff --git a/lib/client.dart b/lib/client.dart index 409183c..f00d779 100644 --- a/lib/client.dart +++ b/lib/client.dart @@ -14,6 +14,15 @@ class Client { UserApi _userApi; UserApi get userApi => _userApi; + HomeApi _homeApi; + HomeApi get homeApi => _homeApi; + + AlarmApi _alarmApi; + AlarmApi get alarmApi => _alarmApi; + + EventApi _eventApi; + EventApi get eventApi => _eventApi; + GroupApi _groupApi; GroupApi get groupApi => _groupApi; @@ -29,13 +38,16 @@ class Client { RoomApi _roomApi; RoomApi get roomApi => _roomApi; - Client() { + Client(String path) { _apiClient = ApiClient( - basePath: "http://192.168.31.140"); + basePath: path); //basePath: "http://localhost:25049"); _tokenApi = TokenApi(_apiClient); _authenticationApi = AuthenticationApi(_apiClient); _userApi = UserApi(_apiClient); + _homeApi = HomeApi(_apiClient); + _alarmApi = AlarmApi(_apiClient); + _eventApi = EventApi(_apiClient); _groupApi = GroupApi(_apiClient); _deviceApi = DeviceApi(_apiClient); _automationApi = AutomationApi(_apiClient); diff --git a/lib/main.dart b/lib/main.dart index eb3dec2..3e35a5c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,19 +1,36 @@ import 'package:flutter/material.dart'; -import 'package:mqtt_client/mqtt_client.dart'; -import 'package:mqtt_client/mqtt_server_client.dart'; -import 'package:mycoreapi/api.dart'; import 'package:myhomie_app/client.dart'; +import 'package:provider/provider.dart'; +import 'Helpers/DatabaseHelper.dart'; +import 'Models/homieContext.dart'; +import 'Screens/Home/HomePage.dart'; +import 'Screens/Login/login_screen.dart'; +import 'app_context.dart'; import 'constants.dart'; -void main() { +void main() async { + WidgetsFlutterBinding.ensureInitialized(); String initialRoute; + HomieAppContext localContext = new HomieAppContext(); + bool isLogged = false; - initialRoute = '/home'; + localContext = await DatabaseHelper.instance.getData(); + + if(localContext != null) { + print("we've got an local db !"); + localContext.clientAPI = new Client(localContext.host); // TODO "http://192.168.31.140" + isLogged = localContext.token != null; // TODO refresh token.. + print(localContext); + } else { + print("NO LOCAL DB !"); + } + + initialRoute = isLogged ? '/home' : '/login'; final MyApp myApp = MyApp( initialRoute: initialRoute, - //context: localContext, + homieAppContext: localContext, ); runApp(myApp); @@ -21,225 +38,39 @@ void main() { class MyApp extends StatefulWidget { final String initialRoute; - //final Context context; - MyApp({this.initialRoute}); + final HomieAppContext homieAppContext; + MyApp({this.initialRoute, this.homieAppContext}); - // This widget is the root of your application. @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { - - @override - Widget build(BuildContext context) { - return MaterialApp( - debugShowCheckedModeBanner: false, - title: 'MyHomie App Demo', - initialRoute: widget.initialRoute, - /*supportedLocales: [ - const Locale('en', 'US'), - //const Locale('fr', 'FR'), - ],*/ - theme: ThemeData( - primarySwatch: Colors.blue, - scaffoldBackgroundColor: kBackgroundColor, - //fontFamily: "Vollkorn", - textTheme: TextTheme(bodyText1: TextStyle(color: kBodyTextColor)), - visualDensity: VisualDensity.adaptivePlatformDensity, - ), - routes: { - '/home': (context) => MyHomePage(title: 'MyHomie App Demo Home Page') - } - ); - } -} - -class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); - final String title; - - @override - _MyHomePageState createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - int _counter = 0; - //final MqttServerClient client = MqttServerClient.withPort('192.168.31.140', 'flutter_client', 1883); // TODO Add switch button or check online connexion if local broker available - //final MqttServerClient client = MqttServerClient.withPort('myhomie.be', 'flutter_client00', 1883); // TODO ONLINE - final clientAPI = Client(); - - void _incrementCounter() { - setState(() { - _counter++; - - /*print("client.connectionStatus !!! ==" + client.connectionStatus.toString()); - if (client.connectionStatus.state == MqttConnectionState.connected) { - const pubTopic = 'topic/test'; - final builder = MqttClientPayloadBuilder(); - builder.addString('Hello MQTT'); - client.publishMessage(pubTopic, MqttQos.atLeastOnce, builder.payload); - }*/ - }); - } - - void authenticateTRY() async { - print("try auth.. "); - var isError = true; - try { - LoginDTO loginDTO = new LoginDTO(email: "test@email.be", password: "kljqsdkljqsd"); - TokenDTO token = await clientAPI.authenticationApi.authenticationAuthenticateWithJson(loginDTO); - print("Token ??"); - print(token.accessToken); - setAccessToken(token.accessToken); - isError = false; - } - catch (e) { - print("error auth"); - } - - if (!isError) { - UserInfoDetailDTO user = await clientAPI.userApi.userGet("604a33639b4a377a413045b9"); - print("user values ??"); - print(user.email); - print(user.id); - - List rooms = await clientAPI.roomApi.roomGetAll(user.id); - print("number of rooms " + rooms.length.toString()); - rooms.forEach((element) { - print(element); - }); - - List providers = await clientAPI.providerApi.providerGetAll(user.id); - print("number of providers " + providers.length.toString()); - providers.forEach((element) { - print(element); - }); - - List devices = await clientAPI.deviceApi.deviceGetAll(user.id); - print("number of devices " + devices.length.toString()); - /*devices.forEach((element) { - print(element); - });*/ - - List automations = await clientAPI.automationApi.automationGetAll(user.id); - print("number of automations " + automations.length.toString()); - automations.forEach((element) { - print(element); - }); - - List groups = await clientAPI.groupApi.groupGetAll(user.id); - print("number of groups " + groups.length.toString()); - groups.forEach((element) { - print(element); - }); - } - } - - // connection succeeded - void onConnected() { - print('Connected !!!!!!!!!!!! ----------------------------------'); - - /*client.updates.listen((List> c) { - final MqttPublishMessage message = c[0].payload; - final payload = MqttPublishPayload.bytesToStringAsString(message.payload.message); - print('Received message:$payload from topic: ${c[0].topic}>'); - });*/ - } - - void setAccessToken(String accessToken) { - clientAPI.apiApi.authentications.forEach((key, auth) { - if (auth is OAuth) { - auth.accessToken = accessToken; - } - }); - } - -// unconnected - void onDisconnected() { - print('Disconnected'); - } - -// subscribe to topic succeeded - void onSubscribed(String topic) { - print('Subscribed topic: $topic'); - } - -// subscribe to topic failed - void onSubscribeFail(String topic) { - print('Failed to subscribe $topic'); - } - -// unsubscribe succeeded - void onUnsubscribed(String topic) { - print('Unsubscribed topic: $topic'); - } - - Future connect() async { - /*client.logging(on: false); - client.keepAlivePeriod = 20; - client.onDisconnected = onDisconnected; - client.onConnected = onConnected; - client.onSubscribed = onSubscribed;*/ - - /// Security context - /*SecurityContext context = new SecurityContext() - ..useCertificateChain('path/to/my_cert.pem') - ..usePrivateKey('path/to/my_key.pem', password: 'key_password') - ..setClientAuthorities('path/to/client.crt', password: 'password');*/ - //client.setProtocolV31(); - //client.secure = true; - //client.securityContext = context; - - final connMessage = MqttConnectMessage() - .authenticateAs('thomas', 'MyCore,1') // TODO ONLINE - /*.keepAliveFor(60) - .withWillTopic('willtopic') - .withWillMessage('Will message')*/ - .withClientIdentifier("TESSST") - .startClean(); - //.withWillQos(MqttQos.atLeastOnce); - //client.secure = true; - /*client.connectionMessage = connMessage; - client.autoReconnect = true; - try { - await client.connect(); - } catch (e) { - print('Exception: $e'); - client.disconnect(); - } - - client.subscribe("#", MqttQos.atLeastOnce); -*/ - //return client; - return null; - } + //HomieAppContext homieAppContext; @override Widget build(BuildContext context) { - connect(); - return Scaffold( - appBar: AppBar( - title: Text(widget.title), - ), - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - 'You have pushed the button this many times:', - ), - Text( - '$_counter', - style: Theme.of(context).textTheme.headline4, - ), - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: authenticateTRY, - tooltip: 'Increment', - child: Icon(Icons.add), + return ChangeNotifierProvider( + create: (_) => AppContext(widget.homieAppContext), + child: MaterialApp( + debugShowCheckedModeBanner: false, + title: 'MyHomie App Demo', + initialRoute: widget.initialRoute, + /*supportedLocales: [ + const Locale('en', 'US'), + //const Locale('fr', 'FR'), + ],*/ + theme: ThemeData( + primarySwatch: Colors.blue, + scaffoldBackgroundColor: kBackgroundColor, + //fontFamily: "Vollkorn", + textTheme: TextTheme(bodyText1: TextStyle(color: kBodyTextColor)), + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + routes: { + '/home': (context) => HomePage(), + '/login': (context) => LoginScreen() + } ), ); } diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cf98146..8370e57 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -2,11 +2,11 @@ // Generated file. Do not edit. // -// clang-format off - import FlutterMacOS import Foundation +import sqflite func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) } diff --git a/mycore_api/lib/api.dart b/mycore_api/lib/api.dart index c8fdc6a..eff5be1 100644 --- a/mycore_api/lib/api.dart +++ b/mycore_api/lib/api.dart @@ -109,6 +109,7 @@ part 'model/room_create_or_update_detail_dto.dart'; part 'model/room_detail_dto.dart'; part 'model/room_summary_dto.dart'; part 'model/screen_device.dart'; +part 'model/screen_widget.dart'; part 'model/smart_garden_message.dart'; part 'model/smart_printer_message.dart'; part 'model/time_period_alarm.dart'; diff --git a/mycore_api/lib/api/event_api.dart b/mycore_api/lib/api/event_api.dart index 7be6547..bca06f6 100644 --- a/mycore_api/lib/api/event_api.dart +++ b/mycore_api/lib/api/event_api.dart @@ -181,7 +181,7 @@ class EventApi { /// * [OneOfEventType] eventType: /// /// * [OneOfDeviceType] deviceType: - Future eventGetWithHttpInfo(String homeId, { String deviceId, String roomId, int startIndex, int count, DateTime dateStart, DateTime dateEnd, OneOfEventType eventType, OneOfDeviceType deviceType }) async { + Future eventGetWithHttpInfo(String homeId, { String deviceId, String roomId, int startIndex, int count, DateTime dateStart, DateTime dateEnd, EventType eventType, DeviceType deviceType }) async { // Verify required params are set. if (homeId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId'); @@ -271,7 +271,7 @@ class EventApi { /// * [OneOfEventType] eventType: /// /// * [OneOfDeviceType] deviceType: - Future> eventGet(String homeId, { String deviceId, String roomId, int startIndex, int count, DateTime dateStart, DateTime dateEnd, OneOfEventType eventType, OneOfDeviceType deviceType }) async { + Future> eventGet(String homeId, { String deviceId, String roomId, int startIndex, int count, DateTime dateStart, DateTime dateEnd, EventType eventType, DeviceType deviceType }) async { final response = await eventGetWithHttpInfo(homeId, deviceId: deviceId, roomId: roomId, startIndex: startIndex, count: count, dateStart: dateStart, dateEnd: dateEnd, eventType: eventType, deviceType: deviceType ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); diff --git a/mycore_api/lib/model/alarm_mode.dart b/mycore_api/lib/model/alarm_mode.dart index d4d7b05..381cade 100644 --- a/mycore_api/lib/model/alarm_mode.dart +++ b/mycore_api/lib/model/alarm_mode.dart @@ -46,9 +46,9 @@ class AlarmMode { AlarmType type; - OneOfProgrammedMode programmedMode; + ProgrammedMode programmedMode; - OneOfGeolocalizedMode geolocalizedMode; + GeolocalizedMode geolocalizedMode; List triggers; @@ -158,8 +158,8 @@ class AlarmMode { ? null : DateTime.parse(json[r'updatedDate']), type: AlarmType.fromJson(json[r'type']), - programmedMode: OneOfProgrammedMode.fromJson(json[r'programmedMode']), - geolocalizedMode: OneOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), + programmedMode: ProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: GeolocalizedMode.fromJson(json[r'geolocalizedMode']), triggers: Trigger.listFromJson(json[r'triggers']), actions: Action.listFromJson(json[r'actions']), devicesIds: json[r'devicesIds'] == null diff --git a/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto.dart b/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto.dart index 9a4c5cc..1fea333 100644 --- a/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto.dart +++ b/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto.dart @@ -49,9 +49,9 @@ class AlarmModeCreateOrUpdateDetailDTO { List actions; - OneOfProgrammedMode programmedMode; + ProgrammedMode programmedMode; - OneOfGeolocalizedMode geolocalizedMode; + GeolocalizedMode geolocalizedMode; @override bool operator ==(Object other) => identical(this, other) || other is AlarmModeCreateOrUpdateDetailDTO && @@ -152,8 +152,8 @@ class AlarmModeCreateOrUpdateDetailDTO { : DateTime.parse(json[r'updatedDate']), triggers: Trigger.listFromJson(json[r'triggers']), actions: Action.listFromJson(json[r'actions']), - programmedMode: OneOfProgrammedMode.fromJson(json[r'programmedMode']), - geolocalizedMode: OneOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), + programmedMode: ProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: GeolocalizedMode.fromJson(json[r'geolocalizedMode']), ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart b/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart index 8360120..e04b206 100644 --- a/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart +++ b/mycore_api/lib/model/alarm_mode_create_or_update_detail_dto_all_of.dart @@ -22,9 +22,9 @@ class AlarmModeCreateOrUpdateDetailDTOAllOf { List actions; - OneOfProgrammedMode programmedMode; + ProgrammedMode programmedMode; - OneOfGeolocalizedMode geolocalizedMode; + GeolocalizedMode geolocalizedMode; @override bool operator ==(Object other) => identical(this, other) || other is AlarmModeCreateOrUpdateDetailDTOAllOf && @@ -67,8 +67,8 @@ class AlarmModeCreateOrUpdateDetailDTOAllOf { : AlarmModeCreateOrUpdateDetailDTOAllOf( triggers: Trigger.listFromJson(json[r'triggers']), actions: Action.listFromJson(json[r'actions']), - programmedMode: OneOfProgrammedMode.fromJson(json[r'programmedMode']), - geolocalizedMode: OneOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), + programmedMode: ProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: GeolocalizedMode.fromJson(json[r'geolocalizedMode']), ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/mycore_api/lib/model/alarm_mode_detail_dto.dart b/mycore_api/lib/model/alarm_mode_detail_dto.dart index 8dafa38..4f15d1b 100644 --- a/mycore_api/lib/model/alarm_mode_detail_dto.dart +++ b/mycore_api/lib/model/alarm_mode_detail_dto.dart @@ -49,9 +49,9 @@ class AlarmModeDetailDTO { List devices; - OneOfProgrammedMode programmedMode; + ProgrammedMode programmedMode; - OneOfGeolocalizedMode geolocalizedMode; + GeolocalizedMode geolocalizedMode; @override bool operator ==(Object other) => identical(this, other) || other is AlarmModeDetailDTO && @@ -152,8 +152,8 @@ class AlarmModeDetailDTO { : DateTime.parse(json[r'updatedDate']), triggers: Trigger.listFromJson(json[r'triggers']), devices: DeviceDetailDTO.listFromJson(json[r'devices']), - programmedMode: OneOfProgrammedMode.fromJson(json[r'programmedMode']), - geolocalizedMode: OneOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), + programmedMode: ProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: GeolocalizedMode.fromJson(json[r'geolocalizedMode']), ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/mycore_api/lib/model/alarm_mode_detail_dto_all_of.dart b/mycore_api/lib/model/alarm_mode_detail_dto_all_of.dart index a8b1949..860a99e 100644 --- a/mycore_api/lib/model/alarm_mode_detail_dto_all_of.dart +++ b/mycore_api/lib/model/alarm_mode_detail_dto_all_of.dart @@ -22,9 +22,9 @@ class AlarmModeDetailDTOAllOf { List devices; - OneOfProgrammedMode programmedMode; + ProgrammedMode programmedMode; - OneOfGeolocalizedMode geolocalizedMode; + GeolocalizedMode geolocalizedMode; @override bool operator ==(Object other) => identical(this, other) || other is AlarmModeDetailDTOAllOf && @@ -67,8 +67,8 @@ class AlarmModeDetailDTOAllOf { : AlarmModeDetailDTOAllOf( triggers: Trigger.listFromJson(json[r'triggers']), devices: DeviceDetailDTO.listFromJson(json[r'devices']), - programmedMode: OneOfProgrammedMode.fromJson(json[r'programmedMode']), - geolocalizedMode: OneOfGeolocalizedMode.fromJson(json[r'geolocalizedMode']), + programmedMode: ProgrammedMode.fromJson(json[r'programmedMode']), + geolocalizedMode: GeolocalizedMode.fromJson(json[r'geolocalizedMode']), ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/mycore_api/lib/model/condition.dart b/mycore_api/lib/model/condition.dart index 6c78806..390b350 100644 --- a/mycore_api/lib/model/condition.dart +++ b/mycore_api/lib/model/condition.dart @@ -22,7 +22,7 @@ class Condition { String deviceId; - OneOfAutomationState state; + AutomationState state; String startTime; @@ -82,7 +82,7 @@ class Condition { ? null : Condition( deviceId: json[r'deviceId'], - state: OneOfAutomationState.fromJson(json[r'state']), + state: AutomationState.fromJson(json[r'state']), startTime: json[r'startTime'], endTime: json[r'endTime'], type: ConditionType.fromJson(json[r'type']), diff --git a/mycore_api/lib/model/create_or_update_home_dto.dart b/mycore_api/lib/model/create_or_update_home_dto.dart index 91c5c8d..8bc499e 100644 --- a/mycore_api/lib/model/create_or_update_home_dto.dart +++ b/mycore_api/lib/model/create_or_update_home_dto.dart @@ -30,7 +30,7 @@ class CreateOrUpdateHomeDTO { bool isDefault; - OneOfAlarmModeDTO currentAlarmMode; + AlarmModeDTO currentAlarmMode; DateTime createdDate; @@ -101,7 +101,7 @@ class CreateOrUpdateHomeDTO { name: json[r'name'], isAlarm: json[r'isAlarm'], isDefault: json[r'isDefault'], - currentAlarmMode: OneOfAlarmModeDTO.fromJson(json[r'currentAlarmMode']), + currentAlarmMode: AlarmModeDTO.fromJson(json[r'currentAlarmMode']), createdDate: json[r'createdDate'] == null ? null : DateTime.parse(json[r'createdDate']), diff --git a/mycore_api/lib/model/event_detail_dto.dart b/mycore_api/lib/model/event_detail_dto.dart index 8aebcd6..23d7689 100644 --- a/mycore_api/lib/model/event_detail_dto.dart +++ b/mycore_api/lib/model/event_detail_dto.dart @@ -32,11 +32,11 @@ class EventDetailDTO { String roomId; - OneOfDeviceState deviceState; + DeviceState deviceState; - OneOfAutomationTriggered automationTriggered; + AutomationTriggered automationTriggered; - OneOfAlarmTriggered alarmTriggered; + AlarmTriggered alarmTriggered; @override bool operator ==(Object other) => identical(this, other) || other is EventDetailDTO && @@ -104,9 +104,9 @@ class EventDetailDTO { : DateTime.parse(json[r'date']), type: EventType.fromJson(json[r'type']), roomId: json[r'roomId'], - deviceState: OneOfDeviceState.fromJson(json[r'deviceState']), - automationTriggered: OneOfAutomationTriggered.fromJson(json[r'automationTriggered']), - alarmTriggered: OneOfAlarmTriggered.fromJson(json[r'alarmTriggered']), + deviceState: DeviceState.fromJson(json[r'deviceState']), + automationTriggered: AutomationTriggered.fromJson(json[r'automationTriggered']), + alarmTriggered: AlarmTriggered.fromJson(json[r'alarmTriggered']), ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/mycore_api/lib/model/event_detail_dto_all_of.dart b/mycore_api/lib/model/event_detail_dto_all_of.dart index 46464c5..ce7227d 100644 --- a/mycore_api/lib/model/event_detail_dto_all_of.dart +++ b/mycore_api/lib/model/event_detail_dto_all_of.dart @@ -17,11 +17,11 @@ class EventDetailDTOAllOf { this.alarmTriggered, }); - OneOfDeviceState deviceState; + DeviceState deviceState; - OneOfAutomationTriggered automationTriggered; + AutomationTriggered automationTriggered; - OneOfAlarmTriggered alarmTriggered; + AlarmTriggered alarmTriggered; @override bool operator ==(Object other) => identical(this, other) || other is EventDetailDTOAllOf && @@ -57,9 +57,9 @@ class EventDetailDTOAllOf { static EventDetailDTOAllOf fromJson(Map json) => json == null ? null : EventDetailDTOAllOf( - deviceState: OneOfDeviceState.fromJson(json[r'deviceState']), - automationTriggered: OneOfAutomationTriggered.fromJson(json[r'automationTriggered']), - alarmTriggered: OneOfAlarmTriggered.fromJson(json[r'alarmTriggered']), + deviceState: DeviceState.fromJson(json[r'deviceState']), + automationTriggered: AutomationTriggered.fromJson(json[r'automationTriggered']), + alarmTriggered: AlarmTriggered.fromJson(json[r'alarmTriggered']), ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/mycore_api/lib/model/geolocalized_mode.dart b/mycore_api/lib/model/geolocalized_mode.dart index 73c14ea..e67fc94 100644 --- a/mycore_api/lib/model/geolocalized_mode.dart +++ b/mycore_api/lib/model/geolocalized_mode.dart @@ -22,9 +22,9 @@ class GeolocalizedMode { String longitude; - OneOfAlarmMode homeMode; + AlarmMode homeMode; - OneOfAlarmMode absentMode; + AlarmMode absentMode; @override bool operator ==(Object other) => identical(this, other) || other is GeolocalizedMode && @@ -67,8 +67,8 @@ class GeolocalizedMode { : GeolocalizedMode( latitude: json[r'latitude'], longitude: json[r'longitude'], - homeMode: OneOfAlarmMode.fromJson(json[r'homeMode']), - absentMode: OneOfAlarmMode.fromJson(json[r'absentMode']), + homeMode: AlarmMode.fromJson(json[r'homeMode']), + absentMode: AlarmMode.fromJson(json[r'absentMode']), ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/mycore_api/lib/model/home_detail_dto.dart b/mycore_api/lib/model/home_detail_dto.dart index 80810de..0c99b6c 100644 --- a/mycore_api/lib/model/home_detail_dto.dart +++ b/mycore_api/lib/model/home_detail_dto.dart @@ -35,7 +35,7 @@ class HomeDetailDTO { bool isDefault; - OneOfAlarmModeDTO currentAlarmMode; + AlarmModeDTO currentAlarmMode; DateTime createdDate; @@ -141,7 +141,7 @@ class HomeDetailDTO { name: json[r'name'], isAlarm: json[r'isAlarm'], isDefault: json[r'isDefault'], - currentAlarmMode: OneOfAlarmModeDTO.fromJson(json[r'currentAlarmMode']), + currentAlarmMode: AlarmModeDTO.fromJson(json[r'currentAlarmMode']), createdDate: json[r'createdDate'] == null ? null : DateTime.parse(json[r'createdDate']), diff --git a/mycore_api/lib/model/home_dto.dart b/mycore_api/lib/model/home_dto.dart index d040356..3c25def 100644 --- a/mycore_api/lib/model/home_dto.dart +++ b/mycore_api/lib/model/home_dto.dart @@ -30,7 +30,7 @@ class HomeDTO { bool isDefault; - OneOfAlarmModeDTO currentAlarmMode; + AlarmModeDTO currentAlarmMode; DateTime createdDate; @@ -101,7 +101,7 @@ class HomeDTO { name: json[r'name'], isAlarm: json[r'isAlarm'], isDefault: json[r'isDefault'], - currentAlarmMode: OneOfAlarmModeDTO.fromJson(json[r'currentAlarmMode']), + currentAlarmMode: AlarmModeDTO.fromJson(json[r'currentAlarmMode']), createdDate: json[r'createdDate'] == null ? null : DateTime.parse(json[r'createdDate']), diff --git a/mycore_api/lib/model/odd_nice.dart b/mycore_api/lib/model/odd_nice.dart index 8d48e9f..71390a4 100644 --- a/mycore_api/lib/model/odd_nice.dart +++ b/mycore_api/lib/model/odd_nice.dart @@ -24,7 +24,7 @@ class OddNice { String homeTeam; - OneOfOddObject odds; + OddObject odds; @override bool operator ==(Object other) => identical(this, other) || other is OddNice && @@ -70,7 +70,7 @@ class OddNice { : (json[r'teams'] as List).cast(), commenceTime: json[r'commence_time'], homeTeam: json[r'home_team'], - odds: OneOfOddObject.fromJson(json[r'odds']), + odds: OddObject.fromJson(json[r'odds']), ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/mycore_api/lib/model/time_period_alarm.dart b/mycore_api/lib/model/time_period_alarm.dart index a4e67c2..d0f3505 100644 --- a/mycore_api/lib/model/time_period_alarm.dart +++ b/mycore_api/lib/model/time_period_alarm.dart @@ -21,7 +21,7 @@ class TimePeriodAlarm { String end; - OneOfAlarmMode alarmMode; + AlarmMode alarmMode; @override bool operator ==(Object other) => identical(this, other) || other is TimePeriodAlarm && @@ -59,7 +59,7 @@ class TimePeriodAlarm { : TimePeriodAlarm( start: json[r'start'], end: json[r'end'], - alarmMode: OneOfAlarmMode.fromJson(json[r'alarmMode']), + alarmMode: AlarmMode.fromJson(json[r'alarmMode']), ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/pubspec.lock b/pubspec.lock index 7ccda81..26f545a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -21,14 +21,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" clock: dependency: transitive description: @@ -64,6 +64,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" + enum_to_string: + dependency: "direct main" + description: + name: enum_to_string + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" event_bus: dependency: transitive description: @@ -88,6 +95,18 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + fluttertoast: + dependency: "direct main" + description: + name: fluttertoast + url: "https://pub.dartlang.org" + source: hosted + version: "8.0.8" http: dependency: transitive description: @@ -109,20 +128,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.16.1" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.3" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" mqtt_client: dependency: "direct main" description: @@ -137,6 +163,13 @@ packages: relative: true source: path version: "1.0.0" + nested: + dependency: transitive + description: + name: nested + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" path: dependency: transitive description: @@ -151,6 +184,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.11.0" + provider: + dependency: "direct main" + description: + name: provider + url: "https://pub.dartlang.org" + source: hosted + version: "5.0.0" rxdart: dependency: "direct main" description: @@ -170,6 +210,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.1" + sqflite: + dependency: "direct main" + description: + name: sqflite + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0+4" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1+1" stack_trace: dependency: transitive description: @@ -191,6 +245,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + synchronized: + dependency: transitive + description: + name: synchronized + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.0" term_glyph: dependency: transitive description: @@ -204,7 +265,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19" + version: "0.4.3" typed_data: dependency: transitive description: @@ -220,4 +281,5 @@ packages: source: hosted version: "2.1.0" sdks: - dart: ">=2.12.0-0.0 <3.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.16.0" diff --git a/pubspec.yaml b/pubspec.yaml index f12f867..d5d1264 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -24,6 +24,10 @@ dependencies: flutter: sdk: flutter + fluttertoast: + sqflite: + provider: ^5.0.0 + enum_to_string: ^2.0.1 mqtt_client: ^8.1.0 rxdart: 0.22.0 mycoreapi: