Skip to content

Commit

Permalink
TNT-40917-1 Update SDK to use new Delivery client after #18 fix (#19)
Browse files Browse the repository at this point in the history
* Update SDK to use new Delivery client after #18 fix

* Update Delivery client to latest v1.1.1
  • Loading branch information
XDex authored May 13, 2021
1 parent db1abbd commit 39e1c5e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions SampleApp/ProgramSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static void Main(string[] args)
.SetContext(new Context(ChannelType.Web))
.SetExecute(new ExecuteRequest(null, new List<MboxRequest>
{
new MboxRequest(index:1, name: "a1-serverside-ab")
new (index: 0, name: "a1-serverside-ab")
}))
.Build();

Expand All @@ -60,8 +60,8 @@ public static void Main(string[] args)
.SetContext(new Context(ChannelType.Web))
.SetNotifications(new List<Notification>()
{
{ new(id:"notificationId1", type: MetricType.Display, timestamp: DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
tokens: new List<string>())}
new (id:"notificationId1", type: MetricType.Display, timestamp: DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
tokens: new List<string>())
})
.Build();

Expand All @@ -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<MboxRequest>
{
new(index:1, name: "a1-mobile-tstsree")
new (index: 1, name: "a1-mobile-tstsree")
}))
.Build();

Expand Down
2 changes: 1 addition & 1 deletion Source/Adobe.Target.Client/Adobe.Target.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup Label="Project References">
<PackageReference Include="Adobe.ExperienceCloud.Ecid" Version="1.0.0" />
<PackageReference Include="Adobe.Target.Delivery" Version="1.0.0" />
<PackageReference Include="Adobe.Target.Delivery" Version="1.1.1" />
<PackageReference Include="JsonLogic.Net" Version="1.1.9" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Adobe.Target.Client/Model/TargetDeliveryRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public Builder SetImpressionId(string impressionId)
/// </summary>
/// <param name="environmentId">Environment Id</param>
/// <returns><see cref="Builder"/> instance</returns>
public Builder SetEnvironmentId(long environmentId)
public Builder SetEnvironmentId(long? environmentId)
{
this.DeliveryRequest.EnvironmentId = environmentId;
return this;
Expand Down
2 changes: 1 addition & 1 deletion Source/Adobe.Target.Client/OnDevice/GeoClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Source/Adobe.Target.Client/TargetClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions Tests/Adobe.Target.Client.Test/Util/IntegrationTestUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public static EquivalencyAssertionOptions<DeliveryRequest> RootRequestEquivalenc
ctx.Subject.Should().Be(ctx.Expectation);
})
.When(info => info.Type == typeof(string))
.Using<long>(ctx =>
.Using<long?>(ctx =>
{
if (ctx.Expectation == -999L)
{
Expand All @@ -216,8 +216,8 @@ public static EquivalencyAssertionOptions<DeliveryRequest> RootRequestEquivalenc

ctx.Subject.Should().Be(ctx.Expectation);
})
.When(info => info.Type == typeof(long))
.Using<int>(ctx =>
.When(info => info.Type == typeof(long?))
.Using<int?>(ctx =>
{
if (ctx.Expectation == -999)
{
Expand All @@ -227,7 +227,7 @@ public static EquivalencyAssertionOptions<DeliveryRequest> RootRequestEquivalenc

ctx.Subject.Should().Be(ctx.Expectation);
})
.When(info => info.Type == typeof(int))
.When(info => info.Type == typeof(int?))
.WithTracing();
}
}

0 comments on commit 39e1c5e

Please sign in to comment.