From 39e1c5e711cca2288b16a67a0b35dcbf44c9516d Mon Sep 17 00:00:00 2001 From: Andrei Anischevici Date: Thu, 13 May 2021 12:48:55 +0300 Subject: [PATCH] TNT-40917-1 Update SDK to use new Delivery client after #18 fix (#19) * Update SDK to use new Delivery client after #18 fix * Update Delivery client to latest v1.1.1 --- SampleApp/ProgramSync.cs | 8 ++++---- Source/Adobe.Target.Client/Adobe.Target.Client.csproj | 2 +- .../Extension/DeliveryRequestExtension.cs | 4 ++-- Source/Adobe.Target.Client/Model/TargetDeliveryRequest.cs | 2 +- Source/Adobe.Target.Client/OnDevice/GeoClient.cs | 2 +- Source/Adobe.Target.Client/TargetClient.cs | 2 +- .../Adobe.Target.Client.Test/Util/IntegrationTestUtils.cs | 8 ++++---- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/SampleApp/ProgramSync.cs b/SampleApp/ProgramSync.cs index 32a2039..e8cadbd 100644 --- a/SampleApp/ProgramSync.cs +++ b/SampleApp/ProgramSync.cs @@ -42,7 +42,7 @@ public static void Main(string[] args) .SetContext(new Context(ChannelType.Web)) .SetExecute(new ExecuteRequest(null, new List { - new MboxRequest(index:1, name: "a1-serverside-ab") + new (index: 0, name: "a1-serverside-ab") })) .Build(); @@ -60,8 +60,8 @@ public static void Main(string[] args) .SetContext(new Context(ChannelType.Web)) .SetNotifications(new List() { - { new(id:"notificationId1", type: MetricType.Display, timestamp: DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(), - tokens: new List())} + new (id:"notificationId1", type: MetricType.Display, timestamp: DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(), + tokens: new List()) }) .Build(); @@ -81,7 +81,7 @@ private static void DecisioningReady() .SetContext(new Context(ChannelType.Web, geo: new Geo("193.105.140.131"))) .SetExecute(new ExecuteRequest(new RequestDetails(), new List { - new(index:1, name: "a1-mobile-tstsree") + new (index: 1, name: "a1-mobile-tstsree") })) .Build(); diff --git a/Source/Adobe.Target.Client/Adobe.Target.Client.csproj b/Source/Adobe.Target.Client/Adobe.Target.Client.csproj index 83b6677..a6aab8b 100644 --- a/Source/Adobe.Target.Client/Adobe.Target.Client.csproj +++ b/Source/Adobe.Target.Client/Adobe.Target.Client.csproj @@ -13,7 +13,7 @@ - + diff --git a/Source/Adobe.Target.Client/Extension/DeliveryRequestExtension.cs b/Source/Adobe.Target.Client/Extension/DeliveryRequestExtension.cs index 72d1942..3620193 100644 --- a/Source/Adobe.Target.Client/Extension/DeliveryRequestExtension.cs +++ b/Source/Adobe.Target.Client/Extension/DeliveryRequestExtension.cs @@ -17,7 +17,7 @@ namespace Adobe.Target.Client.Extension internal static class DeliveryRequestExtension { - internal static void AddTelemetry(this TargetDeliveryRequest request, TargetClientConfig config, int execution = 0) + internal static void AddTelemetry(this TargetDeliveryRequest request, TargetClientConfig config, int? execution = default) { var telemetryEntry = request.GetTelemetryEntry(config, execution); if (telemetryEntry == null) @@ -30,7 +30,7 @@ internal static void AddTelemetry(this TargetDeliveryRequest request, TargetClie deliveryRequest.Telemetry.Entries.Add(telemetryEntry); } - internal static TelemetryEntry GetTelemetryEntry(this TargetDeliveryRequest request, TargetClientConfig config, int execution = 0) + internal static TelemetryEntry GetTelemetryEntry(this TargetDeliveryRequest request, TargetClientConfig config, int? execution = default) { if (!config.TelemetryEnabled) { diff --git a/Source/Adobe.Target.Client/Model/TargetDeliveryRequest.cs b/Source/Adobe.Target.Client/Model/TargetDeliveryRequest.cs index a532655..7e93f26 100644 --- a/Source/Adobe.Target.Client/Model/TargetDeliveryRequest.cs +++ b/Source/Adobe.Target.Client/Model/TargetDeliveryRequest.cs @@ -180,7 +180,7 @@ public Builder SetImpressionId(string impressionId) /// /// Environment Id /// instance - public Builder SetEnvironmentId(long environmentId) + public Builder SetEnvironmentId(long? environmentId) { this.DeliveryRequest.EnvironmentId = environmentId; return this; diff --git a/Source/Adobe.Target.Client/OnDevice/GeoClient.cs b/Source/Adobe.Target.Client/OnDevice/GeoClient.cs index b7d8481..799195b 100644 --- a/Source/Adobe.Target.Client/OnDevice/GeoClient.cs +++ b/Source/Adobe.Target.Client/OnDevice/GeoClient.cs @@ -52,7 +52,7 @@ private bool ValidateGeo(Geo geo) { return geo != null && !string.IsNullOrEmpty(geo.IpAddress) && string.IsNullOrEmpty(geo.City) && string.IsNullOrEmpty(geo.StateCode) && string.IsNullOrEmpty(geo.CountryCode) - && geo.Latitude == 0 && geo.Longitude == 0; + && geo.Latitude == null && geo.Longitude == null; } private Geo HeadersToGeo(Geo originalGeo, IRestResponse response) diff --git a/Source/Adobe.Target.Client/TargetClient.cs b/Source/Adobe.Target.Client/TargetClient.cs index fedfa02..c402c92 100644 --- a/Source/Adobe.Target.Client/TargetClient.cs +++ b/Source/Adobe.Target.Client/TargetClient.cs @@ -150,7 +150,7 @@ private static TargetDeliveryRequest AddMBoxesToRequest(TargetDeliveryRequest re { if (mbox.Index >= index) { - index = mbox.Index + 1; + index = (int)mbox.Index + 1; } existingMboxNames.Add(mbox.Name); diff --git a/Tests/Adobe.Target.Client.Test/Util/IntegrationTestUtils.cs b/Tests/Adobe.Target.Client.Test/Util/IntegrationTestUtils.cs index 8a3bf5f..d19e073 100644 --- a/Tests/Adobe.Target.Client.Test/Util/IntegrationTestUtils.cs +++ b/Tests/Adobe.Target.Client.Test/Util/IntegrationTestUtils.cs @@ -206,7 +206,7 @@ public static EquivalencyAssertionOptions RootRequestEquivalenc ctx.Subject.Should().Be(ctx.Expectation); }) .When(info => info.Type == typeof(string)) - .Using(ctx => + .Using(ctx => { if (ctx.Expectation == -999L) { @@ -216,8 +216,8 @@ public static EquivalencyAssertionOptions RootRequestEquivalenc ctx.Subject.Should().Be(ctx.Expectation); }) - .When(info => info.Type == typeof(long)) - .Using(ctx => + .When(info => info.Type == typeof(long?)) + .Using(ctx => { if (ctx.Expectation == -999) { @@ -227,7 +227,7 @@ public static EquivalencyAssertionOptions RootRequestEquivalenc ctx.Subject.Should().Be(ctx.Expectation); }) - .When(info => info.Type == typeof(int)) + .When(info => info.Type == typeof(int?)) .WithTracing(); } }