Skip to content

Commit 5f408eb

Browse files
Include booking restrictions and special opening hours (#8)
1 parent 3c3fbac commit 5f408eb

11 files changed

Lines changed: 207 additions & 95 deletions

File tree

OpenActive.NET.Generator/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenActive.NET.Generator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"author": "Nick Evans",
1212
"license": "MIT",
1313
"dependencies": {
14-
"@openactive/data-models": "^2.0.152",
14+
"@openactive/data-models": "^2.0.164",
1515
"fs-extra": "^7.0.1",
1616
"sync-request": "^6.0.0"
1717
}

OpenActive.NET/enums/TestOpportunityCriteriaEnumeration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public enum TestOpportunityCriteriaEnumeration
3838
TestOpportunityBookableWithinValidFromBeforeStartDateWindow,
3939
[EnumMember(Value = "https://openactive.io/test-interface#TestOpportunityBookableOutsideValidFromBeforeStartDateWindow")]
4040
TestOpportunityBookableOutsideValidFromBeforeStartDateWindow,
41-
[EnumMember(Value = "https://openactive.io/test-interface#TestOpportunityBookableFreeAttendeeDetails")]
42-
TestOpportunityBookableFreeAttendeeDetails,
41+
[EnumMember(Value = "https://openactive.io/test-interface#TestOpportunityBookableAttendeeDetails")]
42+
TestOpportunityBookableAttendeeDetails,
4343
[EnumMember(Value = "https://openactive.io/test-interface#TestOpportunityBookableAdditionalDetails")]
4444
TestOpportunityBookableAdditionalDetails,
4545
[EnumMember(Value = "https://openactive.io/test-interface#TestOpportunityBookableFreePrepaymentOptional")]

OpenActive.NET/models/Event.cs

Lines changed: 83 additions & 50 deletions
Large diffs are not rendered by default.

OpenActive.NET/models/FacilityUse.cs

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,22 @@ public override string ToString()
139139
public virtual List<Concept> Activity { get; set; }
140140

141141

142+
/// <summary>
143+
/// Free text restrictions that must be displayed prominently to the user before booking. This property must only contain restrictions not described by `oa:ageRestriction` or `oa:genderRestriction`.
144+
/// </summary>
145+
/// <example>
146+
/// <code>
147+
/// "additionalAdmissionRestriction": [
148+
/// "Participants younger than 12 must be accompanied by an adult",
149+
/// "Participants must be comfortable standing for long periods of time"
150+
/// ]
151+
/// </code>
152+
/// </example>
153+
[DataMember(Name = "additionalAdmissionRestriction", EmitDefaultValue = false, Order = 13)]
154+
[JsonConverter(typeof(ValuesConverter))]
155+
public virtual List<string> AdditionalAdmissionRestriction { get; set; }
156+
157+
142158
/// <summary>
143159
/// Provides additional notes and instructions for users of a facility, for example more information on how to find it, what to bring, etc. The value of this property must not include HTML or other markup.
144160
/// </summary>
@@ -147,7 +163,7 @@ public override string ToString()
147163
/// "attendeeInstructions": "The tennis court is locked with a keycode, so please ensure you book online in advance to gain access."
148164
/// </code>
149165
/// </example>
150-
[DataMember(Name = "attendeeInstructions", EmitDefaultValue = false, Order = 13)]
166+
[DataMember(Name = "attendeeInstructions", EmitDefaultValue = false, Order = 14)]
151167
[JsonConverter(typeof(ValuesConverter))]
152168
public virtual string AttendeeInstructions { get; set; }
153169

@@ -167,7 +183,7 @@ public override string ToString()
167183
/// ]
168184
/// </code>
169185
/// </example>
170-
[DataMember(Name = "category", EmitDefaultValue = false, Order = 14)]
186+
[DataMember(Name = "category", EmitDefaultValue = false, Order = 15)]
171187
[JsonConverter(typeof(ValuesConverter))]
172188
public new virtual SingleValues<List<string>, List<Concept>> Category { get; set; }
173189

@@ -190,15 +206,15 @@ public override string ToString()
190206
/// ]
191207
/// </code>
192208
/// </example>
193-
[DataMember(Name = "event", EmitDefaultValue = false, Order = 15)]
209+
[DataMember(Name = "event", EmitDefaultValue = false, Order = 16)]
194210
[JsonConverter(typeof(ValuesConverter))]
195211
public new virtual List<Slot> Event { get; set; }
196212

197213

198214
/// <summary>
199215
/// The times the facility use is available
200216
/// </summary>
201-
[DataMember(Name = "hoursAvailable", EmitDefaultValue = false, Order = 16)]
217+
[DataMember(Name = "hoursAvailable", EmitDefaultValue = false, Order = 17)]
202218
[JsonConverter(typeof(ValuesConverter))]
203219
public new virtual List<OpeningHoursSpecification> HoursAvailable { get; set; }
204220

@@ -217,7 +233,7 @@ public override string ToString()
217233
/// ]
218234
/// </code>
219235
/// </example>
220-
[DataMember(Name = "image", EmitDefaultValue = false, Order = 17)]
236+
[DataMember(Name = "image", EmitDefaultValue = false, Order = 18)]
221237
[JsonConverter(typeof(ValuesConverter))]
222238
public new virtual List<ImageObject> Image { get; set; }
223239

@@ -236,7 +252,7 @@ public override string ToString()
236252
/// ]
237253
/// </code>
238254
/// </example>
239-
[DataMember(Name = "individualFacilityUse", EmitDefaultValue = false, Order = 18)]
255+
[DataMember(Name = "individualFacilityUse", EmitDefaultValue = false, Order = 19)]
240256
[JsonConverter(typeof(ValuesConverter))]
241257
public virtual List<IndividualFacilityUse> IndividualFacilityUse { get; set; }
242258

@@ -268,7 +284,7 @@ public override string ToString()
268284
/// }
269285
/// </code>
270286
/// </example>
271-
[DataMember(Name = "location", EmitDefaultValue = false, Order = 19)]
287+
[DataMember(Name = "location", EmitDefaultValue = false, Order = 20)]
272288
[JsonConverter(typeof(ValuesConverter))]
273289
public new virtual Place Location { get; set; }
274290

@@ -288,7 +304,7 @@ public override string ToString()
288304
/// }
289305
/// </code>
290306
/// </example>
291-
[DataMember(Name = "offers", EmitDefaultValue = false, Order = 20)]
307+
[DataMember(Name = "offers", EmitDefaultValue = false, Order = 21)]
292308
[JsonConverter(typeof(ValuesConverter))]
293309
public new virtual List<Offer> Offers { get; set; }
294310

@@ -305,7 +321,7 @@ public override string ToString()
305321
/// }
306322
/// </code>
307323
/// </example>
308-
[DataMember(Name = "provider", EmitDefaultValue = false, Order = 21)]
324+
[DataMember(Name = "provider", EmitDefaultValue = false, Order = 22)]
309325
[JsonConverter(typeof(ValuesConverter))]
310326
public new virtual Organization Provider { get; set; }
311327

@@ -318,7 +334,7 @@ public override string ToString()
318334
/// "url": "https://example.com/facility-use/1234"
319335
/// </code>
320336
/// </example>
321-
[DataMember(Name = "url", EmitDefaultValue = false, Order = 22)]
337+
[DataMember(Name = "url", EmitDefaultValue = false, Order = 23)]
322338
[JsonConverter(typeof(ValuesConverter))]
323339
public new virtual Uri Url { get; set; }
324340

@@ -329,7 +345,7 @@ public override string ToString()
329345
///
330346
/// If you are using this property, please join the discussion at proposal [#2](https://github.com/openactive/ns-beta/issues/2).
331347
/// </summary>
332-
[DataMember(Name = "beta:formattedDescription", EmitDefaultValue = false, Order = 1023)]
348+
[DataMember(Name = "beta:formattedDescription", EmitDefaultValue = false, Order = 1024)]
333349
[JsonConverter(typeof(ValuesConverter))]
334350
public virtual string FormattedDescription { get; set; }
335351

@@ -340,7 +356,7 @@ public override string ToString()
340356
///
341357
/// If you are using this property, please join the discussion at proposal [#166](https://github.com/openactive/modelling-opportunity-data/issues/166).
342358
/// </summary>
343-
[DataMember(Name = "beta:isWheelchairAccessible", EmitDefaultValue = false, Order = 1024)]
359+
[DataMember(Name = "beta:isWheelchairAccessible", EmitDefaultValue = false, Order = 1025)]
344360
[JsonConverter(typeof(ValuesConverter))]
345361
public virtual bool? IsWheelchairAccessible { get; set; }
346362

@@ -351,7 +367,7 @@ public override string ToString()
351367
///
352368
/// If you are using this property, please join the discussion at proposal [#88](https://github.com/openactive/modelling-opportunity-data/issues/88).
353369
/// </summary>
354-
[DataMember(Name = "beta:video", EmitDefaultValue = false, Order = 1025)]
370+
[DataMember(Name = "beta:video", EmitDefaultValue = false, Order = 1026)]
355371
[JsonConverter(typeof(ValuesConverter))]
356372
public virtual List<VideoObject> Video { get; set; }
357373

@@ -362,7 +378,7 @@ public override string ToString()
362378
///
363379
/// If you are using this property, please join the discussion at proposal [#110](https://github.com/openactive/modelling-opportunity-data/issues/110).
364380
/// </summary>
365-
[DataMember(Name = "beta:sportsActivityLocation", EmitDefaultValue = false, Order = 1026)]
381+
[DataMember(Name = "beta:sportsActivityLocation", EmitDefaultValue = false, Order = 1027)]
366382
[JsonConverter(typeof(ValuesConverter))]
367383
public virtual List<Schema.NET.SportsActivityLocation> SportsActivityLocation { get; set; }
368384

@@ -373,7 +389,7 @@ public override string ToString()
373389
///
374390
/// If you are using this property, please join the discussion at proposal [#204](https://github.com/openactive/modelling-opportunity-data/issues/204).
375391
/// </summary>
376-
[DataMember(Name = "beta:offerValidityPeriod", EmitDefaultValue = false, Order = 1027)]
392+
[DataMember(Name = "beta:offerValidityPeriod", EmitDefaultValue = false, Order = 1028)]
377393
[JsonConverter(typeof(OpenActiveTimeSpanToISO8601DurationValuesConverter))]
378394
public virtual TimeSpan? OfferValidityPeriod { get; set; }
379395

@@ -384,7 +400,7 @@ public override string ToString()
384400
///
385401
/// If you are using this property, please join the discussion at proposal [#1](https://github.com/openactive/facility-types/issues/1).
386402
/// </summary>
387-
[DataMember(Name = "beta:facilityType", EmitDefaultValue = false, Order = 1028)]
403+
[DataMember(Name = "beta:facilityType", EmitDefaultValue = false, Order = 1029)]
388404
[JsonConverter(typeof(ValuesConverter))]
389405
public virtual List<Concept> FacilityType { get; set; }
390406

@@ -395,7 +411,7 @@ public override string ToString()
395411
///
396412
/// If you are using this property, please join the discussion at proposal [#1](https://github.com/openactive/facility-types/issues/1).
397413
/// </summary>
398-
[DataMember(Name = "beta:facilitySetting", EmitDefaultValue = false, Order = 1029)]
414+
[DataMember(Name = "beta:facilitySetting", EmitDefaultValue = false, Order = 1030)]
399415
[JsonConverter(typeof(ValuesConverter))]
400416
public virtual FacilitySettingType? FacilitySetting { get; set; }
401417

OpenActive.NET/models/Offer.cs

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public override string ToString()
116116

117117

118118
/// <summary>
119-
/// Indicates that an Offer is applicable to a specific age range. Specified as a QuantitativeValue with minValue and maxValue properties.
119+
/// DEPRECATED: Please use `oa:ageRestriction` instead when describing an `Offer`.
120120
/// </summary>
121121
/// <example>
122122
/// <code>
@@ -132,26 +132,43 @@ public override string ToString()
132132
public virtual QuantitativeValue AgeRange { get; set; }
133133

134134

135+
/// <summary>
136+
/// Indicates that an Offer is only applicable to a specific age range. Specified as a QuantitativeValue with minValue and maxValue properties. This must be displayed prominently to the user when selecting an `Offer` or before booking.
137+
/// </summary>
138+
/// <example>
139+
/// <code>
140+
/// "ageRestriction": {
141+
/// "@type": "QuantitativeValue",
142+
/// "minValue": 15,
143+
/// "maxValue": 60
144+
/// }
145+
/// </code>
146+
/// </example>
147+
[DataMember(Name = "ageRestriction", EmitDefaultValue = false, Order = 13)]
148+
[JsonConverter(typeof(ValuesConverter))]
149+
public virtual QuantitativeValue AgeRestriction { get; set; }
150+
151+
135152
/// <summary>
136153
/// The channels through which a booking can be made.
137154
/// </summary>
138-
[DataMember(Name = "availableChannel", EmitDefaultValue = false, Order = 13)]
155+
[DataMember(Name = "availableChannel", EmitDefaultValue = false, Order = 14)]
139156
[JsonConverter(typeof(ValuesConverter))]
140157
public new virtual List<AvailableChannelType> AvailableChannel { get; set; }
141158

142159

143160
/// <summary>
144161
/// The duration before the startDate during which this Offer may not be cancelled, given in ISO 8601 format.
145162
/// </summary>
146-
[DataMember(Name = "latestCancellationBeforeStartDate", EmitDefaultValue = false, Order = 14)]
163+
[DataMember(Name = "latestCancellationBeforeStartDate", EmitDefaultValue = false, Order = 15)]
147164
[JsonConverter(typeof(OpenActiveTimeSpanToISO8601DurationValuesConverter))]
148165
public virtual TimeSpan? LatestCancellationBeforeStartDate { get; set; }
149166

150167

151168
/// <summary>
152169
/// Can include https://openactive.io/OpenBookingIntakeForm, https://openactive.io/OpenBookingAttendeeDetails, https://openactive.io/OpenBookingApproval, https://openactive.io/OpenBookingNegotiation, https://openactive.io/OpenBookingMessageExchange
153170
/// </summary>
154-
[DataMember(Name = "openBookingFlowRequirement", EmitDefaultValue = false, Order = 15)]
171+
[DataMember(Name = "openBookingFlowRequirement", EmitDefaultValue = false, Order = 16)]
155172
[JsonConverter(typeof(ValuesConverter))]
156173
public virtual List<OpenBookingFlowRequirement> OpenBookingFlowRequirement { get; set; }
157174

@@ -164,7 +181,7 @@ public override string ToString()
164181
/// "prepayment": "https://openactive.io/Required"
165182
/// </code>
166183
/// </example>
167-
[DataMember(Name = "prepayment", EmitDefaultValue = false, Order = 16)]
184+
[DataMember(Name = "prepayment", EmitDefaultValue = false, Order = 17)]
168185
[JsonConverter(typeof(ValuesConverter))]
169186
public virtual RequiredStatusType? Prepayment { get; set; }
170187

@@ -180,7 +197,7 @@ public override string ToString()
180197
/// "price": 33
181198
/// </code>
182199
/// </example>
183-
[DataMember(Name = "price", EmitDefaultValue = false, Order = 17)]
200+
[DataMember(Name = "price", EmitDefaultValue = false, Order = 18)]
184201
[JsonConverter(typeof(ValuesConverter))]
185202
public new virtual decimal? Price { get; set; }
186203

@@ -193,7 +210,7 @@ public override string ToString()
193210
/// "priceCurrency": "GBP"
194211
/// </code>
195212
/// </example>
196-
[DataMember(Name = "priceCurrency", EmitDefaultValue = false, Order = 18)]
213+
[DataMember(Name = "priceCurrency", EmitDefaultValue = false, Order = 19)]
197214
[JsonConverter(typeof(ValuesConverter))]
198215
public new virtual string PriceCurrency { get; set; }
199216

@@ -206,15 +223,15 @@ public override string ToString()
206223
/// "url": "http://www.rphs.org.uk/"
207224
/// </code>
208225
/// </example>
209-
[DataMember(Name = "url", EmitDefaultValue = false, Order = 19)]
226+
[DataMember(Name = "url", EmitDefaultValue = false, Order = 20)]
210227
[JsonConverter(typeof(ValuesConverter))]
211228
public new virtual Uri Url { get; set; }
212229

213230

214231
/// <summary>
215232
/// The duration before the startDate for which this Offer is valid, given in ISO 8601 format. This is a relatively-defined equivalent of schema:validFrom, to allow for Offer inheritance.
216233
/// </summary>
217-
[DataMember(Name = "validFromBeforeStartDate", EmitDefaultValue = false, Order = 20)]
234+
[DataMember(Name = "validFromBeforeStartDate", EmitDefaultValue = false, Order = 21)]
218235
[JsonConverter(typeof(OpenActiveTimeSpanToISO8601DurationValuesConverter))]
219236
public virtual TimeSpan? ValidFromBeforeStartDate { get; set; }
220237

@@ -225,7 +242,7 @@ public override string ToString()
225242
///
226243
/// If you are using this property, please join the discussion at proposal [#250](https://github.com/openactive/modelling-opportunity-data/issues/250).
227244
/// </summary>
228-
[DataMember(Name = "beta:partySize", EmitDefaultValue = false, Order = 1021)]
245+
[DataMember(Name = "beta:partySize", EmitDefaultValue = false, Order = 1022)]
229246
[JsonConverter(typeof(ValuesConverter))]
230247
public virtual QuantitativeValue PartySize { get; set; }
231248

OpenActive.NET/models/OfferOverride.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ public override string ToString()
5555
public override QuantitativeValue AgeRange { get; set; }
5656

5757

58+
[Obsolete("This property is disinherited in this type, and must not be used.", true)]
59+
public override QuantitativeValue AgeRestriction { get; set; }
60+
61+
5862
[Obsolete("This property is disinherited in this type, and must not be used.", true)]
5963
public override List<AvailableChannelType> AvailableChannel { get; set; }
6064

OpenActive.NET/models/OpeningHoursSpecification.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,31 @@ public override string ToString()
8585
[JsonConverter(typeof(OpenActiveDateTimeOffsetToISO8601TimeValuesConverter))]
8686
public new virtual DateTimeOffset? Opens { get; set; }
8787

88+
89+
/// <summary>
90+
/// The date when the item becomes valid. The item will be valid at the beginning of the specified day.
91+
/// </summary>
92+
/// <example>
93+
/// <code>
94+
/// "validFrom": "2018-01-22"
95+
/// </code>
96+
/// </example>
97+
[DataMember(Name = "validFrom", EmitDefaultValue = false, Order = 10)]
98+
[JsonConverter(typeof(ValuesConverter))]
99+
public new virtual string ValidFrom { get; set; }
100+
101+
102+
/// <summary>
103+
/// The date after which the item is no longer valid. The item will cease to be valid at the end of the specified day.
104+
/// </summary>
105+
/// <example>
106+
/// <code>
107+
/// "validThrough": "2018-01-27"
108+
/// </code>
109+
/// </example>
110+
[DataMember(Name = "validThrough", EmitDefaultValue = false, Order = 11)]
111+
[JsonConverter(typeof(ValuesConverter))]
112+
public new virtual string ValidThrough { get; set; }
113+
88114
}
89115
}

0 commit comments

Comments
 (0)