mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 01:31:19 +00:00
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
This commit is contained in:
parent
9c5bc07531
commit
2f10433f94
@ -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;
|
||||
|
||||
@ -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<string> GroupIds { get; set; }
|
||||
|
||||
public Dictionary<string, object> Properties { get; set; }
|
||||
public string Properties { get; set; } // Dictionary<string, object>
|
||||
|
||||
public List<string> SupportedOperations { get; set; }
|
||||
}
|
||||
|
||||
@ -5,7 +5,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MyCore.Interfaces.DTO
|
||||
{
|
||||
public class LocationDTO
|
||||
/// <summary>
|
||||
/// Place DTO
|
||||
/// </summary>
|
||||
public class PlaceDTO
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
@ -28,7 +28,7 @@ namespace MyCore.Interfaces
|
||||
public IEnumerable<double> 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<string> 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; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<State> States { get; set; }
|
||||
public List<AutomationState> 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
|
||||
|
||||
@ -94,7 +94,7 @@ namespace MyCore.Interfaces.Models
|
||||
public List<string> GroupIds { get; set; }
|
||||
|
||||
[BsonElement("Properties")]
|
||||
public Dictionary<string, object> Properties { get; set; }
|
||||
public string Properties { get; set; } // Dictionary<string, object>
|
||||
|
||||
[BsonElement("SupportedOperations")]
|
||||
public List<string> SupportedOperations { get; set; }
|
||||
|
||||
@ -7,7 +7,7 @@ namespace MyCore.Interfaces.Models
|
||||
/// <summary>
|
||||
/// Location of a device (Room name, garden, ..)
|
||||
/// </summary>
|
||||
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
|
||||
@ -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; }
|
||||
|
||||
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MyCore.Interfaces.Models
|
||||
{
|
||||
public class Widget
|
||||
public class ScreenWidget
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
@ -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; }
|
||||
|
||||
@ -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; }
|
||||
|
||||
@ -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; }
|
||||
|
||||
@ -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; }
|
||||
|
||||
@ -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; }
|
||||
|
||||
@ -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; }
|
||||
|
||||
@ -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; }
|
||||
|
||||
@ -53,7 +53,13 @@ namespace MyCore.Service.Controllers
|
||||
//_mqttOnlineClientService = onlineProvider.MqttOnlineClientService;
|
||||
}
|
||||
|
||||
private ActionResult<LoginDTO> Authenticate(string email, string password)
|
||||
/// <summary>
|
||||
/// Authenticate (business)
|
||||
/// </summary>
|
||||
/// <param name="email">user email</param>
|
||||
/// <param name="password">user password</param>
|
||||
/// <returns>Token descriptor</returns>
|
||||
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) {
|
||||
if (user == null)
|
||||
throw new KeyNotFoundException("User not found");
|
||||
|
||||
System.Console.WriteLine($"Init userId for MqqClientService ! {user.Email}");
|
||||
MqttClientService.SetServices(_DeviceDatabaseService, _GroupDatabaseService, _ProviderDatabaseService, _LocationDatabaseService, _ActionService, _AutomationDatabaseService, user.Id);
|
||||
}
|
||||
|
||||
return Ok(token);
|
||||
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<LoginDTO> 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<LoginDTO> 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);
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@ namespace MyCore.Service.Controllers
|
||||
/// </summary>
|
||||
/// <param name="userId">Id of user</param>
|
||||
[ProducesResponseType(typeof(List<RoomSummaryDTO>), 200)]
|
||||
[ProducesResponseType(typeof(string), 500)]
|
||||
[HttpGet("{userId}")]
|
||||
public ObjectResult GetAll(string userId)
|
||||
{
|
||||
@ -63,15 +64,32 @@ namespace MyCore.Service.Controllers
|
||||
/// </summary>
|
||||
/// <param name="automationId">automation id</param>
|
||||
[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
|
||||
}
|
||||
|
||||
|
||||
//// <summary>
|
||||
/// <summary>
|
||||
/// Create an automation
|
||||
/// </summary>
|
||||
/// <param name="automationCreateOrUpdateDetail">Automation to create</param>
|
||||
[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
|
||||
/// </summary>
|
||||
/// <param name="automationCreateOrUpdateDetail">automation to update</param>
|
||||
[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
|
||||
/// </summary>
|
||||
/// <param name="automationId">Id of automation to delete</param>
|
||||
[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
|
||||
/// </summary>
|
||||
/// <param name="userId">Id of user</param>
|
||||
[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)
|
||||
{
|
||||
|
||||
@ -39,12 +39,12 @@ namespace MyCore.Controllers
|
||||
//this._mqttOnlineClientService = onlineProvider.MqttOnlineClientService;
|
||||
}
|
||||
|
||||
// GET: Devices
|
||||
/// <summary>
|
||||
/// Get all devices summary
|
||||
/// </summary>
|
||||
/// <param name="userId">Id of user</param>
|
||||
[ProducesResponseType(typeof(List<DeviceSummaryDTO>), 200)]
|
||||
[ProducesResponseType(typeof(string), 500)]
|
||||
[HttpGet("{userId}")]
|
||||
public ObjectResult GetAll(string userId)
|
||||
{
|
||||
@ -72,15 +72,32 @@ namespace MyCore.Controllers
|
||||
/// </summary>
|
||||
/// <param name="deviceId">id of device</param>
|
||||
[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
|
||||
/// <param name="userId">user Id</param>
|
||||
/// <param name="type">device type</param>
|
||||
[ProducesResponseType(typeof(List<DeviceDetailDTO>), 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<Device> 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
|
||||
/// </summary>
|
||||
/// <param name="deviceDetailDTO">Device to create</param>
|
||||
[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
|
||||
/// <param name="userId">User Id</param>
|
||||
/// <param name="providerId">Id of Provider</param>
|
||||
[ProducesResponseType(typeof(List<DeviceDetailDTO>), 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<ObjectResult> 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
|
||||
/// </summary>
|
||||
/// <param name="userId">User Id</param>
|
||||
[ProducesResponseType(typeof(List<DeviceDetailDTO>), 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
|
||||
/// <param name="userId">User Id</param>
|
||||
/// <param name="providerId">Id of Provider</param>
|
||||
[ProducesResponseType(typeof(List<DeviceDetailDTO>), 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
|
||||
/// </summary>
|
||||
/// <param name="deviceDetailDTO">Device to update</param>
|
||||
[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
|
||||
/// </summary>
|
||||
/// <param name="deviceId">Id of device to delete</param>
|
||||
[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
|
||||
/// </summary>
|
||||
/// <param name="userId">User Id</param>
|
||||
/// <param name="providerId">Id of Provider</param>
|
||||
[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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete all device for a specified
|
||||
/// Delete all device for a specified user
|
||||
/// </summary>
|
||||
/// <param name="userId">Id of user</param>
|
||||
[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)
|
||||
{
|
||||
|
||||
@ -38,6 +38,7 @@ namespace MyCore.Controllers
|
||||
/// <param name="oddRequest">Odd Maximum value</param>
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(List<OddNice>), 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];
|
||||
|
||||
@ -33,18 +33,21 @@ namespace MyCore.Controllers
|
||||
this._UserDatabaseService = UserDatabaseService;
|
||||
}
|
||||
|
||||
// GET: Devices
|
||||
/// <summary>
|
||||
/// Get all user providers
|
||||
/// </summary>
|
||||
/// <param name="userId">Id of user</param>
|
||||
[ProducesResponseType(typeof(List<ProviderDTO>), 200)]
|
||||
[ProducesResponseType(typeof(string), 400)]
|
||||
[ProducesResponseType(typeof(string), 404)]
|
||||
[ProducesResponseType(typeof(string), 500)]
|
||||
[HttpGet("{userId}")]
|
||||
public ObjectResult GetAll(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");
|
||||
@ -55,13 +58,13 @@ namespace MyCore.Controllers
|
||||
|
||||
return new OkObjectResult(providersDTO);
|
||||
}
|
||||
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)
|
||||
{
|
||||
@ -74,40 +77,44 @@ namespace MyCore.Controllers
|
||||
/// </summary>
|
||||
/// <param name="providerDTO">Provider to create</param>
|
||||
[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
|
||||
{
|
||||
|
||||
if (providerDTO == null)
|
||||
throw new ArgumentNullException("Incorrect parameters");
|
||||
|
||||
if (providerDTO.UserId == null)
|
||||
throw new InvalidOperationException("User not found");
|
||||
throw new ArgumentNullException("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");
|
||||
throw new InvalidOperationException("Provider already exists");
|
||||
|
||||
ProviderDTO providerCreated = ProviderService.CreateOrUpdate(this._ProviderDatabaseService, providerDTO.UserId, providerDTO, true);
|
||||
|
||||
return new OkObjectResult(providerCreated);
|
||||
|
||||
}
|
||||
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 (ArgumentException ex)
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
return new BadRequestObjectResult(ex.Message) { StatusCode = 409 };
|
||||
return new ConflictObjectResult(ex.Message) {};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -120,13 +127,19 @@ namespace MyCore.Controllers
|
||||
/// </summary>
|
||||
/// <param name="providerDTO">Provider to update</param>
|
||||
[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 InvalidOperationException("User not found");
|
||||
throw new ArgumentNullException("User not found");
|
||||
|
||||
if (!UserService.IsExist(_UserDatabaseService, providerDTO.UserId))
|
||||
throw new KeyNotFoundException("User not found");
|
||||
@ -138,13 +151,13 @@ namespace MyCore.Controllers
|
||||
|
||||
return new OkObjectResult(providerUpdated);
|
||||
}
|
||||
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)
|
||||
{
|
||||
@ -156,6 +169,10 @@ namespace MyCore.Controllers
|
||||
/// Delete a provider
|
||||
/// </summary>
|
||||
/// <param name="providerId">Id of provider to delete</param>
|
||||
[ProducesResponseType(typeof(string), 202)]
|
||||
[ProducesResponseType(typeof(string), 400)]
|
||||
[ProducesResponseType(typeof(string), 404)]
|
||||
[ProducesResponseType(typeof(string), 500)]
|
||||
[HttpDelete("{providerId}")]
|
||||
public ObjectResult Delete(string providerId)
|
||||
{
|
||||
@ -163,14 +180,22 @@ namespace MyCore.Controllers
|
||||
{
|
||||
// TODO DELETE ALL DEVICES linked
|
||||
if (providerId == null)
|
||||
throw new InvalidOperationException("Provider is null");
|
||||
throw new ArgumentNullException("Incorrect parameters");
|
||||
|
||||
if (!_ProviderDatabaseService.IsExist(providerId))
|
||||
throw new InvalidOperationException("Provider is null");
|
||||
throw new KeyNotFoundException("Provider is null");
|
||||
|
||||
_ProviderDatabaseService.Remove(providerId);
|
||||
|
||||
return new OkObjectResult(201);
|
||||
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)
|
||||
{
|
||||
|
||||
@ -23,11 +23,11 @@ namespace MyCore.Controllers
|
||||
_ScreenDeviceDatabaseService = ScreenDeviceDatabaseService;
|
||||
}
|
||||
|
||||
// GET: Devices
|
||||
/// <summary>
|
||||
///
|
||||
/// Get all screen devices
|
||||
/// </summary>
|
||||
[ProducesResponseType(typeof(List<ScreenDevice>), 200)]
|
||||
[ProducesResponseType(typeof(string), 500)]
|
||||
[HttpGet]
|
||||
public ObjectResult GetAllScreenDevices()
|
||||
{
|
||||
@ -43,39 +43,63 @@ namespace MyCore.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
// GET: ScreenDevice
|
||||
/// <summary>
|
||||
///
|
||||
/// Get screen device info
|
||||
/// </summary>
|
||||
/// <param name="screenDeviceId">Id of the screen device you want to get information</param>
|
||||
[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
|
||||
/// <summary>
|
||||
///
|
||||
/// Create screen device
|
||||
/// </summary>
|
||||
/// <param name="screenDevice">Screen device to create</param>
|
||||
[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
|
||||
/// <summary>
|
||||
///
|
||||
/// Update screen device
|
||||
/// </summary>
|
||||
[HttpPut("{screenDeviceId}")]
|
||||
public ObjectResult UpdateDevice(int screenDeviceId, [FromBody] ScreenDevice screenDevice)
|
||||
/// <param name="screenDevice">Screen device to update</param>
|
||||
[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
|
||||
/// <summary>
|
||||
///
|
||||
/// Delete device
|
||||
/// </summary>
|
||||
/// <param name="deviceId">Screen device id to update</param>
|
||||
[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)
|
||||
{
|
||||
|
||||
@ -45,17 +45,26 @@ namespace MyCore.Service.Controllers
|
||||
/// </summary>
|
||||
/// <param name="userId">Id of user</param>
|
||||
[ProducesResponseType(typeof(List<GroupSummaryDTO>), 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<Group> Groups = _GroupDatabaseService.GetAll(userId);
|
||||
|
||||
List<GroupSummaryDTO> 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,16 +74,19 @@ namespace MyCore.Service.Controllers
|
||||
/// <summary>
|
||||
/// Get detail info of a specified group
|
||||
/// </summary>
|
||||
/// <param name="userId">user id</param>
|
||||
/// <param name="groupId">groupid</param>
|
||||
[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)
|
||||
{
|
||||
if (groupId == null)
|
||||
throw new ArgumentNullException("Incorrect parameters");
|
||||
|
||||
Group group = _GroupDatabaseService.GetById(groupId);
|
||||
if (group == null)
|
||||
throw new KeyNotFoundException("Group not found");
|
||||
@ -82,15 +94,15 @@ namespace MyCore.Service.Controllers
|
||||
List<Device> devices = _DeviceDatabaseService.GetByLocation(group.UserId, groupId);
|
||||
|
||||
return new OkObjectResult(group.ToDTO(devices.Select(d => d.ToDTO()).ToList()));
|
||||
|
||||
}
|
||||
else
|
||||
catch (ArgumentNullException ex)
|
||||
{
|
||||
return new ObjectResult("Invalid parameters") { 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)
|
||||
{
|
||||
@ -104,21 +116,61 @@ namespace MyCore.Service.Controllers
|
||||
/// <param name="userId">user Id</param>
|
||||
/// <param name="type">group type</param>
|
||||
[ProducesResponseType(typeof(List<GroupSummaryDTO>), 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)
|
||||
{
|
||||
if (userId == null || type == null)
|
||||
throw new ArgumentNullException("Incorrect parameters");
|
||||
|
||||
List<Group> groups = _GroupDatabaseService.GetByType(userId, type);
|
||||
|
||||
return new OkObjectResult(groups.Select(d => d.ToSummaryDTO()));
|
||||
}
|
||||
else
|
||||
catch (ArgumentNullException ex)
|
||||
{
|
||||
return new ObjectResult("Invalid parameters") { StatusCode = 400 };
|
||||
return new BadRequestObjectResult(ex.Message) {};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ObjectResult(ex.Message) { StatusCode = 500 };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all zigbee2Mqtt groups
|
||||
/// </summary>
|
||||
/// <param name="userId">User Id</param>
|
||||
[ProducesResponseType(typeof(List<GroupDetailDTO>), 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
|
||||
/// </summary>
|
||||
/// <param name="groupCreateOrUpdateDetail">Group to create</param>
|
||||
[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
|
||||
/// </summary>
|
||||
/// <param name="userId">User Id</param>
|
||||
[ProducesResponseType(typeof(List<GroupDetailDTO>), 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
|
||||
/// </summary>
|
||||
/// <param name="groupCreateOrUpdateDetail">group to update</param>
|
||||
[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,15 +293,21 @@ namespace MyCore.Service.Controllers
|
||||
/// </summary>
|
||||
/// <param name="deviceId">Id of device to delete from the group</param>
|
||||
/// <param name="groupId">Id of group </param>
|
||||
[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))
|
||||
{
|
||||
if (groupId == null || deviceId == null)
|
||||
throw new ArgumentNullException("Incorrect parameters");
|
||||
|
||||
if (!_GroupDatabaseService.IsExist(groupId))
|
||||
throw new KeyNotFoundException("Group does not exist");
|
||||
|
||||
// Update group
|
||||
Group group = _GroupDatabaseService.GetById(groupId);
|
||||
group.DevicesIds = group.DevicesIds.Where(d => d != deviceId).ToList();
|
||||
@ -231,16 +316,22 @@ namespace MyCore.Service.Controllers
|
||||
|
||||
// Update device
|
||||
Device device = _DeviceDatabaseService.GetById(deviceId);
|
||||
if (device != null)
|
||||
{
|
||||
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 OkObjectResult(201);
|
||||
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,15 +343,21 @@ namespace MyCore.Service.Controllers
|
||||
/// Delete a group
|
||||
/// </summary>
|
||||
/// <param name="groupId">Id of group to delete</param>
|
||||
[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 (_GroupDatabaseService.IsExist(groupId))
|
||||
{
|
||||
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<Device> devices = _DeviceDatabaseService.GetByLocation(group.UserId, groupId);
|
||||
@ -272,41 +369,16 @@ namespace MyCore.Service.Controllers
|
||||
}
|
||||
// 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) {};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all zigbee2Mqtt groups
|
||||
/// </summary>
|
||||
/// <param name="userId">User Id</param>
|
||||
[ProducesResponseType(typeof(List<GroupDetailDTO>), 200)]
|
||||
[HttpGet("zigbee2Mqtt/{userId}")]
|
||||
public ObjectResult GetGroupsFromZigbee2Mqtt(string userId)
|
||||
catch (KeyNotFoundException ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
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
|
||||
/// </summary>
|
||||
/// <param name="userId">Id of user</param>
|
||||
[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)
|
||||
{
|
||||
|
||||
@ -33,13 +33,15 @@ namespace MyCore.Controllers
|
||||
/// </summary>
|
||||
/// <param name="mqttMessageDTO">Message to send</param>
|
||||
[ProducesResponseType(typeof(bool), 200)]
|
||||
[ProducesResponseType(typeof(string), 400)]
|
||||
[ProducesResponseType(typeof(string), 500)]
|
||||
[HttpPost]
|
||||
public async Task<ObjectResult> 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 };
|
||||
|
||||
@ -19,10 +19,10 @@ namespace MyCore.Controllers
|
||||
public class LayoutController : ControllerBase
|
||||
{
|
||||
|
||||
// GET api/values
|
||||
/// <summary>
|
||||
/// It's a test ! :)
|
||||
/// </summary>
|
||||
[ProducesResponseType(typeof(IEnumerable<PanelSection>), 200)]
|
||||
[AllowAnonymous]
|
||||
[HttpGet("panelSection")]
|
||||
public ActionResult<IEnumerable<PanelSection>> Get()
|
||||
|
||||
@ -31,20 +31,43 @@ namespace MyCore.Controllers
|
||||
_userService = userService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Connect user
|
||||
/// </summary>
|
||||
/// <param name="loginDTO">login info</param>
|
||||
[ProducesResponseType(typeof(UserInfo), 200)]
|
||||
[ProducesResponseType(typeof(string), 401)]
|
||||
[ProducesResponseType(typeof(string), 500)]
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
public ActionResult<UserInfo> ConnectUser([FromBody] LoginDTO loginDTO)
|
||||
{
|
||||
//string test = _TokenService.GenerateSHA256String(password);
|
||||
|
||||
try
|
||||
{
|
||||
UserInfo user = null;
|
||||
if (IsValidUserAndPasswordCombination(loginDTO.Email, loginDTO.Password))
|
||||
{
|
||||
UserInfo user = _userService.GetByEmail(loginDTO.Email);
|
||||
user = _userService.GetByEmail(loginDTO.Email);
|
||||
user.Token = _tokenService.GenerateToken(loginDTO.Email).ToString();
|
||||
|
||||
return user;
|
||||
}
|
||||
return BadRequest();
|
||||
|
||||
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 };
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsValidUserAndPasswordCombination(string email, string password)
|
||||
|
||||
@ -29,11 +29,11 @@ namespace MyCore.Controllers
|
||||
_tokenService = tokenService;
|
||||
}
|
||||
|
||||
// GET api/user
|
||||
/// <summary>
|
||||
/// Get a list of user
|
||||
/// </summary>
|
||||
[ProducesResponseType(typeof(List<UserInfo>), 200)]
|
||||
[ProducesResponseType(typeof(string), 500)]
|
||||
[HttpGet]
|
||||
public ObjectResult Get()
|
||||
{
|
||||
@ -50,64 +50,71 @@ namespace MyCore.Controllers
|
||||
}
|
||||
|
||||
|
||||
// GET api/user/5
|
||||
/// <summary>
|
||||
/// Get a specific user
|
||||
/// </summary>
|
||||
/// <param name="id">id user</param>
|
||||
[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
|
||||
/// <summary>
|
||||
///
|
||||
/// Create an user
|
||||
/// </summary>
|
||||
/// <param name="newUser">New user info</param>
|
||||
[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)
|
||||
{
|
||||
if (newUser == null)
|
||||
throw new ArgumentNullException("User param is null");
|
||||
|
||||
newUser.Token = _tokenService.GenerateToken(newUser.Email).ToString();
|
||||
newUser.DateCreation = DateTime.Now;
|
||||
|
||||
List<UserInfo> users = _userService.GetAll();
|
||||
|
||||
if (users.Select(u => u.Email).Contains(newUser.Email))
|
||||
{
|
||||
return Conflict("This Email is already used");
|
||||
}
|
||||
throw new InvalidOperationException("This Email is already used");
|
||||
|
||||
UserInfo userCreated = _userService.Create(newUser);
|
||||
|
||||
return new OkObjectResult(userCreated.ToDTO());
|
||||
}
|
||||
else {
|
||||
// TODO
|
||||
return new ObjectResult("An error has occurred") { StatusCode = 500 };
|
||||
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
|
||||
/// <summary>
|
||||
///
|
||||
/// Update an user
|
||||
/// </summary>
|
||||
/// <param name="updatedUser">User to update</param>
|
||||
[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);
|
||||
|
||||
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);
|
||||
|
||||
return new OkObjectResult(userModified.ToDTO());
|
||||
}
|
||||
else {
|
||||
// TODO
|
||||
return new ObjectResult("An error has occurred") { StatusCode = 500 };
|
||||
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
|
||||
/// <summary>
|
||||
/// Delete an user
|
||||
/// </summary>
|
||||
/// <param name="id">Id of user to delete</param>
|
||||
[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);
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
return NotFound("The user was not found");
|
||||
}
|
||||
if (user == null)
|
||||
throw new KeyNotFoundException("User does not exist");
|
||||
|
||||
_userService.Remove(id);
|
||||
|
||||
return Accepted("The user has been deleted");
|
||||
return new ObjectResult("The user has been deleted") { StatusCode = 202 };
|
||||
|
||||
}
|
||||
else
|
||||
catch (ArgumentNullException ex)
|
||||
{
|
||||
// TODO
|
||||
return new ObjectResult("An error has occurred") { StatusCode = 500 };
|
||||
return new BadRequestObjectResult(ex.Message) { };
|
||||
}
|
||||
catch (KeyNotFoundException ex)
|
||||
{
|
||||
return new NotFoundObjectResult(ex.Message) { };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@ -42,6 +42,7 @@ namespace MyCore.Service.Controllers
|
||||
/// </summary>
|
||||
/// <param name="userId">Id of user</param>
|
||||
[ProducesResponseType(typeof(List<RoomSummaryDTO>), 200)]
|
||||
[ProducesResponseType(typeof(string), 500)]
|
||||
[HttpGet("{userId}")]
|
||||
public ObjectResult GetAll(string userId)
|
||||
{
|
||||
@ -65,21 +66,32 @@ namespace MyCore.Service.Controllers
|
||||
/// <param name="userId">user id</param>
|
||||
/// <param name="roomId">room id</param>
|
||||
[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)
|
||||
{
|
||||
if (userId == null || roomId == null)
|
||||
throw new ArgumentNullException("Incorrect parameters");
|
||||
|
||||
Room room = _RoomDatabaseService.GetById(roomId);
|
||||
if (room == null)
|
||||
throw new KeyNotFoundException("Room does not exist");
|
||||
List<Device> devices = _DeviceDatabaseService.GetByLocation(room.UserId, roomId);
|
||||
|
||||
return new OkObjectResult(room.ToDTO(devices.Select(d => d.ToDTO()).ToList()));
|
||||
|
||||
}
|
||||
else {
|
||||
return new ObjectResult("Invalid parameters") { StatusCode = 400 };
|
||||
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
|
||||
/// </summary>
|
||||
/// <param name="roomCreateOrUpdateDetail">Room to create</param>
|
||||
[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
|
||||
/// </summary>
|
||||
/// <param name="roomCreateOrUpdateDetail">room to update</param>
|
||||
[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,15 +162,21 @@ namespace MyCore.Service.Controllers
|
||||
/// </summary>
|
||||
/// <param name="deviceId">Id of device to delete from the room</param>
|
||||
/// <param name="roomId">Id of room </param>
|
||||
[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))
|
||||
{
|
||||
if (roomId == null && deviceId == null)
|
||||
throw new ArgumentNullException("Incorrect parameters");
|
||||
|
||||
if (!_RoomDatabaseService.IsExist(roomId))
|
||||
throw new KeyNotFoundException("Room does not exist");
|
||||
|
||||
// Update room
|
||||
Room room = _RoomDatabaseService.GetById(roomId);
|
||||
room.DevicesIds = room.DevicesIds.Where(d => d != deviceId).ToList();
|
||||
@ -159,15 +185,24 @@ namespace MyCore.Service.Controllers
|
||||
|
||||
// Update device
|
||||
Device device = _DeviceDatabaseService.GetById(deviceId);
|
||||
if (device != null) {
|
||||
|
||||
if (device == null)
|
||||
throw new KeyNotFoundException("Device does not exist");
|
||||
|
||||
device.LocationId = null;
|
||||
device.UpdatedDate = DateTime.Now;
|
||||
_DeviceDatabaseService.Update(device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new OkObjectResult(201);
|
||||
|
||||
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,15 +214,21 @@ namespace MyCore.Service.Controllers
|
||||
/// Delete a room
|
||||
/// </summary>
|
||||
/// <param name="roomId">Id of room to delete</param>
|
||||
[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))
|
||||
{
|
||||
if (roomId == null)
|
||||
throw new ArgumentNullException("Incorrect parameters");
|
||||
|
||||
if (!_RoomDatabaseService.IsExist(roomId))
|
||||
throw new KeyNotFoundException("Room does not exist");
|
||||
|
||||
Room room = _RoomDatabaseService.GetById(roomId);
|
||||
// Delete location from all devices
|
||||
List<Device> devices = _DeviceDatabaseService.GetByLocation(room.UserId, roomId);
|
||||
@ -199,10 +240,16 @@ namespace MyCore.Service.Controllers
|
||||
}
|
||||
// Delete room
|
||||
_RoomDatabaseService.Remove(roomId);
|
||||
}
|
||||
}
|
||||
|
||||
return new OkObjectResult(201);
|
||||
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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete all room for a specified
|
||||
/// Delete all room for a specified user
|
||||
/// </summary>
|
||||
/// <param name="userId">Id of user</param>
|
||||
[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)
|
||||
{
|
||||
|
||||
@ -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
|
||||
@ -119,7 +119,7 @@ namespace Mqtt.Client.AspNetCore.Services
|
||||
options = new MqttClientOptionsBuilder()
|
||||
.WithClientId(clientId)
|
||||
.WithTcpServer(domain, port)
|
||||
.WithCredentials(resultToken.userid, hashed_password)
|
||||
.WithCredentials(resultToken?.userid, hashed_password)
|
||||
.WithCleanSession()
|
||||
.WithTls()
|
||||
.WithProtocolVersion(MqttProtocolVersion.V311)
|
||||
@ -256,13 +256,17 @@ namespace Mqtt.Client.AspNetCore.Services
|
||||
|
||||
var message = BuildMQTTMessage(method, namespaceVar, payloadVar);
|
||||
|
||||
if (message != null) {
|
||||
PublishMessage(topic, message);
|
||||
}
|
||||
}
|
||||
|
||||
private static string BuildMQTTMessage(Method method, string namespaceVar, string payloadVar)
|
||||
{
|
||||
HeaderMqtt headerMqtt = new HeaderMqtt();
|
||||
|
||||
if (resultToken != null)
|
||||
{
|
||||
headerMqtt.from = $"/app/{resultToken.userid}-{appId.ToLower()}/subscribe";
|
||||
headerMqtt.messageId = CreateMD5(GenerateNonce(16).ToUpper()).ToLower();
|
||||
headerMqtt.method = method.ToString();
|
||||
@ -286,6 +290,10 @@ namespace Mqtt.Client.AspNetCore.Services
|
||||
|
||||
return data;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task HandleDisconnectedAsync(MqttClientDisconnectedEventArgs eventArgs)
|
||||
{
|
||||
|
||||
@ -226,10 +226,10 @@ namespace MyCore.Services.Devices
|
||||
System.Console.WriteLine($"Yeelight type !");
|
||||
|
||||
// Get device last state
|
||||
var dic = new List<State>();
|
||||
var dic = new List<AutomationState>();
|
||||
if (actionDeviceToTest.LastState != null)
|
||||
{
|
||||
dic = JsonConvert.DeserializeObject<List<State>>(actionDeviceToTest.LastState);
|
||||
dic = JsonConvert.DeserializeObject<List<AutomationState>>(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<State>();
|
||||
var state = new State();
|
||||
var status = new List<AutomationState>();
|
||||
var state = new AutomationState();
|
||||
state.Name = "state";
|
||||
state.Value = "on";
|
||||
status.Add(state);
|
||||
|
||||
@ -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<string> supportedOperationsDTO = new List<string>();
|
||||
foreach (var supportedOperation in light.SupportedOperations)
|
||||
{
|
||||
|
||||
@ -10,36 +10,36 @@ namespace MyCore.Services.MyControlPanel
|
||||
{
|
||||
public class LocationDatabaseService
|
||||
{
|
||||
private readonly IMongoCollection<Location> _Locations;
|
||||
private readonly IMongoCollection<Place> _Locations;
|
||||
|
||||
public LocationDatabaseService(IConfiguration config)
|
||||
{
|
||||
var client = new MongoClient(config.GetConnectionString("MyCoreDb"));
|
||||
var database = client.GetDatabase("MyCoreDb");
|
||||
_Locations = database.GetCollection<Location>("Locations");
|
||||
_Locations = database.GetCollection<Place>("Locations");
|
||||
}
|
||||
public List<Location> GetAll()
|
||||
public List<Place> GetAll()
|
||||
{
|
||||
return _Locations.Find(l => true).ToList();
|
||||
}
|
||||
|
||||
public Location GetById(string id)
|
||||
public Place GetById(string id)
|
||||
{
|
||||
return _Locations.Find<Location>(l => l.Id == id).FirstOrDefault();
|
||||
return _Locations.Find<Place>(l => l.Id == id).FirstOrDefault();
|
||||
}
|
||||
|
||||
public bool IsExist(string id)
|
||||
{
|
||||
return _Locations.Find<Location>(p => p.Id == id).FirstOrDefault() != null ? true : false;
|
||||
return _Locations.Find<Place>(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;
|
||||
|
||||
@ -29,6 +29,11 @@ namespace MyCore.Services
|
||||
return _screenDevices.Find<ScreenDevice>(m => m.Id == id).FirstOrDefault();
|
||||
}
|
||||
|
||||
public bool IsExist(string id)
|
||||
{
|
||||
return _screenDevices.Find<ScreenDevice>(d => d.Id == id).FirstOrDefault() != null ? true : false;
|
||||
}
|
||||
|
||||
public ScreenDevice Create(ScreenDevice device)
|
||||
{
|
||||
_screenDevices.InsertOne(device);
|
||||
|
||||
@ -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}");
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -10,7 +10,7 @@ Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**groupId** | **String** | | [optional]
|
||||
**deviceId** | **String** | | [optional]
|
||||
**states** | [**List<State>**](State.md) | | [optional] [default to const []]
|
||||
**states** | [**List<AutomationState>**](AutomationState.md) | | [optional] [default to const []]
|
||||
**rawRequest** | **String** | | [optional]
|
||||
**providerId** | **String** | | [optional]
|
||||
**type** | [**ActionType**](ActionType.md) | | [optional]
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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>**](Trigger.md) | | [optional] [default to const []]
|
||||
|
||||
@ -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<OAuth>('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)
|
||||
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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]
|
||||
|
||||
16
Test service generation - dart/doc/AutomationState.md
Normal file
16
Test service generation - dart/doc/AutomationState.md
Normal file
@ -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)
|
||||
|
||||
|
||||
@ -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
|
||||
------------- | ------------- | -------------
|
||||
|
||||
@ -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
|
||||
------------- | ------------- | -------------
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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
|
||||
------------- | ------------- | -------------
|
||||
|
||||
@ -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
|
||||
------------- | ------------- | -------------
|
||||
|
||||
@ -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
|
||||
------------- | ------------- | -------------
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
------------- | ------------- | -------------
|
||||
|
||||
@ -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
|
||||
------------- | ------------- | -------------
|
||||
|
||||
@ -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
|
||||
------------- | ------------- | -------------
|
||||
|
||||
@ -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
|
||||
------------- | ------------- | -------------
|
||||
|
||||
@ -11,7 +11,7 @@ Name | Type | Description | Notes
|
||||
**teams** | **List<String>** | | [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)
|
||||
|
||||
|
||||
17
Test service generation - dart/doc/OddObject.md
Normal file
17
Test service generation - dart/doc/OddObject.md
Normal file
@ -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)
|
||||
|
||||
|
||||
@ -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<OAuth>('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
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ Name | Type | Description | Notes
|
||||
**id** | **String** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
**type** | **String** | | [optional]
|
||||
**widgets** | [**List<Widget>**](Widget.md) | | [optional] [default to const []]
|
||||
**widgets** | [**List<ScreenWidget>**](ScreenWidget.md) | | [optional] [default to const []]
|
||||
**height** | **int** | | [optional]
|
||||
**width** | **int** | | [optional]
|
||||
|
||||
|
||||
@ -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<OAuth>('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<OAuth>('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<ScreenDevice> 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<OAuth>('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)
|
||||
|
||||
|
||||
27
Test service generation - dart/doc/ScreenWidget.md
Normal file
27
Test service generation - dart/doc/ScreenWidget.md
Normal file
@ -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)
|
||||
|
||||
|
||||
@ -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<OAuth>('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
|
||||
|
||||
|
||||
20
Test service generation - dart/doc/TokenDTO.md
Normal file
20
Test service generation - dart/doc/TokenDTO.md
Normal file
@ -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)
|
||||
|
||||
|
||||
@ -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
|
||||
------------- | ------------- | -------------
|
||||
|
||||
@ -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<OAuth>('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<OAuth>('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<OAuth>('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<UserInfo> userGetAll()
|
||||
|
||||
Get a list of user
|
||||
|
||||
### Example
|
||||
```dart
|
||||
@ -196,7 +157,46 @@ import 'package:mycoreapi/api.dart';
|
||||
//defaultApiClient.getAuthentication<OAuth>('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>**](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<OAuth>('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
|
||||
|
||||
|
||||
@ -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
|
||||
------------- | ------------- | -------------
|
||||
|
||||
@ -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': '|'};
|
||||
|
||||
@ -117,7 +117,7 @@ class AuthenticationApi {
|
||||
/// * [String] clientId:
|
||||
///
|
||||
/// * [String] clientSecret:
|
||||
Future<LoginDTO> authenticationAuthenticateWithForm({ String grantType, String username, String password, String clientId, String clientSecret }) async {
|
||||
Future<TokenDTO> 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<LoginDTO>.value(null);
|
||||
return Future<TokenDTO>.value(null);
|
||||
}
|
||||
|
||||
/// Authenticate with Json parameters (used by most clients)
|
||||
|
||||
@ -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<Response> 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<AutomationDTO> 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<MultipartFile> automationDelete(String automationId) async {
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
return Future<String>.value(null);
|
||||
}
|
||||
|
||||
/// Delete all automation for a specified
|
||||
@ -206,7 +213,7 @@ class AutomationApi {
|
||||
///
|
||||
/// * [String] userId (required):
|
||||
/// Id of user
|
||||
Future<MultipartFile> automationDeleteAllForUser(String userId) async {
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
return Future<String>.value(null);
|
||||
}
|
||||
|
||||
/// Get all automations for the specified user
|
||||
|
||||
@ -225,7 +225,7 @@ class DeviceApi {
|
||||
///
|
||||
/// * [String] deviceId (required):
|
||||
/// Id of device to delete
|
||||
Future<MultipartFile> deviceDelete(String deviceId) async {
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
return Future<String>.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<MultipartFile> deviceDeleteAllForUser(String userId) async {
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
return Future<String>.value(null);
|
||||
}
|
||||
|
||||
/// Delete devices from provider
|
||||
@ -377,7 +377,7 @@ class DeviceApi {
|
||||
///
|
||||
/// * [String] providerId (required):
|
||||
/// Id of Provider
|
||||
Future<MultipartFile> deviceDeleteDevicesFromProvider(String userId, String providerId) async {
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
return Future<String>.value(null);
|
||||
}
|
||||
|
||||
/// Get all devices summary
|
||||
|
||||
@ -225,7 +225,7 @@ class GroupApi {
|
||||
///
|
||||
/// * [String] groupId (required):
|
||||
/// Id of group
|
||||
Future<MultipartFile> groupDelete(String deviceId, String groupId) async {
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
return Future<String>.value(null);
|
||||
}
|
||||
|
||||
/// Delete a group
|
||||
@ -296,7 +296,7 @@ class GroupApi {
|
||||
///
|
||||
/// * [String] groupId (required):
|
||||
/// Id of group
|
||||
Future<MultipartFile> groupDelete2(String groupId) async {
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
return Future<String>.value(null);
|
||||
}
|
||||
|
||||
/// Delete all group for a specified
|
||||
@ -367,7 +367,7 @@ class GroupApi {
|
||||
///
|
||||
/// * [String] userId (required):
|
||||
/// Id of user
|
||||
Future<MultipartFile> groupDeleteAllForUser(String userId) async {
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
return Future<String>.value(null);
|
||||
}
|
||||
|
||||
/// Get all groups for the specified user
|
||||
@ -462,10 +462,7 @@ class GroupApi {
|
||||
///
|
||||
/// * [String] groupId (required):
|
||||
/// groupid
|
||||
///
|
||||
/// * [String] userId:
|
||||
/// user id
|
||||
Future<Response> groupGetDetailWithHttpInfo(String groupId, { String userId }) async {
|
||||
Future<Response> 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 = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
if (userId != null) {
|
||||
queryParams.addAll(_convertParametersForCollectionFormat('', 'userId', userId));
|
||||
}
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['bearer'];
|
||||
@ -518,11 +511,8 @@ class GroupApi {
|
||||
///
|
||||
/// * [String] groupId (required):
|
||||
/// groupid
|
||||
///
|
||||
/// * [String] userId:
|
||||
/// user id
|
||||
Future<GroupDetailDTO> groupGetDetail(String groupId, { String userId }) async {
|
||||
final response = await groupGetDetailWithHttpInfo(groupId, userId: userId );
|
||||
Future<GroupDetailDTO> groupGetDetail(String groupId) async {
|
||||
final response = await groupGetDetailWithHttpInfo(groupId);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ class ProviderApi {
|
||||
///
|
||||
/// * [String] providerId (required):
|
||||
/// Id of provider to delete
|
||||
Future<MultipartFile> providerDelete(String providerId) async {
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
return Future<String>.value(null);
|
||||
}
|
||||
|
||||
/// Get all user providers
|
||||
@ -163,6 +163,7 @@ class ProviderApi {
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] userId (required):
|
||||
/// Id of user
|
||||
Future<Response> 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<List<ProviderDTO>> providerGetAll(String userId) async {
|
||||
final response = await providerGetAllWithHttpInfo(userId);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
|
||||
@ -152,7 +152,7 @@ class RoomApi {
|
||||
///
|
||||
/// * [String] roomId (required):
|
||||
/// Id of room
|
||||
Future<MultipartFile> roomDelete(String deviceId, String roomId) async {
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
return Future<String>.value(null);
|
||||
}
|
||||
|
||||
/// Delete a room
|
||||
@ -223,7 +223,7 @@ class RoomApi {
|
||||
///
|
||||
/// * [String] roomId (required):
|
||||
/// Id of room
|
||||
Future<MultipartFile> roomDelete2(String roomId) async {
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
return Future<String>.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<MultipartFile> roomDeleteAllForUser(String userId) async {
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
return Future<String>.value(null);
|
||||
}
|
||||
|
||||
/// Get all rooms for the specified user
|
||||
|
||||
@ -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<Response> 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<MultipartFile> screenDeviceCreateDevice(ScreenDevice screenDevice) async {
|
||||
/// Screen device to create
|
||||
Future<ScreenDevice> 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<MultipartFile>.value(null);
|
||||
return Future<ScreenDevice>.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<Response> 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<MultipartFile> screenDeviceDeleteDevice(String deviceId) async {
|
||||
/// Screen device id to update
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
return Future<String>.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<Response> screenDeviceGetAllScreenDevicesWithHttpInfo() async {
|
||||
final path = r'/api/device/screen';
|
||||
|
||||
@ -180,6 +196,7 @@ class ScreenDeviceApi {
|
||||
);
|
||||
}
|
||||
|
||||
/// Get all screen devices
|
||||
Future<List<ScreenDevice>> screenDeviceGetAllScreenDevices() async {
|
||||
final response = await screenDeviceGetAllScreenDevicesWithHttpInfo();
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
@ -196,7 +213,10 @@ class ScreenDeviceApi {
|
||||
return Future<List<ScreenDevice>>.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<ScreenDevice>.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<Response> screenDeviceUpdateDeviceWithHttpInfo(int screenDeviceId, ScreenDevice screenDevice) async {
|
||||
/// Screen device to update
|
||||
Future<Response> 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<MultipartFile> screenDeviceUpdateDevice(int screenDeviceId, ScreenDevice screenDevice) async {
|
||||
final response = await screenDeviceUpdateDeviceWithHttpInfo(screenDeviceId, screenDevice);
|
||||
/// Screen device to update
|
||||
Future<ScreenDevice> 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<MultipartFile>.value(null);
|
||||
return Future<ScreenDevice>.value(null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<Response> 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<UserInfo> tokenConnectUser(LoginDTO loginDTO) async {
|
||||
final response = await tokenConnectUserWithHttpInfo(loginDTO);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
|
||||
@ -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<Response> 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<UserInfoDetailDTO> userCreateUser(UserInfo userInfo) async {
|
||||
final response = await userCreateUserWithHttpInfo(userInfo);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
@ -78,10 +85,14 @@ class UserApi {
|
||||
return Future<UserInfoDetailDTO>.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<Response> 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<MultipartFile> userDeleteUser(String id) async {
|
||||
/// Id of user to delete
|
||||
Future<String> 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<MultipartFile>.value(null);
|
||||
}
|
||||
|
||||
/// Get a list of user
|
||||
///
|
||||
/// Note: This method returns the HTTP [Response].
|
||||
Future<Response> userGetWithHttpInfo() async {
|
||||
final path = r'/api/user';
|
||||
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['bearer'];
|
||||
|
||||
if (
|
||||
nullableContentType != null &&
|
||||
nullableContentType.toLowerCase().startsWith('multipart/form-data')
|
||||
) {
|
||||
bool hasFields = false;
|
||||
final mp = MultipartRequest(null, null);
|
||||
if (hasFields) {
|
||||
postBody = mp;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
|
||||
/// Get a list of user
|
||||
Future<MultipartFile> 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<MultipartFile>.value(null);
|
||||
return Future<String>.value(null);
|
||||
}
|
||||
|
||||
/// Get a specific user
|
||||
@ -205,7 +164,7 @@ class UserApi {
|
||||
///
|
||||
/// * [String] id (required):
|
||||
/// id user
|
||||
Future<Response> userGet2WithHttpInfo(String id) async {
|
||||
Future<Response> 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<UserInfoDetailDTO> userGet2(String id) async {
|
||||
final response = await userGet2WithHttpInfo(id);
|
||||
Future<UserInfoDetailDTO> 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<UserInfoDetailDTO>.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<Response> userGetAllWithHttpInfo() async {
|
||||
final path = r'/api/user';
|
||||
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['bearer'];
|
||||
|
||||
if (
|
||||
nullableContentType != null &&
|
||||
nullableContentType.toLowerCase().startsWith('multipart/form-data')
|
||||
) {
|
||||
bool hasFields = false;
|
||||
final mp = MultipartRequest(null, null);
|
||||
if (hasFields) {
|
||||
postBody = mp;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
|
||||
/// Get a list of user
|
||||
Future<List<UserInfo>> 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<UserInfo>') as List)
|
||||
.cast<UserInfo>()
|
||||
.toList(growable: false);
|
||||
}
|
||||
return Future<List<UserInfo>>.value(null);
|
||||
}
|
||||
|
||||
/// Update an user
|
||||
///
|
||||
/// Note: This method returns the HTTP [Response].
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [UserInfo] userInfo (required):
|
||||
/// User to update
|
||||
Future<Response> 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<UserInfoDetailDTO> userUpdateUser(UserInfo userInfo) async {
|
||||
final response = await userUpdateUserWithHttpInfo(userInfo);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -24,7 +24,7 @@ class Action {
|
||||
|
||||
String deviceId;
|
||||
|
||||
List<State> states;
|
||||
List<AutomationState> 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']),
|
||||
|
||||
@ -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<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -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']),
|
||||
|
||||
@ -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<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -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
|
||||
|
||||
@ -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<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -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
|
||||
|
||||
@ -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<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -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
|
||||
|
||||
@ -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<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
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<String, dynamic> json) => json == null
|
||||
? null
|
||||
: AutomationState(
|
||||
name: json[r'name'],
|
||||
value: json[r'value'],
|
||||
);
|
||||
|
||||
static List<AutomationState> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <AutomationState>[]
|
||||
: json.map((v) => AutomationState.fromJson(v)).toList(growable: true == growable);
|
||||
|
||||
static Map<String, AutomationState> mapFromJson(Map<String, dynamic> json) {
|
||||
final map = <String, AutomationState>{};
|
||||
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<String, List<AutomationState>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<AutomationState>>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) {
|
||||
map[key] = AutomationState.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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']),
|
||||
|
||||
@ -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<String>(),
|
||||
commenceTime: json[r'commence_time'],
|
||||
homeTeam: json[r'home_team'],
|
||||
odds: OneOfOddH2H.fromJson(json[r'odds']),
|
||||
odds: OneOfOddObject.fromJson(json[r'odds']),
|
||||
);
|
||||
|
||||
static List<OddNice> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
|
||||
89
Test service generation - dart/lib/model/odd_object.dart
Normal file
89
Test service generation - dart/lib/model/odd_object.dart
Normal file
@ -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<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
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<String, dynamic> json) => json == null
|
||||
? null
|
||||
: OddObject(
|
||||
homeOdd: json[r'homeOdd'],
|
||||
drawOdd: json[r'drawOdd'],
|
||||
visitOdd: json[r'visitOdd'],
|
||||
);
|
||||
|
||||
static List<OddObject> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <OddObject>[]
|
||||
: json.map((v) => OddObject.fromJson(v)).toList(growable: true == growable);
|
||||
|
||||
static Map<String, OddObject> mapFromJson(Map<String, dynamic> json) {
|
||||
final map = <String, OddObject>{};
|
||||
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<String, List<OddObject>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<OddObject>>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) {
|
||||
map[key] = OddObject.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ class ScreenConfiguration {
|
||||
|
||||
String type;
|
||||
|
||||
List<Widget> widgets;
|
||||
List<ScreenWidget> 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'],
|
||||
);
|
||||
|
||||
179
Test service generation - dart/lib/model/screen_widget.dart
Normal file
179
Test service generation - dart/lib/model/screen_widget.dart
Normal file
@ -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<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
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<String, dynamic> 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<ScreenWidget> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ScreenWidget>[]
|
||||
: json.map((v) => ScreenWidget.fromJson(v)).toList(growable: true == growable);
|
||||
|
||||
static Map<String, ScreenWidget> mapFromJson(Map<String, dynamic> json) {
|
||||
final map = <String, ScreenWidget>{};
|
||||
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<String, List<ScreenWidget>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ScreenWidget>>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) {
|
||||
map[key] = ScreenWidget.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
118
Test service generation - dart/lib/model/token_dto.dart
Normal file
118
Test service generation - dart/lib/model/token_dto.dart
Normal file
@ -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<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
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<String, dynamic> 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<TokenDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <TokenDTO>[]
|
||||
: json.map((v) => TokenDTO.fromJson(v)).toList(growable: true == growable);
|
||||
|
||||
static Map<String, TokenDTO> mapFromJson(Map<String, dynamic> json) {
|
||||
final map = <String, TokenDTO>{};
|
||||
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<String, List<TokenDTO>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<TokenDTO>>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) {
|
||||
map[key] = TokenDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
36
Test service generation - dart/test/odd_object_test.dart
Normal file
36
Test service generation - dart/test/odd_object_test.dart
Normal file
@ -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
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
86
Test service generation - dart/test/screen_widget_test.dart
Normal file
86
Test service generation - dart/test/screen_widget_test.dart
Normal file
@ -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
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
51
Test service generation - dart/test/token_dto_test.dart
Normal file
51
Test service generation - dart/test/token_dto_test.dart
Normal file
@ -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
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
1933
swagger.json
1933
swagger.json
File diff suppressed because it is too large
Load Diff
3021
swagger.yaml
3021
swagger.yaml
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user