diff --git a/SeatsioDotNet.Test/Events/HoldObjectsTest.cs b/SeatsioDotNet.Test/Events/HoldObjectsTest.cs index b1a1309..8db2149 100644 --- a/SeatsioDotNet.Test/Events/HoldObjectsTest.cs +++ b/SeatsioDotNet.Test/Events/HoldObjectsTest.cs @@ -44,5 +44,19 @@ public void OrderId() Assert.Equal("order1", Client.Events.RetrieveObjectStatus(evnt.Key, "A-1").OrderId); Assert.Equal("order1", Client.Events.RetrieveObjectStatus(evnt.Key, "A-2").OrderId); } + + [Fact] + public void BestAvailable() + { + var chartKey = CreateTestChart(); + var evnt = Client.Events.Create(chartKey); + HoldToken holdToken = Client.HoldTokens.Create(); + + var bestAvailableResult = Client.Events.Hold(evnt.Key, new BestAvailable(3), holdToken.Token, "order1"); + + Assert.True(bestAvailableResult.NextToEachOther); + Assert.Equal(new[] {"B-4", "B-5", "B-6"}, bestAvailableResult.Objects); + Assert.Equal("order1", Client.Events.RetrieveObjectStatus(evnt.Key, "B-4").OrderId); + } } } \ No newline at end of file diff --git a/SeatsioDotNet/Events/Events.cs b/SeatsioDotNet/Events/Events.cs index 91c09cc..1836d66 100644 --- a/SeatsioDotNet/Events/Events.cs +++ b/SeatsioDotNet/Events/Events.cs @@ -147,6 +147,11 @@ public ChangeObjectStatusResult Hold(string[] eventKeys, IEnumerable objects, string status, string holdToken = null, string orderId = null) { return ChangeObjectStatus(new[] {eventKey}, objects.Select(o => new ObjectProperties(o)), status, holdToken, orderId); @@ -186,13 +191,22 @@ public ChangeObjectStatusResult ChangeObjectStatus(IEnumerable events, I return AssertOk(_restClient.Execute(restRequest)); } - public BestAvailableResult ChangeObjectStatus(string eventKey, BestAvailable bestAvailable, string status) + public BestAvailableResult ChangeObjectStatus(string eventKey, BestAvailable bestAvailable, string status, string holdToken = null, string orderId = null) { var requestBody = new Dictionary() { {"status", status}, {"bestAvailable", bestAvailable.AsDictionary()} }; + if (holdToken != null) + { + requestBody.Add("holdToken", holdToken); + } + + if (orderId != null) + { + requestBody.Add("orderId", orderId); + } var restRequest = new RestRequest("/events/{key}/actions/change-object-status", Method.POST) .AddUrlSegment("key", eventKey) diff --git a/SeatsioDotNet/SeatsioDotNet.csproj b/SeatsioDotNet/SeatsioDotNet.csproj index 219420f..c8378c6 100644 --- a/SeatsioDotNet/SeatsioDotNet.csproj +++ b/SeatsioDotNet/SeatsioDotNet.csproj @@ -2,7 +2,7 @@ Library true - 32 + 33 mroloux;bverbeken Official Seats.io .NET API client Official Seats.io .NET API client