From 93ac64ea038cb54814781f55e72a41e84d19c52b Mon Sep 17 00:00:00 2001 From: mroloux Date: Mon, 10 Jul 2023 12:40:31 +0200 Subject: [PATCH] Removed social distancing (#88) --- .../SaveSocialDistancingRulesetsTest.cs | 74 ------- .../EventReports/EventReportsTest.cs | 1 - SeatsioDotNet.Test/Events/BookObjectsTest.cs | 21 -- ...ChangeObjectStatusForMultipleEventsTest.cs | 22 -- .../Events/ChangeObjectStatusTest.cs | 23 +- SeatsioDotNet.Test/Events/CreateEventTest.cs | 16 -- SeatsioDotNet.Test/Events/CreateEventsTest.cs | 23 +- SeatsioDotNet.Test/Events/HoldObjectsTest.cs | 22 -- SeatsioDotNet.Test/Events/UpdateEventTest.cs | 39 +--- .../Seasons/CreateSeasonTest.cs | 15 -- SeatsioDotNet/Charts/Chart.cs | 1 - SeatsioDotNet/Charts/Charts.cs | 20 -- .../Charts/SocialDistancingRuleset.cs | 196 ------------------ SeatsioDotNet/Events/CreateEventParams.cs | 7 - SeatsioDotNet/Events/Event.cs | 1 - SeatsioDotNet/Events/EventObjectInfo.cs | 1 - SeatsioDotNet/Events/Events.cs | 86 +++----- SeatsioDotNet/Events/UpdateEventParams.cs | 7 - SeatsioDotNet/Seasons/Seasons.cs | 7 +- 19 files changed, 35 insertions(+), 547 deletions(-) delete mode 100644 SeatsioDotNet.Test/Charts/SaveSocialDistancingRulesetsTest.cs delete mode 100644 SeatsioDotNet/Charts/SocialDistancingRuleset.cs diff --git a/SeatsioDotNet.Test/Charts/SaveSocialDistancingRulesetsTest.cs b/SeatsioDotNet.Test/Charts/SaveSocialDistancingRulesetsTest.cs deleted file mode 100644 index 618b9da..0000000 --- a/SeatsioDotNet.Test/Charts/SaveSocialDistancingRulesetsTest.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System.Collections.Generic; -using SeatsioDotNet.Charts; -using SeatsioDotNet.Events; -using Xunit; - -namespace SeatsioDotNet.Test.Charts -{ - public class SaveSocialDistancingRulesetsTest : SeatsioClientTest - { - [Fact] - public void SaveRulesets() - { - var chartKey = CreateTestChart(); - var ruleset1 = SocialDistancingRuleset.RuleBased("My first ruleset") - .WithIndex(0) - .WithNumberOfDisabledSeatsToTheSides(1) - .WithDisableSeatsInFrontAndBehind(true) - .WithDisableDiagonalSeatsInFrontAndBehind(true) - .WithNumberOfDisabledAisleSeats(2) - .WithMaxGroupSize(1) - .WithMaxOccupancyAbsolute(10) - .WithOneGroupPerTable(true) - .WithDisabledSeats(new List {"A-1"}) - .WithEnabledSeats(new List {"A-2"}) - .Build(); - - var ruleset2 = SocialDistancingRuleset.Fixed("My second ruleset") - .WithIndex(1) - .WithDisabledSeats(new List {"A-1"}) - .Build(); - - var rulesets = new Dictionary - { - {"ruleset1", ruleset1}, - {"ruleset2", ruleset2} - }; - - Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets); - - var retrievedChart = Client.Charts.Retrieve(chartKey); - Assert.Equal(2, retrievedChart.SocialDistancingRulesets.Count); - - var retrievedRuleset1 = retrievedChart.SocialDistancingRulesets["ruleset1"]; - Assert.Equal(0, retrievedRuleset1.Index); - Assert.Equal("My first ruleset", retrievedRuleset1.Name); - Assert.Equal(1, retrievedRuleset1.NumberOfDisabledSeatsToTheSides); - Assert.True(retrievedRuleset1.DisableSeatsInFrontAndBehind); - Assert.True(retrievedRuleset1.DisableDiagonalSeatsInFrontAndBehind); - Assert.Equal(2, retrievedRuleset1.NumberOfDisabledAisleSeats); - Assert.Equal(1, retrievedRuleset1.MaxGroupSize); - Assert.Equal(10, retrievedRuleset1.MaxOccupancyAbsolute); - Assert.Equal(0, retrievedRuleset1.MaxOccupancyPercentage); - Assert.True(retrievedRuleset1.OneGroupPerTable); - Assert.False(retrievedRuleset1.FixedGroupLayout); - Assert.Equal(new List {"A-1"}, retrievedRuleset1.DisabledSeats); - Assert.Equal(new List {"A-2"}, retrievedRuleset1.EnabledSeats); - - var retrievedRuleset2 = retrievedChart.SocialDistancingRulesets["ruleset2"]; - Assert.Equal(1, retrievedRuleset2.Index); - Assert.Equal("My second ruleset", retrievedRuleset2.Name); - Assert.Equal(0, retrievedRuleset2.NumberOfDisabledSeatsToTheSides); - Assert.False(retrievedRuleset2.DisableSeatsInFrontAndBehind); - Assert.False(retrievedRuleset2.DisableDiagonalSeatsInFrontAndBehind); - Assert.Equal(0, retrievedRuleset2.NumberOfDisabledAisleSeats); - Assert.Equal(0, retrievedRuleset2.MaxGroupSize); - Assert.Equal(0, retrievedRuleset2.MaxOccupancyAbsolute); - Assert.Equal(0, retrievedRuleset2.MaxOccupancyPercentage); - Assert.False(retrievedRuleset2.OneGroupPerTable); - Assert.True(retrievedRuleset2.FixedGroupLayout); - Assert.Equal(new List {"A-1"}, retrievedRuleset1.DisabledSeats); - Assert.Empty(retrievedRuleset2.EnabledSeats); - } - } -} \ No newline at end of file diff --git a/SeatsioDotNet.Test/EventReports/EventReportsTest.cs b/SeatsioDotNet.Test/EventReports/EventReportsTest.cs index e56935a..79f8b58 100644 --- a/SeatsioDotNet.Test/EventReports/EventReportsTest.cs +++ b/SeatsioDotNet.Test/EventReports/EventReportsTest.cs @@ -47,7 +47,6 @@ public void ReportItemProperties() Assert.Null(reportItem.LeftNeighbour); Assert.Equal("A-2", reportItem.RightNeighbour); Assert.False(reportItem.IsAvailable); - Assert.False(reportItem.IsDisabledBySocialDistancing); Assert.Equal("channelKey1", reportItem.Channel); Assert.Null(reportItem.BookAsAWhole); Assert.NotNull(reportItem.DistanceToFocalPoint); diff --git a/SeatsioDotNet.Test/Events/BookObjectsTest.cs b/SeatsioDotNet.Test/Events/BookObjectsTest.cs index 62d0d17..9d8358c 100644 --- a/SeatsioDotNet.Test/Events/BookObjectsTest.cs +++ b/SeatsioDotNet.Test/Events/BookObjectsTest.cs @@ -115,27 +115,6 @@ public void IgnoreChannels() Client.Events.Book(evnt.Key, new[] {"A-1"}, null, null, true, true); - Assert.Equal(EventObjectInfo.Booked, Client.Events.RetrieveObjectInfo(evnt.Key, "A-1").Status); - } - - [Fact] - public void IgnoreSocialDistancing() - { - var chartKey = CreateTestChart(); - var evnt = Client.Events.Create(chartKey); - var ruleset = SocialDistancingRuleset.Fixed("ruleset") - .WithDisabledSeats(new List {"A-1"}) - .Build(); - - var rulesets = new Dictionary - { - {"ruleset", ruleset}, - }; - Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets); - Client.Events.Update(evnt.Key, new UpdateEventParams().WithSocialDistancingRulesetKey("ruleset")); - - Client.Events.Book(evnt.Key, new[] {"A-1"}, null, null, null, null, null, true); - Assert.Equal(EventObjectInfo.Booked, Client.Events.RetrieveObjectInfo(evnt.Key, "A-1").Status); } } diff --git a/SeatsioDotNet.Test/Events/ChangeObjectStatusForMultipleEventsTest.cs b/SeatsioDotNet.Test/Events/ChangeObjectStatusForMultipleEventsTest.cs index 0a9c200..f6b66ab 100644 --- a/SeatsioDotNet.Test/Events/ChangeObjectStatusForMultipleEventsTest.cs +++ b/SeatsioDotNet.Test/Events/ChangeObjectStatusForMultipleEventsTest.cs @@ -70,27 +70,5 @@ public void Release() Assert.Equal(EventObjectInfo.Free, Client.Events.RetrieveObjectInfo(event2.Key, "A-1").Status); Assert.Equal(EventObjectInfo.Free, Client.Events.RetrieveObjectInfo(event2.Key, "A-2").Status); } - - [Fact] - public void IgnoreSocialDistancing() - { - var chartKey = CreateTestChart(); - var ruleset = SocialDistancingRuleset.Fixed("ruleset") - .WithDisabledSeats(new List {"A-1"}) - .Build(); - var rulesets = new Dictionary - { - {"ruleset", ruleset}, - }; - Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets); - var event1 = Client.Events.Create(chartKey, new CreateEventParams().WithSocialDistancingRulesetKey("ruleset")); - var event2 = Client.Events.Create(chartKey, new CreateEventParams().WithSocialDistancingRulesetKey("ruleset")); - - Client.Events.Book(new[] {event1.Key, event2.Key}, new[] {"A-1"}, null, null, null, null, null, true); - - Assert.Equal(EventObjectInfo.Booked, Client.Events.RetrieveObjectInfo(event1.Key, "A-1").Status); - Assert.Equal(EventObjectInfo.Booked, Client.Events.RetrieveObjectInfo(event2.Key, "A-1").Status); - } - } } \ No newline at end of file diff --git a/SeatsioDotNet.Test/Events/ChangeObjectStatusTest.cs b/SeatsioDotNet.Test/Events/ChangeObjectStatusTest.cs index e0df3f2..1e88667 100644 --- a/SeatsioDotNet.Test/Events/ChangeObjectStatusTest.cs +++ b/SeatsioDotNet.Test/Events/ChangeObjectStatusTest.cs @@ -163,25 +163,6 @@ public void NoKeepExtraData() Assert.Null(Client.Events.RetrieveObjectInfo(evnt.Key, "A-1").ExtraData); } - [Fact] - public void IgnoreSocialDistancing() - { - var chartKey = CreateTestChart(); - var ruleset = SocialDistancingRuleset.Fixed("ruleset") - .WithDisabledSeats(new List {"A-1"}) - .Build(); - var rulesets = new Dictionary - { - {"ruleset", ruleset}, - }; - Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets); - var evnt = Client.Events.Create(chartKey, new CreateEventParams().WithSocialDistancingRulesetKey("ruleset")); - - Client.Events.ChangeObjectStatus(evnt.Key, new[] {"A-1"}, "someStatus", null, null, null, null, null, true); - - Assert.Null(Client.Events.RetrieveObjectInfo(evnt.Key, "A-1").ExtraData); - } - [Fact] public void AllowedPreviousStatuses() { @@ -191,7 +172,7 @@ public void AllowedPreviousStatuses() Assert.Throws(() => { Client.Events.ChangeObjectStatus(evnt.Key, new[] {"A-1"}, "someStatus", - null, null, null, null, null, true, + null, null, null, null, null, new []{"somePreviousStatus"} ); }); @@ -206,7 +187,7 @@ public void RejectedPreviousStatuses() Assert.Throws(() => { Client.Events.ChangeObjectStatus(evnt.Key, new[] {"A-1"}, "someStatus", - null, null, null, null, null, true, + null, null, null, null, null, null, new []{"free"} ); }); diff --git a/SeatsioDotNet.Test/Events/CreateEventTest.cs b/SeatsioDotNet.Test/Events/CreateEventTest.cs index 1f28b4f..bbd56db 100644 --- a/SeatsioDotNet.Test/Events/CreateEventTest.cs +++ b/SeatsioDotNet.Test/Events/CreateEventTest.cs @@ -61,22 +61,6 @@ public void TableBookingModeInheritCanBeUsed() Assert.Equal("INHERIT", evnt.TableBookingConfig.Mode); } - [Fact] - public void SocialDistancingRulesetKeyCanBePassedIn() - { - var chartKey = CreateTestChart(); - var rulesets = new Dictionary() - { - {"ruleset1", SocialDistancingRuleset.RuleBased("My first ruleset").Build()}, - }; - Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets); - - var evnt = Client.Events.Create(chartKey, new CreateEventParams().WithSocialDistancingRulesetKey("ruleset1")); - - Assert.Equal("ruleset1", evnt.SocialDistancingRulesetKey); - } - - [Fact] public void ObjectCategoriesCanBePassedIn() { diff --git a/SeatsioDotNet.Test/Events/CreateEventsTest.cs b/SeatsioDotNet.Test/Events/CreateEventsTest.cs index 7964637..6c2a3d2 100644 --- a/SeatsioDotNet.Test/Events/CreateEventsTest.cs +++ b/SeatsioDotNet.Test/Events/CreateEventsTest.cs @@ -81,28 +81,7 @@ public void TableBookingModesCanBePassedIn() Assert.Equal("CUSTOM", events[1].TableBookingConfig.Mode); Assert.Equal(new() {{"T1", "BY_SEAT"}, {"T2", "BY_TABLE"}}, events[1].TableBookingConfig.Tables); } - - [Fact] - public void SocialDistancingRulesetKeyCanBePassedIn() - { - var chartKey = CreateTestChart(); - var rulesets = new Dictionary() - { - {"ruleset1", SocialDistancingRuleset.RuleBased("My first ruleset").Build()}, - }; - Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets); - var eventCreationParams = new[] - { - new CreateEventParams().WithSocialDistancingRulesetKey("ruleset1"), - new CreateEventParams().WithSocialDistancingRulesetKey("ruleset1") - }; - - var events = Client.Events.Create(chartKey, eventCreationParams); - - Assert.Equal("ruleset1", events[0].SocialDistancingRulesetKey); - Assert.Equal("ruleset1", events[1].SocialDistancingRulesetKey); - } - + [Fact] public void ObjectCategoriesCanBePassedIn() { diff --git a/SeatsioDotNet.Test/Events/HoldObjectsTest.cs b/SeatsioDotNet.Test/Events/HoldObjectsTest.cs index 6d2cd98..9032b70 100644 --- a/SeatsioDotNet.Test/Events/HoldObjectsTest.cs +++ b/SeatsioDotNet.Test/Events/HoldObjectsTest.cs @@ -101,27 +101,5 @@ public void IgnoreChannels() Assert.Equal(EventObjectInfo.Held, Client.Events.RetrieveObjectInfo(evnt.Key, "A-1").Status); } - - [Fact] - public void IgnoreSocialDistancing() - { - var chartKey = CreateTestChart(); - var evnt = Client.Events.Create(chartKey); - var ruleset = SocialDistancingRuleset.Fixed("ruleset") - .WithDisabledSeats(new List {"A-1"}) - .Build(); - - var rulesets = new Dictionary - { - {"ruleset", ruleset}, - }; - Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets); - Client.Events.Update(evnt.Key, new UpdateEventParams().WithSocialDistancingRulesetKey("ruleset")); - HoldToken holdToken = Client.HoldTokens.Create(); - - Client.Events.Hold(evnt.Key, new[] {"A-1"}, holdToken.Token, null, null, null, null, true); - - Assert.Equal(EventObjectInfo.Held, Client.Events.RetrieveObjectInfo(evnt.Key, "A-1").Status); - } } } diff --git a/SeatsioDotNet.Test/Events/UpdateEventTest.cs b/SeatsioDotNet.Test/Events/UpdateEventTest.cs index 576021b..3f52fa1 100644 --- a/SeatsioDotNet.Test/Events/UpdateEventTest.cs +++ b/SeatsioDotNet.Test/Events/UpdateEventTest.cs @@ -51,44 +51,7 @@ public void UpdateTableBookingConfig() Assert.Equal("CUSTOM", retrievedEvent.TableBookingConfig.Mode); Assert.Equal(new() {{"T1", "BY_SEAT"}}, retrievedEvent.TableBookingConfig.Tables); } - - [Fact] - public void UpdateSocialDistancingRulesetKey() - { - var chartKey = CreateTestChart(); - var rulesets = new Dictionary() - { - {"ruleset1", SocialDistancingRuleset.RuleBased("My first ruleset").Build()}, - {"ruleset2", SocialDistancingRuleset.RuleBased("My second ruleset").Build()} - }; - Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets); - var evnt = Client.Events.Create(chartKey, - new CreateEventParams().WithSocialDistancingRulesetKey("ruleset1")); - - Client.Events.Update(evnt.Key, new UpdateEventParams().WithSocialDistancingRulesetKey("ruleset2")); - - var retrievedEvent = Client.Events.Retrieve(evnt.Key); - Assert.Equal(retrievedEvent.SocialDistancingRulesetKey, "ruleset2"); - } - - [Fact] - public void RemoveSocialDistancingRulesetKey() - { - var chartKey = CreateTestChart(); - var rulesets = new Dictionary() - { - {"ruleset1", SocialDistancingRuleset.RuleBased("My first ruleset").Build()} - }; - Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets); - var evnt = Client.Events.Create(chartKey, - new CreateEventParams().WithSocialDistancingRulesetKey("ruleset1")); - - Client.Events.Update(evnt.Key, new UpdateEventParams().WithSocialDistancingRulesetKey("")); - - var retrievedEvent = Client.Events.Retrieve(evnt.Key); - Assert.Null(retrievedEvent.SocialDistancingRulesetKey); - } - + [Fact] public void UpdateObjectCategories() { diff --git a/SeatsioDotNet.Test/Seasons/CreateSeasonTest.cs b/SeatsioDotNet.Test/Seasons/CreateSeasonTest.cs index 8fab514..fa98bb8 100644 --- a/SeatsioDotNet.Test/Seasons/CreateSeasonTest.cs +++ b/SeatsioDotNet.Test/Seasons/CreateSeasonTest.cs @@ -68,21 +68,6 @@ public void TableBookingConfigCanBePassedIn() var season = Client.Seasons.Create(chartKey, tableBookingConfig: TableBookingConfig.AllBySeat()); Assert.Equal(TableBookingConfig.AllBySeat().Mode, season.TableBookingConfig.Mode); - } - - [Fact] - public void SocialDistancingRulesetKeyCanBePassedIn() - { - var chartKey = CreateTestChart(); - var rulesets = new Dictionary() - { - { "ruleset1", SocialDistancingRuleset.RuleBased("My first ruleset").Build() }, - }; - Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets); - - var season = Client.Seasons.Create(chartKey, socialDistancingRulesetKey: "ruleset1"); - - Assert.Equal("ruleset1", season.SocialDistancingRulesetKey); } } } \ No newline at end of file diff --git a/SeatsioDotNet/Charts/Chart.cs b/SeatsioDotNet/Charts/Chart.cs index e8d0302..e126608 100644 --- a/SeatsioDotNet/Charts/Chart.cs +++ b/SeatsioDotNet/Charts/Chart.cs @@ -15,6 +15,5 @@ public class Chart public string DraftVersionThumbnailUrl { get; set; } public IEnumerable Events { get; set; } public ChartValidationResult Validation { get; set; } - public Dictionary SocialDistancingRulesets { get; set; } } } \ No newline at end of file diff --git a/SeatsioDotNet/Charts/Charts.cs b/SeatsioDotNet/Charts/Charts.cs index 8303ca3..5aebe83 100644 --- a/SeatsioDotNet/Charts/Charts.cs +++ b/SeatsioDotNet/Charts/Charts.cs @@ -137,26 +137,6 @@ public void RemoveTag(string chartKey, string tag) AssertOk(_restClient.Execute(restRequest)); } - public void SaveSocialDistancingRulesets(string chartKey, Dictionary rulesets) - { - var restRequest = new RestRequest("/charts/{key}/social-distancing-rulesets", Method.Post) - .AddUrlSegment("key", chartKey) - .AddJsonBody(SaveSocialDistancingRulesetsRequest(rulesets)); - AssertOk(_restClient.Execute(restRequest)); - } - - private Dictionary SaveSocialDistancingRulesetsRequest(Dictionary rulesets) - { - var json = new Dictionary(); - foreach(KeyValuePair entry in rulesets) - { - json.Add(entry.Key, entry.Value.AsJsonObject()); - } - var request = new Dictionary(); - request.Add("socialDistancingRulesets", json); - return request; - } - public Chart Retrieve(string chartKey, bool? expandEvents = null) { var restRequest = new RestRequest("/charts/{key}", Method.Get) diff --git a/SeatsioDotNet/Charts/SocialDistancingRuleset.cs b/SeatsioDotNet/Charts/SocialDistancingRuleset.cs deleted file mode 100644 index 3a5a8d3..0000000 --- a/SeatsioDotNet/Charts/SocialDistancingRuleset.cs +++ /dev/null @@ -1,196 +0,0 @@ -using System.Collections.Generic; - -namespace SeatsioDotNet.Charts -{ - public class SocialDistancingRuleset - { - public int Index { get; set; } - public string Name { get; set; } - public int NumberOfDisabledSeatsToTheSides { get; set; } - public bool DisableSeatsInFrontAndBehind { get; set; } - public bool DisableDiagonalSeatsInFrontAndBehind { get; set; } - public int NumberOfDisabledAisleSeats { get; set; } - public int MaxGroupSize { get; set; } - public int MaxOccupancyAbsolute { get; set; } - public int MaxOccupancyPercentage { get; set; } - public bool OneGroupPerTable { get; set; } - public bool FixedGroupLayout { get; set; } - public List DisabledSeats { get; set; } = new List(); - public List EnabledSeats { get; set; } = new List(); - - public static FixedSocialDistancingRulesetBuilder Fixed(string name) - { - return new FixedSocialDistancingRulesetBuilder(name); - } - - public static RuleBasedSocialDistancingRulesetBuilder RuleBased(string name) - { - return new RuleBasedSocialDistancingRulesetBuilder(name); - } - - public object AsJsonObject() - { - return new - { - index = Index, - name = Name, - numberOfDisabledSeatsToTheSides = NumberOfDisabledSeatsToTheSides, - disableSeatsInFrontAndBehind = DisableSeatsInFrontAndBehind, - disableDiagonalSeatsInFrontAndBehind = DisableDiagonalSeatsInFrontAndBehind, - numberOfDisabledAisleSeats = NumberOfDisabledAisleSeats, - maxGroupSize = MaxGroupSize, - maxOccupancyAbsolute = MaxOccupancyAbsolute, - maxOccupancyPercentage = MaxOccupancyPercentage, - oneGroupPerTable = OneGroupPerTable, - fixedGroupLayout = FixedGroupLayout, - disabledSeats = DisabledSeats, - enabledSeats = EnabledSeats - }; - } - } - - public class FixedSocialDistancingRulesetBuilder - { - private readonly string Name; - private int Index; - private List DisabledSeats; - - public FixedSocialDistancingRulesetBuilder(string name) - { - Name = name; - } - - public SocialDistancingRuleset Build() - { - var ruleset = new SocialDistancingRuleset - { - Name = Name, - Index = Index, - FixedGroupLayout = true, - DisabledSeats = DisabledSeats - }; - return ruleset; - } - - public FixedSocialDistancingRulesetBuilder WithIndex(int index) - { - Index = index; - return this; - } - - public FixedSocialDistancingRulesetBuilder WithDisabledSeats(List disabledSeats) - { - DisabledSeats = disabledSeats; - return this; - } - } - - public class RuleBasedSocialDistancingRulesetBuilder - { - private readonly string Name; - private int Index; - private int NumberOfDisabledSeatsToTheSides; - private bool DisableSeatsInFrontAndBehind; - private bool DisableDiagonalSeatsInFrontAndBehind; - private int NumberOfDisabledAisleSeats; - private int MaxGroupSize; - private int MaxOccupancyAbsolute; - private int MaxOccupancyPercentage; - private bool OneGroupPerTable; - private bool FixedGroupLayout; - private List DisabledSeats = new List(); - private List EnabledSeats = new List(); - - public RuleBasedSocialDistancingRulesetBuilder(string name) - { - Name = name; - } - - public SocialDistancingRuleset Build() - { - var ruleset = new SocialDistancingRuleset - { - Name = Name, - Index = Index, - NumberOfDisabledSeatsToTheSides = NumberOfDisabledSeatsToTheSides, - DisableSeatsInFrontAndBehind = DisableSeatsInFrontAndBehind, - DisableDiagonalSeatsInFrontAndBehind = DisableDiagonalSeatsInFrontAndBehind, - NumberOfDisabledAisleSeats = NumberOfDisabledAisleSeats, - MaxGroupSize = MaxGroupSize, - MaxOccupancyAbsolute = MaxOccupancyAbsolute, - MaxOccupancyPercentage = MaxOccupancyPercentage, - OneGroupPerTable = OneGroupPerTable, - FixedGroupLayout = false, - DisabledSeats = DisabledSeats, - EnabledSeats = EnabledSeats - }; - return ruleset; - } - - public RuleBasedSocialDistancingRulesetBuilder WithIndex(int index) - { - Index = index; - return this; - } - - public RuleBasedSocialDistancingRulesetBuilder WithNumberOfDisabledSeatsToTheSides(int numberOfDisabledSeatsToTheSides) - { - NumberOfDisabledSeatsToTheSides = numberOfDisabledSeatsToTheSides; - return this; - } - - public RuleBasedSocialDistancingRulesetBuilder WithDisableSeatsInFrontAndBehind(bool disableSeatsInFrontAndBehind) - { - DisableSeatsInFrontAndBehind = disableSeatsInFrontAndBehind; - return this; - } - - public RuleBasedSocialDistancingRulesetBuilder WithDisableDiagonalSeatsInFrontAndBehind(bool disableDiagonalSeatsInFrontAndBehind) - { - DisableDiagonalSeatsInFrontAndBehind = disableDiagonalSeatsInFrontAndBehind; - return this; - } - - public RuleBasedSocialDistancingRulesetBuilder WithNumberOfDisabledAisleSeats(int numberOfDisabledAisleSeats) - { - NumberOfDisabledAisleSeats = numberOfDisabledAisleSeats; - return this; - } - - public RuleBasedSocialDistancingRulesetBuilder WithMaxGroupSize(int maxGroupSize) - { - MaxGroupSize = maxGroupSize; - return this; - } - - public RuleBasedSocialDistancingRulesetBuilder WithMaxOccupancyAbsolute(int maxOccupancyAbsolute) - { - MaxOccupancyAbsolute = maxOccupancyAbsolute; - return this; - } - - public RuleBasedSocialDistancingRulesetBuilder WithMaxOccupancyPercentage(int maxOccupancyPercentage) - { - MaxOccupancyPercentage = maxOccupancyPercentage; - return this; - } - - public RuleBasedSocialDistancingRulesetBuilder WithOneGroupPerTable(bool oneGroupPerTable) - { - OneGroupPerTable = oneGroupPerTable; - return this; - } - - public RuleBasedSocialDistancingRulesetBuilder WithDisabledSeats(List disabledSeats) - { - DisabledSeats = disabledSeats; - return this; - } - - public RuleBasedSocialDistancingRulesetBuilder WithEnabledSeats(List enabledSeats) - { - EnabledSeats = enabledSeats; - return this; - } - } -} \ No newline at end of file diff --git a/SeatsioDotNet/Events/CreateEventParams.cs b/SeatsioDotNet/Events/CreateEventParams.cs index 8dd3b60..62e7501 100644 --- a/SeatsioDotNet/Events/CreateEventParams.cs +++ b/SeatsioDotNet/Events/CreateEventParams.cs @@ -10,7 +10,6 @@ public class CreateEventParams public string Name { get; set; } public DateOnly? Date { get; set; } public TableBookingConfig TableBookingConfig { get; set; } - public string SocialDistancingRulesetKey { get; set; } public Dictionary ObjectCategories { get; set; } public Category[] Categories { get; set; } @@ -26,12 +25,6 @@ public CreateEventParams WithTableBookingConfig(TableBookingConfig tableBookingC return this; } - public CreateEventParams WithSocialDistancingRulesetKey(string socialDistancingRulesetKey) - { - SocialDistancingRulesetKey = socialDistancingRulesetKey; - return this; - } - public CreateEventParams WithObjectCategories(Dictionary objectCategories) { ObjectCategories = objectCategories; diff --git a/SeatsioDotNet/Events/Event.cs b/SeatsioDotNet/Events/Event.cs index 1c95240..f60066f 100644 --- a/SeatsioDotNet/Events/Event.cs +++ b/SeatsioDotNet/Events/Event.cs @@ -18,7 +18,6 @@ public class Event public DateTimeOffset? CreatedOn { get; set; } public DateTimeOffset? UpdatedOn { get; set; } public List Channels { get; set; } - public string SocialDistancingRulesetKey { get; set; } public Dictionary ObjectCategories { get; set; } public List Categories { get; set; } public List PartialSeasonKeys { get; set; } diff --git a/SeatsioDotNet/Events/EventObjectInfo.cs b/SeatsioDotNet/Events/EventObjectInfo.cs index 8c5cf0f..f2ce919 100644 --- a/SeatsioDotNet/Events/EventObjectInfo.cs +++ b/SeatsioDotNet/Events/EventObjectInfo.cs @@ -41,7 +41,6 @@ public class EventObjectInfo public string LeftNeighbour { get; set; } public string RightNeighbour { get; set; } public bool IsAvailable { get; set; } - public bool? IsDisabledBySocialDistancing { get; set; } public string Channel { get; set; } public float? DistanceToFocalPoint { get; set; } public Dictionary> Holds { get; set; } diff --git a/SeatsioDotNet/Events/Events.cs b/SeatsioDotNet/Events/Events.cs index 8c2f842..fec18a7 100644 --- a/SeatsioDotNet/Events/Events.cs +++ b/SeatsioDotNet/Events/Events.cs @@ -49,11 +49,6 @@ public Event Create(string chartKey, CreateEventParams p) requestBody.Add("tableBookingConfig", p.TableBookingConfig.AsJsonObject()); } - if (p.SocialDistancingRulesetKey != null) - { - requestBody.Add("socialDistancingRulesetKey", p.SocialDistancingRulesetKey); - } - if (p.ObjectCategories != null) { requestBody.Add("objectCategories", p.ObjectCategories); @@ -96,11 +91,6 @@ public Event[] Create(string chartKey, CreateEventParams[] eventCreationParams) e.Add("tableBookingConfig", param.TableBookingConfig.AsJsonObject()); } - if (param.SocialDistancingRulesetKey != null) - { - e.Add("socialDistancingRulesetKey", param.SocialDistancingRulesetKey); - } - if (param.ObjectCategories != null) { e.Add("objectCategories", param.ObjectCategories); @@ -148,11 +138,6 @@ public void Update(string eventKey, UpdateEventParams p) requestBody.Add("tableBookingConfig", p.TableBookingConfig.AsJsonObject()); } - if (p.SocialDistancingRulesetKey != null) - { - requestBody.Add("socialDistancingRulesetKey", p.SocialDistancingRulesetKey); - } - if (p.ObjectCategories != null) { requestBody.Add("objectCategories", p.ObjectCategories); @@ -203,35 +188,33 @@ public Dictionary RetrieveObjectInfos(string eventKey, } public ChangeObjectStatusResult Book(string eventKey, IEnumerable objects, string holdToken = null, - string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, string[] channelKeys = null, - bool? ignoreSocialDistancing = null) + string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, string[] channelKeys = null) { return ChangeObjectStatus(eventKey, objects, EventObjectInfo.Booked, holdToken, orderId, keepExtraData, - ignoreChannels, channelKeys, ignoreSocialDistancing); + ignoreChannels, channelKeys); } public ChangeObjectStatusResult Book(string[] eventKeys, IEnumerable objects, string holdToken = null, - string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, string[] channelKeys = null, - bool? ignoreSocialDistancing = null) + string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, string[] channelKeys = null) { return ChangeObjectStatus(eventKeys, objects, EventObjectInfo.Booked, holdToken, orderId, keepExtraData, - ignoreChannels, channelKeys, ignoreSocialDistancing); + ignoreChannels, channelKeys); } public ChangeObjectStatusResult Book(string eventKey, IEnumerable objects, string holdToken = null, string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, - string[] channelKeys = null, bool? ignoreSocialDistancing = null) + string[] channelKeys = null) { return ChangeObjectStatus(eventKey, objects, EventObjectInfo.Booked, holdToken, orderId, keepExtraData, - ignoreChannels, channelKeys, ignoreSocialDistancing); + ignoreChannels, channelKeys); } public ChangeObjectStatusResult Book(string[] eventKeys, IEnumerable objects, string holdToken = null, string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, - string[] channelKeys = null, bool? ignoreSocialDistancing = null) + string[] channelKeys = null) { return ChangeObjectStatus(eventKeys, objects, EventObjectInfo.Booked, holdToken, orderId, keepExtraData, - ignoreChannels, channelKeys, ignoreSocialDistancing); + ignoreChannels, channelKeys); } public BestAvailableResult Book(string eventKey, BestAvailable bestAvailable, string holdToken = null, @@ -273,35 +256,32 @@ public ChangeObjectStatusResult Release(string[] eventKeys, IEnumerable objects, string holdToken, - string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, string[] channelKeys = null, - bool? ignoreSocialDistancing = null) + string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, string[] channelKeys = null) { return ChangeObjectStatus(eventKey, objects, EventObjectInfo.Held, holdToken, orderId, keepExtraData, - ignoreChannels, channelKeys, ignoreSocialDistancing); + ignoreChannels, channelKeys); } public ChangeObjectStatusResult Hold(string[] eventKeys, IEnumerable objects, string holdToken, - string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, string[] channelKeys = null, - bool? ignoreSocialDistancing = null) + string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, string[] channelKeys = null) { return ChangeObjectStatus(eventKeys, objects, EventObjectInfo.Held, holdToken, orderId, keepExtraData, - ignoreChannels, channelKeys, ignoreSocialDistancing); + ignoreChannels, channelKeys); } public ChangeObjectStatusResult Hold(string eventKey, IEnumerable objects, string holdToken, - string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, string[] channelKeys = null, - bool? ignoreSocialDistancing = null) + string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, string[] channelKeys = null) { return ChangeObjectStatus(eventKey, objects, EventObjectInfo.Held, holdToken, orderId, keepExtraData, - ignoreChannels, channelKeys, ignoreSocialDistancing); + ignoreChannels, channelKeys); } public ChangeObjectStatusResult Hold(string[] eventKeys, IEnumerable objects, string holdToken, string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, - string[] channelKeys = null, bool? ignoreSocialDistancing = null) + string[] channelKeys = null) { return ChangeObjectStatus(eventKeys, objects, EventObjectInfo.Held, holdToken, orderId, keepExtraData, - ignoreChannels, channelKeys, ignoreSocialDistancing); + ignoreChannels, channelKeys); } public BestAvailableResult Hold(string eventKey, BestAvailable bestAvailable, string holdToken, @@ -313,38 +293,37 @@ public BestAvailableResult Hold(string eventKey, BestAvailable bestAvailable, st public ChangeObjectStatusResult ChangeObjectStatus(string eventKey, IEnumerable objects, string status, string holdToken = null, string orderId = null, bool? keepExtraData = null, bool? ignoreChannels = null, - string[] channelKeys = null, bool? ignoreSocialDistancing = null, string[] allowedPreviousStatuses = null, + string[] channelKeys = null, string[] allowedPreviousStatuses = null, string[] rejectedPreviousStatuses = null) { return ChangeObjectStatus(new[] {eventKey}, objects.Select(o => new ObjectProperties(o)), status, holdToken, - orderId, keepExtraData, ignoreChannels, channelKeys, ignoreSocialDistancing, allowedPreviousStatuses, + orderId, keepExtraData, ignoreChannels, channelKeys, allowedPreviousStatuses, rejectedPreviousStatuses); } public ChangeObjectStatusResult ChangeObjectStatus(string eventKey, IEnumerable objects, string status, string holdToken = null, string orderId = null, bool? keepExtraData = null, - bool? ignoreChannels = null, string[] channelKeys = null, bool? ignoreSocialDistancing = null) + bool? ignoreChannels = null, string[] channelKeys = null) { return ChangeObjectStatus(new[] {eventKey}, objects, status, holdToken, orderId, keepExtraData, - ignoreChannels, channelKeys, ignoreSocialDistancing); + ignoreChannels, channelKeys); } public ChangeObjectStatusResult ChangeObjectStatus(IEnumerable events, IEnumerable objects, string status, string holdToken = null, string orderId = null, bool? keepExtraData = null, - bool? ignoreChannels = null, string[] channelKeys = null, bool? ignoreSocialDistancing = null) + bool? ignoreChannels = null, string[] channelKeys = null) { return ChangeObjectStatus(events, objects.Select(o => new ObjectProperties(o)), status, holdToken, orderId, - keepExtraData, ignoreChannels, channelKeys, ignoreSocialDistancing); + keepExtraData, ignoreChannels, channelKeys); } public ChangeObjectStatusResult ChangeObjectStatus(IEnumerable events, IEnumerable objects, string status, string holdToken = null, string orderId = null, - bool? keepExtraData = null, bool? ignoreChannels = null, string[] channelKeys = null, - bool? ignoreSocialDistancing = null, string[] allowedPreviousStatuses = null, + bool? keepExtraData = null, bool? ignoreChannels = null, string[] channelKeys = null, string[] allowedPreviousStatuses = null, string[] rejectedPreviousStatuses = null) { var requestBody = ChangeObjectStatusRequest(events, objects, status, holdToken, orderId, keepExtraData, - ignoreChannels, channelKeys, ignoreSocialDistancing, allowedPreviousStatuses, rejectedPreviousStatuses); + ignoreChannels, channelKeys, allowedPreviousStatuses, rejectedPreviousStatuses); var restRequest = new RestRequest("/events/groups/actions/change-object-status", Method.Post) .AddQueryParameter("expand", "objects") .AddJsonBody(requestBody); @@ -354,7 +333,7 @@ public ChangeObjectStatusResult ChangeObjectStatus(IEnumerable events, public List ChangeObjectStatus(StatusChangeRequest[] requests) { var serializedRequests = requests.Select(r => ChangeObjectStatusRequest(r.EventKey, r.Objects, r.Status, - r.HoldToken, r.OrderId, r.KeepExtraData, r.IgnoreChannels, r.ChannelKeys, null, + r.HoldToken, r.OrderId, r.KeepExtraData, r.IgnoreChannels, r.ChannelKeys, r.AllowedPreviousStatuses, r.RejectedPreviousStatuses)); var restRequest = new RestRequest("/events/actions/change-object-status", Method.Post) .AddQueryParameter("expand", "objects") @@ -364,29 +343,29 @@ public List ChangeObjectStatus(StatusChangeRequest[] r private Dictionary ChangeObjectStatusRequest(string evnt, IEnumerable objects, string status, string holdToken, string orderId, bool? keepExtraData, bool? ignoreChannels = null, - string[] channelKeys = null, bool? ignoreSocialDistancing = null, string[] allowedPreviousStatuses = null, + string[] channelKeys = null, string[] allowedPreviousStatuses = null, string[] rejectedPreviousStatuses = null) { var request = ChangeObjectStatusRequest(objects, status, holdToken, orderId, keepExtraData, ignoreChannels, - channelKeys, ignoreSocialDistancing, allowedPreviousStatuses, rejectedPreviousStatuses); + channelKeys, allowedPreviousStatuses, rejectedPreviousStatuses); request.Add("event", evnt); return request; } private Dictionary ChangeObjectStatusRequest(IEnumerable events, IEnumerable objects, string status, string holdToken, string orderId, bool? keepExtraData, - bool? ignoreChannels = null, string[] channelKeys = null, bool? ignoreSocialDistancing = null, + bool? ignoreChannels = null, string[] channelKeys = null, string[] allowedPreviousStatuses = null, string[] rejectedPreviousStatuses = null) { var request = ChangeObjectStatusRequest(objects, status, holdToken, orderId, keepExtraData, ignoreChannels, - channelKeys, ignoreSocialDistancing, allowedPreviousStatuses, rejectedPreviousStatuses); + channelKeys, allowedPreviousStatuses, rejectedPreviousStatuses); request.Add("events", events); return request; } private Dictionary ChangeObjectStatusRequest(IEnumerable objects, string status, string holdToken, string orderId, bool? keepExtraData, bool? ignoreChannels = null, - string[] channelKeys = null, bool? ignoreSocialDistancing = null, string[] allowedPreviousStatuses = null, + string[] channelKeys = null, string[] allowedPreviousStatuses = null, string[] rejectedPreviousStatuses = null) { var requestBody = new Dictionary() @@ -420,11 +399,6 @@ private Dictionary ChangeObjectStatusRequest(IEnumerable ObjectCategories { get; set; } public Category[] Categories { get; set; } @@ -33,12 +32,6 @@ public UpdateEventParams WithTableBookingConfig(TableBookingConfig tableBookingC return this; } - public UpdateEventParams WithSocialDistancingRulesetKey(string socialDistancingRulesetKey) - { - SocialDistancingRulesetKey = socialDistancingRulesetKey; - return this; - } - public UpdateEventParams WithObjectCategories(Dictionary objectCategories) { ObjectCategories = objectCategories; diff --git a/SeatsioDotNet/Seasons/Seasons.cs b/SeatsioDotNet/Seasons/Seasons.cs index 148b4c6..2bc071a 100644 --- a/SeatsioDotNet/Seasons/Seasons.cs +++ b/SeatsioDotNet/Seasons/Seasons.cs @@ -17,7 +17,7 @@ public Seasons(RestClient restClient, SeatsioClient seatsioClient) _seatsioClient = seatsioClient; } - public Event Create(string chartKey, string key = null, int? numberOfEvents = null, IEnumerable eventKeys = null, TableBookingConfig tableBookingConfig = null, string socialDistancingRulesetKey = null) + public Event Create(string chartKey, string key = null, int? numberOfEvents = null, IEnumerable eventKeys = null, TableBookingConfig tableBookingConfig = null) { Dictionary requestBody = new Dictionary(); requestBody.Add("chartKey", chartKey); @@ -42,11 +42,6 @@ public Event Create(string chartKey, string key = null, int? numberOfEvents = nu requestBody.Add("tableBookingConfig", tableBookingConfig.AsJsonObject()); } - if (socialDistancingRulesetKey != null) - { - requestBody.Add("socialDistancingRulesetKey", socialDistancingRulesetKey); - } - var restRequest = new RestRequest("/seasons", Method.Post).AddJsonBody(requestBody); return AssertOk(_restClient.Execute(restRequest)); }