Commit 05828720 authored by Andreas Müller's avatar Andreas Müller
Browse files

Fixing an error based on wrong doumentation

parent 72c4f40f
......@@ -63,7 +63,7 @@ namespace AMWD.Net.Api.Divera.Test
GroupIds = new List<string> { "g1" },
UserClusterRelationIds = new List<string> { "c1g1", "c2g1" },
VehicleIds = new List<string> { "v1", "v2" },
AlarmcodeId = new List<string> { "t2" }
AlarmcodeId = "t2"
};
var api = GetApi(accessKey);
......@@ -109,7 +109,7 @@ namespace AMWD.Net.Api.Divera.Test
CollectionAssert.AreEqual(request.GroupIds, callbackJson["group_ids"].ToObject<List<string>>());
CollectionAssert.AreEqual(request.UserClusterRelationIds, callbackJson["user_cluster_relation_ids"].ToObject<List<string>>());
CollectionAssert.AreEqual(request.VehicleIds, callbackJson["vehicle_ids"].ToObject<List<string>>());
CollectionAssert.AreEqual(request.AlarmcodeId, callbackJson["alarmcode_id"].ToObject<List<string>>());
Assert.AreEqual(request.AlarmcodeId, callbackJson["alarmcode_id"]);
httpMessageHandlerMock.Protected().Verify("SendAsync", Times.Exactly(1), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
}
......
......@@ -210,9 +210,8 @@ namespace AMWD.Net.Api.Divera.Requests
/// <summary>
/// Gets or sets primary key of an alarm template.
/// TODO: Why is it marked as list on the swagger UI?
/// [Primärschlüssel einer Alarmvorlage]
/// </summary>
public List<string> AlarmcodeId { get; set; }
public string AlarmcodeId { get; set; }
}
}
......@@ -10,7 +10,6 @@ namespace AMWD.Net.Api.Divera.Utils
{
internal static class DiveraApiRequestConverter
{
private static readonly DateTime unixTime = new(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
private static readonly string jsonMimeType = "application/json";
#region Create alarm
......@@ -124,8 +123,8 @@ namespace AMWD.Net.Api.Divera.Utils
if (request.VehicleIds?.Any() == true)
jObj["vehicle_ids"] = JArray.FromObject(request.VehicleIds);
if (request.AlarmcodeId?.Any() == true)
jObj["alarmcode_id"] = JArray.FromObject(request.AlarmcodeId);
if (!string.IsNullOrWhiteSpace(request.AlarmcodeId))
jObj["alarmcode_id"] = request.AlarmcodeId.Trim();
return jObj;
}
......
......@@ -4,7 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased](https://git.am-wd.de/andreasmueller/divera-24-7-api/compare/v0.1.0...main) - 0000-00-00
## [Unreleased](https://git.am-wd.de/andreasmueller/divera-24-7-api/compare/v0.2.0...main) - 0000-00-00
_nothing for now_
## [v0.2.0](https://git.am-wd.de/andreasmueller/divera-24-7-api/compare/v0.1.1...v0.2.0) - 2022-01-10
### Changed
- `CreateAlarmRequest.AlarmcodeId` is a single and no list
## [v0.1.1](https://git.am-wd.de/andreasmueller/divera-24-7-api/compare/v0.1.0...v0.1.1) - 2022-01-09
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment