diff --git a/OpenActive.NET.Test/OrderTest.cs b/OpenActive.NET.Test/OrderTest.cs index 378f11c..b23eb9b 100644 --- a/OpenActive.NET.Test/OrderTest.cs +++ b/OpenActive.NET.Test/OrderTest.cs @@ -197,7 +197,9 @@ public void OrderQuote_EncodeDecode() "\"orderedItem\":{" + "\"@type\":\"ScheduledSession\"," + "\"@id\":\"https://example.com/events/452/subEvents/132\"," + + "\"startDate\":\"2018-10-30T11:00:00+00:00\"," + "\"identifier\":123," + + "\"endDate\":\"2018-10-30T12:00:00+00:00\"," + "\"superEvent\":{" + "\"@type\":\"SessionSeries\"," + "\"@id\":\"https://example.com/events/452\"," + @@ -228,9 +230,7 @@ public void OrderQuote_EncodeDecode() "}" + "}," + "\"duration\":\"PT1H\"," + - "\"eventStatus\":\"https://schema.org/EventScheduled\"," + - "\"startDate\":\"2018-10-30T11:00:00+00:00\"," + - "\"endDate\":\"2018-10-30T12:00:00+00:00\"" + + "\"eventStatus\":\"https://schema.org/EventScheduled\"" + "}," + "\"orderItemStatus\":\"https://openactive.io/OrderItemConfirmed\"," + "\"unitTaxSpecification\":[" + @@ -331,7 +331,7 @@ public void Order_Deserialize_Accessors() Assert.Equal("Geoff", order?.Customer.GivenName); Assert.Equal("EUCODE", order?.OrderedItem?[0]?.UnitTaxSpecification?[0]?.Identifier.GetClass>()?[0].Name); Assert.Equal(new TimeSpan(6,0,0,0), order?.OrderedItem?[0]?.AcceptedOffer?.ValidFromBeforeStartDate); - Assert.Equal(new DateTimeOffset(2018, 10, 30, 11, 00, 00, 00, new TimeSpan()), order?.OrderedItem?[0]?.OrderedItem?.StartDate.GetPrimative()); + Assert.Equal(new DateTimeOffset(2018, 10, 30, 11, 00, 00, 00, new TimeSpan()), ((ScheduledSession)order?.OrderedItem?[0]?.OrderedItem)?.StartDate); } [Fact] diff --git a/OpenActive.NET/models/ScheduledSession.cs b/OpenActive.NET/models/ScheduledSession.cs index f327af6..d35c141 100644 --- a/OpenActive.NET/models/ScheduledSession.cs +++ b/OpenActive.NET/models/ScheduledSession.cs @@ -44,13 +44,38 @@ public override string ToString() [DataMember(Name = "@type", Order = 1)] public override string Type => "ScheduledSession"; + /// + /// The start date and time of the event. + /// + /// + /// + /// "startDate": "2018-01-27T12:00:00Z" + /// + /// + [DataMember(Name = "startDate", EmitDefaultValue = false, Order = 7)] + [JsonConverter(typeof(OpenActiveDateTimeOffsetToISO8601DateTimeValuesConverter))] + public new virtual DateTimeOffset? StartDate { get; set; } + + /// + /// The end date and time of the event. + /// It is recommended that publishers provide either an schema:endDate or a schema:duration for an event. + /// + /// + /// + /// "endDate": "2018-01-27T12:00:00Z" + /// + /// + [DataMember(Name = "endDate", EmitDefaultValue = false, Order = 8)] + [JsonConverter(typeof(OpenActiveDateTimeOffsetToISO8601DateTimeValuesConverter))] + public new virtual DateTimeOffset? EndDate { get; set; } + [Obsolete("This property is disinherited in this type, and must not be used.", true)] public override List SubEvent { get; set; } /// /// Relates a child event to a parent event. Properties describing the parent event can be assumed to apply to the child, unless otherwise specified. A parent event might specify a recurring schedule, of which the child event is one specific instance /// - [DataMember(Name = "superEvent", EmitDefaultValue = false, Order = 8)] + [DataMember(Name = "superEvent", EmitDefaultValue = false, Order = 10)] [JsonConverter(typeof(ValuesConverter))] public new virtual SingleValues SuperEvent { get; set; } } diff --git a/OpenActive.NET/models/SessionSeries.cs b/OpenActive.NET/models/SessionSeries.cs index 04946ef..669ee44 100644 --- a/OpenActive.NET/models/SessionSeries.cs +++ b/OpenActive.NET/models/SessionSeries.cs @@ -70,10 +70,16 @@ public override string ToString() [Obsolete("This property is disinherited in this type, and must not be used.", true)] public override long? RemainingAttendeeCapacity { get; set; } + [Obsolete("This property is disinherited in this type, and must not be used.", true)] + public override SingleValues StartDate { get; set; } + + [Obsolete("This property is disinherited in this type, and must not be used.", true)] + public override SingleValues EndDate { get; set; } + /// /// Relates a parent event to a child event. Properties describing the parent event can be assumed to apply to the child, unless otherwise specified. A child event might be a specific instance of an Event within a schedule /// - [DataMember(Name = "subEvent", EmitDefaultValue = false, Order = 9)] + [DataMember(Name = "subEvent", EmitDefaultValue = false, Order = 11)] [JsonConverter(typeof(ValuesConverter))] public new virtual List SubEvent { get; set; } } diff --git a/OpenActive.NET/models/Slot.cs b/OpenActive.NET/models/Slot.cs index 305e987..2ac81f2 100644 --- a/OpenActive.NET/models/Slot.cs +++ b/OpenActive.NET/models/Slot.cs @@ -202,7 +202,7 @@ public override string ToString() public override string SchedulingNote { get; set; } /// - /// The start date and time of the slot. Can be specified as a schema:Date or schema:DateTime + /// The start date and time of the slot. /// /// /// @@ -210,11 +210,11 @@ public override string ToString() /// /// [DataMember(Name = "startDate", EmitDefaultValue = false, Order = 39)] - [JsonConverter(typeof(ValuesConverter))] - public override SingleValues StartDate { get; set; } + [JsonConverter(typeof(OpenActiveDateTimeOffsetToISO8601DateTimeValuesConverter))] + public new virtual DateTimeOffset? StartDate { get; set; } /// - /// The end date and time of the slot. Can be specified as a schema:Date or schema:DateTime + /// The end date and time of the slot. /// It is recommended that publishers provide either an schema:endDate or a schema:duration for an slot. /// /// @@ -223,8 +223,8 @@ public override string ToString() /// /// [DataMember(Name = "endDate", EmitDefaultValue = false, Order = 40)] - [JsonConverter(typeof(ValuesConverter))] - public override SingleValues EndDate { get; set; } + [JsonConverter(typeof(OpenActiveDateTimeOffsetToISO8601DateTimeValuesConverter))] + public new virtual DateTimeOffset? EndDate { get; set; } [Obsolete("This property is disinherited in this type, and must not be used.", true)] public override List SubEvent { get; set; }