Skip to content

Commit

Permalink
add methods to put up objects for resale (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
bverbeken authored Oct 4, 2024
1 parent 5f61725 commit 8dff0d1
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ public async Task Book()
Assert.Equal(EventObjectInfo.Booked, (await Client.Events.RetrieveObjectInfoAsync(event2.Key, "A-1")).Status);
Assert.Equal(EventObjectInfo.Booked, (await Client.Events.RetrieveObjectInfoAsync(event2.Key, "A-2")).Status);
}

[Fact]
public async Task PutUpForResale()
{
var chartKey = CreateTestChart();
var event1 = await Client.Events.CreateAsync(chartKey);
var event2 = await Client.Events.CreateAsync(chartKey);

await Client.Events.PutUpForResaleAsync(new[] {event1.Key, event2.Key}, new[] {"A-1", "A-2"});

Assert.Equal(EventObjectInfo.Resale, (await Client.Events.RetrieveObjectInfoAsync(event1.Key, "A-1")).Status);
Assert.Equal(EventObjectInfo.Resale, (await Client.Events.RetrieveObjectInfoAsync(event1.Key, "A-2")).Status);
Assert.Equal(EventObjectInfo.Resale, (await Client.Events.RetrieveObjectInfoAsync(event2.Key, "A-1")).Status);
Assert.Equal(EventObjectInfo.Resale, (await Client.Events.RetrieveObjectInfoAsync(event2.Key, "A-2")).Status);
}

[Fact]
public async Task Hold()
Expand Down
26 changes: 26 additions & 0 deletions SeatsioDotNet.Test/Events/PutObjectsUpForResaleTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using FluentAssertions;
using SeatsioDotNet.EventReports;
using SeatsioDotNet.Events;
using SeatsioDotNet.HoldTokens;
using Xunit;

namespace SeatsioDotNet.Test.Events;

public class PutObjectsUpForResale : SeatsioClientTest
{
[Fact]
public async Task Test()
{
var chartKey = CreateTestChart();
var evnt = await Client.Events.CreateAsync(chartKey);

var result = await Client.Events.PutUpForResaleAsync(evnt.Key, new[] {"A-1", "A-2"});

Assert.Equal(EventObjectInfo.Resale, (await Client.Events.RetrieveObjectInfoAsync(evnt.Key, "A-1")).Status);
Assert.Equal(EventObjectInfo.Resale, (await Client.Events.RetrieveObjectInfoAsync(evnt.Key, "A-2")).Status);
Assert.Equal(EventObjectInfo.Free, (await Client.Events.RetrieveObjectInfoAsync(evnt.Key, "A-3")).Status);
CustomAssert.ContainsOnly(new[] {"A-1", "A-2"}, result.Objects.Keys);
}
}
1 change: 1 addition & 0 deletions SeatsioDotNet/Events/EventObjectInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class EventObjectInfo
public const string Free = "free";
public const string Booked = "booked";
public const string Held = "reservedByToken";
public const string Resale = "resale";

public string Label { get; set; }
public Labels Labels { get; set; }
Expand Down
10 changes: 10 additions & 0 deletions SeatsioDotNet/Events/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,16 @@ public async Task<BestAvailableResult> BookAsync(string eventKey, BestAvailable
keepExtraData, ignoreChannels, channelKeys, cancellationToken);
}

public async Task<ChangeObjectStatusResult> PutUpForResaleAsync(string eventKey, IEnumerable<string> objects)
{
return await ChangeObjectStatusAsync(eventKey, objects, EventObjectInfo.Resale, null);
}

public async Task<ChangeObjectStatusResult> PutUpForResaleAsync(string[] eventKeys, IEnumerable<string> objects)
{
return await ChangeObjectStatusAsync(eventKeys, objects, EventObjectInfo.Resale, null);
}

public async Task<ChangeObjectStatusResult> ReleaseAsync(string eventKey, IEnumerable<string> objects, string holdToken = null,
string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, string[] channelKeys = null, CancellationToken cancellationToken = default)
{
Expand Down

0 comments on commit 8dff0d1

Please sign in to comment.