From 2f10433f941f071deadeedb36b3770c2f89627f1 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Tue, 30 Mar 2021 19:12:35 +0200 Subject: [PATCH] MC Update all controller for better swagger doc (Location to Place, State to AutomationState and Widget to ScreenWidget) + change type auth response type ! + clean code --- MyCore.Framework/Business/ProfileLogic.cs | 4 +- .../DTO/MyControlPanel/DeviceDTO.cs | 4 +- .../{LocationDTO.cs => PlaceDTO.cs} | 5 +- MyCore.Interfaces/DTO/Odd.cs | 4 +- .../MyControlPanel/Database/Automation.cs | 6 +- .../Models/MyControlPanel/Database/Device.cs | 2 +- .../Database/{Location.cs => Place.cs} | 6 +- .../Models/Screen/ScreenConfiguration.cs | 2 +- .../Widgets/{Widget.cs => ScreenWidget.cs} | 2 +- .../Models/Screen/Widgets/WidgetAgenda.cs | 2 +- .../Screen/Widgets/WidgetHourAndDate.cs | 2 +- .../Models/Screen/Widgets/WidgetMessage.cs | 2 +- .../Models/Screen/Widgets/WidgetNews.cs | 2 +- .../Models/Screen/Widgets/WidgetRadio.cs | 2 +- .../Models/Screen/Widgets/WidgetTraffic.cs | 2 +- .../Models/Screen/Widgets/WidgetWeather.cs | 2 +- .../Controllers/AuthenticationController.cs | 39 +- MyCore/Controllers/AutomationController.cs | 96 +- .../Controllers/Devices/DeviceController.cs | 138 +- .../Devices/IoThomas/OddController.cs | 10 +- .../Controllers/Devices/ProviderController.cs | 319 +- .../Devices/ScreenDeviceController.cs | 90 +- MyCore/Controllers/GroupController.cs | 280 +- MyCore/Controllers/Helpers/MQTTController.cs | 8 +- .../MyControlPanel/LayoutController.cs | 2 +- .../MyControlPanel/TokenController.cs | 37 +- .../MyControlPanel/UserController.cs | 133 +- MyCore/Controllers/RoomController.cs | 173 +- MyCore/Extensions/MqttClientMerossService.cs | 60 +- MyCore/Services/Devices/ActionService.cs | 8 +- MyCore/Services/Devices/DeviceService.cs | 4 +- .../Database/LocationDatabaseService.cs | 16 +- .../Database/ScreenDeviceDatabaseService.cs | 5 + MyCore/Services/TokensService.cs | 4 +- .../.openapi-generator/FILES | 89 +- Test service generation - dart/README.md | 37 +- Test service generation - dart/doc/Action.md | 2 +- .../doc/AuthenticationApi.md | 6 +- .../doc/Automation.md | 1 + .../doc/AutomationApi.md | 22 +- .../doc/AutomationCreateOrUpdateDetailDTO.md | 1 + .../doc/AutomationDTO.md | 1 + .../doc/AutomationDetailDTO.md | 1 + .../doc/AutomationState.md | 16 + .../doc/AzureApi.md | 2 +- .../doc/BooksApi.md | 2 +- .../doc/Condition.md | 2 +- .../doc/DeviceApi.md | 24 +- .../doc/EnergyApi.md | 2 +- .../doc/FacebookApi.md | 2 +- .../doc/GoogleApi.md | 2 +- .../doc/GroupApi.md | 26 +- Test service generation - dart/doc/IOTApi.md | 2 +- .../doc/LayoutApi.md | 2 +- Test service generation - dart/doc/MQTTApi.md | 2 +- Test service generation - dart/doc/OddApi.md | 2 +- Test service generation - dart/doc/OddNice.md | 2 +- .../doc/OddObject.md | 17 + .../doc/ProviderApi.md | 12 +- Test service generation - dart/doc/RoomApi.md | 24 +- .../doc/ScreenConfiguration.md | 2 +- .../doc/ScreenDeviceApi.md | 56 +- .../doc/ScreenWidget.md | 27 + .../doc/TokenApi.md | 10 +- .../doc/TokenDTO.md | 20 + .../doc/TwitterApi.md | 2 +- Test service generation - dart/doc/UserApi.md | 124 +- .../doc/ValuesApi.md | 2 +- Test service generation - dart/lib/api.dart | 7 +- .../lib/api/authentication_api.dart | 6 +- .../lib/api/automation_api.dart | 21 +- .../lib/api/device_api.dart | 22 +- .../lib/api/group_api.dart | 34 +- .../lib/api/provider_api.dart | 8 +- .../lib/api/room_api.dart | 22 +- .../lib/api/screen_device_api.dart | 71 +- .../lib/api/token_api.dart | 9 +- .../lib/api/user_api.dart | 151 +- .../lib/api_client.dart | 16 +- .../lib/model/action.dart | 4 +- .../lib/model/automation.dart | 11 +- ...utomation_create_or_update_detail_dto.dart | 11 +- .../lib/model/automation_detail_dto.dart | 11 +- .../lib/model/automation_dto.dart | 11 +- .../lib/model/automation_state.dart | 80 + .../lib/model/condition.dart | 4 +- .../lib/model/odd_nice.dart | 4 +- .../lib/model/odd_object.dart | 89 + .../lib/model/screen_configuration.dart | 4 +- .../lib/model/screen_widget.dart | 179 + .../lib/model/token_dto.dart | 118 + Test service generation - dart/swagger.yaml | 1190 +++++-- .../test/automation_state_test.dart | 31 + .../test/odd_object_test.dart | 36 + .../test/screen_widget_test.dart | 86 + .../test/token_dto_test.dart | 51 + swagger.json | 1941 +++++++++-- swagger.yaml | 3021 ----------------- 98 files changed, 4756 insertions(+), 4508 deletions(-) rename MyCore.Interfaces/DTO/MyControlPanel/{LocationDTO.cs => PlaceDTO.cs} (73%) rename MyCore.Interfaces/Models/MyControlPanel/Database/{Location.cs => Place.cs} (84%) rename MyCore.Interfaces/Models/Screen/Widgets/{Widget.cs => ScreenWidget.cs} (97%) create mode 100644 Test service generation - dart/doc/AutomationState.md create mode 100644 Test service generation - dart/doc/OddObject.md create mode 100644 Test service generation - dart/doc/ScreenWidget.md create mode 100644 Test service generation - dart/doc/TokenDTO.md create mode 100644 Test service generation - dart/lib/model/automation_state.dart create mode 100644 Test service generation - dart/lib/model/odd_object.dart create mode 100644 Test service generation - dart/lib/model/screen_widget.dart create mode 100644 Test service generation - dart/lib/model/token_dto.dart create mode 100644 Test service generation - dart/test/automation_state_test.dart create mode 100644 Test service generation - dart/test/odd_object_test.dart create mode 100644 Test service generation - dart/test/screen_widget_test.dart create mode 100644 Test service generation - dart/test/token_dto_test.dart delete mode 100644 swagger.yaml diff --git a/MyCore.Framework/Business/ProfileLogic.cs b/MyCore.Framework/Business/ProfileLogic.cs index c6abd14..8cd59b1 100644 --- a/MyCore.Framework/Business/ProfileLogic.cs +++ b/MyCore.Framework/Business/ProfileLogic.cs @@ -23,12 +23,12 @@ namespace MyCore.Framework.Business if (string.IsNullOrWhiteSpace(email)) { _logger.LogError($"Authenticate error: No e-mail provided"); - throw new RequestException(StatusCodes.Status401Unauthorized, "Authentication error"); + throw new UnauthorizedAccessException("Authentication error"); } if (string.IsNullOrEmpty(password)) { _logger.LogError($"Authenticate error: No password provided"); - throw new RequestException(StatusCodes.Status401Unauthorized, "Authentication error"); + throw new UnauthorizedAccessException("Authentication error"); } return true; diff --git a/MyCore.Interfaces/DTO/MyControlPanel/DeviceDTO.cs b/MyCore.Interfaces/DTO/MyControlPanel/DeviceDTO.cs index dbdf787..edc02f0 100644 --- a/MyCore.Interfaces/DTO/MyControlPanel/DeviceDTO.cs +++ b/MyCore.Interfaces/DTO/MyControlPanel/DeviceDTO.cs @@ -29,7 +29,7 @@ namespace MyCore.Interfaces.DTO public string ProviderName { get; set; } - public LocationDTO Location { get; set; } + public PlaceDTO Location { get; set; } public DateTime LastStateDate { get; set; } @@ -62,7 +62,7 @@ namespace MyCore.Interfaces.DTO public List GroupIds { get; set; } - public Dictionary Properties { get; set; } + public string Properties { get; set; } // Dictionary public List SupportedOperations { get; set; } } diff --git a/MyCore.Interfaces/DTO/MyControlPanel/LocationDTO.cs b/MyCore.Interfaces/DTO/MyControlPanel/PlaceDTO.cs similarity index 73% rename from MyCore.Interfaces/DTO/MyControlPanel/LocationDTO.cs rename to MyCore.Interfaces/DTO/MyControlPanel/PlaceDTO.cs index 331de58..79e3060 100644 --- a/MyCore.Interfaces/DTO/MyControlPanel/LocationDTO.cs +++ b/MyCore.Interfaces/DTO/MyControlPanel/PlaceDTO.cs @@ -5,7 +5,10 @@ using System.Threading.Tasks; namespace MyCore.Interfaces.DTO { - public class LocationDTO + /// + /// Place DTO + /// + public class PlaceDTO { public string Id { get; set; } public string Name { get; set; } diff --git a/MyCore.Interfaces/DTO/Odd.cs b/MyCore.Interfaces/DTO/Odd.cs index 62df32a..aee886d 100644 --- a/MyCore.Interfaces/DTO/Odd.cs +++ b/MyCore.Interfaces/DTO/Odd.cs @@ -28,7 +28,7 @@ namespace MyCore.Interfaces public IEnumerable H2h { get; set; } } - public class OddH2H + public class OddObject { public double HomeOdd { get; set; } public double DrawOdd { get; set; } @@ -40,6 +40,6 @@ namespace MyCore.Interfaces public List Teams { get; set; } public int Commence_time { get; set; } public string Home_team { get; set; } - public OddH2H Odds { get; set; } + public OddObject Odds { get; set; } } } diff --git a/MyCore.Interfaces/Models/MyControlPanel/Database/Automation.cs b/MyCore.Interfaces/Models/MyControlPanel/Database/Automation.cs index b7eda59..39d6c66 100644 --- a/MyCore.Interfaces/Models/MyControlPanel/Database/Automation.cs +++ b/MyCore.Interfaces/Models/MyControlPanel/Database/Automation.cs @@ -96,7 +96,7 @@ namespace MyCore.Interfaces.Models public class Condition { public string DeviceId { get; set; } - public State State { get; set; } + public AutomationState State { get; set; } public string StartTime { get; set; } // TIMESPAN JSON SERIALIZED public string EndTime { get; set; } // TIMESPAN JSON SERIALIZED public ConditionType Type { get; set; } @@ -123,7 +123,7 @@ namespace MyCore.Interfaces.Models { public string GroupId { get; set; } public string DeviceId { get; set; } - public List States { get; set; } + public List States { get; set; } public string RawRequest { get; set; } // http, mqtt public string ProviderId { get; set; } public ActionType Type { get; set; } @@ -134,7 +134,7 @@ namespace MyCore.Interfaces.Models public string message { get; set; } } - public class State + public class AutomationState { public string Name { get; set; } // example : state public string Value { get; set; } // example : ON diff --git a/MyCore.Interfaces/Models/MyControlPanel/Database/Device.cs b/MyCore.Interfaces/Models/MyControlPanel/Database/Device.cs index cd1b65b..8df7a00 100644 --- a/MyCore.Interfaces/Models/MyControlPanel/Database/Device.cs +++ b/MyCore.Interfaces/Models/MyControlPanel/Database/Device.cs @@ -94,7 +94,7 @@ namespace MyCore.Interfaces.Models public List GroupIds { get; set; } [BsonElement("Properties")] - public Dictionary Properties { get; set; } + public string Properties { get; set; } // Dictionary [BsonElement("SupportedOperations")] public List SupportedOperations { get; set; } diff --git a/MyCore.Interfaces/Models/MyControlPanel/Database/Location.cs b/MyCore.Interfaces/Models/MyControlPanel/Database/Place.cs similarity index 84% rename from MyCore.Interfaces/Models/MyControlPanel/Database/Location.cs rename to MyCore.Interfaces/Models/MyControlPanel/Database/Place.cs index 3041e62..ca5b8f8 100644 --- a/MyCore.Interfaces/Models/MyControlPanel/Database/Location.cs +++ b/MyCore.Interfaces/Models/MyControlPanel/Database/Place.cs @@ -7,7 +7,7 @@ namespace MyCore.Interfaces.Models /// /// Location of a device (Room name, garden, ..) /// - public class Location + public class Place { [BsonId] [BsonRepresentation(BsonType.ObjectId)] @@ -17,9 +17,9 @@ namespace MyCore.Interfaces.Models [BsonRequired] public string Name { get; set; } - public LocationDTO ToDTO() + public PlaceDTO ToDTO() { - return new LocationDTO() + return new PlaceDTO() { Id = Id, Name = Name diff --git a/MyCore.Interfaces/Models/Screen/ScreenConfiguration.cs b/MyCore.Interfaces/Models/Screen/ScreenConfiguration.cs index 407a369..785d38d 100644 --- a/MyCore.Interfaces/Models/Screen/ScreenConfiguration.cs +++ b/MyCore.Interfaces/Models/Screen/ScreenConfiguration.cs @@ -20,7 +20,7 @@ namespace MyCore.Interfaces.Models public string Type { get; set; } [BsonElement("Widgets")] - public Widget[] Widgets { get; set; } + public ScreenWidget[] Widgets { get; set; } [BsonElement("Height")] public int Height { get; set; } diff --git a/MyCore.Interfaces/Models/Screen/Widgets/Widget.cs b/MyCore.Interfaces/Models/Screen/Widgets/ScreenWidget.cs similarity index 97% rename from MyCore.Interfaces/Models/Screen/Widgets/Widget.cs rename to MyCore.Interfaces/Models/Screen/Widgets/ScreenWidget.cs index e40055d..e7d8976 100644 --- a/MyCore.Interfaces/Models/Screen/Widgets/Widget.cs +++ b/MyCore.Interfaces/Models/Screen/Widgets/ScreenWidget.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace MyCore.Interfaces.Models { - public class Widget + public class ScreenWidget { [BsonId] [BsonRepresentation(BsonType.ObjectId)] diff --git a/MyCore.Interfaces/Models/Screen/Widgets/WidgetAgenda.cs b/MyCore.Interfaces/Models/Screen/Widgets/WidgetAgenda.cs index 52f706f..3a0ec44 100644 --- a/MyCore.Interfaces/Models/Screen/Widgets/WidgetAgenda.cs +++ b/MyCore.Interfaces/Models/Screen/Widgets/WidgetAgenda.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace MyCore.Interfaces.Models { - public class WidgetAgenda : Widget + public class WidgetAgenda : ScreenWidget { [BsonElement("Provider")] public string Provider { get; set; } diff --git a/MyCore.Interfaces/Models/Screen/Widgets/WidgetHourAndDate.cs b/MyCore.Interfaces/Models/Screen/Widgets/WidgetHourAndDate.cs index b22c121..efdfb51 100644 --- a/MyCore.Interfaces/Models/Screen/Widgets/WidgetHourAndDate.cs +++ b/MyCore.Interfaces/Models/Screen/Widgets/WidgetHourAndDate.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace MyCore.Interfaces.Models { - public class WidgetHourAndDate : Widget + public class WidgetHourAndDate : ScreenWidget { [BsonElement("Timezone")] public string Timezone { get; set; } diff --git a/MyCore.Interfaces/Models/Screen/Widgets/WidgetMessage.cs b/MyCore.Interfaces/Models/Screen/Widgets/WidgetMessage.cs index 8721192..f309165 100644 --- a/MyCore.Interfaces/Models/Screen/Widgets/WidgetMessage.cs +++ b/MyCore.Interfaces/Models/Screen/Widgets/WidgetMessage.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace MyCore.Interfaces.Models { - public class WidgetMessage : Widget + public class WidgetMessage : ScreenWidget { [BsonElement("Message")] public string Message { get; set; } diff --git a/MyCore.Interfaces/Models/Screen/Widgets/WidgetNews.cs b/MyCore.Interfaces/Models/Screen/Widgets/WidgetNews.cs index 148aaac..1b1f0ca 100644 --- a/MyCore.Interfaces/Models/Screen/Widgets/WidgetNews.cs +++ b/MyCore.Interfaces/Models/Screen/Widgets/WidgetNews.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace MyCore.Interfaces.Models { - public class WidgetNews : Widget + public class WidgetNews : ScreenWidget { [BsonElement("Country")] public string Country { get; set; } diff --git a/MyCore.Interfaces/Models/Screen/Widgets/WidgetRadio.cs b/MyCore.Interfaces/Models/Screen/Widgets/WidgetRadio.cs index 7d37d99..99ed5c2 100644 --- a/MyCore.Interfaces/Models/Screen/Widgets/WidgetRadio.cs +++ b/MyCore.Interfaces/Models/Screen/Widgets/WidgetRadio.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace MyCore.Interfaces.Models { - public class WidgetRadio : Widget + public class WidgetRadio : ScreenWidget { [BsonElement("Provider")] public string Provider { get; set; } diff --git a/MyCore.Interfaces/Models/Screen/Widgets/WidgetTraffic.cs b/MyCore.Interfaces/Models/Screen/Widgets/WidgetTraffic.cs index 7aad064..545e062 100644 --- a/MyCore.Interfaces/Models/Screen/Widgets/WidgetTraffic.cs +++ b/MyCore.Interfaces/Models/Screen/Widgets/WidgetTraffic.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace MyCore.Interfaces.Models { - public class WidgetTraffic : Widget + public class WidgetTraffic : ScreenWidget { [BsonElement("WorkAddress")] public string WorkAddress { get; set; } diff --git a/MyCore.Interfaces/Models/Screen/Widgets/WidgetWeather.cs b/MyCore.Interfaces/Models/Screen/Widgets/WidgetWeather.cs index db13a10..1070b41 100644 --- a/MyCore.Interfaces/Models/Screen/Widgets/WidgetWeather.cs +++ b/MyCore.Interfaces/Models/Screen/Widgets/WidgetWeather.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace MyCore.Interfaces.Models { - public class WidgetWeather : Widget + public class WidgetWeather : ScreenWidget { [BsonElement("City")] public string City { get; set; } diff --git a/MyCore/Controllers/AuthenticationController.cs b/MyCore/Controllers/AuthenticationController.cs index 850971e..5e417f8 100644 --- a/MyCore/Controllers/AuthenticationController.cs +++ b/MyCore/Controllers/AuthenticationController.cs @@ -53,7 +53,13 @@ namespace MyCore.Service.Controllers //_mqttOnlineClientService = onlineProvider.MqttOnlineClientService; } - private ActionResult Authenticate(string email, string password) + /// + /// Authenticate (business) + /// + /// user email + /// user password + /// Token descriptor + private ObjectResult Authenticate(string email, string password) { try { @@ -65,18 +71,19 @@ namespace MyCore.Service.Controllers // Set user token ? var user = _UserDatabaseService.GetByEmail(email.ToLower()); - if (user != null) { - System.Console.WriteLine($"Init userId for MqqClientService ! {user.Email}"); - MqttClientService.SetServices(_DeviceDatabaseService, _GroupDatabaseService, _ProviderDatabaseService, _LocationDatabaseService, _ActionService, _AutomationDatabaseService, user.Id); - } + if (user == null) + throw new KeyNotFoundException("User not found"); - return Ok(token); + System.Console.WriteLine($"Init userId for MqqClientService ! {user.Email}"); + MqttClientService.SetServices(_DeviceDatabaseService, _GroupDatabaseService, _ProviderDatabaseService, _LocationDatabaseService, _ActionService, _AutomationDatabaseService, user.Id); + + return new OkObjectResult(token); } - /*catch (UnauthorizedAccessException ex) + catch (UnauthorizedAccessException ex) { _logger?.LogError(ex, $"Authentication error for user '{email}': unauthorized access"); return Unauthorized(ex); - }*/ + } catch (Exception ex) { _logger?.LogError(ex, $"Authenticate error for user '{email}'"); @@ -92,10 +99,10 @@ namespace MyCore.Service.Controllers [AllowAnonymous] [HttpPost("Token")] [Consumes("application/x-www-form-urlencoded")] - [SwaggerResponse(HttpStatusCode.OK, typeof(TokenDTO), Description = "Success")] // or ? [ProducesResponseType(typeof(TokenDTO), 200)] - [SwaggerResponse(HttpStatusCode.Unauthorized, typeof(string), Description = "Invalid credentials")] - [SwaggerResponse(HttpStatusCode.InternalServerError, typeof(string), Description = "Error")] - public ActionResult AuthenticateWithForm([FromForm] SwaggerTokenRequest tokenRequest) + [ProducesResponseType(typeof(TokenDTO), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(string), (int) HttpStatusCode.Unauthorized)] + [ProducesResponseType(typeof(string), (int) HttpStatusCode.InternalServerError)] + public ObjectResult AuthenticateWithForm([FromForm] SwaggerTokenRequest tokenRequest) { return Authenticate(tokenRequest.username, tokenRequest.password); } @@ -108,10 +115,10 @@ namespace MyCore.Service.Controllers [AllowAnonymous] [HttpPost("Authenticate")] [Consumes("application/json")] - [SwaggerResponse(HttpStatusCode.OK, typeof(LoginDTO), Description = "Success")] - [SwaggerResponse(HttpStatusCode.Unauthorized, typeof(string), Description = "Invalid credentials")] - [SwaggerResponse(HttpStatusCode.InternalServerError, typeof(string), Description = "Error")] - public ActionResult AuthenticateWithJson([FromBody] LoginDTO login) + [ProducesResponseType(typeof(TokenDTO), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(string), (int)HttpStatusCode.Unauthorized)] + [ProducesResponseType(typeof(string), (int)HttpStatusCode.InternalServerError)] + public ObjectResult AuthenticateWithJson([FromBody] LoginDTO login) { return Authenticate(login.Email.ToLower(), login.Password); } diff --git a/MyCore/Controllers/AutomationController.cs b/MyCore/Controllers/AutomationController.cs index 88b512b..24fb5a1 100644 --- a/MyCore/Controllers/AutomationController.cs +++ b/MyCore/Controllers/AutomationController.cs @@ -41,6 +41,7 @@ namespace MyCore.Service.Controllers /// /// Id of user [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("{userId}")] public ObjectResult GetAll(string userId) { @@ -63,15 +64,32 @@ namespace MyCore.Service.Controllers /// /// automation id [ProducesResponseType(typeof(AutomationDetailDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("detail/{automationId}")] public ObjectResult GetDetail(string automationId) { try { + if (automationId == null) + throw new ArgumentNullException("Incorrect parameters"); + Automation automation = _AutomationDatabaseService.GetById(automationId); + if (automation == null) + throw new KeyNotFoundException("Automation not found"); + return new OkObjectResult(automation.ToDetailDTO()); } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; + } catch (Exception ex) { return new ObjectResult(ex.Message) { StatusCode = 500 }; @@ -79,23 +97,29 @@ namespace MyCore.Service.Controllers } - //// + /// /// Create an automation /// /// Automation to create [ProducesResponseType(typeof(AutomationDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 500)] [HttpPost] public ObjectResult Create([FromBody] AutomationCreateOrUpdateDetailDTO automationCreateOrUpdateDetail) { try { if (automationCreateOrUpdateDetail == null) - throw new KeyNotFoundException("Automation is null"); + throw new ArgumentNullException("Incorrect parameters"); AutomationDTO automationCreated = AutomationService.CreateOrUpdate(this._AutomationDatabaseService, automationCreateOrUpdateDetail.UserId, automationCreateOrUpdateDetail, true); return new OkObjectResult(automationCreated); } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } catch (Exception ex) { return new ObjectResult(ex.Message) { StatusCode = 500 }; @@ -108,11 +132,17 @@ namespace MyCore.Service.Controllers /// /// automation to update [ProducesResponseType(typeof(AutomationCreateOrUpdateDetailDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpPut] public ObjectResult Update([FromBody] AutomationCreateOrUpdateDetailDTO automationCreateOrUpdateDetail) { try { + if (automationCreateOrUpdateDetail == null) + throw new ArgumentNullException("Incorrect parameters"); + if (!_AutomationDatabaseService.IsExist(automationCreateOrUpdateDetail.Id)) throw new KeyNotFoundException("Automation does not exist"); @@ -120,9 +150,13 @@ namespace MyCore.Service.Controllers return new OkObjectResult(automationUpdated); } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } catch (KeyNotFoundException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; + return new BadRequestObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -134,20 +168,32 @@ namespace MyCore.Service.Controllers /// Delete an automation /// /// Id of automation to delete + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpDelete("{automationId}")] public ObjectResult Delete(string automationId) { try { - if (automationId != null) - { - if (_AutomationDatabaseService.IsExist(automationId)) - { - _AutomationDatabaseService.Remove(automationId); - } - } + if (automationId == null) + throw new ArgumentNullException("Incorrect parameters"); - return new OkObjectResult(201); + if (!_AutomationDatabaseService.IsExist(automationId)) + throw new KeyNotFoundException("Automation does not exist"); + + _AutomationDatabaseService.Remove(automationId); + + return new ObjectResult("The automation has been deleted") { StatusCode = 202 }; + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -159,20 +205,32 @@ namespace MyCore.Service.Controllers /// Delete all automation for a specified /// /// Id of user + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpDelete("user/{userId}")] public ObjectResult DeleteAllForUser(string userId) { try { - if (userId != null) - { - if (_UserDatabaseService.IsExist(userId)) - { - _AutomationDatabaseService.RemoveForUser(userId); - } - } + if (userId == null) + throw new ArgumentNullException("Incorrect parameters"); - return new OkObjectResult(201); + if (!_UserDatabaseService.IsExist(userId)) + throw new KeyNotFoundException("User does not exist"); + + _AutomationDatabaseService.RemoveForUser(userId); + + return new ObjectResult("All automation linked with specified user has been successfully deleted") { StatusCode = 202 }; + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { diff --git a/MyCore/Controllers/Devices/DeviceController.cs b/MyCore/Controllers/Devices/DeviceController.cs index 6838436..93eb4f2 100644 --- a/MyCore/Controllers/Devices/DeviceController.cs +++ b/MyCore/Controllers/Devices/DeviceController.cs @@ -39,12 +39,12 @@ namespace MyCore.Controllers //this._mqttOnlineClientService = onlineProvider.MqttOnlineClientService; } - // GET: Devices /// /// Get all devices summary /// /// Id of user [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("{userId}")] public ObjectResult GetAll(string userId) { @@ -72,15 +72,32 @@ namespace MyCore.Controllers /// /// id of device [ProducesResponseType(typeof(DeviceDetailDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("detail/{deviceId}")] public ObjectResult GetDetail(string deviceId) { try { + if (deviceId == null) + throw new ArgumentNullException("Incorrect parameters"); + Device device = _DeviceDatabaseService.GetById(deviceId); + if (device == null) + throw new KeyNotFoundException("Device does not exist"); + return new OkObjectResult(device.ToDTO()); } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) { }; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) { }; + } catch (Exception ex) { return new ObjectResult(ex.Message) { StatusCode = 500 }; @@ -93,22 +110,24 @@ namespace MyCore.Controllers /// user Id /// device type [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("{userId}/type/{type}")] public ObjectResult GetDevicesByType(string userId, DeviceType type) { try { if (userId == null) - throw new InvalidOperationException("User not found"); + throw new ArgumentNullException("Incorrect parameters"); List devices = _DeviceDatabaseService.GetByType(userId, type); return new OkObjectResult(devices.Select(d => d.ToDTO())); } - catch (InvalidOperationException ex) + catch (ArgumentNullException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 400 }; + return new BadRequestObjectResult(ex.Message) { }; } catch (Exception ex) { @@ -121,26 +140,34 @@ namespace MyCore.Controllers /// /// Device to create [ProducesResponseType(typeof(DeviceDetailDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 409)] + [ProducesResponseType(typeof(string), 500)] [HttpPost] public ObjectResult Create([FromBody] DeviceDetailDTO deviceDetailDTO) { try { if (deviceDetailDTO == null) - throw new KeyNotFoundException("Device detail not found"); + throw new ArgumentNullException("Incorrect parameters"); DeviceDetailDTO deviceCreated = DeviceService.CreateOrUpdate(this._DeviceDatabaseService, this._ProviderDatabaseService, this._LocationDatabaseService, deviceDetailDTO.UserId, deviceDetailDTO, true); return new OkObjectResult(deviceCreated); } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) { }; + } catch (DuplicateWaitObjectException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 400 }; + return new ConflictObjectResult(ex.Message) { }; } catch (KeyNotFoundException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; + return new NotFoundObjectResult(ex.Message) { }; } catch (Exception ex) { @@ -154,13 +181,18 @@ namespace MyCore.Controllers /// User Id /// Id of Provider [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 401)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 421)] + [ProducesResponseType(typeof(string), 500)] [HttpPost("{userId}/fromProvider/{providerId}")] public async Task CreateDevicesFromProvider(string userId, string providerId) { try { if (userId == null) - throw new InvalidOperationException("User not found"); + throw new ArgumentNullException("Invalid paramaters"); if (!UserService.IsExist(_UserDatabaseService, userId)) throw new KeyNotFoundException("User not found"); @@ -173,17 +205,17 @@ namespace MyCore.Controllers return new OkObjectResult(devices); } - catch (InvalidOperationException ex) + catch (ArgumentNullException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 400 }; + return new BadRequestObjectResult(ex.Message) {}; } catch (KeyNotFoundException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; + return new NotFoundObjectResult(ex.Message) {}; } catch (AuthenticationException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 401 }; + return new UnauthorizedObjectResult(ex.Message) {}; } catch (HttpRequestException ex) // Not ok if not http request.. { @@ -200,13 +232,16 @@ namespace MyCore.Controllers /// /// User Id [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("zigbee2Mqtt/{userId}")] public ObjectResult GetDevicesFromZigbee2Mqtt(string userId) { try { if (userId == null) - throw new InvalidOperationException("User not found"); + throw new ArgumentNullException("Invalid paramaters"); if (!UserService.IsExist(_UserDatabaseService, userId)) throw new KeyNotFoundException("User not found"); @@ -216,9 +251,13 @@ namespace MyCore.Controllers return new OkObjectResult(devices); } - catch (InvalidOperationException ex) + catch (ArgumentNullException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 400 }; + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -232,16 +271,16 @@ namespace MyCore.Controllers /// User Id /// Id of Provider [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("{userId}/fromProvider/{providerId}")] public ObjectResult GetDevicesFromProvider(string userId, string providerId) { try { - if (userId == null) - throw new InvalidOperationException("User not found"); - - if (providerId == null) - throw new InvalidOperationException("Provider not found"); + if (userId == null || providerId == null) + throw new ArgumentNullException("Invalid paramaters"); if (!_UserDatabaseService.IsExist(userId)) throw new KeyNotFoundException("User does not exist"); @@ -254,13 +293,13 @@ namespace MyCore.Controllers return new OkObjectResult(devices.Select(d => d.ToDTO())); } - catch (InvalidOperationException ex) + catch (ArgumentNullException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 400 }; + return new BadRequestObjectResult(ex.Message) {}; } catch (KeyNotFoundException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; + return new BadRequestObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -273,6 +312,8 @@ namespace MyCore.Controllers /// /// Device to update [ProducesResponseType(typeof(DeviceDetailDTO), 200)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpPut("{deviceId}")] public ObjectResult Update([FromBody] DeviceDetailDTO deviceDetailDTO) { @@ -287,7 +328,7 @@ namespace MyCore.Controllers } catch (KeyNotFoundException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; + return new BadRequestObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -299,13 +340,17 @@ namespace MyCore.Controllers /// Delete a device /// /// Id of device to delete + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpDelete("{deviceId}")] public ObjectResult Delete(string deviceId) { try { if (deviceId == null) - throw new InvalidOperationException("Device not found"); + throw new ArgumentNullException("Invalid paramaters"); if (!_DeviceDatabaseService.IsExist(deviceId)) throw new KeyNotFoundException("Device does not exist"); @@ -313,16 +358,16 @@ namespace MyCore.Controllers // TODO REMOVE DEVICE ID IN AUTOMATION and delete automation if none device ? _DeviceDatabaseService.Remove(deviceId); - return new OkObjectResult(200); + return new ObjectResult("Device has been deleted") { StatusCode = 202 }; } - catch (InvalidOperationException ex) + catch (ArgumentNullException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 400 }; + return new BadRequestObjectResult(ex.Message) {}; } catch (KeyNotFoundException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -335,16 +380,17 @@ namespace MyCore.Controllers /// /// User Id /// Id of Provider + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpDelete("{userId}/fromProvider/{providerId}")] public ObjectResult DeleteDevicesFromProvider(string userId, string providerId) { try { - if (userId == null) - throw new InvalidOperationException("User not found"); - - if (providerId == null) - throw new InvalidOperationException("Provider not found"); + if (userId == null || providerId == null) + throw new ArgumentNullException("Invalid paramaters"); if (!_UserDatabaseService.IsExist(userId)) throw new KeyNotFoundException("User does not exist"); @@ -354,15 +400,15 @@ namespace MyCore.Controllers // TODO REMOVE DEVICE ID IN AUTOMATION and delete automation if none device ? _DeviceDatabaseService.RemoveForProvider(providerId); - return new OkObjectResult(200); + return new ObjectResult("Provider devices has been successfully deleted") { StatusCode = 202 }; } - catch (InvalidOperationException ex) + catch (ArgumentNullException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 400 }; + return new BadRequestObjectResult(ex.Message) {}; } catch (KeyNotFoundException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -371,31 +417,35 @@ namespace MyCore.Controllers } /// - /// Delete all device for a specified + /// Delete all device for a specified user /// /// Id of user + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpDelete("user/{userId}")] public ObjectResult DeleteAllForUser(string userId) { try { if (userId == null) - throw new InvalidOperationException("User not found"); + throw new ArgumentNullException("Invalid paramaters"); if (!_UserDatabaseService.IsExist(userId)) throw new KeyNotFoundException("User does not exist"); // TODO REMOVE DEVICE ID IN AUTOMATION and delete automation if none device ? _DeviceDatabaseService.RemoveForUser(userId); - return new OkObjectResult(200); + return new ObjectResult("User devices has been successfully deleted") { StatusCode = 202 }; } - catch (InvalidOperationException ex) + catch (ArgumentNullException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 400 }; + return new BadRequestObjectResult(ex.Message) {}; } catch (KeyNotFoundException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { diff --git a/MyCore/Controllers/Devices/IoThomas/OddController.cs b/MyCore/Controllers/Devices/IoThomas/OddController.cs index 39dc109..887d281 100644 --- a/MyCore/Controllers/Devices/IoThomas/OddController.cs +++ b/MyCore/Controllers/Devices/IoThomas/OddController.cs @@ -38,6 +38,7 @@ namespace MyCore.Controllers /// Odd Maximum value [AllowAnonymous] [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 400)] [ProducesResponseType(typeof(string), 404)] [ProducesResponseType(typeof(string), 500)] [HttpGet("country/{id}/{oddRequest}")] @@ -45,6 +46,9 @@ namespace MyCore.Controllers { try { + if (id == null) + throw new ArgumentNullException("Incorrect parameters"); + try { League leagueTest = new League(id); @@ -58,6 +62,10 @@ namespace MyCore.Controllers return Ok(result); } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) { }; + } catch (Exception e) { Console.WriteLine(e); @@ -116,7 +124,7 @@ namespace MyCore.Controllers oddNice.Commence_time = odd.Commence_time; oddNice.Home_team = odd.Home_team; oddNice.Teams = odd.Teams; - oddNice.Odds = new OddH2H(); + oddNice.Odds = new OddObject(); oddNice.Odds.HomeOdd = unibet.Odds.H2h.ToArray()[0]; oddNice.Odds.VisitOdd = unibet.Odds.H2h.ToArray()[1]; oddNice.Odds.DrawOdd = unibet.Odds.H2h.ToArray()[2]; diff --git a/MyCore/Controllers/Devices/ProviderController.cs b/MyCore/Controllers/Devices/ProviderController.cs index ad02ed3..89b4142 100644 --- a/MyCore/Controllers/Devices/ProviderController.cs +++ b/MyCore/Controllers/Devices/ProviderController.cs @@ -14,169 +14,194 @@ using MyCore.Services.MyControlPanel; namespace MyCore.Controllers { - //[Authorize(Roles = "Admin")] - [Authorize] - [Route("api/provider")] - [ApiController] - public class ProviderController : ControllerBase + //[Authorize(Roles = "Admin")] + [Authorize] + [Route("api/provider")] + [ApiController] + public class ProviderController : ControllerBase + { + private DeviceDatabaseService _DeviceDatabaseService; + private ProviderDatabaseService _ProviderDatabaseService; + private LocationDatabaseService _LocationDatabaseService; + private UserDatabaseService _UserDatabaseService; + + public ProviderController(DeviceDatabaseService DeviceDatabaseService, ProviderDatabaseService ProviderDatabaseService, LocationDatabaseService LocationDatabaseService, UserDatabaseService UserDatabaseService) { - private DeviceDatabaseService _DeviceDatabaseService; - private ProviderDatabaseService _ProviderDatabaseService; - private LocationDatabaseService _LocationDatabaseService; - private UserDatabaseService _UserDatabaseService; + this._DeviceDatabaseService = DeviceDatabaseService; + this._ProviderDatabaseService = ProviderDatabaseService; + this._LocationDatabaseService = LocationDatabaseService; + this._UserDatabaseService = UserDatabaseService; + } - public ProviderController(DeviceDatabaseService DeviceDatabaseService, ProviderDatabaseService ProviderDatabaseService, LocationDatabaseService LocationDatabaseService, UserDatabaseService UserDatabaseService) + /// + /// Get all user providers + /// + /// Id of user + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] + [HttpGet("{userId}")] + public ObjectResult GetAll(string userId) + { + try { - this._DeviceDatabaseService = DeviceDatabaseService; - this._ProviderDatabaseService = ProviderDatabaseService; - this._LocationDatabaseService = LocationDatabaseService; - this._UserDatabaseService = UserDatabaseService; + if (userId == null) + throw new ArgumentNullException("Incorrect parameters"); + + if (!UserService.IsExist(_UserDatabaseService, userId)) + throw new KeyNotFoundException("User not found"); + + List providers = ProviderService.GetAll(this._ProviderDatabaseService, userId); + + List providersDTO = providers.Select(p => p.ToDTO()).ToList(); + + return new OkObjectResult(providersDTO); } - - // GET: Devices - /// - /// Get all user providers - /// - [ProducesResponseType(typeof(List), 200)] - [HttpGet("{userId}")] - public ObjectResult GetAll(string userId) + catch (ArgumentNullException ex) { - try - { - if (userId == null) - throw new InvalidOperationException("User not found"); - - if (!UserService.IsExist(_UserDatabaseService, userId)) - throw new KeyNotFoundException("User not found"); - - List providers = ProviderService.GetAll(this._ProviderDatabaseService, userId); - - List providersDTO = providers.Select(p => p.ToDTO()).ToList(); - - return new OkObjectResult(providersDTO); - } - catch (InvalidOperationException ex) - { - return new BadRequestObjectResult(ex.Message) { StatusCode = 400 }; - } - catch (KeyNotFoundException ex) - { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; - } - catch (Exception ex) - { - return new ObjectResult(ex.Message) { StatusCode = 500 }; - } + return new BadRequestObjectResult(ex.Message) {}; } - - /// - /// Create a provider - /// - /// Provider to create - [ProducesResponseType(typeof(ProviderDTO), 200)] - [HttpPost] - public ObjectResult Create([FromBody] ProviderDTO providerDTO) + catch (KeyNotFoundException ex) { - try - { - - if (providerDTO.UserId == null) - throw new InvalidOperationException("User not found"); - - if (!UserService.IsExist(_UserDatabaseService, providerDTO.UserId)) - throw new KeyNotFoundException("User not found"); - - if (providerDTO == null) - throw new KeyNotFoundException("Provider is null"); - - if (_ProviderDatabaseService.AlreadyExistForUser(providerDTO.UserId, providerDTO.Name)) - throw new ArgumentException("Provider already exists"); - - ProviderDTO providerCreated = ProviderService.CreateOrUpdate(this._ProviderDatabaseService, providerDTO.UserId, providerDTO, true); - - return new OkObjectResult(providerCreated); - - } - catch (InvalidOperationException ex) - { - return new BadRequestObjectResult(ex.Message) { StatusCode = 400 }; - } - catch (KeyNotFoundException ex) - { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; - } - catch (ArgumentException ex) - { - return new BadRequestObjectResult(ex.Message) { StatusCode = 409 }; - } - catch (Exception ex) - { - return new ObjectResult(ex.Message) { StatusCode = 500 }; - } + return new NotFoundObjectResult(ex.Message) {}; } - - /// - /// Update a provider - /// - /// Provider to update - [ProducesResponseType(typeof(DeviceDetailDTO), 200)] - [HttpPut] - public ObjectResult Update([FromBody] ProviderDTO providerDTO) + catch (Exception ex) { - try - { - if (providerDTO.UserId == null) - throw new InvalidOperationException("User not found"); - - if (!UserService.IsExist(_UserDatabaseService, providerDTO.UserId)) - throw new KeyNotFoundException("User not found"); - - if (!ProviderService.IsExist(this._ProviderDatabaseService, providerDTO.UserId, providerDTO.Id)) - throw new KeyNotFoundException("Provider does not exist"); - - ProviderDTO providerUpdated = ProviderService.CreateOrUpdate(this._ProviderDatabaseService, providerDTO.UserId, providerDTO, false); - - return new OkObjectResult(providerUpdated); - } - catch (InvalidOperationException ex) - { - return new BadRequestObjectResult(ex.Message) { StatusCode = 400 }; - } - catch (KeyNotFoundException ex) - { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; - } - catch (Exception ex) - { - return new ObjectResult(ex.Message) { StatusCode = 500 }; - } + return new ObjectResult(ex.Message) { StatusCode = 500 }; } + } - /// - /// Delete a provider - /// - /// Id of provider to delete - [HttpDelete("{providerId}")] - public ObjectResult Delete(string providerId) + /// + /// Create a provider + /// + /// Provider to create + [ProducesResponseType(typeof(ProviderDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 409)] + [ProducesResponseType(typeof(string), 500)] + [HttpPost] + public ObjectResult Create([FromBody] ProviderDTO providerDTO) + { + try { - try - { - // TODO DELETE ALL DEVICES linked - if (providerId == null) - throw new InvalidOperationException("Provider is null"); - if (!_ProviderDatabaseService.IsExist(providerId)) - throw new InvalidOperationException("Provider is null"); + if (providerDTO == null) + throw new ArgumentNullException("Incorrect parameters"); - _ProviderDatabaseService.Remove(providerId); + if (providerDTO.UserId == null) + throw new ArgumentNullException("User not found"); - return new OkObjectResult(201); - } - catch (Exception ex) - { - return new ObjectResult(ex.Message) { StatusCode = 500 }; - } + if (!UserService.IsExist(_UserDatabaseService, providerDTO.UserId)) + throw new KeyNotFoundException("User not found"); + + if (_ProviderDatabaseService.AlreadyExistForUser(providerDTO.UserId, providerDTO.Name)) + throw new InvalidOperationException("Provider already exists"); + + ProviderDTO providerCreated = ProviderService.CreateOrUpdate(this._ProviderDatabaseService, providerDTO.UserId, providerDTO, true); + + return new OkObjectResult(providerCreated); + + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; + } + catch (InvalidOperationException ex) + { + return new ConflictObjectResult(ex.Message) {}; + } + catch (Exception ex) + { + return new ObjectResult(ex.Message) { StatusCode = 500 }; + } + } + + /// + /// Update a provider + /// + /// Provider to update + [ProducesResponseType(typeof(DeviceDetailDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] + [HttpPut] + public ObjectResult Update([FromBody] ProviderDTO providerDTO) + { + try + { + if (providerDTO == null) + throw new ArgumentNullException("Incorrect parameters"); + + if (providerDTO.UserId == null) + throw new ArgumentNullException("User not found"); + + if (!UserService.IsExist(_UserDatabaseService, providerDTO.UserId)) + throw new KeyNotFoundException("User not found"); + + if (!ProviderService.IsExist(this._ProviderDatabaseService, providerDTO.UserId, providerDTO.Id)) + throw new KeyNotFoundException("Provider does not exist"); + + ProviderDTO providerUpdated = ProviderService.CreateOrUpdate(this._ProviderDatabaseService, providerDTO.UserId, providerDTO, false); + + return new OkObjectResult(providerUpdated); + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; + } + catch (Exception ex) + { + return new ObjectResult(ex.Message) { StatusCode = 500 }; + } + } + + /// + /// Delete a provider + /// + /// Id of provider to delete + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] + [HttpDelete("{providerId}")] + public ObjectResult Delete(string providerId) + { + try + { + // TODO DELETE ALL DEVICES linked + if (providerId == null) + throw new ArgumentNullException("Incorrect parameters"); + + if (!_ProviderDatabaseService.IsExist(providerId)) + throw new KeyNotFoundException("Provider is null"); + + _ProviderDatabaseService.Remove(providerId); + + return new ObjectResult("The provider has been deleted") { StatusCode = 202 }; + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; + } + catch (Exception ex) + { + return new ObjectResult(ex.Message) { StatusCode = 500 }; } } } +} diff --git a/MyCore/Controllers/Devices/ScreenDeviceController.cs b/MyCore/Controllers/Devices/ScreenDeviceController.cs index 01c390f..24ed3da 100644 --- a/MyCore/Controllers/Devices/ScreenDeviceController.cs +++ b/MyCore/Controllers/Devices/ScreenDeviceController.cs @@ -23,11 +23,11 @@ namespace MyCore.Controllers _ScreenDeviceDatabaseService = ScreenDeviceDatabaseService; } - // GET: Devices /// - /// + /// Get all screen devices /// [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 500)] [HttpGet] public ObjectResult GetAllScreenDevices() { @@ -43,39 +43,63 @@ namespace MyCore.Controllers } } - // GET: ScreenDevice /// - /// + /// Get screen device info /// /// Id of the screen device you want to get information [ProducesResponseType(typeof(ScreenDevice), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("{screenDeviceId}")] public ObjectResult GetDeviceInfo(string screenDeviceId) { try { + if (screenDeviceId == null) + throw new ArgumentNullException("Incorrect parameters"); + ScreenDevice screenDevice = _ScreenDeviceDatabaseService.GetInfo(screenDeviceId); + if (screenDevice == null) + throw new KeyNotFoundException("Screen device not found"); return new OkObjectResult(screenDevice); } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; + } catch (Exception ex) { return new ObjectResult(ex.Message) { StatusCode = 500 }; } } - // POST: Device/Create /// - /// + /// Create screen device /// + /// Screen device to create + [ProducesResponseType(typeof(ScreenDevice), 200)] + [ProducesResponseType(typeof(string), 400)] [HttpPost] public ObjectResult CreateDevice([FromBody] ScreenDevice screenDevice) { try { + if (screenDevice == null) + throw new ArgumentNullException("Incorrect parameters"); + _ScreenDeviceDatabaseService.Create(screenDevice); - return new OkObjectResult(201); + return new OkObjectResult(screenDevice); + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -83,18 +107,36 @@ namespace MyCore.Controllers } } - // PUT: Device/Update /// - /// + /// Update screen device /// - [HttpPut("{screenDeviceId}")] - public ObjectResult UpdateDevice(int screenDeviceId, [FromBody] ScreenDevice screenDevice) + /// Screen device to update + [ProducesResponseType(typeof(ScreenDevice), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] + [HttpPut()] + public ObjectResult UpdateDevice([FromBody] ScreenDevice screenDevice) { try { + if (screenDevice == null) + throw new ArgumentNullException("Incorrect parameters"); + + if (!_ScreenDeviceDatabaseService.IsExist(screenDevice.Id)) + throw new KeyNotFoundException("Screen device does not exist"); + _ScreenDeviceDatabaseService.Update(screenDevice.Id, screenDevice); - return new OkObjectResult(201); + return new OkObjectResult(screenDevice); + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -102,18 +144,36 @@ namespace MyCore.Controllers } } - // Delete: Device/Delete /// - /// + /// Delete device /// + /// Screen device id to update + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpDelete("{deviceId}")] public ObjectResult DeleteDevice(string deviceId) { try { + if (deviceId == null) + throw new ArgumentNullException("Incorrect parameters"); + + if (!_ScreenDeviceDatabaseService.IsExist(deviceId)) + throw new KeyNotFoundException("Device does not exist"); + _ScreenDeviceDatabaseService.Remove(deviceId); - return new OkObjectResult(201); + return new ObjectResult("The screen device has been successfully deleted") { StatusCode = 202 }; + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { diff --git a/MyCore/Controllers/GroupController.cs b/MyCore/Controllers/GroupController.cs index e5f5732..6263169 100644 --- a/MyCore/Controllers/GroupController.cs +++ b/MyCore/Controllers/GroupController.cs @@ -45,17 +45,26 @@ namespace MyCore.Service.Controllers /// /// Id of user [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("{userId}")] public ObjectResult GetAll(string userId) { try { + if (userId == null) + throw new ArgumentNullException("Incorrect parameters"); + List Groups = _GroupDatabaseService.GetAll(userId); List groupsSummaryDTO = Groups.Select(d => d.ToSummaryDTO()).ToList(); return new OkObjectResult(groupsSummaryDTO); } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) { }; + } catch (Exception ex) { return new ObjectResult(ex.Message) { StatusCode = 500 }; @@ -65,32 +74,35 @@ namespace MyCore.Service.Controllers /// /// Get detail info of a specified group /// - /// user id /// groupid [ProducesResponseType(typeof(GroupDetailDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("detail/{groupId}")] - public ObjectResult GetDetail(string userId, string groupId) + public ObjectResult GetDetail(string groupId) { try { - if (userId != null && groupId != null) - { - Group group = _GroupDatabaseService.GetById(groupId); - if (group == null) - throw new KeyNotFoundException("Group not found"); + if (groupId == null) + throw new ArgumentNullException("Incorrect parameters"); - List devices = _DeviceDatabaseService.GetByLocation(group.UserId, groupId); + Group group = _GroupDatabaseService.GetById(groupId); + if (group == null) + throw new KeyNotFoundException("Group not found"); - return new OkObjectResult(group.ToDTO(devices.Select(d => d.ToDTO()).ToList())); - } - else - { - return new ObjectResult("Invalid parameters") { StatusCode = 400 }; - } + List devices = _DeviceDatabaseService.GetByLocation(group.UserId, groupId); + + return new OkObjectResult(group.ToDTO(devices.Select(d => d.ToDTO()).ToList())); + + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; } catch (KeyNotFoundException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -104,21 +116,61 @@ namespace MyCore.Service.Controllers /// user Id /// group type [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("{userId}/type/{type}")] public ObjectResult GetGroupsByType(string userId, string type) // Change string type to enum ? Lights etc ? { try { - if (userId != null) - { - List groups = _GroupDatabaseService.GetByType(userId, type); + if (userId == null || type == null) + throw new ArgumentNullException("Incorrect parameters"); - return new OkObjectResult(groups.Select(d => d.ToSummaryDTO())); - } - else - { - return new ObjectResult("Invalid parameters") { StatusCode = 400 }; - } + List groups = _GroupDatabaseService.GetByType(userId, type); + + return new OkObjectResult(groups.Select(d => d.ToSummaryDTO())); + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (Exception ex) + { + return new ObjectResult(ex.Message) { StatusCode = 500 }; + } + } + + /// + /// Get all zigbee2Mqtt groups + /// + /// User Id + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] + [HttpGet("zigbee2Mqtt/{userId}")] + public ObjectResult GetGroupsFromZigbee2Mqtt(string userId) + { + try + { + if (userId == null) + throw new ArgumentNullException("Incorrect parameters"); + + if (!UserService.IsExist(_UserDatabaseService, userId)) + throw new KeyNotFoundException("User not found"); + + // GET ALL LOCAL GROUPS + var groups = MqttClientService.groups; // Be carefull, we only got the exact result after each connection + + return new OkObjectResult(groups); + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new BadRequestObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -131,18 +183,24 @@ namespace MyCore.Service.Controllers /// /// Group to create [ProducesResponseType(typeof(GroupDetailDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 500)] [HttpPost] public ObjectResult Create([FromBody] GroupCreateOrUpdateDetailDTO groupCreateOrUpdateDetail) { try { if (groupCreateOrUpdateDetail == null) - throw new KeyNotFoundException("Group is null"); + throw new ArgumentNullException("Incorrect parameters"); GroupDetailDTO groupCreated = GroupService.CreateOrUpdate(this._GroupDatabaseService, this._DeviceDatabaseService, groupCreateOrUpdateDetail.UserId, groupCreateOrUpdateDetail, true); return new OkObjectResult(groupCreated); } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } catch (Exception ex) { return new ObjectResult(ex.Message) { StatusCode = 500 }; @@ -154,13 +212,16 @@ namespace MyCore.Service.Controllers /// /// User Id [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpPost("{userId}/fromZigbee")] public ObjectResult CreateDevicesFromZigbee2Mqtt(string userId) { try { if (userId == null) - throw new InvalidOperationException("User not found"); + throw new ArgumentNullException("Incorrect parameters"); if (!UserService.IsExist(_UserDatabaseService, userId)) throw new KeyNotFoundException("User not found"); @@ -176,6 +237,14 @@ namespace MyCore.Service.Controllers return new OkObjectResult(groupsDetail); } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } catch (Exception ex) { return new ObjectResult(ex.Message) { StatusCode = 500 }; @@ -187,11 +256,17 @@ namespace MyCore.Service.Controllers /// /// group to update [ProducesResponseType(typeof(GroupCreateOrUpdateDetailDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpPut] public ObjectResult Update([FromBody] GroupCreateOrUpdateDetailDTO groupCreateOrUpdateDetail) { try { + if (groupCreateOrUpdateDetail == null) + throw new ArgumentNullException("Incorrect parameters"); + if (!_GroupDatabaseService.IsExist(groupCreateOrUpdateDetail.Id)) throw new KeyNotFoundException("Group does not exist"); @@ -199,9 +274,13 @@ namespace MyCore.Service.Controllers return new OkObjectResult(groupUpdated); } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } catch (KeyNotFoundException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -214,33 +293,45 @@ namespace MyCore.Service.Controllers /// /// Id of device to delete from the group /// Id of group + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpDelete("{groupId}/device/{deviceId}")] public ObjectResult Delete(string deviceId, string groupId) { try { - if (groupId != null && deviceId != null) - { - if (_GroupDatabaseService.IsExist(groupId)) - { - // Update group - Group group = _GroupDatabaseService.GetById(groupId); - group.DevicesIds = group.DevicesIds.Where(d => d != deviceId).ToList(); - group.UpdatedDate = DateTime.Now; - _GroupDatabaseService.Update(group); + if (groupId == null || deviceId == null) + throw new ArgumentNullException("Incorrect parameters"); - // Update device - Device device = _DeviceDatabaseService.GetById(deviceId); - if (device != null) - { - device.GroupIds = device.GroupIds.Where(g => g != groupId).ToList(); - device.UpdatedDate = DateTime.Now; - _DeviceDatabaseService.Update(device); - } - } - } + if (!_GroupDatabaseService.IsExist(groupId)) + throw new KeyNotFoundException("Group does not exist"); - return new OkObjectResult(201); + // Update group + Group group = _GroupDatabaseService.GetById(groupId); + group.DevicesIds = group.DevicesIds.Where(d => d != deviceId).ToList(); + group.UpdatedDate = DateTime.Now; + _GroupDatabaseService.Update(group); + + // Update device + Device device = _DeviceDatabaseService.GetById(deviceId); + if (device == null) + throw new KeyNotFoundException("Device does not exist"); + + device.GroupIds = device.GroupIds.Where(g => g != groupId).ToList(); + device.UpdatedDate = DateTime.Now; + _DeviceDatabaseService.Update(device); + + return new ObjectResult("Device has been successfully removed from specified group") { StatusCode = 202 }; + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -252,61 +343,42 @@ namespace MyCore.Service.Controllers /// Delete a group /// /// Id of group to delete + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpDelete("{groupId}")] public ObjectResult Delete(string groupId) { try { - if (groupId != null) + if (groupId == null) + throw new ArgumentNullException("Incorrect parameters"); + + if (!_GroupDatabaseService.IsExist(groupId)) + throw new KeyNotFoundException("Group does not exist"); + + Group group = _GroupDatabaseService.GetById(groupId); + // Delete group from all devices + List devices = _DeviceDatabaseService.GetByLocation(group.UserId, groupId); + foreach (var device in devices) { - if (_GroupDatabaseService.IsExist(groupId)) - { - Group group = _GroupDatabaseService.GetById(groupId); - // Delete group from all devices - List devices = _DeviceDatabaseService.GetByLocation(group.UserId, groupId); - foreach (var device in devices) - { - device.GroupIds = device.GroupIds.Where(g => g != groupId).ToList(); - device.UpdatedDate = DateTime.Now; - _DeviceDatabaseService.Update(device); - } - // Delete group - _GroupDatabaseService.Remove(groupId); - } + device.GroupIds = device.GroupIds.Where(g => g != groupId).ToList(); + device.UpdatedDate = DateTime.Now; + _DeviceDatabaseService.Update(device); } + // Delete group + _GroupDatabaseService.Remove(groupId); - return new OkObjectResult(201); + return new ObjectResult("The group has been successfully deleted") { StatusCode = 202 }; } - catch (Exception ex) + catch (ArgumentNullException ex) { - return new ObjectResult(ex.Message) { StatusCode = 500 }; + return new BadRequestObjectResult(ex.Message) {}; } - } - - /// - /// Get all zigbee2Mqtt groups - /// - /// User Id - [ProducesResponseType(typeof(List), 200)] - [HttpGet("zigbee2Mqtt/{userId}")] - public ObjectResult GetGroupsFromZigbee2Mqtt(string userId) - { - try + catch (KeyNotFoundException ex) { - if (userId == null) - throw new InvalidOperationException("User not found"); - - if (!UserService.IsExist(_UserDatabaseService, userId)) - throw new KeyNotFoundException("User not found"); - - // GET ALL LOCAL GROUPS - var groups = MqttClientService.groups; // Be carefull, we only got the exact result after each connection - - return new OkObjectResult(groups); - } - catch (InvalidOperationException ex) - { - return new BadRequestObjectResult(ex.Message) { StatusCode = 400 }; + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -318,20 +390,32 @@ namespace MyCore.Service.Controllers /// Delete all group for a specified /// /// Id of user + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpDelete("user/{userId}")] public ObjectResult DeleteAllForUser(string userId) { try { - if (userId != null) - { - if (_UserDatabaseService.IsExist(userId)) - { - _GroupDatabaseService.RemoveForUser(userId); - } - } + if (userId == null) + throw new ArgumentNullException("Incorrect parameters"); - return new OkObjectResult(201); + if (!_UserDatabaseService.IsExist(userId)) + throw new KeyNotFoundException("User does not exist"); + + _GroupDatabaseService.RemoveForUser(userId); + + return new ObjectResult("All group linked with specified user has been successfully deleted") { StatusCode = 202 }; + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { diff --git a/MyCore/Controllers/Helpers/MQTTController.cs b/MyCore/Controllers/Helpers/MQTTController.cs index 6e81d1b..dfeaf47 100644 --- a/MyCore/Controllers/Helpers/MQTTController.cs +++ b/MyCore/Controllers/Helpers/MQTTController.cs @@ -33,13 +33,15 @@ namespace MyCore.Controllers /// /// Message to send [ProducesResponseType(typeof(bool), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 500)] [HttpPost] public async Task PublishMessage([FromBody] MqttMessageDTO mqttMessageDTO) { try { if (mqttMessageDTO == null) - throw new KeyNotFoundException("message is null"); + throw new ArgumentNullException("Incorrect parameters"); bool isSucess = false; @@ -68,6 +70,10 @@ namespace MyCore.Controllers return new OkObjectResult(isSucess); } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } catch (Exception ex) { return new ObjectResult(ex.Message) { StatusCode = 500 }; diff --git a/MyCore/Controllers/MyControlPanel/LayoutController.cs b/MyCore/Controllers/MyControlPanel/LayoutController.cs index 4132549..259cc58 100644 --- a/MyCore/Controllers/MyControlPanel/LayoutController.cs +++ b/MyCore/Controllers/MyControlPanel/LayoutController.cs @@ -19,10 +19,10 @@ namespace MyCore.Controllers public class LayoutController : ControllerBase { - // GET api/values /// /// It's a test ! :) /// + [ProducesResponseType(typeof(IEnumerable), 200)] [AllowAnonymous] [HttpGet("panelSection")] public ActionResult> Get() diff --git a/MyCore/Controllers/MyControlPanel/TokenController.cs b/MyCore/Controllers/MyControlPanel/TokenController.cs index d12908b..fb19980 100644 --- a/MyCore/Controllers/MyControlPanel/TokenController.cs +++ b/MyCore/Controllers/MyControlPanel/TokenController.cs @@ -31,20 +31,43 @@ namespace MyCore.Controllers _userService = userService; } + /// + /// Connect user + /// + /// login info + [ProducesResponseType(typeof(UserInfo), 200)] + [ProducesResponseType(typeof(string), 401)] + [ProducesResponseType(typeof(string), 500)] [AllowAnonymous] [HttpPost] public ActionResult ConnectUser([FromBody] LoginDTO loginDTO) { - //string test = _TokenService.GenerateSHA256String(password); - - if (IsValidUserAndPasswordCombination(loginDTO.Email, loginDTO.Password)) + try { - UserInfo user = _userService.GetByEmail(loginDTO.Email); - user.Token = _tokenService.GenerateToken(loginDTO.Email).ToString(); + UserInfo user = null; + if (IsValidUserAndPasswordCombination(loginDTO.Email, loginDTO.Password)) + { + user = _userService.GetByEmail(loginDTO.Email); + user.Token = _tokenService.GenerateToken(loginDTO.Email).ToString(); + } - return user; + if (user != null) + { + return new OkObjectResult(user); + } + else { + throw new UnauthorizedAccessException("Bad credential"); + } + + } + catch (UnauthorizedAccessException ex) + { + return new UnauthorizedObjectResult(ex.Message) {}; + } + catch (Exception ex) + { + return new ObjectResult(ex.Message) { StatusCode = 500 }; } - return BadRequest(); } private bool IsValidUserAndPasswordCombination(string email, string password) diff --git a/MyCore/Controllers/MyControlPanel/UserController.cs b/MyCore/Controllers/MyControlPanel/UserController.cs index 23f9fa1..c41fdcf 100644 --- a/MyCore/Controllers/MyControlPanel/UserController.cs +++ b/MyCore/Controllers/MyControlPanel/UserController.cs @@ -29,11 +29,11 @@ namespace MyCore.Controllers _tokenService = tokenService; } - // GET api/user /// /// Get a list of user /// [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 500)] [HttpGet] public ObjectResult Get() { @@ -50,64 +50,71 @@ namespace MyCore.Controllers } - // GET api/user/5 /// /// Get a specific user /// /// id user [ProducesResponseType(typeof(UserInfoDetailDTO), 200)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("{id}")] public ObjectResult Get(string id) { try { - // TODO ! Add object id verification UserInfo user = _userService.GetById(id); if (user == null) - { - return Conflict("This user was not found"); - } + throw new KeyNotFoundException("This user was not found"); return new OkObjectResult(user.ToDTO()); } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; + } catch (Exception ex) { return new ObjectResult(ex.Message) { StatusCode = 500 }; } } - // POST: User/Create /// - /// + /// Create an user /// + /// New user info [AllowAnonymous] [ProducesResponseType(typeof(UserInfoDetailDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 409)] + [ProducesResponseType(typeof(string), 500)] [HttpPost] public ObjectResult CreateUser([FromBody] UserInfo newUser) { try { - if (newUser != null) - { - newUser.Token = _tokenService.GenerateToken(newUser.Email).ToString(); - newUser.DateCreation = DateTime.Now; + if (newUser == null) + throw new ArgumentNullException("User param is null"); - List users = _userService.GetAll(); + newUser.Token = _tokenService.GenerateToken(newUser.Email).ToString(); + newUser.DateCreation = DateTime.Now; - if (users.Select(u => u.Email).Contains(newUser.Email)) - { - return Conflict("This Email is already used"); - } + List users = _userService.GetAll(); - UserInfo userCreated = _userService.Create(newUser); + if (users.Select(u => u.Email).Contains(newUser.Email)) + throw new InvalidOperationException("This Email is already used"); - return new OkObjectResult(userCreated.ToDTO()); - } - else { - // TODO - return new ObjectResult("An error has occurred") { StatusCode = 500 }; - } + UserInfo userCreated = _userService.Create(newUser); + + return new OkObjectResult(userCreated.ToDTO()); + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (InvalidOperationException ex) + { + return new ConflictObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -116,35 +123,38 @@ namespace MyCore.Controllers } - // PUT: User/Update /// - /// + /// Update an user /// + /// User to update [ProducesResponseType(typeof(UserInfoDetailDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpPut] public ObjectResult UpdateUser([FromBody] UserInfo updatedUser) { try { - // TODO ! Add object id verification + if (updatedUser == null) + throw new ArgumentNullException("User param is null"); - if (updatedUser != null) - { - UserInfo user = _userService.GetById(updatedUser.Id); + UserInfo user = _userService.GetById(updatedUser.Id); - if (user != null) - { - return NotFound("The user was not found"); - } + if (user == null) + throw new KeyNotFoundException("User does not exist"); - UserInfo userModified = _userService.Update(updatedUser.Id, updatedUser); + UserInfo userModified = _userService.Update(updatedUser.Id, updatedUser); - return new OkObjectResult(userModified.ToDTO()); - } - else { - // TODO - return new ObjectResult("An error has occurred") { StatusCode = 500 }; - } + return new OkObjectResult(userModified.ToDTO()); + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) {}; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -153,32 +163,39 @@ namespace MyCore.Controllers } - // DELETE: User/Delete + /// + /// Delete an user + /// + /// Id of user to delete + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpDelete("{id}")] public ObjectResult DeleteUser(string id) { try { - // TODO ! Add object id verification + if (id == null) + throw new ArgumentNullException("User param is null"); - if (id != null) - { - UserInfo user = _userService.GetById(id); + UserInfo user = _userService.GetById(id); - if (user != null) - { - return NotFound("The user was not found"); - } + if (user == null) + throw new KeyNotFoundException("User does not exist"); - _userService.Remove(id); + _userService.Remove(id); - return Accepted("The user has been deleted"); - } - else - { - // TODO - return new ObjectResult("An error has occurred") { StatusCode = 500 }; - } + return new ObjectResult("The user has been deleted") { StatusCode = 202 }; + + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) { }; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) { }; } catch (Exception ex) { diff --git a/MyCore/Controllers/RoomController.cs b/MyCore/Controllers/RoomController.cs index a80d897..ba97350 100644 --- a/MyCore/Controllers/RoomController.cs +++ b/MyCore/Controllers/RoomController.cs @@ -42,6 +42,7 @@ namespace MyCore.Service.Controllers /// /// Id of user [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("{userId}")] public ObjectResult GetAll(string userId) { @@ -65,21 +66,32 @@ namespace MyCore.Service.Controllers /// user id /// room id [ProducesResponseType(typeof(RoomDetailDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpGet("detail/{roomId}")] public ObjectResult GetDetail(string userId, string roomId) { try { - if (userId != null && roomId != null) - { - Room room = _RoomDatabaseService.GetById(roomId); - List devices = _DeviceDatabaseService.GetByLocation(room.UserId, roomId); + if (userId == null || roomId == null) + throw new ArgumentNullException("Incorrect parameters"); - return new OkObjectResult(room.ToDTO(devices.Select(d => d.ToDTO()).ToList())); - } - else { - return new ObjectResult("Invalid parameters") { StatusCode = 400 }; - } + Room room = _RoomDatabaseService.GetById(roomId); + if (room == null) + throw new KeyNotFoundException("Room does not exist"); + List devices = _DeviceDatabaseService.GetByLocation(room.UserId, roomId); + + return new OkObjectResult(room.ToDTO(devices.Select(d => d.ToDTO()).ToList())); + + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) { }; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) { }; } catch (Exception ex) { @@ -92,18 +104,24 @@ namespace MyCore.Service.Controllers /// /// Room to create [ProducesResponseType(typeof(RoomDetailDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 500)] [HttpPost] public ObjectResult Create([FromBody] RoomCreateOrUpdateDetailDTO roomCreateOrUpdateDetail) { try { if (roomCreateOrUpdateDetail == null) - throw new KeyNotFoundException("Room is null"); + throw new ArgumentNullException("Incorrect parameters"); RoomDetailDTO roomCreated = RoomService.CreateOrUpdate(this._RoomDatabaseService, this._DeviceDatabaseService, roomCreateOrUpdateDetail.UserId, roomCreateOrUpdateDetail, true); return new OkObjectResult(roomCreated); } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) { }; + } catch (Exception ex) { return new ObjectResult(ex.Message) { StatusCode = 500 }; @@ -115,6 +133,8 @@ namespace MyCore.Service.Controllers /// /// room to update [ProducesResponseType(typeof(RoomCreateOrUpdateDetailDTO), 200)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpPut] public ObjectResult Update([FromBody] RoomCreateOrUpdateDetailDTO roomCreateOrUpdateDetail) { @@ -129,7 +149,7 @@ namespace MyCore.Service.Controllers } catch (KeyNotFoundException ex) { - return new BadRequestObjectResult(ex.Message) { StatusCode = 404 }; + return new NotFoundObjectResult(ex.Message) {}; } catch (Exception ex) { @@ -142,32 +162,47 @@ namespace MyCore.Service.Controllers /// /// Id of device to delete from the room /// Id of room + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpDelete("{roomId}/device/{deviceId}")] public ObjectResult Delete(string deviceId, string roomId) { try { - if (roomId != null && deviceId != null) - { - if (_RoomDatabaseService.IsExist(roomId)) - { - // Update room - Room room = _RoomDatabaseService.GetById(roomId); - room.DevicesIds = room.DevicesIds.Where(d => d != deviceId).ToList(); - room.UpdatedDate = DateTime.Now; - _RoomDatabaseService.Update(room); + if (roomId == null && deviceId == null) + throw new ArgumentNullException("Incorrect parameters"); - // Update device - Device device = _DeviceDatabaseService.GetById(deviceId); - if (device != null) { - device.LocationId = null; - device.UpdatedDate = DateTime.Now; - _DeviceDatabaseService.Update(device); - } - } - } + if (!_RoomDatabaseService.IsExist(roomId)) + throw new KeyNotFoundException("Room does not exist"); - return new OkObjectResult(201); + // Update room + Room room = _RoomDatabaseService.GetById(roomId); + room.DevicesIds = room.DevicesIds.Where(d => d != deviceId).ToList(); + room.UpdatedDate = DateTime.Now; + _RoomDatabaseService.Update(room); + + // Update device + Device device = _DeviceDatabaseService.GetById(deviceId); + + if (device == null) + throw new KeyNotFoundException("Device does not exist"); + + device.LocationId = null; + device.UpdatedDate = DateTime.Now; + _DeviceDatabaseService.Update(device); + + + return new OkObjectResult("Device has been removed from specified room") { StatusCode = 202 }; + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) { }; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) { }; } catch (Exception ex) { @@ -179,30 +214,42 @@ namespace MyCore.Service.Controllers /// Delete a room /// /// Id of room to delete + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpDelete("{roomId}")] public ObjectResult Delete(string roomId) { try { - if (roomId != null) - { - if (_RoomDatabaseService.IsExist(roomId)) - { - Room room = _RoomDatabaseService.GetById(roomId); - // Delete location from all devices - List devices = _DeviceDatabaseService.GetByLocation(room.UserId, roomId); - foreach (var device in devices) - { - device.LocationId = null; - device.UpdatedDate = DateTime.Now; - _DeviceDatabaseService.Update(device); - } - // Delete room - _RoomDatabaseService.Remove(roomId); - } - } + if (roomId == null) + throw new ArgumentNullException("Incorrect parameters"); + + if (!_RoomDatabaseService.IsExist(roomId)) + throw new KeyNotFoundException("Room does not exist"); - return new OkObjectResult(201); + Room room = _RoomDatabaseService.GetById(roomId); + // Delete location from all devices + List devices = _DeviceDatabaseService.GetByLocation(room.UserId, roomId); + foreach (var device in devices) + { + device.LocationId = null; + device.UpdatedDate = DateTime.Now; + _DeviceDatabaseService.Update(device); + } + // Delete room + _RoomDatabaseService.Remove(roomId); + + return new OkObjectResult("Room has been successfully deleted") { StatusCode = 202 }; + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) { }; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) { }; } catch (Exception ex) { @@ -211,23 +258,35 @@ namespace MyCore.Service.Controllers } /// - /// Delete all room for a specified + /// Delete all room for a specified user /// /// Id of user + [ProducesResponseType(typeof(string), 202)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] [HttpDelete("user/{userId}")] public ObjectResult DeleteAllForUser(string userId) { try { - if (userId != null) - { - if (_UserDatabaseService.IsExist(userId)) - { - _RoomDatabaseService.RemoveForUser(userId); - } - } + if (userId == null) + throw new ArgumentNullException("Incorrect parameters"); - return new OkObjectResult(201); + if (!_UserDatabaseService.IsExist(userId)) + throw new KeyNotFoundException("User does not exist"); + + _RoomDatabaseService.RemoveForUser(userId); + + return new OkObjectResult("All room associated to specified user has been removed") { StatusCode = 202 }; + } + catch (ArgumentNullException ex) + { + return new BadRequestObjectResult(ex.Message) { }; + } + catch (KeyNotFoundException ex) + { + return new NotFoundObjectResult(ex.Message) { }; } catch (Exception ex) { diff --git a/MyCore/Extensions/MqttClientMerossService.cs b/MyCore/Extensions/MqttClientMerossService.cs index b414735..4cadd0b 100644 --- a/MyCore/Extensions/MqttClientMerossService.cs +++ b/MyCore/Extensions/MqttClientMerossService.cs @@ -108,7 +108,7 @@ namespace Mqtt.Client.AspNetCore.Services throw new AuthenticationException("Bad service username or password"); } - string stringForMD5 = resultToken.userid + resultToken.key; + string stringForMD5 = resultToken?.userid + resultToken?.key; string hashed_password = CreateMD5(stringForMD5).ToLower(); // Check if we can hardcode it -> seems ok 20/01/2020 @@ -117,13 +117,13 @@ namespace Mqtt.Client.AspNetCore.Services GenerateClientAndAppId(uuid); options = new MqttClientOptionsBuilder() - .WithClientId(clientId) - .WithTcpServer(domain, port) - .WithCredentials(resultToken.userid, hashed_password) - .WithCleanSession() - .WithTls() - .WithProtocolVersion(MqttProtocolVersion.V311) - .Build(); + .WithClientId(clientId) + .WithTcpServer(domain, port) + .WithCredentials(resultToken?.userid, hashed_password) + .WithCleanSession() + .WithTls() + .WithProtocolVersion(MqttProtocolVersion.V311) + .Build(); client = new MqttFactory().CreateMqttClient(); @@ -256,35 +256,43 @@ namespace Mqtt.Client.AspNetCore.Services var message = BuildMQTTMessage(method, namespaceVar, payloadVar); - PublishMessage(topic, message); + if (message != null) { + PublishMessage(topic, message); + } } private static string BuildMQTTMessage(Method method, string namespaceVar, string payloadVar) { HeaderMqtt headerMqtt = new HeaderMqtt(); - headerMqtt.from = $"/app/{resultToken.userid}-{appId.ToLower()}/subscribe"; - headerMqtt.messageId = CreateMD5(GenerateNonce(16).ToUpper()).ToLower(); - headerMqtt.method = method.ToString(); - headerMqtt.Namespace = namespaceVar; - headerMqtt.payloadVersion = 1; - headerMqtt.timestamp = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds(); - headerMqtt.sign = CreateMD5($"{headerMqtt.messageId}{resultToken.key}{(headerMqtt.timestamp).ToString()}").ToLower(); + if (resultToken != null) + { + headerMqtt.from = $"/app/{resultToken.userid}-{appId.ToLower()}/subscribe"; + headerMqtt.messageId = CreateMD5(GenerateNonce(16).ToUpper()).ToLower(); + headerMqtt.method = method.ToString(); + headerMqtt.Namespace = namespaceVar; + headerMqtt.payloadVersion = 1; + headerMqtt.timestamp = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds(); + headerMqtt.sign = CreateMD5($"{headerMqtt.messageId}{resultToken.key}{(headerMqtt.timestamp).ToString()}").ToLower(); - RequestMQTT requestMQTT = new RequestMQTT(); - requestMQTT.header = headerMqtt; - if (payloadVar != null) - requestMQTT.payload = JsonConvert.DeserializeObject(payloadVar); - else - requestMQTT.payload = new Object(); + RequestMQTT requestMQTT = new RequestMQTT(); + requestMQTT.header = headerMqtt; + if (payloadVar != null) + requestMQTT.payload = JsonConvert.DeserializeObject(payloadVar); + else + requestMQTT.payload = new Object(); - var data = JsonConvert.SerializeObject(requestMQTT); + var data = JsonConvert.SerializeObject(requestMQTT); - // Change Namespace to namespace - data = data.Replace("Namespace", "namespace"); + // Change Namespace to namespace + data = data.Replace("Namespace", "namespace"); - return data; + return data; + } + else { + return null; + } } public async Task HandleDisconnectedAsync(MqttClientDisconnectedEventArgs eventArgs) diff --git a/MyCore/Services/Devices/ActionService.cs b/MyCore/Services/Devices/ActionService.cs index 3093c70..3d71d17 100644 --- a/MyCore/Services/Devices/ActionService.cs +++ b/MyCore/Services/Devices/ActionService.cs @@ -226,10 +226,10 @@ namespace MyCore.Services.Devices System.Console.WriteLine($"Yeelight type !"); // Get device last state - var dic = new List(); + var dic = new List(); if (actionDeviceToTest.LastState != null) { - dic = JsonConvert.DeserializeObject>(actionDeviceToTest.LastState); + dic = JsonConvert.DeserializeObject>(actionDeviceToTest.LastState); } try @@ -628,8 +628,8 @@ namespace MyCore.Services.Devices if (zigbeeDevice != null && eventConvert.type == "device_announce") // Check if we can not hardcode that.. { - var status = new List(); - var state = new State(); + var status = new List(); + var state = new AutomationState(); state.Name = "state"; state.Value = "on"; status.Add(state); diff --git a/MyCore/Services/Devices/DeviceService.cs b/MyCore/Services/Devices/DeviceService.cs index db5c9c2..febca9f 100644 --- a/MyCore/Services/Devices/DeviceService.cs +++ b/MyCore/Services/Devices/DeviceService.cs @@ -315,7 +315,7 @@ namespace MyCore.Services.Devices properties.Add("presignedLastImageUrl", arlo.presignedLastImageUrl); properties.Add("presignedFullFrameSnapshotUrl", arlo.presignedFullFrameSnapshotUrl); properties.Add("presignedSnapshotUrl", arlo.presignedSnapshotUrl); - deviceDetailDTO.Properties = properties; + deviceDetailDTO.Properties = JsonConvert.SerializeObject(properties); break; case "siren": deviceDetailDTO.Type = DeviceType.Sound; @@ -420,7 +420,7 @@ namespace MyCore.Services.Devices { properties.Add(property.Key, property.Value); } - deviceDetailDTO.Properties = properties; + deviceDetailDTO.Properties = JsonConvert.SerializeObject(properties); List supportedOperationsDTO = new List(); foreach (var supportedOperation in light.SupportedOperations) { diff --git a/MyCore/Services/MyControlPanel/Database/LocationDatabaseService.cs b/MyCore/Services/MyControlPanel/Database/LocationDatabaseService.cs index bb059cf..ed5c5c1 100644 --- a/MyCore/Services/MyControlPanel/Database/LocationDatabaseService.cs +++ b/MyCore/Services/MyControlPanel/Database/LocationDatabaseService.cs @@ -10,36 +10,36 @@ namespace MyCore.Services.MyControlPanel { public class LocationDatabaseService { - private readonly IMongoCollection _Locations; + private readonly IMongoCollection _Locations; public LocationDatabaseService(IConfiguration config) { var client = new MongoClient(config.GetConnectionString("MyCoreDb")); var database = client.GetDatabase("MyCoreDb"); - _Locations = database.GetCollection("Locations"); + _Locations = database.GetCollection("Locations"); } - public List GetAll() + public List GetAll() { return _Locations.Find(l => true).ToList(); } - public Location GetById(string id) + public Place GetById(string id) { - return _Locations.Find(l => l.Id == id).FirstOrDefault(); + return _Locations.Find(l => l.Id == id).FirstOrDefault(); } public bool IsExist(string id) { - return _Locations.Find(p => p.Id == id).FirstOrDefault() != null ? true : false; + return _Locations.Find(p => p.Id == id).FirstOrDefault() != null ? true : false; } - public Location Create(Location location) + public Place Create(Place location) { _Locations.InsertOne(location); return location; } - public Location Update(string id, Location locationIn) + public Place Update(string id, Place locationIn) { _Locations.ReplaceOne(location => location.Id == id, locationIn); return locationIn; diff --git a/MyCore/Services/MyControlPanel/Database/ScreenDeviceDatabaseService.cs b/MyCore/Services/MyControlPanel/Database/ScreenDeviceDatabaseService.cs index f3d6b3a..6d8f1bd 100644 --- a/MyCore/Services/MyControlPanel/Database/ScreenDeviceDatabaseService.cs +++ b/MyCore/Services/MyControlPanel/Database/ScreenDeviceDatabaseService.cs @@ -29,6 +29,11 @@ namespace MyCore.Services return _screenDevices.Find(m => m.Id == id).FirstOrDefault(); } + public bool IsExist(string id) + { + return _screenDevices.Find(d => d.Id == id).FirstOrDefault() != null ? true : false; + } + public ScreenDevice Create(ScreenDevice device) { _screenDevices.InsertOne(device); diff --git a/MyCore/Services/TokensService.cs b/MyCore/Services/TokensService.cs index e7cb3ac..f258b5d 100644 --- a/MyCore/Services/TokensService.cs +++ b/MyCore/Services/TokensService.cs @@ -84,11 +84,11 @@ namespace MyCore.Service.Services scope = Security.Scope }; } - /*catch (UnauthorizedAccessException ex) + catch (UnauthorizedAccessException ex) { _logger?.LogError(ex, $"Authenticate error for user '{email}': unauthorized access"); throw; - }*/ + } catch (Exception ex) { _logger?.LogError(ex, $"Authenticate error for user '{email}': {ex.Message}"); diff --git a/Test service generation - dart/.openapi-generator/FILES b/Test service generation - dart/.openapi-generator/FILES index abba30d..56810a6 100644 --- a/Test service generation - dart/.openapi-generator/FILES +++ b/Test service generation - dart/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore .travis.yml README.md doc/Action.md @@ -12,6 +11,7 @@ doc/AutomationCreateOrUpdateDetailDTOAllOf.md doc/AutomationDTO.md doc/AutomationDetailDTO.md doc/AutomationDetailDTOAllOf.md +doc/AutomationState.md doc/AzureADAuthModel.md doc/AzureApi.md doc/Book.md @@ -47,8 +47,8 @@ doc/MQTTApi.md doc/MeansOfCommunication.md doc/MqttMessageDTO.md doc/OddApi.md -doc/OddH2H.md doc/OddNice.md +doc/OddObject.md doc/PanelMenuItem.md doc/PanelSection.md doc/Provider.md @@ -61,10 +61,11 @@ doc/RoomSummaryDTO.md doc/ScreenConfiguration.md doc/ScreenDevice.md doc/ScreenDeviceApi.md +doc/ScreenWidget.md doc/SmartGardenMessage.md doc/SmartPrinterMessage.md -doc/State.md doc/TokenApi.md +doc/TokenDTO.md doc/Trigger.md doc/TriggerType.md doc/TwitterApi.md @@ -75,7 +76,6 @@ doc/UserInfo.md doc/UserInfoDetailDTO.md doc/ValuesApi.md doc/ViewBy.md -doc/Widget.md git_push.sh lib/api.dart lib/api/authentication_api.dart @@ -114,6 +114,7 @@ lib/model/automation_create_or_update_detail_dto_all_of.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/azure_ad_auth_model.dart lib/model/book.dart lib/model/condition.dart @@ -138,8 +139,8 @@ lib/model/location_dto.dart lib/model/login_dto.dart lib/model/means_of_communication.dart lib/model/mqtt_message_dto.dart -lib/model/odd_h2_h.dart lib/model/odd_nice.dart +lib/model/odd_object.dart lib/model/panel_menu_item.dart lib/model/panel_section.dart lib/model/provider.dart @@ -149,9 +150,10 @@ 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/state.dart +lib/model/token_dto.dart lib/model/trigger.dart lib/model/trigger_type.dart lib/model/twitter_auth_model.dart @@ -159,79 +161,4 @@ lib/model/user.dart lib/model/user_info.dart lib/model/user_info_detail_dto.dart lib/model/view_by.dart -lib/model/widget.dart pubspec.yaml -test/action_test.dart -test/action_type_test.dart -test/authentication_api_test.dart -test/automation_api_test.dart -test/automation_create_or_update_detail_dto_all_of_test.dart -test/automation_create_or_update_detail_dto_test.dart -test/automation_detail_dto_all_of_test.dart -test/automation_detail_dto_test.dart -test/automation_dto_test.dart -test/automation_test.dart -test/azure_ad_auth_model_test.dart -test/azure_api_test.dart -test/book_test.dart -test/books_api_test.dart -test/condition_test.dart -test/condition_type_test.dart -test/condition_value_test.dart -test/connection_status_test.dart -test/device_api_test.dart -test/device_detail_dto_all_of_test.dart -test/device_detail_dto_test.dart -test/device_summary_dto_test.dart -test/device_test.dart -test/device_type_test.dart -test/electricity_production_test.dart -test/energy_api_test.dart -test/facebook_api_test.dart -test/facebook_auth_model_test.dart -test/google_api_test.dart -test/google_auth_model_test.dart -test/group_api_test.dart -test/group_create_or_update_detail_dto_all_of_test.dart -test/group_create_or_update_detail_dto_test.dart -test/group_detail_dto_all_of_test.dart -test/group_detail_dto_test.dart -test/group_summary_dto_test.dart -test/group_test.dart -test/iot_api_test.dart -test/layout_api_test.dart -test/location_dto_test.dart -test/login_dto_test.dart -test/means_of_communication_test.dart -test/mqtt_api_test.dart -test/mqtt_message_dto_test.dart -test/odd_api_test.dart -test/odd_h2_h_test.dart -test/odd_nice_test.dart -test/panel_menu_item_test.dart -test/panel_section_test.dart -test/provider_api_test.dart -test/provider_dto_test.dart -test/provider_test.dart -test/room_api_test.dart -test/room_create_or_update_detail_dto_test.dart -test/room_detail_dto_test.dart -test/room_summary_dto_test.dart -test/screen_configuration_test.dart -test/screen_device_api_test.dart -test/screen_device_test.dart -test/smart_garden_message_test.dart -test/smart_printer_message_test.dart -test/state_test.dart -test/token_api_test.dart -test/trigger_test.dart -test/trigger_type_test.dart -test/twitter_api_test.dart -test/twitter_auth_model_test.dart -test/user_api_test.dart -test/user_info_detail_dto_test.dart -test/user_info_test.dart -test/user_test.dart -test/values_api_test.dart -test/view_by_test.dart -test/widget_test.dart diff --git a/Test service generation - dart/README.md b/Test service generation - dart/README.md index 220e744..476995d 100644 --- a/Test service generation - dart/README.md +++ b/Test service generation - dart/README.md @@ -60,13 +60,13 @@ try { ## Documentation for API Endpoints -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *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 | +*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 @@ -81,7 +81,7 @@ Class | Method | HTTP request | Description *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* | [**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 +*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* | [**deviceGetDetail**](doc\/DeviceApi.md#devicegetdetail) | **GET** /api/device/detail/{deviceId} | Get a specific device info @@ -116,23 +116,23 @@ Class | Method | HTTP request | Description *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 +*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* | [**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 | -*ScreenDeviceApi* | [**screenDeviceDeleteDevice**](doc\/ScreenDeviceApi.md#screendevicedeletedevice) | **DELETE** /api/device/screen/{deviceId} | -*ScreenDeviceApi* | [**screenDeviceGetAllScreenDevices**](doc\/ScreenDeviceApi.md#screendevicegetallscreendevices) | **GET** /api/device/screen | -*ScreenDeviceApi* | [**screenDeviceGetDeviceInfo**](doc\/ScreenDeviceApi.md#screendevicegetdeviceinfo) | **GET** /api/device/screen/{screenDeviceId} | -*ScreenDeviceApi* | [**screenDeviceUpdateDevice**](doc\/ScreenDeviceApi.md#screendeviceupdatedevice) | **PUT** /api/device/screen/{screenDeviceId} | -*TokenApi* | [**tokenConnectUser**](doc\/TokenApi.md#tokenconnectuser) | **POST** /api/token | +*ScreenDeviceApi* | [**screenDeviceCreateDevice**](doc\/ScreenDeviceApi.md#screendevicecreatedevice) | **POST** /api/device/screen | Create screen device +*ScreenDeviceApi* | [**screenDeviceDeleteDevice**](doc\/ScreenDeviceApi.md#screendevicedeletedevice) | **DELETE** /api/device/screen/{deviceId} | Delete device +*ScreenDeviceApi* | [**screenDeviceGetAllScreenDevices**](doc\/ScreenDeviceApi.md#screendevicegetallscreendevices) | **GET** /api/device/screen | Get all screen devices +*ScreenDeviceApi* | [**screenDeviceGetDeviceInfo**](doc\/ScreenDeviceApi.md#screendevicegetdeviceinfo) | **GET** /api/device/screen/{screenDeviceId} | Get screen device info +*ScreenDeviceApi* | [**screenDeviceUpdateDevice**](doc\/ScreenDeviceApi.md#screendeviceupdatedevice) | **PUT** /api/device/screen | Update screen device +*TokenApi* | [**tokenConnectUser**](doc\/TokenApi.md#tokenconnectuser) | **POST** /api/token | Connect user *TokenApi* | [**tokenCreate**](doc\/TokenApi.md#tokencreate) | **POST** /token | *TwitterApi* | [**twitterCreate**](doc\/TwitterApi.md#twittercreate) | **POST** /twitter | -*UserApi* | [**userCreateUser**](doc\/UserApi.md#usercreateuser) | **POST** /api/user | -*UserApi* | [**userDeleteUser**](doc\/UserApi.md#userdeleteuser) | **DELETE** /api/user/{id} | -*UserApi* | [**userGet**](doc\/UserApi.md#userget) | **GET** /api/user | Get a list of user -*UserApi* | [**userGet2**](doc\/UserApi.md#userget2) | **GET** /api/user/{id} | Get a specific user -*UserApi* | [**userUpdateUser**](doc\/UserApi.md#userupdateuser) | **PUT** /api/user | +*UserApi* | [**userCreateUser**](doc\/UserApi.md#usercreateuser) | **POST** /api/user | Create an user +*UserApi* | [**userDeleteUser**](doc\/UserApi.md#userdeleteuser) | **DELETE** /api/user/{id} | Delete an user +*UserApi* | [**userGet**](doc\/UserApi.md#userget) | **GET** /api/user/{id} | Get a specific user +*UserApi* | [**userGetAll**](doc\/UserApi.md#usergetall) | **GET** /api/user | Get a list of user +*UserApi* | [**userUpdateUser**](doc\/UserApi.md#userupdateuser) | **PUT** /api/user | Update an user *ValuesApi* | [**valuesDelete**](doc\/ValuesApi.md#valuesdelete) | **DELETE** /api/test/{id} | *ValuesApi* | [**valuesGet**](doc\/ValuesApi.md#valuesget) | **GET** /api/test/{id} | *ValuesApi* | [**valuesGetAll**](doc\/ValuesApi.md#valuesgetall) | **GET** /api/test | It's a test ! :) @@ -150,6 +150,7 @@ Class | Method | HTTP request | Description - [AutomationDTO](doc\/AutomationDTO.md) - [AutomationDetailDTO](doc\/AutomationDetailDTO.md) - [AutomationDetailDTOAllOf](doc\/AutomationDetailDTOAllOf.md) + - [AutomationState](doc\/AutomationState.md) - [AzureADAuthModel](doc\/AzureADAuthModel.md) - [Book](doc\/Book.md) - [Condition](doc\/Condition.md) @@ -174,8 +175,8 @@ Class | Method | HTTP request | Description - [LoginDTO](doc\/LoginDTO.md) - [MeansOfCommunication](doc\/MeansOfCommunication.md) - [MqttMessageDTO](doc\/MqttMessageDTO.md) - - [OddH2H](doc\/OddH2H.md) - [OddNice](doc\/OddNice.md) + - [OddObject](doc\/OddObject.md) - [PanelMenuItem](doc\/PanelMenuItem.md) - [PanelSection](doc\/PanelSection.md) - [Provider](doc\/Provider.md) @@ -185,9 +186,10 @@ Class | Method | HTTP request | Description - [RoomSummaryDTO](doc\/RoomSummaryDTO.md) - [ScreenConfiguration](doc\/ScreenConfiguration.md) - [ScreenDevice](doc\/ScreenDevice.md) + - [ScreenWidget](doc\/ScreenWidget.md) - [SmartGardenMessage](doc\/SmartGardenMessage.md) - [SmartPrinterMessage](doc\/SmartPrinterMessage.md) - - [State](doc\/State.md) + - [TokenDTO](doc\/TokenDTO.md) - [Trigger](doc\/Trigger.md) - [TriggerType](doc\/TriggerType.md) - [TwitterAuthModel](doc\/TwitterAuthModel.md) @@ -195,7 +197,6 @@ Class | Method | HTTP request | Description - [UserInfo](doc\/UserInfo.md) - [UserInfoDetailDTO](doc\/UserInfoDetailDTO.md) - [ViewBy](doc\/ViewBy.md) - - [Widget](doc\/Widget.md) ## Documentation For Authorization diff --git a/Test service generation - dart/doc/Action.md b/Test service generation - dart/doc/Action.md index cccb51a..0b51014 100644 --- a/Test service generation - dart/doc/Action.md +++ b/Test service generation - dart/doc/Action.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **groupId** | **String** | | [optional] **deviceId** | **String** | | [optional] -**states** | [**List**](State.md) | | [optional] [default to const []] +**states** | [**List**](AutomationState.md) | | [optional] [default to const []] **rawRequest** | **String** | | [optional] **providerId** | **String** | | [optional] **type** | [**ActionType**](ActionType.md) | | [optional] diff --git a/Test service generation - dart/doc/AuthenticationApi.md b/Test service generation - dart/doc/AuthenticationApi.md index 19d7b68..f60de40 100644 --- a/Test service generation - dart/doc/AuthenticationApi.md +++ b/Test service generation - dart/doc/AuthenticationApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -14,7 +14,7 @@ Method | HTTP request | Description # **authenticationAuthenticateWithForm** -> LoginDTO authenticationAuthenticateWithForm(grantType, username, password, clientId, clientSecret) +> TokenDTO authenticationAuthenticateWithForm(grantType, username, password, clientId, clientSecret) Authenticate with form parameters (used by Swagger test client) @@ -51,7 +51,7 @@ Name | Type | Description | Notes ### Return type -[**LoginDTO**](LoginDTO.md) +[**TokenDTO**](TokenDTO.md) ### Authorization diff --git a/Test service generation - dart/doc/Automation.md b/Test service generation - dart/doc/Automation.md index 7f21f61..c45de7e 100644 --- a/Test service generation - dart/doc/Automation.md +++ b/Test service generation - dart/doc/Automation.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **id** | **String** | | [optional] **userId** | **String** | | [optional] **name** | **String** | | [optional] +**active** | **bool** | | [optional] **createdDate** | [**DateTime**](DateTime.md) | | [optional] **updatedDate** | [**DateTime**](DateTime.md) | | [optional] **triggers** | [**List**](Trigger.md) | | [optional] [default to const []] diff --git a/Test service generation - dart/doc/AutomationApi.md b/Test service generation - dart/doc/AutomationApi.md index 222ff90..3ed0854 100644 --- a/Test service generation - dart/doc/AutomationApi.md +++ b/Test service generation - dart/doc/AutomationApi.md @@ -5,11 +5,11 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- -[**automationCreate**](AutomationApi.md#automationcreate) | **POST** /api/automation | +[**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 @@ -20,7 +20,7 @@ Method | HTTP request | Description # **automationCreate** > AutomationDTO automationCreate(automationCreateOrUpdateDetailDTO) - +Create an automation ### Example ```dart @@ -29,7 +29,7 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = AutomationApi(); -final automationCreateOrUpdateDetailDTO = AutomationCreateOrUpdateDetailDTO(); // AutomationCreateOrUpdateDetailDTO | +final automationCreateOrUpdateDetailDTO = AutomationCreateOrUpdateDetailDTO(); // AutomationCreateOrUpdateDetailDTO | Automation to create try { final result = api_instance.automationCreate(automationCreateOrUpdateDetailDTO); @@ -43,7 +43,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **automationCreateOrUpdateDetailDTO** | [**AutomationCreateOrUpdateDetailDTO**](AutomationCreateOrUpdateDetailDTO.md)| | + **automationCreateOrUpdateDetailDTO** | [**AutomationCreateOrUpdateDetailDTO**](AutomationCreateOrUpdateDetailDTO.md)| Automation to create | ### Return type @@ -61,7 +61,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) # **automationDelete** -> MultipartFile automationDelete(automationId) +> String automationDelete(automationId) Delete an automation @@ -90,7 +90,7 @@ Name | Type | Description | Notes ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -99,12 +99,12 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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) # **automationDeleteAllForUser** -> MultipartFile automationDeleteAllForUser(userId) +> String automationDeleteAllForUser(userId) Delete all automation for a specified @@ -133,7 +133,7 @@ Name | Type | Description | Notes ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -142,7 +142,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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/Test service generation - dart/doc/AutomationCreateOrUpdateDetailDTO.md b/Test service generation - dart/doc/AutomationCreateOrUpdateDetailDTO.md index 0914263..55af5f8 100644 --- a/Test service generation - dart/doc/AutomationCreateOrUpdateDetailDTO.md +++ b/Test service generation - dart/doc/AutomationCreateOrUpdateDetailDTO.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] **name** | **String** | | [optional] +**active** | **bool** | | [optional] **userId** | **String** | | [optional] **createdDate** | [**DateTime**](DateTime.md) | | [optional] **updatedDate** | [**DateTime**](DateTime.md) | | [optional] diff --git a/Test service generation - dart/doc/AutomationDTO.md b/Test service generation - dart/doc/AutomationDTO.md index c1af32f..5e17714 100644 --- a/Test service generation - dart/doc/AutomationDTO.md +++ b/Test service generation - dart/doc/AutomationDTO.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] **name** | **String** | | [optional] +**active** | **bool** | | [optional] **userId** | **String** | | [optional] **createdDate** | [**DateTime**](DateTime.md) | | [optional] **updatedDate** | [**DateTime**](DateTime.md) | | [optional] diff --git a/Test service generation - dart/doc/AutomationDetailDTO.md b/Test service generation - dart/doc/AutomationDetailDTO.md index f5aedde..0ad0030 100644 --- a/Test service generation - dart/doc/AutomationDetailDTO.md +++ b/Test service generation - dart/doc/AutomationDetailDTO.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] **name** | **String** | | [optional] +**active** | **bool** | | [optional] **userId** | **String** | | [optional] **createdDate** | [**DateTime**](DateTime.md) | | [optional] **updatedDate** | [**DateTime**](DateTime.md) | | [optional] diff --git a/Test service generation - dart/doc/AutomationState.md b/Test service generation - dart/doc/AutomationState.md new file mode 100644 index 0000000..dcd8a45 --- /dev/null +++ b/Test service generation - dart/doc/AutomationState.md @@ -0,0 +1,16 @@ +# mycoreapi.model.AutomationState + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] +**value** | **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/Test service generation - dart/doc/AzureApi.md b/Test service generation - dart/doc/AzureApi.md index 53812e2..fddaa58 100644 --- a/Test service generation - dart/doc/AzureApi.md +++ b/Test service generation - dart/doc/AzureApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/Test service generation - dart/doc/BooksApi.md b/Test service generation - dart/doc/BooksApi.md index f3af77f..640b94a 100644 --- a/Test service generation - dart/doc/BooksApi.md +++ b/Test service generation - dart/doc/BooksApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/Test service generation - dart/doc/Condition.md b/Test service generation - dart/doc/Condition.md index 0d14c7a..3268817 100644 --- a/Test service generation - dart/doc/Condition.md +++ b/Test service generation - dart/doc/Condition.md @@ -9,7 +9,7 @@ import 'package:mycoreapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **deviceId** | **String** | | [optional] -**state** | [**OneOfState**](OneOfState.md) | | [optional] +**state** | [**OneOfAutomationState**](OneOfAutomationState.md) | | [optional] **startTime** | **String** | | [optional] **endTime** | **String** | | [optional] **type** | [**ConditionType**](ConditionType.md) | | [optional] diff --git a/Test service generation - dart/doc/DeviceApi.md b/Test service generation - dart/doc/DeviceApi.md index 9f7b8d5..2af1629 100644 --- a/Test service generation - dart/doc/DeviceApi.md +++ b/Test service generation - dart/doc/DeviceApi.md @@ -5,14 +5,14 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* 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 [**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 +[**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 [**deviceGetDetail**](DeviceApi.md#devicegetdetail) | **GET** /api/device/detail/{deviceId} | Get a specific device info @@ -111,7 +111,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) # **deviceDelete** -> MultipartFile deviceDelete(deviceId) +> String deviceDelete(deviceId) Delete a device @@ -140,7 +140,7 @@ Name | Type | Description | Notes ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -149,14 +149,14 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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) # **deviceDeleteAllForUser** -> MultipartFile deviceDeleteAllForUser(userId) +> String deviceDeleteAllForUser(userId) -Delete all device for a specified +Delete all device for a specified user ### Example ```dart @@ -183,7 +183,7 @@ Name | Type | Description | Notes ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -192,12 +192,12 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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) # **deviceDeleteDevicesFromProvider** -> MultipartFile deviceDeleteDevicesFromProvider(userId, providerId) +> String deviceDeleteDevicesFromProvider(userId, providerId) Delete devices from provider @@ -228,7 +228,7 @@ Name | Type | Description | Notes ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -237,7 +237,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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/Test service generation - dart/doc/EnergyApi.md b/Test service generation - dart/doc/EnergyApi.md index 44c4290..bc037ab 100644 --- a/Test service generation - dart/doc/EnergyApi.md +++ b/Test service generation - dart/doc/EnergyApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/Test service generation - dart/doc/FacebookApi.md b/Test service generation - dart/doc/FacebookApi.md index 189a21b..6683ab2 100644 --- a/Test service generation - dart/doc/FacebookApi.md +++ b/Test service generation - dart/doc/FacebookApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/Test service generation - dart/doc/GoogleApi.md b/Test service generation - dart/doc/GoogleApi.md index 29e2edb..783c600 100644 --- a/Test service generation - dart/doc/GoogleApi.md +++ b/Test service generation - dart/doc/GoogleApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/Test service generation - dart/doc/GroupApi.md b/Test service generation - dart/doc/GroupApi.md index 814bf73..bcf716e 100644 --- a/Test service generation - dart/doc/GroupApi.md +++ b/Test service generation - dart/doc/GroupApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -108,7 +108,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) # **groupDelete** -> MultipartFile groupDelete(deviceId, groupId) +> String groupDelete(deviceId, groupId) Delete device from a group @@ -139,7 +139,7 @@ Name | Type | Description | Notes ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -148,12 +148,12 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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) # **groupDelete2** -> MultipartFile groupDelete2(groupId) +> String groupDelete2(groupId) Delete a group @@ -182,7 +182,7 @@ Name | Type | Description | Notes ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -191,12 +191,12 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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) # **groupDeleteAllForUser** -> MultipartFile groupDeleteAllForUser(userId) +> String groupDeleteAllForUser(userId) Delete all group for a specified @@ -225,7 +225,7 @@ Name | Type | Description | Notes ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -234,7 +234,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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) @@ -282,7 +282,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) # **groupGetDetail** -> GroupDetailDTO groupGetDetail(groupId, userId) +> GroupDetailDTO groupGetDetail(groupId) Get detail info of a specified group @@ -294,10 +294,9 @@ import 'package:mycoreapi/api.dart'; final api_instance = GroupApi(); final groupId = groupId_example; // String | groupid -final userId = userId_example; // String | user id try { - final result = api_instance.groupGetDetail(groupId, userId); + final result = api_instance.groupGetDetail(groupId); print(result); } catch (e) { print('Exception when calling GroupApi->groupGetDetail: $e\n'); @@ -309,7 +308,6 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **groupId** | **String**| groupid | - **userId** | **String**| user id | [optional] ### Return type diff --git a/Test service generation - dart/doc/IOTApi.md b/Test service generation - dart/doc/IOTApi.md index c999c1f..519e912 100644 --- a/Test service generation - dart/doc/IOTApi.md +++ b/Test service generation - dart/doc/IOTApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/Test service generation - dart/doc/LayoutApi.md b/Test service generation - dart/doc/LayoutApi.md index facfb02..dd7d018 100644 --- a/Test service generation - dart/doc/LayoutApi.md +++ b/Test service generation - dart/doc/LayoutApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/Test service generation - dart/doc/MQTTApi.md b/Test service generation - dart/doc/MQTTApi.md index 4d42331..e8ca3ed 100644 --- a/Test service generation - dart/doc/MQTTApi.md +++ b/Test service generation - dart/doc/MQTTApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/Test service generation - dart/doc/OddApi.md b/Test service generation - dart/doc/OddApi.md index 64f416c..307d47e 100644 --- a/Test service generation - dart/doc/OddApi.md +++ b/Test service generation - dart/doc/OddApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/Test service generation - dart/doc/OddNice.md b/Test service generation - dart/doc/OddNice.md index 40a7bb7..de75aaa 100644 --- a/Test service generation - dart/doc/OddNice.md +++ b/Test service generation - dart/doc/OddNice.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **teams** | **List** | | [optional] [default to const []] **commenceTime** | **int** | | [optional] **homeTeam** | **String** | | [optional] -**odds** | [**OneOfOddH2H**](OneOfOddH2H.md) | | [optional] +**odds** | [**OneOfOddObject**](OneOfOddObject.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/Test service generation - dart/doc/OddObject.md b/Test service generation - dart/doc/OddObject.md new file mode 100644 index 0000000..5204f6b --- /dev/null +++ b/Test service generation - dart/doc/OddObject.md @@ -0,0 +1,17 @@ +# mycoreapi.model.OddObject + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**homeOdd** | **double** | | [optional] +**drawOdd** | **double** | | [optional] +**visitOdd** | **double** | | [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/Test service generation - dart/doc/ProviderApi.md b/Test service generation - dart/doc/ProviderApi.md index bb566cc..96068a7 100644 --- a/Test service generation - dart/doc/ProviderApi.md +++ b/Test service generation - dart/doc/ProviderApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -59,7 +59,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) # **providerDelete** -> MultipartFile providerDelete(providerId) +> String providerDelete(providerId) Delete a provider @@ -88,7 +88,7 @@ Name | Type | Description | Notes ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -97,7 +97,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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) @@ -113,7 +113,7 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = ProviderApi(); -final userId = userId_example; // String | +final userId = userId_example; // String | Id of user try { final result = api_instance.providerGetAll(userId); @@ -127,7 +127,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userId** | **String**| | + **userId** | **String**| Id of user | ### Return type diff --git a/Test service generation - dart/doc/RoomApi.md b/Test service generation - dart/doc/RoomApi.md index 3b7deb5..77f2099 100644 --- a/Test service generation - dart/doc/RoomApi.md +++ b/Test service generation - dart/doc/RoomApi.md @@ -5,14 +5,14 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* 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 +[**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 [**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 @@ -62,7 +62,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) # **roomDelete** -> MultipartFile roomDelete(deviceId, roomId) +> String roomDelete(deviceId, roomId) Delete device from a room @@ -93,7 +93,7 @@ Name | Type | Description | Notes ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -102,12 +102,12 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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) # **roomDelete2** -> MultipartFile roomDelete2(roomId) +> String roomDelete2(roomId) Delete a room @@ -136,7 +136,7 @@ Name | Type | Description | Notes ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -145,14 +145,14 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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) # **roomDeleteAllForUser** -> MultipartFile roomDeleteAllForUser(userId) +> String roomDeleteAllForUser(userId) -Delete all room for a specified +Delete all room for a specified user ### Example ```dart @@ -179,7 +179,7 @@ Name | Type | Description | Notes ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -188,7 +188,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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/Test service generation - dart/doc/ScreenConfiguration.md b/Test service generation - dart/doc/ScreenConfiguration.md index 131ec98..1afefbb 100644 --- a/Test service generation - dart/doc/ScreenConfiguration.md +++ b/Test service generation - dart/doc/ScreenConfiguration.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **id** | **String** | | [optional] **name** | **String** | | [optional] **type** | **String** | | [optional] -**widgets** | [**List**](Widget.md) | | [optional] [default to const []] +**widgets** | [**List**](ScreenWidget.md) | | [optional] [default to const []] **height** | **int** | | [optional] **width** | **int** | | [optional] diff --git a/Test service generation - dart/doc/ScreenDeviceApi.md b/Test service generation - dart/doc/ScreenDeviceApi.md index 367d096..c5bfa26 100644 --- a/Test service generation - dart/doc/ScreenDeviceApi.md +++ b/Test service generation - dart/doc/ScreenDeviceApi.md @@ -5,21 +5,21 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- -[**screenDeviceCreateDevice**](ScreenDeviceApi.md#screendevicecreatedevice) | **POST** /api/device/screen | -[**screenDeviceDeleteDevice**](ScreenDeviceApi.md#screendevicedeletedevice) | **DELETE** /api/device/screen/{deviceId} | -[**screenDeviceGetAllScreenDevices**](ScreenDeviceApi.md#screendevicegetallscreendevices) | **GET** /api/device/screen | -[**screenDeviceGetDeviceInfo**](ScreenDeviceApi.md#screendevicegetdeviceinfo) | **GET** /api/device/screen/{screenDeviceId} | -[**screenDeviceUpdateDevice**](ScreenDeviceApi.md#screendeviceupdatedevice) | **PUT** /api/device/screen/{screenDeviceId} | +[**screenDeviceCreateDevice**](ScreenDeviceApi.md#screendevicecreatedevice) | **POST** /api/device/screen | Create screen device +[**screenDeviceDeleteDevice**](ScreenDeviceApi.md#screendevicedeletedevice) | **DELETE** /api/device/screen/{deviceId} | Delete device +[**screenDeviceGetAllScreenDevices**](ScreenDeviceApi.md#screendevicegetallscreendevices) | **GET** /api/device/screen | Get all screen devices +[**screenDeviceGetDeviceInfo**](ScreenDeviceApi.md#screendevicegetdeviceinfo) | **GET** /api/device/screen/{screenDeviceId} | Get screen device info +[**screenDeviceUpdateDevice**](ScreenDeviceApi.md#screendeviceupdatedevice) | **PUT** /api/device/screen | Update screen device # **screenDeviceCreateDevice** -> MultipartFile screenDeviceCreateDevice(screenDevice) - +> ScreenDevice screenDeviceCreateDevice(screenDevice) +Create screen device ### Example ```dart @@ -28,7 +28,7 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = ScreenDeviceApi(); -final screenDevice = ScreenDevice(); // ScreenDevice | +final screenDevice = ScreenDevice(); // ScreenDevice | Screen device to create try { final result = api_instance.screenDeviceCreateDevice(screenDevice); @@ -42,11 +42,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **screenDevice** | [**ScreenDevice**](ScreenDevice.md)| | + **screenDevice** | [**ScreenDevice**](ScreenDevice.md)| Screen device to create | ### Return type -[**MultipartFile**](MultipartFile.md) +[**ScreenDevice**](ScreenDevice.md) ### Authorization @@ -55,14 +55,14 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: application/json - - **Accept**: application/octet-stream + - **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) # **screenDeviceDeleteDevice** -> MultipartFile screenDeviceDeleteDevice(deviceId) - +> String screenDeviceDeleteDevice(deviceId) +Delete device ### Example ```dart @@ -71,7 +71,7 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = ScreenDeviceApi(); -final deviceId = deviceId_example; // String | +final deviceId = deviceId_example; // String | Screen device id to update try { final result = api_instance.screenDeviceDeleteDevice(deviceId); @@ -85,11 +85,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **deviceId** | **String**| | + **deviceId** | **String**| Screen device id to update | ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -98,14 +98,14 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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) # **screenDeviceGetAllScreenDevices** > List screenDeviceGetAllScreenDevices() - +Get all screen devices ### Example ```dart @@ -144,7 +144,7 @@ This endpoint does not need any parameter. # **screenDeviceGetDeviceInfo** > ScreenDevice screenDeviceGetDeviceInfo(screenDeviceId) - +Get screen device info ### Example ```dart @@ -185,9 +185,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) # **screenDeviceUpdateDevice** -> MultipartFile screenDeviceUpdateDevice(screenDeviceId, screenDevice) - +> ScreenDevice screenDeviceUpdateDevice(screenDevice) +Update screen device ### Example ```dart @@ -196,11 +196,10 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = ScreenDeviceApi(); -final screenDeviceId = 56; // int | -final screenDevice = ScreenDevice(); // ScreenDevice | +final screenDevice = ScreenDevice(); // ScreenDevice | Screen device to update try { - final result = api_instance.screenDeviceUpdateDevice(screenDeviceId, screenDevice); + final result = api_instance.screenDeviceUpdateDevice(screenDevice); print(result); } catch (e) { print('Exception when calling ScreenDeviceApi->screenDeviceUpdateDevice: $e\n'); @@ -211,12 +210,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **screenDeviceId** | **int**| | - **screenDevice** | [**ScreenDevice**](ScreenDevice.md)| | + **screenDevice** | [**ScreenDevice**](ScreenDevice.md)| Screen device to update | ### Return type -[**MultipartFile**](MultipartFile.md) +[**ScreenDevice**](ScreenDevice.md) ### Authorization @@ -225,7 +223,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: application/json - - **Accept**: application/octet-stream + - **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/Test service generation - dart/doc/ScreenWidget.md b/Test service generation - dart/doc/ScreenWidget.md new file mode 100644 index 0000000..3ca3e6b --- /dev/null +++ b/Test service generation - dart/doc/ScreenWidget.md @@ -0,0 +1,27 @@ +# mycoreapi.model.ScreenWidget + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**displayName** | **String** | | [optional] +**type** | **String** | | [optional] +**activated** | **bool** | | [optional] +**form** | **String** | | [optional] +**font** | **String** | | [optional] +**color** | **String** | | [optional] +**size** | **String** | | [optional] +**width** | **int** | | [optional] +**height** | **int** | | [optional] +**positionX** | **int** | | [optional] +**positionY** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/Test service generation - dart/doc/TokenApi.md b/Test service generation - dart/doc/TokenApi.md index fed3edd..abfebff 100644 --- a/Test service generation - dart/doc/TokenApi.md +++ b/Test service generation - dart/doc/TokenApi.md @@ -5,18 +5,18 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- -[**tokenConnectUser**](TokenApi.md#tokenconnectuser) | **POST** /api/token | +[**tokenConnectUser**](TokenApi.md#tokenconnectuser) | **POST** /api/token | Connect user [**tokenCreate**](TokenApi.md#tokencreate) | **POST** /token | # **tokenConnectUser** > UserInfo tokenConnectUser(loginDTO) - +Connect user ### Example ```dart @@ -25,7 +25,7 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = TokenApi(); -final loginDTO = LoginDTO(); // LoginDTO | +final loginDTO = LoginDTO(); // LoginDTO | login info try { final result = api_instance.tokenConnectUser(loginDTO); @@ -39,7 +39,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **loginDTO** | [**LoginDTO**](LoginDTO.md)| | + **loginDTO** | [**LoginDTO**](LoginDTO.md)| login info | ### Return type diff --git a/Test service generation - dart/doc/TokenDTO.md b/Test service generation - dart/doc/TokenDTO.md new file mode 100644 index 0000000..be926b3 --- /dev/null +++ b/Test service generation - dart/doc/TokenDTO.md @@ -0,0 +1,20 @@ +# mycoreapi.model.TokenDTO + +## Load the model package +```dart +import 'package:mycoreapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**accessToken** | **String** | | [optional] +**refreshToken** | **String** | | [optional] +**scope** | **String** | | [optional] +**tokenType** | **String** | | [optional] +**expiresIn** | **int** | | [optional] +**expiration** | [**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/Test service generation - dart/doc/TwitterApi.md b/Test service generation - dart/doc/TwitterApi.md index 04bf6e5..daf0096 100644 --- a/Test service generation - dart/doc/TwitterApi.md +++ b/Test service generation - dart/doc/TwitterApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/Test service generation - dart/doc/UserApi.md b/Test service generation - dart/doc/UserApi.md index 4d8d8de..5d5208f 100644 --- a/Test service generation - dart/doc/UserApi.md +++ b/Test service generation - dart/doc/UserApi.md @@ -5,21 +5,21 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- -[**userCreateUser**](UserApi.md#usercreateuser) | **POST** /api/user | -[**userDeleteUser**](UserApi.md#userdeleteuser) | **DELETE** /api/user/{id} | -[**userGet**](UserApi.md#userget) | **GET** /api/user | Get a list of user -[**userGet2**](UserApi.md#userget2) | **GET** /api/user/{id} | Get a specific user -[**userUpdateUser**](UserApi.md#userupdateuser) | **PUT** /api/user | +[**userCreateUser**](UserApi.md#usercreateuser) | **POST** /api/user | Create an user +[**userDeleteUser**](UserApi.md#userdeleteuser) | **DELETE** /api/user/{id} | Delete an user +[**userGet**](UserApi.md#userget) | **GET** /api/user/{id} | Get a specific user +[**userGetAll**](UserApi.md#usergetall) | **GET** /api/user | Get a list of user +[**userUpdateUser**](UserApi.md#userupdateuser) | **PUT** /api/user | Update an user # **userCreateUser** > UserInfoDetailDTO userCreateUser(userInfo) - +Create an user ### Example ```dart @@ -28,7 +28,7 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = UserApi(); -final userInfo = UserInfo(); // UserInfo | +final userInfo = UserInfo(); // UserInfo | New user info try { final result = api_instance.userCreateUser(userInfo); @@ -42,7 +42,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userInfo** | [**UserInfo**](UserInfo.md)| | + **userInfo** | [**UserInfo**](UserInfo.md)| New user info | ### Return type @@ -60,9 +60,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) # **userDeleteUser** -> MultipartFile userDeleteUser(id) - +> String userDeleteUser(id) +Delete an user ### Example ```dart @@ -71,7 +71,7 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = UserApi(); -final id = id_example; // String | +final id = id_example; // String | Id of user to delete try { final result = api_instance.userDeleteUser(id); @@ -85,11 +85,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **String**| | + **id** | **String**| Id of user to delete | ### Return type -[**MultipartFile**](MultipartFile.md) +**String** ### Authorization @@ -98,51 +98,12 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/octet-stream + - **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) # **userGet** -> MultipartFile userGet() - -Get a list of 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 = UserApi(); - -try { - final result = api_instance.userGet(); - print(result); -} catch (e) { - print('Exception when calling UserApi->userGet: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**MultipartFile**](MultipartFile.md) - -### Authorization - -[bearer](../README.md#bearer) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/octet-stream - -[[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) - -# **userGet2** -> UserInfoDetailDTO userGet2(id) +> UserInfoDetailDTO userGet(id) Get a specific user @@ -156,10 +117,10 @@ final api_instance = UserApi(); final id = id_example; // String | id user try { - final result = api_instance.userGet2(id); + final result = api_instance.userGet(id); print(result); } catch (e) { - print('Exception when calling UserApi->userGet2: $e\n'); + print('Exception when calling UserApi->userGet: $e\n'); } ``` @@ -184,10 +145,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) -# **userUpdateUser** -> UserInfoDetailDTO userUpdateUser(userInfo) - +# **userGetAll** +> List userGetAll() +Get a list of user ### Example ```dart @@ -196,7 +157,46 @@ import 'package:mycoreapi/api.dart'; //defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = UserApi(); -final userInfo = UserInfo(); // UserInfo | + +try { + final result = api_instance.userGetAll(); + print(result); +} catch (e) { + print('Exception when calling UserApi->userGetAll: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List**](UserInfo.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) + +# **userUpdateUser** +> UserInfoDetailDTO userUpdateUser(userInfo) + +Update an 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 = UserApi(); +final userInfo = UserInfo(); // UserInfo | User to update try { final result = api_instance.userUpdateUser(userInfo); @@ -210,7 +210,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userInfo** | [**UserInfo**](UserInfo.md)| | + **userInfo** | [**UserInfo**](UserInfo.md)| User to update | ### Return type diff --git a/Test service generation - dart/doc/ValuesApi.md b/Test service generation - dart/doc/ValuesApi.md index 170a923..2ee67e6 100644 --- a/Test service generation - dart/doc/ValuesApi.md +++ b/Test service generation - dart/doc/ValuesApi.md @@ -5,7 +5,7 @@ import 'package:mycoreapi/api.dart'; ``` -All URIs are relative to *http://192.168.31.140* +All URIs are relative to *http://localhost:25049* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/Test service generation - dart/lib/api.dart b/Test service generation - dart/lib/api.dart index 20b5dd4..91f1f26 100644 --- a/Test service generation - dart/lib/api.dart +++ b/Test service generation - dart/lib/api.dart @@ -56,6 +56,7 @@ part 'model/automation_create_or_update_detail_dto_all_of.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/azure_ad_auth_model.dart'; part 'model/book.dart'; part 'model/condition.dart'; @@ -80,8 +81,8 @@ part 'model/location_dto.dart'; part 'model/login_dto.dart'; part 'model/means_of_communication.dart'; part 'model/mqtt_message_dto.dart'; -part 'model/odd_h2_h.dart'; part 'model/odd_nice.dart'; +part 'model/odd_object.dart'; part 'model/panel_menu_item.dart'; part 'model/panel_section.dart'; part 'model/provider.dart'; @@ -91,9 +92,10 @@ 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/state.dart'; +part 'model/token_dto.dart'; part 'model/trigger.dart'; part 'model/trigger_type.dart'; part 'model/twitter_auth_model.dart'; @@ -101,7 +103,6 @@ part 'model/user.dart'; part 'model/user_info.dart'; part 'model/user_info_detail_dto.dart'; part 'model/view_by.dart'; -part 'model/widget.dart'; const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; diff --git a/Test service generation - dart/lib/api/authentication_api.dart b/Test service generation - dart/lib/api/authentication_api.dart index af318e4..0975313 100644 --- a/Test service generation - dart/lib/api/authentication_api.dart +++ b/Test service generation - dart/lib/api/authentication_api.dart @@ -117,7 +117,7 @@ class AuthenticationApi { /// * [String] clientId: /// /// * [String] clientSecret: - Future authenticationAuthenticateWithForm({ String grantType, String username, String password, String clientId, String clientSecret }) async { + Future authenticationAuthenticateWithForm({ String grantType, String username, String password, String clientId, String clientSecret }) async { final response = await authenticationAuthenticateWithFormWithHttpInfo( grantType: grantType, username: username, password: password, clientId: clientId, clientSecret: clientSecret ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -126,9 +126,9 @@ class AuthenticationApi { // 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), 'LoginDTO') as LoginDTO; + return apiClient.deserialize(_decodeBodyBytes(response), 'TokenDTO') as TokenDTO; } - return Future.value(null); + return Future.value(null); } /// Authenticate with Json parameters (used by most clients) diff --git a/Test service generation - dart/lib/api/automation_api.dart b/Test service generation - dart/lib/api/automation_api.dart index f032867..db42f23 100644 --- a/Test service generation - dart/lib/api/automation_api.dart +++ b/Test service generation - dart/lib/api/automation_api.dart @@ -15,10 +15,14 @@ class AutomationApi { final ApiClient apiClient; - /// Performs an HTTP 'POST /api/automation' operation and returns the [Response]. + /// Create an automation + /// + /// Note: This method returns the HTTP [Response]. + /// /// Parameters: /// /// * [AutomationCreateOrUpdateDetailDTO] automationCreateOrUpdateDetailDTO (required): + /// Automation to create Future automationCreateWithHttpInfo(AutomationCreateOrUpdateDetailDTO automationCreateOrUpdateDetailDTO) async { // Verify required params are set. if (automationCreateOrUpdateDetailDTO == null) { @@ -61,9 +65,12 @@ class AutomationApi { ); } + /// Create an automation + /// /// Parameters: /// /// * [AutomationCreateOrUpdateDetailDTO] automationCreateOrUpdateDetailDTO (required): + /// Automation to create Future automationCreate(AutomationCreateOrUpdateDetailDTO automationCreateOrUpdateDetailDTO) async { final response = await automationCreateWithHttpInfo(automationCreateOrUpdateDetailDTO); if (response.statusCode >= HttpStatus.badRequest) { @@ -135,7 +142,7 @@ class AutomationApi { /// /// * [String] automationId (required): /// Id of automation to delete - Future automationDelete(String automationId) async { + Future automationDelete(String automationId) async { final response = await automationDeleteWithHttpInfo(automationId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -144,9 +151,9 @@ 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); + return Future.value(null); } /// Delete all automation for a specified @@ -206,7 +213,7 @@ class AutomationApi { /// /// * [String] userId (required): /// Id of user - Future automationDeleteAllForUser(String userId) async { + Future automationDeleteAllForUser(String userId) async { final response = await automationDeleteAllForUserWithHttpInfo(userId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -215,9 +222,9 @@ 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); + return Future.value(null); } /// Get all automations for the specified user diff --git a/Test service generation - dart/lib/api/device_api.dart b/Test service generation - dart/lib/api/device_api.dart index c41b65b..2d8054d 100644 --- a/Test service generation - dart/lib/api/device_api.dart +++ b/Test service generation - dart/lib/api/device_api.dart @@ -225,7 +225,7 @@ class DeviceApi { /// /// * [String] deviceId (required): /// Id of device to delete - Future deviceDelete(String deviceId) async { + Future deviceDelete(String deviceId) async { final response = await deviceDeleteWithHttpInfo(deviceId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -234,12 +234,12 @@ class DeviceApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); + return Future.value(null); } - /// Delete all device for a specified + /// Delete all device for a specified user /// /// Note: This method returns the HTTP [Response]. /// @@ -290,13 +290,13 @@ class DeviceApi { ); } - /// Delete all device for a specified + /// Delete all device for a specified user /// /// Parameters: /// /// * [String] userId (required): /// Id of user - Future deviceDeleteAllForUser(String userId) async { + Future deviceDeleteAllForUser(String userId) async { final response = await deviceDeleteAllForUserWithHttpInfo(userId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -305,9 +305,9 @@ class DeviceApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); + return Future.value(null); } /// Delete devices from provider @@ -377,7 +377,7 @@ class DeviceApi { /// /// * [String] providerId (required): /// Id of Provider - Future deviceDeleteDevicesFromProvider(String userId, String providerId) async { + Future deviceDeleteDevicesFromProvider(String userId, String providerId) async { final response = await deviceDeleteDevicesFromProviderWithHttpInfo(userId, providerId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -386,9 +386,9 @@ class DeviceApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); + return Future.value(null); } /// Get all devices summary diff --git a/Test service generation - dart/lib/api/group_api.dart b/Test service generation - dart/lib/api/group_api.dart index a1964eb..dcbf5a7 100644 --- a/Test service generation - dart/lib/api/group_api.dart +++ b/Test service generation - dart/lib/api/group_api.dart @@ -225,7 +225,7 @@ class GroupApi { /// /// * [String] groupId (required): /// Id of group - Future groupDelete(String deviceId, String groupId) async { + Future groupDelete(String deviceId, String groupId) async { final response = await groupDeleteWithHttpInfo(deviceId, groupId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -234,9 +234,9 @@ class GroupApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); + return Future.value(null); } /// Delete a group @@ -296,7 +296,7 @@ class GroupApi { /// /// * [String] groupId (required): /// Id of group - Future groupDelete2(String groupId) async { + Future groupDelete2(String groupId) async { final response = await groupDelete2WithHttpInfo(groupId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -305,9 +305,9 @@ class GroupApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); + return Future.value(null); } /// Delete all group for a specified @@ -367,7 +367,7 @@ class GroupApi { /// /// * [String] userId (required): /// Id of user - Future groupDeleteAllForUser(String userId) async { + Future groupDeleteAllForUser(String userId) async { final response = await groupDeleteAllForUserWithHttpInfo(userId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -376,9 +376,9 @@ class GroupApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); + return Future.value(null); } /// Get all groups for the specified user @@ -462,10 +462,7 @@ class GroupApi { /// /// * [String] groupId (required): /// groupid - /// - /// * [String] userId: - /// user id - Future groupGetDetailWithHttpInfo(String groupId, { String userId }) async { + Future groupGetDetailWithHttpInfo(String groupId) async { // Verify required params are set. if (groupId == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: groupId'); @@ -480,10 +477,6 @@ class GroupApi { final headerParams = {}; final formParams = {}; - if (userId != null) { - queryParams.addAll(_convertParametersForCollectionFormat('', 'userId', userId)); - } - final contentTypes = []; final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; final authNames = ['bearer']; @@ -518,11 +511,8 @@ class GroupApi { /// /// * [String] groupId (required): /// groupid - /// - /// * [String] userId: - /// user id - Future groupGetDetail(String groupId, { String userId }) async { - final response = await groupGetDetailWithHttpInfo(groupId, userId: userId ); + Future groupGetDetail(String groupId) async { + final response = await groupGetDetailWithHttpInfo(groupId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } diff --git a/Test service generation - dart/lib/api/provider_api.dart b/Test service generation - dart/lib/api/provider_api.dart index 90f0751..f642d34 100644 --- a/Test service generation - dart/lib/api/provider_api.dart +++ b/Test service generation - dart/lib/api/provider_api.dart @@ -142,7 +142,7 @@ class ProviderApi { /// /// * [String] providerId (required): /// Id of provider to delete - Future providerDelete(String providerId) async { + Future providerDelete(String providerId) async { final response = await providerDeleteWithHttpInfo(providerId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -151,9 +151,9 @@ class ProviderApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); + return Future.value(null); } /// Get all user providers @@ -163,6 +163,7 @@ class ProviderApi { /// Parameters: /// /// * [String] userId (required): + /// Id of user Future providerGetAllWithHttpInfo(String userId) async { // Verify required params are set. if (userId == null) { @@ -211,6 +212,7 @@ class ProviderApi { /// Parameters: /// /// * [String] userId (required): + /// Id of user Future> providerGetAll(String userId) async { final response = await providerGetAllWithHttpInfo(userId); if (response.statusCode >= HttpStatus.badRequest) { diff --git a/Test service generation - dart/lib/api/room_api.dart b/Test service generation - dart/lib/api/room_api.dart index 8e9ed90..1ec88b4 100644 --- a/Test service generation - dart/lib/api/room_api.dart +++ b/Test service generation - dart/lib/api/room_api.dart @@ -152,7 +152,7 @@ class RoomApi { /// /// * [String] roomId (required): /// Id of room - Future roomDelete(String deviceId, String roomId) async { + Future roomDelete(String deviceId, String roomId) async { final response = await roomDeleteWithHttpInfo(deviceId, roomId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -161,9 +161,9 @@ class RoomApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); + return Future.value(null); } /// Delete a room @@ -223,7 +223,7 @@ class RoomApi { /// /// * [String] roomId (required): /// Id of room - Future roomDelete2(String roomId) async { + Future roomDelete2(String roomId) async { final response = await roomDelete2WithHttpInfo(roomId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -232,12 +232,12 @@ class RoomApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); + return Future.value(null); } - /// Delete all room for a specified + /// Delete all room for a specified user /// /// Note: This method returns the HTTP [Response]. /// @@ -288,13 +288,13 @@ class RoomApi { ); } - /// Delete all room for a specified + /// Delete all room for a specified user /// /// Parameters: /// /// * [String] userId (required): /// Id of user - Future roomDeleteAllForUser(String userId) async { + Future roomDeleteAllForUser(String userId) async { final response = await roomDeleteAllForUserWithHttpInfo(userId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -303,9 +303,9 @@ class RoomApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); + return Future.value(null); } /// Get all rooms for the specified user diff --git a/Test service generation - dart/lib/api/screen_device_api.dart b/Test service generation - dart/lib/api/screen_device_api.dart index 03b7854..6def34f 100644 --- a/Test service generation - dart/lib/api/screen_device_api.dart +++ b/Test service generation - dart/lib/api/screen_device_api.dart @@ -15,10 +15,14 @@ class ScreenDeviceApi { final ApiClient apiClient; - /// Performs an HTTP 'POST /api/device/screen' operation and returns the [Response]. + /// Create screen device + /// + /// Note: This method returns the HTTP [Response]. + /// /// Parameters: /// /// * [ScreenDevice] screenDevice (required): + /// Screen device to create Future screenDeviceCreateDeviceWithHttpInfo(ScreenDevice screenDevice) async { // Verify required params are set. if (screenDevice == null) { @@ -61,10 +65,13 @@ class ScreenDeviceApi { ); } + /// Create screen device + /// /// Parameters: /// /// * [ScreenDevice] screenDevice (required): - Future screenDeviceCreateDevice(ScreenDevice screenDevice) async { + /// Screen device to create + Future screenDeviceCreateDevice(ScreenDevice screenDevice) async { final response = await screenDeviceCreateDeviceWithHttpInfo(screenDevice); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -73,15 +80,19 @@ class ScreenDeviceApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'ScreenDevice') as ScreenDevice; } - return Future.value(null); + return Future.value(null); } - /// Performs an HTTP 'DELETE /api/device/screen/{deviceId}' operation and returns the [Response]. + /// Delete device + /// + /// Note: This method returns the HTTP [Response]. + /// /// Parameters: /// /// * [String] deviceId (required): + /// Screen device id to update Future screenDeviceDeleteDeviceWithHttpInfo(String deviceId) async { // Verify required params are set. if (deviceId == null) { @@ -125,10 +136,13 @@ class ScreenDeviceApi { ); } + /// Delete device + /// /// Parameters: /// /// * [String] deviceId (required): - Future screenDeviceDeleteDevice(String deviceId) async { + /// Screen device id to update + Future screenDeviceDeleteDevice(String deviceId) async { final response = await screenDeviceDeleteDeviceWithHttpInfo(deviceId); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -137,12 +151,14 @@ class ScreenDeviceApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); + return Future.value(null); } - /// Performs an HTTP 'GET /api/device/screen' operation and returns the [Response]. + /// Get all screen devices + /// + /// Note: This method returns the HTTP [Response]. Future screenDeviceGetAllScreenDevicesWithHttpInfo() async { final path = r'/api/device/screen'; @@ -180,6 +196,7 @@ class ScreenDeviceApi { ); } + /// Get all screen devices Future> screenDeviceGetAllScreenDevices() async { final response = await screenDeviceGetAllScreenDevicesWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { @@ -196,7 +213,10 @@ class ScreenDeviceApi { return Future>.value(null); } - /// Performs an HTTP 'GET /api/device/screen/{screenDeviceId}' operation and returns the [Response]. + /// Get screen device info + /// + /// Note: This method returns the HTTP [Response]. + /// /// Parameters: /// /// * [String] screenDeviceId (required): @@ -244,6 +264,8 @@ class ScreenDeviceApi { ); } + /// Get screen device info + /// /// Parameters: /// /// * [String] screenDeviceId (required): @@ -262,23 +284,21 @@ class ScreenDeviceApi { return Future.value(null); } - /// Performs an HTTP 'PUT /api/device/screen/{screenDeviceId}' operation and returns the [Response]. + /// Update screen device + /// + /// Note: This method returns the HTTP [Response]. + /// /// Parameters: /// - /// * [int] screenDeviceId (required): - /// /// * [ScreenDevice] screenDevice (required): - Future screenDeviceUpdateDeviceWithHttpInfo(int screenDeviceId, ScreenDevice screenDevice) async { + /// Screen device to update + Future screenDeviceUpdateDeviceWithHttpInfo(ScreenDevice screenDevice) async { // Verify required params are set. - if (screenDeviceId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: screenDeviceId'); - } if (screenDevice == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: screenDevice'); } - final path = r'/api/device/screen/{screenDeviceId}' - .replaceAll('{' + 'screenDeviceId' + '}', screenDeviceId.toString()); + final path = r'/api/device/screen'; Object postBody = screenDevice; @@ -314,13 +334,14 @@ class ScreenDeviceApi { ); } + /// Update screen device + /// /// Parameters: /// - /// * [int] screenDeviceId (required): - /// /// * [ScreenDevice] screenDevice (required): - Future screenDeviceUpdateDevice(int screenDeviceId, ScreenDevice screenDevice) async { - final response = await screenDeviceUpdateDeviceWithHttpInfo(screenDeviceId, screenDevice); + /// Screen device to update + Future screenDeviceUpdateDevice(ScreenDevice screenDevice) async { + final response = await screenDeviceUpdateDeviceWithHttpInfo(screenDevice); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -328,8 +349,8 @@ class ScreenDeviceApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'ScreenDevice') as ScreenDevice; } - return Future.value(null); + return Future.value(null); } } diff --git a/Test service generation - dart/lib/api/token_api.dart b/Test service generation - dart/lib/api/token_api.dart index ac72635..88287aa 100644 --- a/Test service generation - dart/lib/api/token_api.dart +++ b/Test service generation - dart/lib/api/token_api.dart @@ -15,10 +15,14 @@ class TokenApi { final ApiClient apiClient; - /// Performs an HTTP 'POST /api/token' operation and returns the [Response]. + /// Connect user + /// + /// Note: This method returns the HTTP [Response]. + /// /// Parameters: /// /// * [LoginDTO] loginDTO (required): + /// login info Future tokenConnectUserWithHttpInfo(LoginDTO loginDTO) async { // Verify required params are set. if (loginDTO == null) { @@ -61,9 +65,12 @@ class TokenApi { ); } + /// Connect user + /// /// Parameters: /// /// * [LoginDTO] loginDTO (required): + /// login info Future tokenConnectUser(LoginDTO loginDTO) async { final response = await tokenConnectUserWithHttpInfo(loginDTO); if (response.statusCode >= HttpStatus.badRequest) { diff --git a/Test service generation - dart/lib/api/user_api.dart b/Test service generation - dart/lib/api/user_api.dart index 9c01f91..7a38f44 100644 --- a/Test service generation - dart/lib/api/user_api.dart +++ b/Test service generation - dart/lib/api/user_api.dart @@ -15,10 +15,14 @@ class UserApi { final ApiClient apiClient; - /// Performs an HTTP 'POST /api/user' operation and returns the [Response]. + /// Create an user + /// + /// Note: This method returns the HTTP [Response]. + /// /// Parameters: /// /// * [UserInfo] userInfo (required): + /// New user info Future userCreateUserWithHttpInfo(UserInfo userInfo) async { // Verify required params are set. if (userInfo == null) { @@ -61,9 +65,12 @@ class UserApi { ); } + /// Create an user + /// /// Parameters: /// /// * [UserInfo] userInfo (required): + /// New user info Future userCreateUser(UserInfo userInfo) async { final response = await userCreateUserWithHttpInfo(userInfo); if (response.statusCode >= HttpStatus.badRequest) { @@ -78,10 +85,14 @@ class UserApi { return Future.value(null); } - /// Performs an HTTP 'DELETE /api/user/{id}' operation and returns the [Response]. + /// Delete an user + /// + /// Note: This method returns the HTTP [Response]. + /// /// Parameters: /// /// * [String] id (required): + /// Id of user to delete Future userDeleteUserWithHttpInfo(String id) async { // Verify required params are set. if (id == null) { @@ -125,10 +136,13 @@ class UserApi { ); } + /// Delete an user + /// /// Parameters: /// /// * [String] id (required): - Future userDeleteUser(String id) async { + /// Id of user to delete + Future userDeleteUser(String id) async { final response = await userDeleteUserWithHttpInfo(id); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -137,64 +151,9 @@ class UserApi { // 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), 'MultipartFile') as MultipartFile; + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } - return Future.value(null); - } - - /// Get a list of user - /// - /// Note: This method returns the HTTP [Response]. - Future userGetWithHttpInfo() async { - final path = r'/api/user'; - - 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 a list of user - Future userGet() async { - final response = await userGetWithHttpInfo(); - 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), 'MultipartFile') as MultipartFile; - } - return Future.value(null); + return Future.value(null); } /// Get a specific user @@ -205,7 +164,7 @@ class UserApi { /// /// * [String] id (required): /// id user - Future userGet2WithHttpInfo(String id) async { + Future userGetWithHttpInfo(String id) async { // Verify required params are set. if (id == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: id'); @@ -254,8 +213,8 @@ class UserApi { /// /// * [String] id (required): /// id user - Future userGet2(String id) async { - final response = await userGet2WithHttpInfo(id); + Future userGet(String id) async { + final response = await userGetWithHttpInfo(id); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -268,10 +227,71 @@ class UserApi { return Future.value(null); } - /// Performs an HTTP 'PUT /api/user' operation and returns the [Response]. + /// Get a list of user + /// + /// Note: This method returns the HTTP [Response]. + Future userGetAllWithHttpInfo() async { + final path = r'/api/user'; + + 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 a list of user + Future> userGetAll() async { + final response = await userGetAllWithHttpInfo(); + 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); + } + + /// Update an user + /// + /// Note: This method returns the HTTP [Response]. + /// /// Parameters: /// /// * [UserInfo] userInfo (required): + /// User to update Future userUpdateUserWithHttpInfo(UserInfo userInfo) async { // Verify required params are set. if (userInfo == null) { @@ -314,9 +334,12 @@ class UserApi { ); } + /// Update an user + /// /// Parameters: /// /// * [UserInfo] userInfo (required): + /// User to update Future userUpdateUser(UserInfo userInfo) async { final response = await userUpdateUserWithHttpInfo(userInfo); if (response.statusCode >= HttpStatus.badRequest) { diff --git a/Test service generation - dart/lib/api_client.dart b/Test service generation - dart/lib/api_client.dart index 24e903f..83232fc 100644 --- a/Test service generation - dart/lib/api_client.dart +++ b/Test service generation - dart/lib/api_client.dart @@ -10,7 +10,7 @@ part of openapi.api; class ApiClient { - ApiClient({this.basePath = 'http://192.168.31.140'}) { + ApiClient({this.basePath = 'http://localhost:25049'}) { // Setup authentications (key: authentication name, value: authentication). _authentications[r'bearer'] = OAuth(); } @@ -173,6 +173,8 @@ class ApiClient { return AutomationDetailDTO.fromJson(value); case 'AutomationDetailDTOAllOf': return AutomationDetailDTOAllOf.fromJson(value); + case 'AutomationState': + return AutomationState.fromJson(value); case 'AzureADAuthModel': return AzureADAuthModel.fromJson(value); case 'Book': @@ -226,10 +228,10 @@ class ApiClient { case 'MqttMessageDTO': return MqttMessageDTO.fromJson(value); - case 'OddH2H': - return OddH2H.fromJson(value); case 'OddNice': return OddNice.fromJson(value); + case 'OddObject': + return OddObject.fromJson(value); case 'PanelMenuItem': return PanelMenuItem.fromJson(value); case 'PanelSection': @@ -248,12 +250,14 @@ class ApiClient { 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 'State': - return State.fromJson(value); + case 'TokenDTO': + return TokenDTO.fromJson(value); case 'Trigger': return Trigger.fromJson(value); case 'TriggerType': @@ -270,8 +274,6 @@ class ApiClient { case 'ViewBy': return ViewByTypeTransformer().decode(value); - case 'Widget': - return Widget.fromJson(value); default: Match match; if (value is List && (match = _regList.firstMatch(targetType)) != null) { diff --git a/Test service generation - dart/lib/model/action.dart b/Test service generation - dart/lib/model/action.dart index ea90fa3..3d0b9d3 100644 --- a/Test service generation - dart/lib/model/action.dart +++ b/Test service generation - dart/lib/model/action.dart @@ -24,7 +24,7 @@ class Action { String deviceId; - List states; + List states; String rawRequest; @@ -83,7 +83,7 @@ class Action { : Action( groupId: json[r'groupId'], deviceId: json[r'deviceId'], - states: State.listFromJson(json[r'states']), + states: AutomationState.listFromJson(json[r'states']), rawRequest: json[r'rawRequest'], providerId: json[r'providerId'], type: ActionType.fromJson(json[r'type']), diff --git a/Test service generation - dart/lib/model/automation.dart b/Test service generation - dart/lib/model/automation.dart index 91bb5cd..5eb1e9a 100644 --- a/Test service generation - dart/lib/model/automation.dart +++ b/Test service generation - dart/lib/model/automation.dart @@ -15,6 +15,7 @@ class Automation { this.id, this.userId, this.name, + this.active, this.createdDate, this.updatedDate, this.triggers, @@ -29,6 +30,8 @@ class Automation { String name; + bool active; + DateTime createdDate; DateTime updatedDate; @@ -46,6 +49,7 @@ class Automation { other.id == id && other.userId == userId && other.name == name && + other.active == active && other.createdDate == createdDate && other.updatedDate == updatedDate && other.triggers == triggers && @@ -58,6 +62,7 @@ class Automation { (id == null ? 0 : id.hashCode) + (userId == null ? 0 : userId.hashCode) + (name == null ? 0 : name.hashCode) + + (active == null ? 0 : active.hashCode) + (createdDate == null ? 0 : createdDate.hashCode) + (updatedDate == null ? 0 : updatedDate.hashCode) + (triggers == null ? 0 : triggers.hashCode) + @@ -66,7 +71,7 @@ class Automation { (devicesIds == null ? 0 : devicesIds.hashCode); @override - String toString() => 'Automation[id=$id, userId=$userId, name=$name, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, conditions=$conditions, actions=$actions, devicesIds=$devicesIds]'; + String toString() => 'Automation[id=$id, userId=$userId, name=$name, active=$active, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, conditions=$conditions, actions=$actions, devicesIds=$devicesIds]'; Map toJson() { final json = {}; @@ -79,6 +84,9 @@ class Automation { if (name != null) { json[r'name'] = name; } + if (active != null) { + json[r'active'] = active; + } if (createdDate != null) { json[r'createdDate'] = createdDate.toUtc().toIso8601String(); } @@ -108,6 +116,7 @@ class Automation { id: json[r'id'], userId: json[r'userId'], name: json[r'name'], + active: json[r'active'], createdDate: json[r'createdDate'] == null ? null : DateTime.parse(json[r'createdDate']), diff --git a/Test service generation - dart/lib/model/automation_create_or_update_detail_dto.dart b/Test service generation - dart/lib/model/automation_create_or_update_detail_dto.dart index 32ff3a1..3216b8d 100644 --- a/Test service generation - dart/lib/model/automation_create_or_update_detail_dto.dart +++ b/Test service generation - dart/lib/model/automation_create_or_update_detail_dto.dart @@ -14,6 +14,7 @@ class AutomationCreateOrUpdateDetailDTO { AutomationCreateOrUpdateDetailDTO({ this.id, this.name, + this.active, this.userId, this.createdDate, this.updatedDate, @@ -27,6 +28,8 @@ class AutomationCreateOrUpdateDetailDTO { String name; + bool active; + String userId; DateTime createdDate; @@ -45,6 +48,7 @@ class AutomationCreateOrUpdateDetailDTO { bool operator ==(Object other) => identical(this, other) || other is AutomationCreateOrUpdateDetailDTO && other.id == id && other.name == name && + other.active == active && other.userId == userId && other.createdDate == createdDate && other.updatedDate == updatedDate && @@ -57,6 +61,7 @@ class AutomationCreateOrUpdateDetailDTO { int get hashCode => (id == null ? 0 : id.hashCode) + (name == null ? 0 : name.hashCode) + + (active == null ? 0 : active.hashCode) + (userId == null ? 0 : userId.hashCode) + (createdDate == null ? 0 : createdDate.hashCode) + (updatedDate == null ? 0 : updatedDate.hashCode) + @@ -66,7 +71,7 @@ class AutomationCreateOrUpdateDetailDTO { (deviceIds == null ? 0 : deviceIds.hashCode); @override - String toString() => 'AutomationCreateOrUpdateDetailDTO[id=$id, name=$name, userId=$userId, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, conditions=$conditions, actions=$actions, deviceIds=$deviceIds]'; + String toString() => 'AutomationCreateOrUpdateDetailDTO[id=$id, name=$name, active=$active, userId=$userId, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, conditions=$conditions, actions=$actions, deviceIds=$deviceIds]'; Map toJson() { final json = {}; @@ -76,6 +81,9 @@ class AutomationCreateOrUpdateDetailDTO { if (name != null) { json[r'name'] = name; } + if (active != null) { + json[r'active'] = active; + } if (userId != null) { json[r'userId'] = userId; } @@ -107,6 +115,7 @@ class AutomationCreateOrUpdateDetailDTO { : AutomationCreateOrUpdateDetailDTO( id: json[r'id'], name: json[r'name'], + active: json[r'active'], userId: json[r'userId'], createdDate: json[r'createdDate'] == null ? null diff --git a/Test service generation - dart/lib/model/automation_detail_dto.dart b/Test service generation - dart/lib/model/automation_detail_dto.dart index e3f3f9d..46371cd 100644 --- a/Test service generation - dart/lib/model/automation_detail_dto.dart +++ b/Test service generation - dart/lib/model/automation_detail_dto.dart @@ -14,6 +14,7 @@ class AutomationDetailDTO { AutomationDetailDTO({ this.id, this.name, + this.active, this.userId, this.createdDate, this.updatedDate, @@ -27,6 +28,8 @@ class AutomationDetailDTO { String name; + bool active; + String userId; DateTime createdDate; @@ -45,6 +48,7 @@ class AutomationDetailDTO { bool operator ==(Object other) => identical(this, other) || other is AutomationDetailDTO && other.id == id && other.name == name && + other.active == active && other.userId == userId && other.createdDate == createdDate && other.updatedDate == updatedDate && @@ -57,6 +61,7 @@ class AutomationDetailDTO { int get hashCode => (id == null ? 0 : id.hashCode) + (name == null ? 0 : name.hashCode) + + (active == null ? 0 : active.hashCode) + (userId == null ? 0 : userId.hashCode) + (createdDate == null ? 0 : createdDate.hashCode) + (updatedDate == null ? 0 : updatedDate.hashCode) + @@ -66,7 +71,7 @@ class AutomationDetailDTO { (devicesIds == null ? 0 : devicesIds.hashCode); @override - String toString() => 'AutomationDetailDTO[id=$id, name=$name, userId=$userId, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, conditions=$conditions, actions=$actions, devicesIds=$devicesIds]'; + String toString() => 'AutomationDetailDTO[id=$id, name=$name, active=$active, userId=$userId, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, conditions=$conditions, actions=$actions, devicesIds=$devicesIds]'; Map toJson() { final json = {}; @@ -76,6 +81,9 @@ class AutomationDetailDTO { if (name != null) { json[r'name'] = name; } + if (active != null) { + json[r'active'] = active; + } if (userId != null) { json[r'userId'] = userId; } @@ -107,6 +115,7 @@ class AutomationDetailDTO { : AutomationDetailDTO( id: json[r'id'], name: json[r'name'], + active: json[r'active'], userId: json[r'userId'], createdDate: json[r'createdDate'] == null ? null diff --git a/Test service generation - dart/lib/model/automation_dto.dart b/Test service generation - dart/lib/model/automation_dto.dart index 68bed66..779c392 100644 --- a/Test service generation - dart/lib/model/automation_dto.dart +++ b/Test service generation - dart/lib/model/automation_dto.dart @@ -14,6 +14,7 @@ class AutomationDTO { AutomationDTO({ this.id, this.name, + this.active, this.userId, this.createdDate, this.updatedDate, @@ -23,6 +24,8 @@ class AutomationDTO { String name; + bool active; + String userId; DateTime createdDate; @@ -33,6 +36,7 @@ class AutomationDTO { bool operator ==(Object other) => identical(this, other) || other is AutomationDTO && other.id == id && other.name == name && + other.active == active && other.userId == userId && other.createdDate == createdDate && other.updatedDate == updatedDate; @@ -41,12 +45,13 @@ class AutomationDTO { int get hashCode => (id == null ? 0 : id.hashCode) + (name == null ? 0 : name.hashCode) + + (active == null ? 0 : active.hashCode) + (userId == null ? 0 : userId.hashCode) + (createdDate == null ? 0 : createdDate.hashCode) + (updatedDate == null ? 0 : updatedDate.hashCode); @override - String toString() => 'AutomationDTO[id=$id, name=$name, userId=$userId, createdDate=$createdDate, updatedDate=$updatedDate]'; + String toString() => 'AutomationDTO[id=$id, name=$name, active=$active, userId=$userId, createdDate=$createdDate, updatedDate=$updatedDate]'; Map toJson() { final json = {}; @@ -56,6 +61,9 @@ class AutomationDTO { if (name != null) { json[r'name'] = name; } + if (active != null) { + json[r'active'] = active; + } if (userId != null) { json[r'userId'] = userId; } @@ -75,6 +83,7 @@ class AutomationDTO { : AutomationDTO( id: json[r'id'], name: json[r'name'], + active: json[r'active'], userId: json[r'userId'], createdDate: json[r'createdDate'] == null ? null diff --git a/Test service generation - dart/lib/model/automation_state.dart b/Test service generation - dart/lib/model/automation_state.dart new file mode 100644 index 0000000..7c55189 --- /dev/null +++ b/Test service generation - dart/lib/model/automation_state.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 AutomationState { + /// Returns a new [AutomationState] instance. + AutomationState({ + this.name, + this.value, + }); + + String name; + + String value; + + @override + bool operator ==(Object other) => identical(this, other) || other is AutomationState && + other.name == name && + other.value == value; + + @override + int get hashCode => + (name == null ? 0 : name.hashCode) + + (value == null ? 0 : value.hashCode); + + @override + String toString() => 'AutomationState[name=$name, value=$value]'; + + Map toJson() { + final json = {}; + if (name != null) { + json[r'name'] = name; + } + if (value != null) { + json[r'value'] = value; + } + return json; + } + + /// Returns a new [AutomationState] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static AutomationState fromJson(Map json) => json == null + ? null + : AutomationState( + name: json[r'name'], + value: json[r'value'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => AutomationState.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] = AutomationState.fromJson(v)); + } + return map; + } + + // maps a json object with a list of AutomationState-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] = AutomationState.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/Test service generation - dart/lib/model/condition.dart b/Test service generation - dart/lib/model/condition.dart index f20804a..6c78806 100644 --- a/Test service generation - dart/lib/model/condition.dart +++ b/Test service generation - dart/lib/model/condition.dart @@ -22,7 +22,7 @@ class Condition { String deviceId; - OneOfState state; + OneOfAutomationState state; String startTime; @@ -82,7 +82,7 @@ class Condition { ? null : Condition( deviceId: json[r'deviceId'], - state: OneOfState.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/Test service generation - dart/lib/model/odd_nice.dart b/Test service generation - dart/lib/model/odd_nice.dart index 9aea874..8d48e9f 100644 --- a/Test service generation - dart/lib/model/odd_nice.dart +++ b/Test service generation - dart/lib/model/odd_nice.dart @@ -24,7 +24,7 @@ class OddNice { String homeTeam; - OneOfOddH2H 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: OneOfOddH2H.fromJson(json[r'odds']), + odds: OneOfOddObject.fromJson(json[r'odds']), ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/Test service generation - dart/lib/model/odd_object.dart b/Test service generation - dart/lib/model/odd_object.dart new file mode 100644 index 0000000..72a301d --- /dev/null +++ b/Test service generation - dart/lib/model/odd_object.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 OddObject { + /// Returns a new [OddObject] instance. + OddObject({ + this.homeOdd, + this.drawOdd, + this.visitOdd, + }); + + double homeOdd; + + double drawOdd; + + double visitOdd; + + @override + bool operator ==(Object other) => identical(this, other) || other is OddObject && + other.homeOdd == homeOdd && + other.drawOdd == drawOdd && + other.visitOdd == visitOdd; + + @override + int get hashCode => + (homeOdd == null ? 0 : homeOdd.hashCode) + + (drawOdd == null ? 0 : drawOdd.hashCode) + + (visitOdd == null ? 0 : visitOdd.hashCode); + + @override + String toString() => 'OddObject[homeOdd=$homeOdd, drawOdd=$drawOdd, visitOdd=$visitOdd]'; + + Map toJson() { + final json = {}; + if (homeOdd != null) { + json[r'homeOdd'] = homeOdd; + } + if (drawOdd != null) { + json[r'drawOdd'] = drawOdd; + } + if (visitOdd != null) { + json[r'visitOdd'] = visitOdd; + } + return json; + } + + /// Returns a new [OddObject] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static OddObject fromJson(Map json) => json == null + ? null + : OddObject( + homeOdd: json[r'homeOdd'], + drawOdd: json[r'drawOdd'], + visitOdd: json[r'visitOdd'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => OddObject.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] = OddObject.fromJson(v)); + } + return map; + } + + // maps a json object with a list of OddObject-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] = OddObject.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/Test service generation - dart/lib/model/screen_configuration.dart b/Test service generation - dart/lib/model/screen_configuration.dart index 706b645..b78a6d9 100644 --- a/Test service generation - dart/lib/model/screen_configuration.dart +++ b/Test service generation - dart/lib/model/screen_configuration.dart @@ -26,7 +26,7 @@ class ScreenConfiguration { String type; - List widgets; + List widgets; int height; @@ -84,7 +84,7 @@ class ScreenConfiguration { id: json[r'id'], name: json[r'name'], type: json[r'type'], - widgets: Widget.listFromJson(json[r'widgets']), + widgets: ScreenWidget.listFromJson(json[r'widgets']), height: json[r'height'], width: json[r'width'], ); diff --git a/Test service generation - dart/lib/model/screen_widget.dart b/Test service generation - dart/lib/model/screen_widget.dart new file mode 100644 index 0000000..398a6a3 --- /dev/null +++ b/Test service generation - dart/lib/model/screen_widget.dart @@ -0,0 +1,179 @@ +// +// 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 ScreenWidget { + /// Returns a new [ScreenWidget] instance. + ScreenWidget({ + this.id, + this.name, + this.displayName, + this.type, + this.activated, + this.form, + this.font, + this.color, + this.size, + this.width, + this.height, + this.positionX, + this.positionY, + }); + + String id; + + String name; + + String displayName; + + String type; + + bool activated; + + String form; + + String font; + + String color; + + String size; + + int width; + + int height; + + int positionX; + + int positionY; + + @override + bool operator ==(Object other) => identical(this, other) || other is ScreenWidget && + other.id == id && + other.name == name && + other.displayName == displayName && + other.type == type && + other.activated == activated && + other.form == form && + other.font == font && + other.color == color && + other.size == size && + other.width == width && + other.height == height && + other.positionX == positionX && + other.positionY == positionY; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (name == null ? 0 : name.hashCode) + + (displayName == null ? 0 : displayName.hashCode) + + (type == null ? 0 : type.hashCode) + + (activated == null ? 0 : activated.hashCode) + + (form == null ? 0 : form.hashCode) + + (font == null ? 0 : font.hashCode) + + (color == null ? 0 : color.hashCode) + + (size == null ? 0 : size.hashCode) + + (width == null ? 0 : width.hashCode) + + (height == null ? 0 : height.hashCode) + + (positionX == null ? 0 : positionX.hashCode) + + (positionY == null ? 0 : positionY.hashCode); + + @override + String toString() => 'ScreenWidget[id=$id, name=$name, displayName=$displayName, type=$type, activated=$activated, form=$form, font=$font, color=$color, size=$size, width=$width, height=$height, positionX=$positionX, positionY=$positionY]'; + + Map toJson() { + final json = {}; + if (id != null) { + json[r'id'] = id; + } + if (name != null) { + json[r'name'] = name; + } + if (displayName != null) { + json[r'displayName'] = displayName; + } + if (type != null) { + json[r'type'] = type; + } + if (activated != null) { + json[r'activated'] = activated; + } + if (form != null) { + json[r'form'] = form; + } + if (font != null) { + json[r'font'] = font; + } + if (color != null) { + json[r'color'] = color; + } + if (size != null) { + json[r'size'] = size; + } + if (width != null) { + json[r'width'] = width; + } + if (height != null) { + json[r'height'] = height; + } + if (positionX != null) { + json[r'positionX'] = positionX; + } + if (positionY != null) { + json[r'positionY'] = positionY; + } + return json; + } + + /// Returns a new [ScreenWidget] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static ScreenWidget fromJson(Map json) => json == null + ? null + : ScreenWidget( + id: json[r'id'], + name: json[r'name'], + displayName: json[r'displayName'], + type: json[r'type'], + activated: json[r'activated'], + form: json[r'form'], + font: json[r'font'], + color: json[r'color'], + size: json[r'size'], + width: json[r'width'], + height: json[r'height'], + positionX: json[r'positionX'], + positionY: json[r'positionY'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => ScreenWidget.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] = ScreenWidget.fromJson(v)); + } + return map; + } + + // maps a json object with a list of ScreenWidget-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] = ScreenWidget.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/Test service generation - dart/lib/model/token_dto.dart b/Test service generation - dart/lib/model/token_dto.dart new file mode 100644 index 0000000..5ef4e57 --- /dev/null +++ b/Test service generation - dart/lib/model/token_dto.dart @@ -0,0 +1,118 @@ +// +// 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 TokenDTO { + /// Returns a new [TokenDTO] instance. + TokenDTO({ + this.accessToken, + this.refreshToken, + this.scope, + this.tokenType, + this.expiresIn, + this.expiration, + }); + + String accessToken; + + String refreshToken; + + String scope; + + String tokenType; + + int expiresIn; + + DateTime expiration; + + @override + bool operator ==(Object other) => identical(this, other) || other is TokenDTO && + other.accessToken == accessToken && + other.refreshToken == refreshToken && + other.scope == scope && + other.tokenType == tokenType && + other.expiresIn == expiresIn && + other.expiration == expiration; + + @override + int get hashCode => + (accessToken == null ? 0 : accessToken.hashCode) + + (refreshToken == null ? 0 : refreshToken.hashCode) + + (scope == null ? 0 : scope.hashCode) + + (tokenType == null ? 0 : tokenType.hashCode) + + (expiresIn == null ? 0 : expiresIn.hashCode) + + (expiration == null ? 0 : expiration.hashCode); + + @override + String toString() => 'TokenDTO[accessToken=$accessToken, refreshToken=$refreshToken, scope=$scope, tokenType=$tokenType, expiresIn=$expiresIn, expiration=$expiration]'; + + Map toJson() { + final json = {}; + if (accessToken != null) { + json[r'access_token'] = accessToken; + } + if (refreshToken != null) { + json[r'refresh_token'] = refreshToken; + } + if (scope != null) { + json[r'scope'] = scope; + } + if (tokenType != null) { + json[r'token_type'] = tokenType; + } + if (expiresIn != null) { + json[r'expires_in'] = expiresIn; + } + if (expiration != null) { + json[r'expiration'] = expiration.toUtc().toIso8601String(); + } + return json; + } + + /// Returns a new [TokenDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static TokenDTO fromJson(Map json) => json == null + ? null + : TokenDTO( + accessToken: json[r'access_token'], + refreshToken: json[r'refresh_token'], + scope: json[r'scope'], + tokenType: json[r'token_type'], + expiresIn: json[r'expires_in'], + expiration: json[r'expiration'] == null + ? null + : DateTime.parse(json[r'expiration']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => TokenDTO.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] = TokenDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of TokenDTO-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] = TokenDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/Test service generation - dart/swagger.yaml b/Test service generation - dart/swagger.yaml index ce74c0a..c988600 100644 --- a/Test service generation - dart/swagger.yaml +++ b/Test service generation - dart/swagger.yaml @@ -142,6 +142,12 @@ paths: type: array items: $ref: '#/components/schemas/DeviceSummaryDTO' + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] '/api/device/detail/{deviceId}': @@ -166,6 +172,24 @@ paths: application/json: schema: $ref: '#/components/schemas/DeviceDetailDTO' + '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/device/{userId}/type/{type}': @@ -199,6 +223,18 @@ paths: type: array items: $ref: '#/components/schemas/DeviceDetailDTO' + '400': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] /api/device: @@ -223,6 +259,30 @@ paths: application/json: schema: $ref: '#/components/schemas/DeviceDetailDTO' + '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/device/{userId}/fromProvider/{providerId}': @@ -257,6 +317,36 @@ paths: type: array items: $ref: '#/components/schemas/DeviceDetailDTO' + '400': + description: '' + content: + application/json: + schema: + type: string + '401': + description: '' + content: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '421': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] get: @@ -290,6 +380,24 @@ paths: type: array items: $ref: '#/components/schemas/DeviceDetailDTO' + '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: [] delete: @@ -315,13 +423,30 @@ paths: nullable: true x-position: 2 responses: - '200': + '202': description: '' content: - application/octet-stream: + 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 - format: binary security: - bearer: [] '/api/device/zigbee2Mqtt/{userId}': @@ -348,6 +473,24 @@ paths: type: array items: $ref: '#/components/schemas/DeviceDetailDTO' + '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/device/{deviceId}': @@ -379,6 +522,18 @@ paths: application/json: schema: $ref: '#/components/schemas/DeviceDetailDTO' + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] delete: @@ -396,20 +551,37 @@ paths: nullable: true x-position: 1 responses: - '200': + '202': description: '' content: - application/octet-stream: + 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 - format: binary security: - bearer: [] '/api/device/user/{userId}': delete: tags: - Device - summary: Delete all device for a specified + summary: Delete all device for a specified user operationId: Device_DeleteAllForUser parameters: - name: userId @@ -421,13 +593,30 @@ paths: nullable: true x-position: 1 responses: - '200': + '202': description: '' content: - application/octet-stream: + 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 - format: binary security: - bearer: [] /api/energy/electricity: @@ -591,6 +780,12 @@ paths: type: array items: $ref: '#/components/schemas/OddNice' + '400': + description: '' + content: + application/json: + schema: + type: string '404': description: '' content: @@ -651,6 +846,7 @@ paths: - name: userId in: path required: true + description: Id of user schema: type: string nullable: true @@ -664,6 +860,24 @@ paths: type: array items: $ref: '#/components/schemas/ProviderDTO' + '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/provider: @@ -688,6 +902,30 @@ paths: application/json: schema: $ref: '#/components/schemas/ProviderDTO' + '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: [] put: @@ -711,6 +949,24 @@ paths: application/json: schema: $ref: '#/components/schemas/DeviceDetailDTO' + '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/provider/{providerId}': @@ -729,19 +985,37 @@ paths: nullable: true x-position: 1 responses: - '200': + '202': description: '' content: - application/octet-stream: + 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 - format: binary security: - bearer: [] /api/device/screen: get: tags: - ScreenDevice + summary: Get all screen devices operationId: ScreenDevice_GetAllScreenDevices responses: '200': @@ -752,14 +1026,22 @@ paths: type: array items: $ref: '#/components/schemas/ScreenDevice' + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] post: tags: - ScreenDevice + summary: Create screen device operationId: ScreenDevice_CreateDevice requestBody: x-name: screenDevice + description: Screen device to create content: application/json: schema: @@ -770,16 +1052,63 @@ paths: '200': description: '' content: - application/octet-stream: + application/json: + schema: + $ref: '#/components/schemas/ScreenDevice' + '400': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + put: + tags: + - ScreenDevice + summary: Update screen device + operationId: ScreenDevice_UpdateDevice + requestBody: + x-name: screenDevice + description: Screen device to update + content: + application/json: + schema: + $ref: '#/components/schemas/ScreenDevice' + required: true + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/ScreenDevice' + '400': + description: '' + content: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: schema: type: string - format: binary security: - bearer: [] '/api/device/screen/{screenDeviceId}': get: tags: - ScreenDevice + summary: Get screen device info operationId: ScreenDevice_GetDeviceInfo parameters: - name: screenDeviceId @@ -797,59 +1126,66 @@ paths: application/json: schema: $ref: '#/components/schemas/ScreenDevice' - security: - - bearer: [] - put: - tags: - - ScreenDevice - operationId: ScreenDevice_UpdateDevice - parameters: - - name: screenDeviceId - in: path - required: true - schema: - type: integer - format: int32 - x-position: 1 - requestBody: - x-name: screenDevice - content: - application/json: - schema: - $ref: '#/components/schemas/ScreenDevice' - required: true - x-position: 2 - responses: - '200': + '400': description: '' content: - application/octet-stream: + application/json: + schema: + type: string + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: schema: type: string - format: binary security: - bearer: [] '/api/device/screen/{deviceId}': delete: tags: - ScreenDevice + summary: Delete device operationId: ScreenDevice_DeleteDevice parameters: - name: deviceId in: path required: true + description: Screen device id to update schema: type: string nullable: true x-position: 1 responses: - '200': + '202': description: '' content: - application/octet-stream: + 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 - format: binary security: - bearer: [] /api/mqtt: @@ -874,6 +1210,18 @@ paths: application/json: schema: type: boolean + '400': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] /api/layout/panelSection: @@ -895,9 +1243,11 @@ paths: post: tags: - Token + summary: Connect user operationId: Token_ConnectUser requestBody: x-name: loginDTO + description: login info content: application/json: schema: @@ -911,6 +1261,18 @@ paths: application/json: schema: $ref: '#/components/schemas/UserInfo' + '401': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string /api/user: get: tags: @@ -926,14 +1288,22 @@ paths: type: array items: $ref: '#/components/schemas/UserInfo' + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] post: tags: - User + summary: Create an user operationId: User_CreateUser requestBody: x-name: newUser + description: New user info content: application/json: schema: @@ -947,12 +1317,32 @@ paths: application/json: schema: $ref: '#/components/schemas/UserInfoDetailDTO' + '400': + description: '' + content: + application/json: + schema: + type: string + '409': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string put: tags: - User + summary: Update an user operationId: User_UpdateUser requestBody: x-name: updatedUser + description: User to update content: application/json: schema: @@ -966,6 +1356,24 @@ paths: application/json: schema: $ref: '#/components/schemas/UserInfoDetailDTO' + '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/user/{id}': @@ -990,28 +1398,59 @@ paths: application/json: schema: $ref: '#/components/schemas/UserInfoDetailDTO' + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] delete: tags: - User + summary: Delete an user operationId: User_DeleteUser parameters: - name: id in: path required: true + description: Id of user to delete schema: type: string nullable: true x-position: 1 responses: - '200': + '202': description: '' content: - application/octet-stream: + 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 - format: binary security: - bearer: [] /api/test: @@ -1213,6 +1652,12 @@ paths: type: array items: $ref: '#/components/schemas/RoomSummaryDTO' + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] '/api/automation/detail/{automationId}': @@ -1237,15 +1682,35 @@ paths: application/json: schema: $ref: '#/components/schemas/AutomationDetailDTO' + '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/automation: post: tags: - Automation + summary: Create an automation operationId: Automation_Create requestBody: x-name: automationCreateOrUpdateDetail + description: Automation to create content: application/json: schema: @@ -1259,6 +1724,18 @@ paths: application/json: schema: $ref: '#/components/schemas/AutomationDTO' + '400': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] put: @@ -1282,6 +1759,24 @@ paths: application/json: schema: $ref: '#/components/schemas/AutomationCreateOrUpdateDetailDTO' + '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/automation/{automationId}': @@ -1300,13 +1795,30 @@ paths: nullable: true x-position: 1 responses: - '200': + '202': description: '' content: - application/octet-stream: + 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 - format: binary security: - bearer: [] '/api/automation/user/{userId}': @@ -1325,13 +1837,30 @@ paths: nullable: true x-position: 1 responses: - '200': + '202': description: '' content: - application/octet-stream: + 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 - format: binary security: - bearer: [] '/api/group/{userId}': @@ -1358,6 +1887,18 @@ paths: type: array items: $ref: '#/components/schemas/GroupSummaryDTO' + '400': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] '/api/group/detail/{groupId}': @@ -1367,13 +1908,6 @@ paths: summary: Get detail info of a specified group operationId: Group_GetDetail parameters: - - name: userId - in: query - description: user id - schema: - type: string - nullable: true - x-position: 1 - name: groupId in: path required: true @@ -1381,7 +1915,7 @@ paths: schema: type: string nullable: true - x-position: 2 + x-position: 1 responses: '200': description: '' @@ -1389,6 +1923,24 @@ paths: application/json: schema: $ref: '#/components/schemas/GroupDetailDTO' + '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/{userId}/type/{type}': @@ -1423,137 +1975,18 @@ paths: type: array items: $ref: '#/components/schemas/GroupSummaryDTO' - security: - - bearer: [] - /api/group: - post: - tags: - - Group - summary: Create a group - operationId: Group_Create - requestBody: - x-name: groupCreateOrUpdateDetail - description: Group to create - content: - application/json: - schema: - $ref: '#/components/schemas/GroupCreateOrUpdateDetailDTO' - required: true - x-position: 1 - responses: - '200': + '400': description: '' content: application/json: - schema: - $ref: '#/components/schemas/GroupDetailDTO' - security: - - bearer: [] - put: - tags: - - Group - summary: Update a group - operationId: Group_Update - requestBody: - x-name: groupCreateOrUpdateDetail - description: group to update - content: - application/json: - schema: - $ref: '#/components/schemas/GroupCreateOrUpdateDetailDTO' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/GroupCreateOrUpdateDetailDTO' - security: - - bearer: [] - '/api/group/{userId}/fromZigbee': - post: - tags: - - Group - summary: Create groups from provider - operationId: Group_CreateDevicesFromZigbee2Mqtt - parameters: - - name: userId - in: path - required: true - description: User Id - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/GroupDetailDTO' - security: - - bearer: [] - '/api/group/{groupId}/device/{deviceId}': - delete: - tags: - - Group - summary: Delete device from a group - operationId: Group_Delete - parameters: - - name: deviceId - in: path - required: true - description: Id of device to delete from the group - schema: - type: string - nullable: true - x-position: 1 - - name: groupId - in: path - required: true - description: 'Id of group ' - schema: - type: string - nullable: true - x-position: 2 - responses: - '200': - description: '' - content: - application/octet-stream: schema: type: string - format: binary - security: - - bearer: [] - '/api/group/{groupId}': - delete: - tags: - - Group - summary: Delete a group - operationId: Group_Delete2 - parameters: - - name: groupId - in: path - required: true - description: 'Id of group ' - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': + '500': description: '' content: - application/octet-stream: + application/json: schema: type: string - format: binary security: - bearer: [] '/api/group/zigbee2Mqtt/{userId}': @@ -1580,6 +2013,237 @@ paths: type: array items: $ref: '#/components/schemas/GroupDetailDTO' + '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: + post: + tags: + - Group + summary: Create a group + operationId: Group_Create + requestBody: + x-name: groupCreateOrUpdateDetail + description: Group to create + content: + application/json: + schema: + $ref: '#/components/schemas/GroupCreateOrUpdateDetailDTO' + required: true + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/GroupDetailDTO' + '400': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string + security: + - bearer: [] + put: + tags: + - Group + summary: Update a group + operationId: Group_Update + requestBody: + x-name: groupCreateOrUpdateDetail + description: group to update + content: + application/json: + schema: + $ref: '#/components/schemas/GroupCreateOrUpdateDetailDTO' + required: true + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/GroupCreateOrUpdateDetailDTO' + '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/{userId}/fromZigbee': + post: + tags: + - Group + summary: Create groups from provider + operationId: Group_CreateDevicesFromZigbee2Mqtt + parameters: + - name: userId + in: path + required: true + description: User Id + schema: + type: string + nullable: true + x-position: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/GroupDetailDTO' + '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/{groupId}/device/{deviceId}': + delete: + tags: + - Group + summary: Delete device from a group + operationId: Group_Delete + parameters: + - name: deviceId + in: path + required: true + description: Id of device to delete from the group + schema: + type: string + nullable: true + x-position: 1 + - name: groupId + in: path + required: true + description: 'Id of group ' + schema: + type: string + nullable: true + x-position: 2 + 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/{groupId}': + delete: + tags: + - Group + summary: Delete a group + operationId: Group_Delete2 + parameters: + - name: groupId + in: path + required: true + description: 'Id of group ' + 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/user/{userId}': @@ -1598,13 +2262,30 @@ paths: nullable: true x-position: 1 responses: - '200': + '202': description: '' content: - application/octet-stream: + 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 - format: binary security: - bearer: [] '/api/room/{userId}': @@ -1631,6 +2312,12 @@ paths: type: array items: $ref: '#/components/schemas/RoomSummaryDTO' + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] '/api/room/detail/{roomId}': @@ -1662,6 +2349,24 @@ paths: application/json: schema: $ref: '#/components/schemas/RoomDetailDTO' + '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: @@ -1686,6 +2391,18 @@ paths: application/json: schema: $ref: '#/components/schemas/RoomDetailDTO' + '400': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] put: @@ -1709,6 +2426,18 @@ paths: application/json: schema: $ref: '#/components/schemas/RoomCreateOrUpdateDetailDTO' + '404': + description: '' + content: + application/json: + schema: + type: string + '500': + description: '' + content: + application/json: + schema: + type: string security: - bearer: [] '/api/room/{roomId}/device/{deviceId}': @@ -1735,13 +2464,30 @@ paths: nullable: true x-position: 2 responses: - '200': + '202': description: '' content: - application/octet-stream: + 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 - format: binary security: - bearer: [] '/api/room/{roomId}': @@ -1760,20 +2506,37 @@ paths: nullable: true x-position: 1 responses: - '200': + '202': description: '' content: - application/octet-stream: + 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 - format: binary security: - bearer: [] '/api/room/user/{userId}': delete: tags: - Room - summary: Delete all room for a specified + summary: Delete all room for a specified user operationId: Room_DeleteAllForUser parameters: - name: userId @@ -1785,13 +2548,30 @@ paths: nullable: true x-position: 1 responses: - '200': + '202': description: '' content: - application/octet-stream: + 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 - format: binary security: - bearer: [] /azure: @@ -2188,8 +2968,8 @@ components: odds: nullable: true oneOf: - - $ref: '#/components/schemas/OddH2H' - OddH2H: + - $ref: '#/components/schemas/OddObject' + OddObject: type: object additionalProperties: false properties: @@ -2412,6 +3192,8 @@ components: name: type: string nullable: true + active: + type: boolean createdDate: type: string format: date-time @@ -2477,7 +3259,7 @@ components: state: nullable: true oneOf: - - $ref: '#/components/schemas/State' + - $ref: '#/components/schemas/AutomationState' startTime: type: string nullable: true @@ -2488,7 +3270,7 @@ components: $ref: '#/components/schemas/ConditionType' value: $ref: '#/components/schemas/ConditionValue' - State: + AutomationState: type: object additionalProperties: false properties: @@ -2538,7 +3320,7 @@ components: type: array nullable: true items: - $ref: '#/components/schemas/State' + $ref: '#/components/schemas/AutomationState' rawRequest: type: string nullable: true @@ -2731,14 +3513,14 @@ components: type: array nullable: true items: - $ref: '#/components/schemas/Widget' + $ref: '#/components/schemas/ScreenWidget' height: type: integer format: int32 width: type: integer format: int32 - Widget: + ScreenWidget: type: object additionalProperties: false properties: @@ -2877,6 +3659,8 @@ components: name: type: string nullable: true + active: + type: boolean userId: type: string nullable: true diff --git a/Test service generation - dart/test/automation_state_test.dart b/Test service generation - dart/test/automation_state_test.dart new file mode 100644 index 0000000..26a0fbd --- /dev/null +++ b/Test service generation - dart/test/automation_state_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:counterapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AutomationState +void main() { + final instance = AutomationState(); + + group('test AutomationState', () { + // String name + test('to test the property `name`', () async { + // TODO + }); + + // String value + test('to test the property `value`', () async { + // TODO + }); + + + }); + +} diff --git a/Test service generation - dart/test/odd_object_test.dart b/Test service generation - dart/test/odd_object_test.dart new file mode 100644 index 0000000..5255bad --- /dev/null +++ b/Test service generation - dart/test/odd_object_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:counterapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OddObject +void main() { + final instance = OddObject(); + + group('test OddObject', () { + // double homeOdd + test('to test the property `homeOdd`', () async { + // TODO + }); + + // double drawOdd + test('to test the property `drawOdd`', () async { + // TODO + }); + + // double visitOdd + test('to test the property `visitOdd`', () async { + // TODO + }); + + + }); + +} diff --git a/Test service generation - dart/test/screen_widget_test.dart b/Test service generation - dart/test/screen_widget_test.dart new file mode 100644 index 0000000..04b44a0 --- /dev/null +++ b/Test service generation - dart/test/screen_widget_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:counterapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ScreenWidget +void main() { + final instance = ScreenWidget(); + + group('test ScreenWidget', () { + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // String displayName + test('to test the property `displayName`', () async { + // TODO + }); + + // String type + test('to test the property `type`', () async { + // TODO + }); + + // bool activated + test('to test the property `activated`', () async { + // TODO + }); + + // String form + test('to test the property `form`', () async { + // TODO + }); + + // String font + test('to test the property `font`', () async { + // TODO + }); + + // String color + test('to test the property `color`', () async { + // TODO + }); + + // String size + test('to test the property `size`', () async { + // TODO + }); + + // int width + test('to test the property `width`', () async { + // TODO + }); + + // int height + test('to test the property `height`', () async { + // TODO + }); + + // int positionX + test('to test the property `positionX`', () async { + // TODO + }); + + // int positionY + test('to test the property `positionY`', () async { + // TODO + }); + + + }); + +} diff --git a/Test service generation - dart/test/token_dto_test.dart b/Test service generation - dart/test/token_dto_test.dart new file mode 100644 index 0000000..0aed5ca --- /dev/null +++ b/Test service generation - dart/test/token_dto_test.dart @@ -0,0 +1,51 @@ +// +// 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:counterapi/api.dart'; +import 'package:test/test.dart'; + +// tests for TokenDTO +void main() { + final instance = TokenDTO(); + + group('test TokenDTO', () { + // String accessToken + test('to test the property `accessToken`', () async { + // TODO + }); + + // String refreshToken + test('to test the property `refreshToken`', () async { + // TODO + }); + + // String scope + test('to test the property `scope`', () async { + // TODO + }); + + // String tokenType + test('to test the property `tokenType`', () async { + // TODO + }); + + // int expiresIn + test('to test the property `expiresIn`', () async { + // TODO + }); + + // DateTime expiration + test('to test the property `expiration`', () async { + // TODO + }); + + + }); + +} diff --git a/swagger.json b/swagger.json index ed208f3..bebe189 100644 --- a/swagger.json +++ b/swagger.json @@ -229,6 +229,16 @@ } } } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -268,6 +278,36 @@ } } } + }, + "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": [ @@ -320,6 +360,26 @@ } } } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -359,6 +419,46 @@ } } } + }, + "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": [ @@ -412,6 +512,56 @@ } } } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "401": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "421": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -463,6 +613,36 @@ } } } + }, + "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": [ @@ -502,13 +682,42 @@ } ], "responses": { - "200": { + "202": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "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" } } } @@ -554,6 +763,36 @@ } } } + }, + "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": [ @@ -604,6 +843,26 @@ } } } + }, + "404": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -632,13 +891,42 @@ } ], "responses": { - "200": { + "202": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "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" } } } @@ -656,7 +944,7 @@ "tags": [ "Device" ], - "summary": "Delete all device for a specified", + "summary": "Delete all device for a specified user", "operationId": "Device_DeleteAllForUser", "parameters": [ { @@ -672,13 +960,42 @@ } ], "responses": { - "200": { + "202": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "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" } } } @@ -942,6 +1259,16 @@ } } }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, "404": { "description": "", "content": { @@ -1039,6 +1366,7 @@ "name": "userId", "in": "path", "required": true, + "description": "Id of user", "schema": { "type": "string", "nullable": true @@ -1059,6 +1387,36 @@ } } } + }, + "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": [ @@ -1098,6 +1456,46 @@ } } } + }, + "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": [ @@ -1135,6 +1533,36 @@ } } } + }, + "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": [ @@ -1165,13 +1593,42 @@ } ], "responses": { - "200": { + "202": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "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" } } } @@ -1189,6 +1646,7 @@ "tags": [ "ScreenDevice" ], + "summary": "Get all screen devices", "operationId": "ScreenDevice_GetAllScreenDevices", "responses": { "200": { @@ -1203,6 +1661,16 @@ } } } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -1215,9 +1683,11 @@ "tags": [ "ScreenDevice" ], + "summary": "Create screen device", "operationId": "ScreenDevice_CreateDevice", "requestBody": { "x-name": "screenDevice", + "description": "Screen device to create", "content": { "application/json": { "schema": { @@ -1232,10 +1702,86 @@ "200": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "$ref": "#/components/schemas/ScreenDevice" + } + } + } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + }, + "security": [ + { + "bearer": [] + } + ] + }, + "put": { + "tags": [ + "ScreenDevice" + ], + "summary": "Update screen device", + "operationId": "ScreenDevice_UpdateDevice", + "requestBody": { + "x-name": "screenDevice", + "description": "Screen device to update", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ScreenDevice" + } + } + }, + "required": true, + "x-position": 1 + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ScreenDevice" + } + } + } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" } } } @@ -1253,6 +1799,7 @@ "tags": [ "ScreenDevice" ], + "summary": "Get screen device info", "operationId": "ScreenDevice_GetDeviceInfo", "parameters": [ { @@ -1277,51 +1824,33 @@ } } } - } - }, - "security": [ - { - "bearer": [] - } - ] - }, - "put": { - "tags": [ - "ScreenDevice" - ], - "operationId": "ScreenDevice_UpdateDevice", - "parameters": [ - { - "name": "screenDeviceId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - } - ], - "requestBody": { - "x-name": "screenDevice", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ScreenDevice" + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } } } }, - "required": true, - "x-position": 2 - }, - "responses": { - "200": { + "404": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" } } } @@ -1339,12 +1868,14 @@ "tags": [ "ScreenDevice" ], + "summary": "Delete device", "operationId": "ScreenDevice_DeleteDevice", "parameters": [ { "name": "deviceId", "in": "path", "required": true, + "description": "Screen device id to update", "schema": { "type": "string", "nullable": true @@ -1353,13 +1884,42 @@ } ], "responses": { - "200": { + "202": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "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" } } } @@ -1402,6 +1962,26 @@ } } } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -1440,9 +2020,11 @@ "tags": [ "Token" ], + "summary": "Connect user", "operationId": "Token_ConnectUser", "requestBody": { "x-name": "loginDTO", + "description": "login info", "content": { "application/json": { "schema": { @@ -1463,6 +2045,26 @@ } } } + }, + "401": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } } } @@ -1487,6 +2089,16 @@ } } } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -1499,9 +2111,11 @@ "tags": [ "User" ], + "summary": "Create an user", "operationId": "User_CreateUser", "requestBody": { "x-name": "newUser", + "description": "New user info", "content": { "application/json": { "schema": { @@ -1522,6 +2136,36 @@ } } } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "409": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } } }, @@ -1529,9 +2173,11 @@ "tags": [ "User" ], + "summary": "Update an user", "operationId": "User_UpdateUser", "requestBody": { "x-name": "updatedUser", + "description": "User to update", "content": { "application/json": { "schema": { @@ -1552,6 +2198,36 @@ } } } + }, + "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": [ @@ -1591,6 +2267,26 @@ } } } + }, + "404": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -1603,12 +2299,14 @@ "tags": [ "User" ], + "summary": "Delete an user", "operationId": "User_DeleteUser", "parameters": [ { "name": "id", "in": "path", "required": true, + "description": "Id of user to delete", "schema": { "type": "string", "nullable": true @@ -1617,13 +2315,42 @@ } ], "responses": { - "200": { + "202": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "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" } } } @@ -1832,7 +2559,7 @@ }, "responses": { "200": { - "description": "Success", + "description": "Token descriptor", "content": { "application/json": { "schema": { @@ -1842,7 +2569,7 @@ } }, "401": { - "description": "Invalid credentials", + "description": "", "content": { "application/json": { "schema": { @@ -1852,7 +2579,7 @@ } }, "500": { - "description": "Error", + "description": "", "content": { "application/json": { "schema": { @@ -1886,17 +2613,17 @@ }, "responses": { "200": { - "description": "Success", + "description": "Token descriptor", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoginDTO" + "$ref": "#/components/schemas/TokenDTO" } } } }, "401": { - "description": "Invalid credentials", + "description": "", "content": { "application/json": { "schema": { @@ -1906,7 +2633,7 @@ } }, "500": { - "description": "Error", + "description": "", "content": { "application/json": { "schema": { @@ -1951,6 +2678,16 @@ } } } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -1990,6 +2727,36 @@ } } } + }, + "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": [ @@ -2004,9 +2771,11 @@ "tags": [ "Automation" ], + "summary": "Create an automation", "operationId": "Automation_Create", "requestBody": { "x-name": "automationCreateOrUpdateDetail", + "description": "Automation to create", "content": { "application/json": { "schema": { @@ -2027,6 +2796,26 @@ } } } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -2064,6 +2853,36 @@ } } } + }, + "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": [ @@ -2094,13 +2913,42 @@ } ], "responses": { - "200": { + "202": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "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" } } } @@ -2134,13 +2982,42 @@ } ], "responses": { - "200": { + "202": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "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" } } } @@ -2186,6 +3063,26 @@ } } } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -2203,16 +3100,6 @@ "summary": "Get detail info of a specified group", "operationId": "Group_GetDetail", "parameters": [ - { - "name": "userId", - "in": "query", - "description": "user id", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 1 - }, { "name": "groupId", "in": "path", @@ -2222,7 +3109,7 @@ "type": "string", "nullable": true }, - "x-position": 2 + "x-position": 1 } ], "responses": { @@ -2235,6 +3122,36 @@ } } } + }, + "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": [ @@ -2288,212 +3205,23 @@ } } } - } - }, - "security": [ - { - "bearer": [] - } - ] - } - }, - "/api/group": { - "post": { - "tags": [ - "Group" - ], - "summary": "Create a group", - "operationId": "Group_Create", - "requestBody": { - "x-name": "groupCreateOrUpdateDetail", - "description": "Group to create", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GroupCreateOrUpdateDetailDTO" - } - } }, - "required": true, - "x-position": 1 - }, - "responses": { - "200": { + "400": { "description": "", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GroupDetailDTO" + "type": "string" } } } - } - }, - "security": [ - { - "bearer": [] - } - ] - }, - "put": { - "tags": [ - "Group" - ], - "summary": "Update a group", - "operationId": "Group_Update", - "requestBody": { - "x-name": "groupCreateOrUpdateDetail", - "description": "group to update", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GroupCreateOrUpdateDetailDTO" - } - } }, - "required": true, - "x-position": 1 - }, - "responses": { - "200": { + "500": { "description": "", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GroupCreateOrUpdateDetailDTO" - } - } - } - } - }, - "security": [ - { - "bearer": [] - } - ] - } - }, - "/api/group/{userId}/fromZigbee": { - "post": { - "tags": [ - "Group" - ], - "summary": "Create groups from provider", - "operationId": "Group_CreateDevicesFromZigbee2Mqtt", - "parameters": [ - { - "name": "userId", - "in": "path", - "required": true, - "description": "User Id", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GroupDetailDTO" - } - } - } - } - } - }, - "security": [ - { - "bearer": [] - } - ] - } - }, - "/api/group/{groupId}/device/{deviceId}": { - "delete": { - "tags": [ - "Group" - ], - "summary": "Delete device from a group", - "operationId": "Group_Delete", - "parameters": [ - { - "name": "deviceId", - "in": "path", - "required": true, - "description": "Id of device to delete from the group", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 1 - }, - { - "name": "groupId", - "in": "path", - "required": true, - "description": "Id of group ", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 2 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/octet-stream": { - "schema": { - "type": "string", - "format": "binary" - } - } - } - } - }, - "security": [ - { - "bearer": [] - } - ] - } - }, - "/api/group/{groupId}": { - "delete": { - "tags": [ - "Group" - ], - "summary": "Delete a group", - "operationId": "Group_Delete2", - "parameters": [ - { - "name": "groupId", - "in": "path", - "required": true, - "description": "Id of group ", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/octet-stream": { - "schema": { - "type": "string", - "format": "binary" + "type": "string" } } } @@ -2539,6 +3267,383 @@ } } } + }, + "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": { + "post": { + "tags": [ + "Group" + ], + "summary": "Create a group", + "operationId": "Group_Create", + "requestBody": { + "x-name": "groupCreateOrUpdateDetail", + "description": "Group to create", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GroupCreateOrUpdateDetailDTO" + } + } + }, + "required": true, + "x-position": 1 + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GroupDetailDTO" + } + } + } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + }, + "security": [ + { + "bearer": [] + } + ] + }, + "put": { + "tags": [ + "Group" + ], + "summary": "Update a group", + "operationId": "Group_Update", + "requestBody": { + "x-name": "groupCreateOrUpdateDetail", + "description": "group to update", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GroupCreateOrUpdateDetailDTO" + } + } + }, + "required": true, + "x-position": 1 + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GroupCreateOrUpdateDetailDTO" + } + } + } + }, + "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/{userId}/fromZigbee": { + "post": { + "tags": [ + "Group" + ], + "summary": "Create groups from provider", + "operationId": "Group_CreateDevicesFromZigbee2Mqtt", + "parameters": [ + { + "name": "userId", + "in": "path", + "required": true, + "description": "User Id", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GroupDetailDTO" + } + } + } + } + }, + "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/{groupId}/device/{deviceId}": { + "delete": { + "tags": [ + "Group" + ], + "summary": "Delete device from a group", + "operationId": "Group_Delete", + "parameters": [ + { + "name": "deviceId", + "in": "path", + "required": true, + "description": "Id of device to delete from the group", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 1 + }, + { + "name": "groupId", + "in": "path", + "required": true, + "description": "Id of group ", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 2 + } + ], + "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/{groupId}": { + "delete": { + "tags": [ + "Group" + ], + "summary": "Delete a group", + "operationId": "Group_Delete2", + "parameters": [ + { + "name": "groupId", + "in": "path", + "required": true, + "description": "Id of group ", + "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": [ @@ -2569,13 +3674,42 @@ } ], "responses": { - "200": { + "202": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "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" } } } @@ -2621,6 +3755,16 @@ } } } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -2670,6 +3814,36 @@ } } } + }, + "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": [ @@ -2709,6 +3883,26 @@ } } } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -2746,6 +3940,26 @@ } } } + }, + "404": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } } }, "security": [ @@ -2787,13 +4001,42 @@ } ], "responses": { - "200": { + "202": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "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" } } } @@ -2827,13 +4070,42 @@ } ], "responses": { - "200": { + "202": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "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" } } } @@ -2851,7 +4123,7 @@ "tags": [ "Room" ], - "summary": "Delete all room for a specified", + "summary": "Delete all room for a specified user", "operationId": "Room_DeleteAllForUser", "parameters": [ { @@ -2867,13 +4139,42 @@ } ], "responses": { - "200": { + "202": { "description": "", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "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" } } } @@ -3129,7 +4430,7 @@ "nullable": true, "oneOf": [ { - "$ref": "#/components/schemas/LocationDTO" + "$ref": "#/components/schemas/PlaceDTO" } ] }, @@ -3198,7 +4499,7 @@ "Unknown" ] }, - "LocationDTO": { + "PlaceDTO": { "type": "object", "additionalProperties": false, "properties": { @@ -3272,9 +4573,8 @@ } }, "properties": { - "type": "object", - "nullable": true, - "additionalProperties": {} + "type": "string", + "nullable": true }, "supportedOperations": { "type": "array", @@ -3438,13 +4738,13 @@ "nullable": true, "oneOf": [ { - "$ref": "#/components/schemas/OddH2H" + "$ref": "#/components/schemas/OddObject" } ] } } }, - "OddH2H": { + "OddObject": { "type": "object", "additionalProperties": false, "properties": { @@ -3748,6 +5048,9 @@ "type": "string", "nullable": true }, + "active": { + "type": "boolean" + }, "createdDate": { "type": "string", "format": "date-time" @@ -3837,7 +5140,7 @@ "nullable": true, "oneOf": [ { - "$ref": "#/components/schemas/State" + "$ref": "#/components/schemas/AutomationState" } ] }, @@ -3857,7 +5160,7 @@ } } }, - "State": { + "AutomationState": { "type": "object", "additionalProperties": false, "properties": { @@ -3919,7 +5222,7 @@ "type": "array", "nullable": true, "items": { - "$ref": "#/components/schemas/State" + "$ref": "#/components/schemas/AutomationState" } }, "rawRequest": { @@ -4058,9 +5361,8 @@ } }, "properties": { - "type": "object", - "nullable": true, - "additionalProperties": {} + "type": "string", + "nullable": true }, "supportedOperations": { "type": "array", @@ -4180,7 +5482,7 @@ "type": "array", "nullable": true, "items": { - "$ref": "#/components/schemas/Widget" + "$ref": "#/components/schemas/ScreenWidget" } }, "height": { @@ -4193,7 +5495,7 @@ } } }, - "Widget": { + "ScreenWidget": { "type": "object", "additionalProperties": false, "properties": { @@ -4387,6 +5689,9 @@ "type": "string", "nullable": true }, + "active": { + "type": "boolean" + }, "userId": { "type": "string", "nullable": true diff --git a/swagger.yaml b/swagger.yaml deleted file mode 100644 index b6e83e3..0000000 --- a/swagger.yaml +++ /dev/null @@ -1,3021 +0,0 @@ -x-generator: NSwag v13.9.2.0 (NJsonSchema v10.3.1.0 (Newtonsoft.Json v12.0.0.0)) -openapi: 3.0.0 -info: - title: MyCore Service - description: API description - version: Version Pre-Alpha -servers: - - url: 'http://192.168.31.140' -paths: - /api/books: - get: - tags: - - Books - operationId: Books_GetAll - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Book' - security: - - bearer: [] - post: - tags: - - Books - operationId: Books_Create - requestBody: - x-name: book - content: - application/json: - schema: - $ref: '#/components/schemas/Book' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/Book' - security: - - bearer: [] - '/api/books/{id}': - get: - tags: - - Books - operationId: Books_Get - parameters: - - name: id - in: path - required: true - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/Book' - security: - - bearer: [] - put: - tags: - - Books - operationId: Books_Update - parameters: - - name: id - in: path - required: true - schema: - type: string - nullable: true - x-position: 1 - requestBody: - x-name: bookIn - content: - application/json: - schema: - $ref: '#/components/schemas/Book' - required: true - x-position: 2 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - delete: - tags: - - Books - operationId: Books_Delete - parameters: - - name: id - in: path - required: true - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/device/{userId}': - get: - tags: - - Device - summary: Get all devices summary - operationId: Device_GetAll - parameters: - - name: userId - in: path - required: true - description: Id of user - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/DeviceSummaryDTO' - security: - - bearer: [] - '/api/device/detail/{deviceId}': - get: - tags: - - Device - summary: Get a specific device info - operationId: Device_GetDetail - parameters: - - name: deviceId - in: path - required: true - description: id of device - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/DeviceDetailDTO' - security: - - bearer: [] - '/api/device/{userId}/type/{type}': - get: - tags: - - Device - summary: Get list of devices from a type - operationId: Device_GetDevicesByType - parameters: - - name: userId - in: path - required: true - description: user Id - schema: - type: string - nullable: true - x-position: 1 - - name: type - in: path - required: true - description: device type - schema: - $ref: '#/components/schemas/DeviceType' - x-position: 2 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/DeviceDetailDTO' - security: - - bearer: [] - /api/device: - post: - tags: - - Device - summary: Create a device - operationId: Device_Create - requestBody: - x-name: deviceDetailDTO - description: Device to create - content: - application/json: - schema: - $ref: '#/components/schemas/DeviceDetailDTO' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/DeviceDetailDTO' - security: - - bearer: [] - '/api/device/{userId}/fromProvider/{providerId}': - post: - tags: - - Device - summary: Create devices from provider - operationId: Device_CreateDevicesFromProvider - parameters: - - name: userId - in: path - required: true - description: User Id - schema: - type: string - nullable: true - x-position: 1 - - name: providerId - in: path - required: true - description: Id of Provider - schema: - type: string - nullable: true - x-position: 2 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/DeviceDetailDTO' - security: - - bearer: [] - get: - tags: - - Device - summary: Get devices from provider - operationId: Device_GetDevicesFromProvider - parameters: - - name: userId - in: path - required: true - description: User Id - schema: - type: string - nullable: true - x-position: 1 - - name: providerId - in: path - required: true - description: Id of Provider - schema: - type: string - nullable: true - x-position: 2 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/DeviceDetailDTO' - security: - - bearer: [] - delete: - tags: - - Device - summary: Delete devices from provider - operationId: Device_DeleteDevicesFromProvider - parameters: - - name: userId - in: path - required: true - description: User Id - schema: - type: string - nullable: true - x-position: 1 - - name: providerId - in: path - required: true - description: Id of Provider - schema: - type: string - nullable: true - x-position: 2 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/device/zigbee2Mqtt/{userId}': - get: - tags: - - Device - summary: Get all zigbee2Mqtt devices - operationId: Device_GetDevicesFromZigbee2Mqtt - parameters: - - name: userId - in: path - required: true - description: User Id - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/DeviceDetailDTO' - security: - - bearer: [] - '/api/device/{deviceId}': - put: - tags: - - Device - summary: Update a device - operationId: Device_Update - parameters: - - name: deviceId - in: path - required: true - schema: - type: string - x-position: 2 - requestBody: - x-name: deviceDetailDTO - description: Device to update - content: - application/json: - schema: - $ref: '#/components/schemas/DeviceDetailDTO' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/DeviceDetailDTO' - security: - - bearer: [] - delete: - tags: - - Device - summary: Delete a device - operationId: Device_Delete - parameters: - - name: deviceId - in: path - required: true - description: Id of device to delete - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/device/user/{userId}': - delete: - tags: - - Device - summary: Delete all device for a specified - operationId: Device_DeleteAllForUser - parameters: - - name: userId - in: path - required: true - description: Id of user - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - /api/energy/electricity: - get: - tags: - - Energy - summary: Get summary production of Kwh/Year - operationId: Energy_GetElectricityProduction - parameters: - - name: userId - in: query - schema: - type: string - nullable: true - x-position: 1 - - name: viewBy - in: query - schema: - $ref: '#/components/schemas/ViewBy' - x-position: 2 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/ElectricityProduction' - security: - - bearer: [] - '/api/iot/smartprinter/{idDevice}': - get: - tags: - - IOT - summary: Retrieve all SmartPrinterMessage - operationId: IOT_GetSmartPrinterMessages - parameters: - - name: id - in: query - description: Id of the smart printer message - schema: - type: integer - format: int32 - x-position: 1 - - name: idDevice - in: path - required: true - schema: - type: string - x-position: 2 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/SmartPrinterMessage' - security: - - bearer: [] - post: - tags: - - IOT - summary: It's the method to post data from mqtt broker to Database (Thanks Rpi!) - operationId: IOT_PostToDBPrinter - parameters: - - name: idDevice - in: path - required: true - description: Id of the device to upload to DB - schema: - type: integer - format: int32 - x-position: 1 - requestBody: - x-name: content - description: Content that will be uploaded - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/SmartPrinterMessage' - required: true - x-position: 2 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/iot/smartgarden/{idDevice}': - post: - tags: - - IOT - summary: It's the method to post data from mqtt broker to Database (Thanks Rpi!) - operationId: IOT_PostToDBSmartGarden - parameters: - - name: idDevice - in: path - required: true - schema: - type: integer - format: int32 - x-position: 1 - requestBody: - x-name: content - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/SmartGardenMessage' - required: true - x-position: 2 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/odd/country/{id}/{oddRequest}': - get: - tags: - - Odd - summary: Get odds for one country and one odd value maximum - operationId: Odd_GetForCountry - parameters: - - name: id - in: path - required: true - description: 'id of country, e.g = BE for Belgium' - schema: - type: string - nullable: true - x-position: 1 - - name: oddRequest - in: path - required: true - description: Odd Maximum value - schema: - type: number - format: double - x-position: 2 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/OddNice' - '404': - description: '' - content: - application/json: - schema: - type: string - '500': - description: '' - content: - application/json: - schema: - type: string - '/api/odd/{oddRequest}': - get: - tags: - - Odd - summary: Get odds for one country and one odd value maximum - operationId: Odd_GetAll - parameters: - - name: oddRequest - in: path - required: true - description: Odd Maximum value - schema: - type: number - format: double - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/OddNice' - '404': - description: '' - content: - application/json: - schema: - type: string - '500': - description: '' - content: - application/json: - schema: - type: string - security: - - bearer: [] - '/api/provider/{userId}': - get: - tags: - - Provider - summary: 'Get all user providers ' - operationId: Provider_GetAll - parameters: - - name: userId - in: path - required: true - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/ProviderDTO' - security: - - bearer: [] - /api/provider: - post: - tags: - - Provider - summary: Create a provider - operationId: Provider_Create - requestBody: - x-name: providerDTO - description: Provider to create - content: - application/json: - schema: - $ref: '#/components/schemas/ProviderDTO' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ProviderDTO' - security: - - bearer: [] - put: - tags: - - Provider - summary: Update a provider - operationId: Provider_Update - requestBody: - x-name: providerDTO - description: Provider to update - content: - application/json: - schema: - $ref: '#/components/schemas/ProviderDTO' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/DeviceDetailDTO' - security: - - bearer: [] - '/api/provider/{providerId}': - delete: - tags: - - Provider - summary: Delete a provider - operationId: Provider_Delete - parameters: - - name: providerId - in: path - required: true - description: Id of provider to delete - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - /api/device/screen: - get: - tags: - - ScreenDevice - operationId: ScreenDevice_GetAllScreenDevices - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/ScreenDevice' - security: - - bearer: [] - post: - tags: - - ScreenDevice - operationId: ScreenDevice_CreateDevice - requestBody: - x-name: screenDevice - content: - application/json: - schema: - $ref: '#/components/schemas/ScreenDevice' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/device/screen/{screenDeviceId}': - get: - tags: - - ScreenDevice - operationId: ScreenDevice_GetDeviceInfo - parameters: - - name: screenDeviceId - in: path - required: true - description: Id of the screen device you want to get information - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ScreenDevice' - security: - - bearer: [] - put: - tags: - - ScreenDevice - operationId: ScreenDevice_UpdateDevice - parameters: - - name: screenDeviceId - in: path - required: true - schema: - type: integer - format: int32 - x-position: 1 - requestBody: - x-name: screenDevice - content: - application/json: - schema: - $ref: '#/components/schemas/ScreenDevice' - required: true - x-position: 2 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/device/screen/{deviceId}': - delete: - tags: - - ScreenDevice - operationId: ScreenDevice_DeleteDevice - parameters: - - name: deviceId - in: path - required: true - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - /api/mqtt: - post: - tags: - - MQTT - summary: Publish mqtt test - operationId: MQTT_PublishMessage - requestBody: - x-name: mqttMessageDTO - description: Message to send - content: - application/json: - schema: - $ref: '#/components/schemas/MqttMessageDTO' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - type: boolean - security: - - bearer: [] - /api/layout/panelSection: - get: - tags: - - Layout - summary: 'It''s a test ! :) ' - operationId: Layout_Get - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/PanelSection' - /api/token: - post: - tags: - - Token - operationId: Token_ConnectUser - requestBody: - x-name: loginDTO - content: - application/json: - schema: - $ref: '#/components/schemas/LoginDTO' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/UserInfo' - /api/user: - get: - tags: - - User - summary: 'Get a list of user ' - operationId: User_Get - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - post: - tags: - - User - operationId: User_CreateUser - requestBody: - x-name: newUser - content: - application/json: - schema: - $ref: '#/components/schemas/UserInfo' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/UserInfoDetailDTO' - put: - tags: - - User - operationId: User_UpdateUser - requestBody: - x-name: updatedUser - content: - application/json: - schema: - $ref: '#/components/schemas/UserInfo' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/UserInfoDetailDTO' - security: - - bearer: [] - '/api/user/{id}': - get: - tags: - - User - summary: 'Get a specific user ' - operationId: User_Get2 - parameters: - - name: id - in: path - required: true - description: id user - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/UserInfoDetailDTO' - security: - - bearer: [] - delete: - tags: - - User - operationId: User_DeleteUser - parameters: - - name: id - in: path - required: true - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - /api/test: - get: - tags: - - Values - summary: 'It''s a test ! :) ' - operationId: Values_GetAll - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - type: string - post: - tags: - - Values - operationId: Values_Post - requestBody: - x-name: value - content: - application/json: - schema: - type: string - required: true - x-position: 1 - responses: - '200': - description: '' - security: - - bearer: [] - '/api/test/{id}': - get: - tags: - - Values - operationId: Values_Get - parameters: - - name: id - in: path - required: true - schema: - type: integer - format: int32 - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - type: string - security: - - bearer: [] - put: - tags: - - Values - operationId: Values_Put - parameters: - - name: id - in: path - required: true - schema: - type: integer - format: int32 - x-position: 1 - requestBody: - x-name: value - content: - application/json: - schema: - type: string - required: true - x-position: 2 - responses: - '200': - description: '' - security: - - bearer: [] - delete: - tags: - - Values - operationId: Values_Delete - parameters: - - name: id - in: path - required: true - schema: - type: integer - format: int32 - x-position: 1 - responses: - '200': - description: '' - security: - - bearer: [] - /api/Authentication/Token: - post: - tags: - - Authentication - summary: Authenticate with form parameters (used by Swagger test client) - operationId: Authentication_AuthenticateWithForm - requestBody: - content: - multipart/form-data: - schema: - properties: - grant_type: - type: string - nullable: true - username: - type: string - nullable: true - password: - type: string - nullable: true - client_id: - type: string - nullable: true - client_secret: - type: string - nullable: true - responses: - '200': - description: Success - content: - application/json: - schema: - $ref: '#/components/schemas/LoginDTO' - '401': - description: Invalid credentials - content: - application/json: - schema: - type: string - '500': - description: Error - content: - application/json: - schema: - type: string - /api/Authentication/Authenticate: - post: - tags: - - Authentication - summary: Authenticate with Json parameters (used by most clients) - operationId: Authentication_AuthenticateWithJson - requestBody: - x-name: login - description: Login DTO - content: - application/json: - schema: - $ref: '#/components/schemas/LoginDTO' - required: true - x-position: 1 - responses: - '200': - description: Success - content: - application/json: - schema: - $ref: '#/components/schemas/LoginDTO' - '401': - description: Invalid credentials - content: - application/json: - schema: - type: string - '500': - description: Error - content: - application/json: - schema: - type: string - '/api/automation/{userId}': - get: - tags: - - Automation - summary: Get all automations for the specified user - operationId: Automation_GetAll - parameters: - - name: userId - in: path - required: true - description: Id of user - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/RoomSummaryDTO' - security: - - bearer: [] - '/api/automation/detail/{automationId}': - get: - tags: - - Automation - summary: Get detail info of a specified automation - operationId: Automation_GetDetail - parameters: - - name: automationId - in: path - required: true - description: automation id - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/AutomationDetailDTO' - security: - - bearer: [] - /api/automation: - post: - tags: - - Automation - operationId: Automation_Create - requestBody: - x-name: automationCreateOrUpdateDetail - content: - application/json: - schema: - $ref: '#/components/schemas/AutomationCreateOrUpdateDetailDTO' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/AutomationDTO' - security: - - bearer: [] - put: - tags: - - Automation - summary: Update an automation - operationId: Automation_Update - requestBody: - x-name: automationCreateOrUpdateDetail - description: automation to update - content: - application/json: - schema: - $ref: '#/components/schemas/AutomationCreateOrUpdateDetailDTO' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/AutomationCreateOrUpdateDetailDTO' - security: - - bearer: [] - '/api/automation/{automationId}': - delete: - tags: - - Automation - summary: Delete an automation - operationId: Automation_Delete - parameters: - - name: automationId - in: path - required: true - description: Id of automation to delete - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/automation/user/{userId}': - delete: - tags: - - Automation - summary: Delete all automation for a specified - operationId: Automation_DeleteAllForUser - parameters: - - name: userId - in: path - required: true - description: Id of user - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/group/{userId}': - get: - tags: - - Group - summary: Get all groups for the specified user - operationId: Group_GetAll - parameters: - - name: userId - in: path - required: true - description: Id of user - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/GroupSummaryDTO' - security: - - bearer: [] - '/api/group/detail/{groupId}': - get: - tags: - - Group - summary: Get detail info of a specified group - operationId: Group_GetDetail - parameters: - - name: userId - in: query - description: user id - schema: - type: string - nullable: true - x-position: 1 - - name: groupId - in: path - required: true - description: groupid - schema: - type: string - nullable: true - x-position: 2 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/GroupDetailDTO' - security: - - bearer: [] - '/api/group/{userId}/type/{type}': - get: - tags: - - Group - summary: Get list of group from a type - operationId: Group_GetGroupsByType - parameters: - - name: userId - in: path - required: true - description: user Id - schema: - type: string - nullable: true - x-position: 1 - - name: type - in: path - required: true - description: group type - schema: - type: string - nullable: true - x-position: 2 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/GroupSummaryDTO' - security: - - bearer: [] - /api/group: - post: - tags: - - Group - summary: Create a group - operationId: Group_Create - requestBody: - x-name: groupCreateOrUpdateDetail - description: Group to create - content: - application/json: - schema: - $ref: '#/components/schemas/GroupCreateOrUpdateDetailDTO' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/GroupDetailDTO' - security: - - bearer: [] - put: - tags: - - Group - summary: Update a group - operationId: Group_Update - requestBody: - x-name: groupCreateOrUpdateDetail - description: group to update - content: - application/json: - schema: - $ref: '#/components/schemas/GroupCreateOrUpdateDetailDTO' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/GroupCreateOrUpdateDetailDTO' - security: - - bearer: [] - '/api/group/{userId}/fromZigbee': - post: - tags: - - Group - summary: Create groups from provider - operationId: Group_CreateDevicesFromZigbee2Mqtt - parameters: - - name: userId - in: path - required: true - description: User Id - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/GroupDetailDTO' - security: - - bearer: [] - '/api/group/{groupId}/device/{deviceId}': - delete: - tags: - - Group - summary: Delete device from a group - operationId: Group_Delete - parameters: - - name: deviceId - in: path - required: true - description: Id of device to delete from the group - schema: - type: string - nullable: true - x-position: 1 - - name: groupId - in: path - required: true - description: 'Id of group ' - schema: - type: string - nullable: true - x-position: 2 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/group/{groupId}': - delete: - tags: - - Group - summary: Delete a group - operationId: Group_Delete2 - parameters: - - name: groupId - in: path - required: true - description: 'Id of group ' - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/group/zigbee2Mqtt/{userId}': - get: - tags: - - Group - summary: Get all zigbee2Mqtt groups - operationId: Group_GetGroupsFromZigbee2Mqtt - parameters: - - name: userId - in: path - required: true - description: User Id - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/GroupDetailDTO' - security: - - bearer: [] - '/api/group/user/{userId}': - delete: - tags: - - Group - summary: Delete all group for a specified - operationId: Group_DeleteAllForUser - parameters: - - name: userId - in: path - required: true - description: Id of user - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/room/{userId}': - get: - tags: - - Room - summary: Get all rooms for the specified user - operationId: Room_GetAll - parameters: - - name: userId - in: path - required: true - description: Id of user - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/RoomSummaryDTO' - security: - - bearer: [] - '/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 - description: room id - schema: - type: string - nullable: true - x-position: 2 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/RoomDetailDTO' - security: - - bearer: [] - /api/room: - post: - tags: - - Room - summary: Create a room - operationId: Room_Create - requestBody: - x-name: roomCreateOrUpdateDetail - description: Room to create - content: - application/json: - schema: - $ref: '#/components/schemas/RoomCreateOrUpdateDetailDTO' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/RoomDetailDTO' - security: - - bearer: [] - put: - tags: - - Room - summary: Update a room - operationId: Room_Update - requestBody: - x-name: roomCreateOrUpdateDetail - description: room to update - content: - application/json: - schema: - $ref: '#/components/schemas/RoomCreateOrUpdateDetailDTO' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/RoomCreateOrUpdateDetailDTO' - security: - - bearer: [] - '/api/room/{roomId}/device/{deviceId}': - delete: - tags: - - Room - summary: Delete device from a room - operationId: Room_Delete - parameters: - - name: deviceId - in: path - required: true - description: Id of device to delete from the room - schema: - type: string - nullable: true - x-position: 1 - - name: roomId - in: path - required: true - description: 'Id of room ' - schema: - type: string - nullable: true - x-position: 2 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/room/{roomId}': - delete: - tags: - - Room - summary: Delete a room - operationId: Room_Delete2 - parameters: - - name: roomId - in: path - required: true - description: 'Id of room ' - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - '/api/room/user/{userId}': - delete: - tags: - - Room - summary: Delete all room for a specified - operationId: Room_DeleteAllForUser - parameters: - - name: userId - in: path - required: true - description: Id of user - schema: - type: string - nullable: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - security: - - bearer: [] - /azure: - post: - tags: - - Azure - operationId: Azure_Create - requestBody: - x-name: user - content: - application/json: - schema: - $ref: '#/components/schemas/AzureADAuthModel' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - /facebook: - post: - tags: - - Facebook - operationId: Facebook_Create - requestBody: - x-name: user - content: - application/json: - schema: - $ref: '#/components/schemas/FacebookAuthModel' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - /google: - post: - tags: - - Google - operationId: Google_Create - requestBody: - x-name: user - content: - application/json: - schema: - $ref: '#/components/schemas/GoogleAuthModel' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - /token: - post: - tags: - - Token - operationId: Token_Create - requestBody: - x-name: user - content: - application/json: - schema: - $ref: '#/components/schemas/User' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary - /twitter: - post: - tags: - - Twitter - operationId: Twitter_Create - requestBody: - x-name: user - content: - application/json: - schema: - $ref: '#/components/schemas/TwitterAuthModel' - required: true - x-position: 1 - responses: - '200': - description: '' - content: - application/octet-stream: - schema: - type: string - format: binary -components: - schemas: - Book: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - bookName: - type: string - nullable: true - price: - type: number - format: decimal - category: - type: string - nullable: true - author: - type: string - nullable: true - DeviceSummaryDTO: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - userId: - type: string - nullable: true - description: - type: string - nullable: true - name: - type: string - nullable: true - model: - type: string - nullable: true - type: - $ref: '#/components/schemas/DeviceType' - status: - type: boolean - connectionStatus: - $ref: '#/components/schemas/ConnectionStatus' - locationId: - type: string - nullable: true - providerId: - type: string - nullable: true - providerName: - type: string - nullable: true - location: - nullable: true - oneOf: - - $ref: '#/components/schemas/LocationDTO' - lastStateDate: - type: string - format: date-time - battery: - type: boolean - batteryStatus: - type: integer - format: int32 - DeviceType: - type: string - description: '' - x-enumNames: - - Sensor - - Actuator - - Camera - - Switch - - Light - - Sound - - Plug - - Multiplug - - Thermostat - - Valve - - Door - - Environment - - Motion - - Gateway - - Unknown - enum: - - Sensor - - Actuator - - Camera - - Switch - - Light - - Sound - - Plug - - Multiplug - - Thermostat - - Valve - - Door - - Environment - - Motion - - Gateway - - Unknown - ConnectionStatus: - type: string - description: '' - x-enumNames: - - Connected - - Disconnected - - Unknown - enum: - - Connected - - Disconnected - - Unknown - LocationDTO: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - name: - type: string - nullable: true - DeviceDetailDTO: - allOf: - - $ref: '#/components/schemas/DeviceSummaryDTO' - - type: object - additionalProperties: false - properties: - firmwareVersion: - type: string - nullable: true - hardwareVersion: - type: string - nullable: true - port: - type: integer - format: int32 - 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 - ipAddress: - type: string - nullable: true - serviceIdentification: - type: string - nullable: true - manufacturerName: - type: string - nullable: true - groupIds: - type: array - nullable: true - items: - type: string - properties: - type: object - nullable: true - additionalProperties: {} - supportedOperations: - type: array - nullable: true - items: - type: string - MeansOfCommunication: - type: string - description: '' - x-enumNames: - - Wifi - - Bluetooth - - Zigbee - - Zwave - enum: - - Wifi - - Bluetooth - - Zigbee - - Zwave - ElectricityProduction: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - deviceId: - type: string - nullable: true - userId: - type: string - nullable: true - watt: - type: number - format: double - ampere: - type: number - format: double - timestamp: - type: string - format: date-time - ViewBy: - type: string - description: '' - x-enumNames: - - Year - - Month - - Day - enum: - - Year - - Month - - Day - SmartPrinterMessage: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - type: - type: string - nullable: true - time: - type: string - nullable: true - temperature: - type: number - format: double - pressure: - type: number - format: double - smoke: - type: integer - format: int32 - SmartGardenMessage: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - type: - type: string - nullable: true - time: - type: string - nullable: true - temperature: - type: number - format: double - pressure: - type: number - format: double - humidity: - type: number - format: double - water: - type: integer - format: int32 - light: - type: integer - format: int32 - OddNice: - type: object - additionalProperties: false - properties: - teams: - type: array - nullable: true - items: - type: string - commence_time: - type: integer - format: int32 - home_team: - type: string - nullable: true - odds: - nullable: true - oneOf: - - $ref: '#/components/schemas/OddH2H' - OddH2H: - type: object - additionalProperties: false - properties: - homeOdd: - type: number - format: double - drawOdd: - type: number - format: double - visitOdd: - type: number - format: double - ProviderDTO: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - name: - type: string - nullable: true - type: - type: string - nullable: true - userId: - type: string - nullable: true - endpoint: - type: string - nullable: true - username: - type: string - nullable: true - password: - type: string - nullable: true - apiKey: - type: string - nullable: true - active: - type: boolean - ScreenDevice: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - name: - type: string - nullable: true - type: - type: string - nullable: true - location: - type: string - nullable: true - locationExplanation: - type: string - nullable: true - height: - type: integer - format: int32 - width: - type: integer - format: int32 - MqttMessageDTO: - type: object - additionalProperties: false - properties: - topic: - type: string - nullable: true - message: - type: string - nullable: true - online: - type: boolean - PanelSection: - type: object - additionalProperties: false - properties: - label: - type: string - nullable: true - icon: - type: string - nullable: true - color: - type: string - nullable: true - defaultRoute: - type: string - nullable: true - children: - type: array - nullable: true - items: - $ref: '#/components/schemas/PanelMenuItem' - PanelMenuItem: - type: object - additionalProperties: false - properties: - label: - type: string - nullable: true - route: - type: string - nullable: true - icon: - type: string - nullable: true - color: - type: string - nullable: true - badgeValue: - type: integer - format: int32 - badgeType: - type: string - nullable: true - children: - type: array - nullable: true - items: - $ref: '#/components/schemas/PanelMenuItem' - UserInfo: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - role: - type: string - nullable: true - email: - type: string - nullable: true - password: - type: string - nullable: true - firstName: - type: string - nullable: true - lastName: - type: string - nullable: true - token: - type: string - nullable: true - birthday: - type: string - format: date-time - dateCreation: - type: string - format: date-time - address: - type: string - nullable: true - city: - type: string - nullable: true - state: - type: string - nullable: true - country: - type: string - nullable: true - language: - type: string - nullable: true - timeZone: - type: string - nullable: true - postalCode: - type: integer - format: int32 - automations: - type: array - nullable: true - items: - $ref: '#/components/schemas/Automation' - devices: - type: array - 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: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - userId: - type: string - nullable: true - name: - type: string - nullable: true - createdDate: - type: string - format: date-time - 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 - Trigger: - type: object - additionalProperties: false - properties: - providerId: - type: string - nullable: true - deviceId: - type: string - nullable: true - stateName: - type: string - nullable: true - stateValue: - type: string - nullable: true - type: - $ref: '#/components/schemas/TriggerType' - TriggerType: - type: string - description: '' - x-enumNames: - - MQTT - - WEB - - TIME - enum: - - MQTT - - WEB - - TIME - Condition: - type: object - additionalProperties: false - properties: - deviceId: - type: string - nullable: true - state: - nullable: true - oneOf: - - $ref: '#/components/schemas/State' - startTime: - type: string - nullable: true - endTime: - type: string - nullable: true - type: - $ref: '#/components/schemas/ConditionType' - value: - $ref: '#/components/schemas/ConditionValue' - State: - type: object - additionalProperties: false - properties: - name: - type: string - nullable: true - value: - 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 - Action: - type: object - additionalProperties: false - properties: - groupId: - type: string - nullable: true - deviceId: - type: string - nullable: true - states: - type: array - nullable: true - items: - $ref: '#/components/schemas/State' - rawRequest: - type: string - nullable: true - providerId: - type: string - nullable: true - type: - $ref: '#/components/schemas/ActionType' - ActionType: - type: string - description: '' - x-enumNames: - - DELAY - - DEVICE - - HTTP - - ZIGBEE2MQTT - - MQTT - - GROUP - enum: - - DELAY - - DEVICE - - HTTP - - 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: object - nullable: true - additionalProperties: {} - 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/Widget' - height: - type: integer - format: int32 - width: - type: integer - format: int32 - Widget: - 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 - RoomSummaryDTO: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - userId: - type: string - nullable: true - name: - type: string - nullable: true - AutomationDetailDTO: - 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' - devicesIds: - type: array - nullable: true - items: - type: string - AutomationDTO: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - name: - type: string - nullable: true - userId: - 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 - GroupSummaryDTO: - 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 - isAlarm: - type: boolean - GroupDetailDTO: - allOf: - - $ref: '#/components/schemas/GroupSummaryDTO' - - type: object - additionalProperties: false - properties: - createdDate: - type: string - format: date-time - updatedDate: - type: string - format: date-time - devices: - type: array - nullable: true - items: - $ref: '#/components/schemas/DeviceDetailDTO' - GroupCreateOrUpdateDetailDTO: - allOf: - - $ref: '#/components/schemas/GroupSummaryDTO' - - type: object - additionalProperties: false - properties: - deviceIds: - type: array - nullable: true - items: - type: string - RoomDetailDTO: - allOf: - - $ref: '#/components/schemas/RoomSummaryDTO' - - type: object - additionalProperties: false - properties: - createdDate: - type: string - format: date-time - updatedDate: - type: string - format: date-time - devices: - type: array - nullable: true - items: - $ref: '#/components/schemas/DeviceDetailDTO' - RoomCreateOrUpdateDetailDTO: - allOf: - - $ref: '#/components/schemas/RoomSummaryDTO' - - type: object - additionalProperties: false - properties: - deviceIds: - type: array - nullable: true - items: - type: string - AzureADAuthModel: - type: object - additionalProperties: false - properties: - apiKey: - type: string - nullable: true - FacebookAuthModel: - type: object - additionalProperties: false - properties: - userAccessToken: - type: string - nullable: true - GoogleAuthModel: - type: object - additionalProperties: false - properties: - authorizationCode: - type: string - nullable: true - apiKey: - type: string - nullable: true - User: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - password: - type: string - nullable: true - TwitterAuthModel: - type: object - additionalProperties: false - properties: - apiKey: - type: string - nullable: true - securitySchemes: - bearer: - type: oauth2 - description: MyCore Authentication - flows: - password: - authorizationUrl: /authentication/Token - tokenUrl: /api/authentication/Token - scopes: - MyCore-api: MyCore WebAPI -security: - - bearer: [] -tags: - - name: Authentication - description: Authentication management