From a28a4a7cb85aede08d36ac7870b7175a3ccbd017 Mon Sep 17 00:00:00 2001 From: Ben Verbeken Date: Wed, 4 Sep 2024 10:30:50 +0200 Subject: [PATCH] expose floor information when changing object status --- SeatsioDotNet.Test/Events/BookObjectsTest.cs | 13 + SeatsioDotNet.Test/SeatsioClientTest.cs | 5 + .../resources/sampleChartWithFloors.json | 627 ++++++++++++++++++ SeatsioDotNet/Events/EventObjectInfo.cs | 1 + SeatsioDotNet/Events/Floor.cs | 18 + 5 files changed, 664 insertions(+) create mode 100644 SeatsioDotNet.Test/resources/sampleChartWithFloors.json create mode 100644 SeatsioDotNet/Events/Floor.cs diff --git a/SeatsioDotNet.Test/Events/BookObjectsTest.cs b/SeatsioDotNet.Test/Events/BookObjectsTest.cs index cdf4408..78915b7 100644 --- a/SeatsioDotNet.Test/Events/BookObjectsTest.cs +++ b/SeatsioDotNet.Test/Events/BookObjectsTest.cs @@ -24,6 +24,18 @@ public async Task Test() CustomAssert.ContainsOnly(new[] {"A-1", "A-2"}, result.Objects.Keys); } + [Fact] + public async Task Floors() + { + var chartKey = CreateTestChartWithFloors(); + var evnt = await Client.Events.CreateAsync(chartKey); + + var result = await Client.Events.BookAsync(evnt.Key, new[] {"S1-A-1"}); + + var reportItem = result.Objects["S1-A-1"]; + reportItem.Floor.Should().BeEquivalentTo(new Floor("1", "Floor 1")); + } + [Fact] public async Task Sections() { @@ -39,6 +51,7 @@ public async Task Sections() var reportItem = result.Objects["Section A-A-1"]; Assert.Equal("Section A", reportItem.Section); Assert.Equal("Entrance 1", reportItem.Entrance); + Assert.Null(reportItem.Floor); reportItem.Labels.Should().BeEquivalentTo(new Labels("1", "seat", "A", "row", "Section A")); reportItem.IDs.Should().BeEquivalentTo(new IDs("1", "A", "Section A")); } diff --git a/SeatsioDotNet.Test/SeatsioClientTest.cs b/SeatsioDotNet.Test/SeatsioClientTest.cs index 97f86a3..dd9ce6f 100644 --- a/SeatsioDotNet.Test/SeatsioClientTest.cs +++ b/SeatsioDotNet.Test/SeatsioClientTest.cs @@ -63,6 +63,11 @@ protected string CreateTestChartWithZones() return CreateTestChartFromJson(File.ReadAllText("./resources/sampleChartWithZones.json")); } + protected string CreateTestChartWithFloors() + { + return CreateTestChartFromJson(File.ReadAllText("./resources/sampleChartWithFloors.json")); + } + protected string CreateTestChartWithTables() { return CreateTestChartFromJson(File.ReadAllText("./resources/sampleChartWithTables.json")); diff --git a/SeatsioDotNet.Test/resources/sampleChartWithFloors.json b/SeatsioDotNet.Test/resources/sampleChartWithFloors.json new file mode 100644 index 0000000..e4679c1 --- /dev/null +++ b/SeatsioDotNet.Test/resources/sampleChartWithFloors.json @@ -0,0 +1,627 @@ +{ + "name": "chartWithFloors", + "tablesLabelCounter": 1, + "uuidCounter": 43, + "categories": { + "list": [ + { + "label": "CatA", + "color": "#992C4E", + "accessible": false, + "key": 1 + }, + { + "label": "CatB", + "color": "#CD254A", + "accessible": false, + "key": 2 + } + ], + "maxCategoryKey": 2 + }, + "zones": { + "list": [] + }, + "rowSpacing": 14, + "rowChairSpacing": 5, + "colorScheme": "light", + "version": 21, + "venueType": "WITH_SECTIONS_AND_FLOORS", + "sectionScaleFactor": 100, + "referenceChartVisible": true, + "subChartFloors": [ + { + "height": 173.11, + "width": 268.67, + "tables": [], + "texts": [], + "imageObjects": [], + "rows": [], + "shapes": [], + "booths": [], + "icons": [], + "generalAdmissionAreas": [], + "sections": [ + { + "points": [ + { + "x": 1, + "y": 1 + }, + { + "x": 238.78, + "y": 1 + }, + { + "x": 238.78, + "y": 147.67 + }, + { + "x": 1, + "y": 147.67 + } + ], + "label": "S1", + "labelSize": 12, + "labelShown": true, + "labelHorizontalOffset": 0, + "labelVerticalOffset": 0, + "labelRotationAngle": 0, + "uuid": "uuid2", + "categoryLabel": null, + "categoryKey": null, + "topLeft": { + "x": 0, + "y": 0 + }, + "entrance": null, + "viewFromYourSeatImage": null, + "objectLabeling": { + "algoName": "SimpleLettersUppercase", + "prefix": "", + "startAtIndex": 0, + "skippedCharacters": [] + }, + "subChart": { + "height": 149, + "width": 240, + "tables": [], + "texts": [], + "imageObjects": [], + "rows": [ + { + "label": "A", + "displayLabel": null, + "sectionLabel": null, + "sectionDisplayedLabel": null, + "rowLabelPosition": "label-position-invisible", + "seatLabeling": { + "algoName": "SimpleNumbers", + "startAtIndex": null, + "isInverted": null, + "useEndAt": false + }, + "objectLabeling": { + "algoName": null, + "prefix": null, + "startAtIndex": null, + "skippedCharacters": [] + }, + "seats": [ + { + "x": 42.22, + "y": 105, + "label": "1", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "uuid": "uuid5", + "published": true + }, + { + "x": 63.22, + "y": 105, + "label": "2", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "uuid": "uuid6", + "published": true + }, + { + "x": 84.22, + "y": 105, + "label": "3", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "uuid": "uuid7", + "published": true + }, + { + "x": 105.22, + "y": 105, + "label": "4", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "uuid": "uuid8", + "published": true + }, + { + "x": 126.22, + "y": 105, + "label": "5", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "uuid": "uuid9", + "published": true + }, + { + "x": 147.22, + "y": 105, + "label": "6", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "uuid": "uuid10", + "published": true + }, + { + "x": 168.22, + "y": 105, + "label": "7", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "uuid": "uuid11", + "published": true + }, + { + "x": 189.22, + "y": 105, + "label": "8", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "uuid": "uuid12", + "published": true + }, + { + "x": 210.22, + "y": 105, + "label": "9", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "uuid": "uuid13", + "published": true + } + ], + "curve": 0, + "chairSpacing": 5, + "verticalRowLabelDirection": "BASELINE_LEFT", + "displayObjectType": "row", + "objectType": "row", + "uuid": "uuid15", + "points": null, + "smooth": false, + "smoothness": 50, + "rowLabelDisabled": false, + "published": true, + "rotationAngle": 0 + } + ], + "shapes": [], + "booths": [ + { + "label": "1", + "displayLabel": null, + "sectionLabel": null, + "sectionDisplayedLabel": null, + "objectLabeling": { + "algoName": "SimpleNumbers", + "prefix": "", + "startAtIndex": 0, + "skippedCharacters": [] + }, + "center": { + "x": 47.78, + "y": 48.33 + }, + "width": 50, + "height": 50, + "rotationAngle": 0, + "categoryLabel": "CatA", + "categoryKey": 1, + "objectType": "booth", + "uuid": "uuid4", + "published": true, + "entrance": null + } + ], + "icons": [], + "generalAdmissionAreas": [] + }, + "cutoffAngle": 180, + "published": true + } + ], + "focalPoint": null, + "backgroundImage": null, + "referenceChart": null, + "snapOffset": { + "x": 3, + "y": 2.11 + }, + "floorDisplayName": "Floor 1", + "floorName": "1" + }, + { + "height": 173.11, + "width": 268.67, + "tables": [], + "texts": [], + "imageObjects": [], + "rows": [], + "shapes": [], + "booths": [], + "icons": [], + "generalAdmissionAreas": [], + "sections": [ + { + "points": [ + { + "x": 29.89, + "y": 25.44 + }, + { + "x": 267.67, + "y": 25.44 + }, + { + "x": 267.67, + "y": 172.11 + }, + { + "x": 29.89, + "y": 172.11 + } + ], + "label": "S2", + "labelSize": 12, + "labelShown": true, + "labelHorizontalOffset": 0, + "labelVerticalOffset": 0, + "labelRotationAngle": 0, + "uuid": "uuid31", + "categoryLabel": null, + "categoryKey": null, + "topLeft": { + "x": 28.89, + "y": 24.44 + }, + "entrance": null, + "viewFromYourSeatImage": null, + "objectLabeling": { + "algoName": "SimpleLettersUppercase", + "prefix": "", + "startAtIndex": 0, + "skippedCharacters": [] + }, + "subChart": { + "height": 149, + "width": 240, + "tables": [], + "texts": [], + "imageObjects": [], + "rows": [ + { + "label": "A", + "displayLabel": null, + "sectionLabel": null, + "sectionDisplayedLabel": null, + "rowLabelPosition": "label-position-invisible", + "seatLabeling": { + "algoName": "SimpleNumbers", + "startAtIndex": null, + "isInverted": null, + "useEndAt": false + }, + "objectLabeling": { + "algoName": null, + "prefix": null, + "startAtIndex": null, + "skippedCharacters": [] + }, + "seats": [ + { + "x": 42.22, + "y": 105, + "label": "1", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "entrance": null, + "uuid": "uuid34", + "published": true + }, + { + "x": 63.22, + "y": 105, + "label": "2", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "entrance": null, + "uuid": "uuid35", + "published": true + }, + { + "x": 84.22, + "y": 105, + "label": "3", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "entrance": null, + "uuid": "uuid36", + "published": true + }, + { + "x": 105.22, + "y": 105, + "label": "4", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "entrance": null, + "uuid": "uuid37", + "published": true + }, + { + "x": 126.22, + "y": 105, + "label": "5", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "entrance": null, + "uuid": "uuid38", + "published": true + }, + { + "x": 147.22, + "y": 105, + "label": "6", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "entrance": null, + "uuid": "uuid39", + "published": true + }, + { + "x": 168.22, + "y": 105, + "label": "7", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "entrance": null, + "uuid": "uuid40", + "published": true + }, + { + "x": 189.22, + "y": 105, + "label": "8", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "entrance": null, + "uuid": "uuid41", + "published": true + }, + { + "x": 210.22, + "y": 105, + "label": "9", + "displayLabel": null, + "categoryLabel": "CatB", + "categoryAccessible": false, + "categoryKey": 2, + "restrictedView": false, + "viewFromYourSeatImage": null, + "accessible": false, + "companionSeat": false, + "semiAmbulatorySeat": false, + "disabledBySocialDistancingRules": false, + "entrance": null, + "uuid": "uuid42", + "published": true + } + ], + "curve": 0, + "chairSpacing": 5, + "verticalRowLabelDirection": "BASELINE_LEFT", + "displayObjectType": "row", + "objectType": "row", + "uuid": "uuid33", + "points": null, + "smooth": false, + "smoothness": 50, + "rowLabelDisabled": false, + "published": true, + "rotationAngle": 0 + } + ], + "shapes": [], + "booths": [ + { + "label": "1", + "displayLabel": null, + "sectionLabel": null, + "sectionDisplayedLabel": null, + "objectLabeling": { + "algoName": "SimpleNumbers", + "prefix": "", + "startAtIndex": 0, + "skippedCharacters": [] + }, + "center": { + "x": 47.78, + "y": 48.33 + }, + "width": 50, + "height": 50, + "rotationAngle": 0, + "categoryLabel": "CatA", + "categoryKey": 1, + "objectType": "booth", + "uuid": "uuid43", + "published": true, + "entrance": null + } + ], + "icons": [], + "generalAdmissionAreas": [] + }, + "cutoffAngle": 180, + "published": true + } + ], + "focalPoint": null, + "backgroundImage": null, + "referenceChart": null, + "snapOffset": { + "x": 3, + "y": 2.11 + }, + "floorDisplayName": "Floor 2", + "floorName": "2" + } + ], + "multiFloorView": "isometric" +} + diff --git a/SeatsioDotNet/Events/EventObjectInfo.cs b/SeatsioDotNet/Events/EventObjectInfo.cs index e1ae6c2..b1869d2 100644 --- a/SeatsioDotNet/Events/EventObjectInfo.cs +++ b/SeatsioDotNet/Events/EventObjectInfo.cs @@ -52,4 +52,5 @@ public class EventObjectInfo public int? MaxOccupancy { get; set; } public int SeasonStatusOverriddenQuantity { get; set; } public string Zone { get; set; } + public Floor Floor { get; set; } } \ No newline at end of file diff --git a/SeatsioDotNet/Events/Floor.cs b/SeatsioDotNet/Events/Floor.cs new file mode 100644 index 0000000..edf5d71 --- /dev/null +++ b/SeatsioDotNet/Events/Floor.cs @@ -0,0 +1,18 @@ +namespace SeatsioDotNet.Events; + +public class Floor +{ + public string Name { get; set; } + public string DisplayName { get; set; } + + public Floor() + { + } + + public Floor(string name = null, string displayName = null) + { + Name = name; + DisplayName = displayName; + } + +} \ No newline at end of file