Skip to content

Commit

Permalink
Include booking restrictions and special opening hours (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
openactive-bot authored Jan 12, 2021
1 parent 3c3fbac commit 5f408eb
Show file tree
Hide file tree
Showing 11 changed files with 207 additions and 95 deletions.
6 changes: 3 additions & 3 deletions OpenActive.NET.Generator/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion OpenActive.NET.Generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"author": "Nick Evans",
"license": "MIT",
"dependencies": {
"@openactive/data-models": "^2.0.152",
"@openactive/data-models": "^2.0.164",
"fs-extra": "^7.0.1",
"sync-request": "^6.0.0"
}
Expand Down
4 changes: 2 additions & 2 deletions OpenActive.NET/enums/TestOpportunityCriteriaEnumeration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public enum TestOpportunityCriteriaEnumeration
TestOpportunityBookableWithinValidFromBeforeStartDateWindow,
[EnumMember(Value = "https://openactive.io/test-interface#TestOpportunityBookableOutsideValidFromBeforeStartDateWindow")]
TestOpportunityBookableOutsideValidFromBeforeStartDateWindow,
[EnumMember(Value = "https://openactive.io/test-interface#TestOpportunityBookableFreeAttendeeDetails")]
TestOpportunityBookableFreeAttendeeDetails,
[EnumMember(Value = "https://openactive.io/test-interface#TestOpportunityBookableAttendeeDetails")]
TestOpportunityBookableAttendeeDetails,
[EnumMember(Value = "https://openactive.io/test-interface#TestOpportunityBookableAdditionalDetails")]
TestOpportunityBookableAdditionalDetails,
[EnumMember(Value = "https://openactive.io/test-interface#TestOpportunityBookableFreePrepaymentOptional")]
Expand Down
133 changes: 83 additions & 50 deletions OpenActive.NET/models/Event.cs

Large diffs are not rendered by default.

50 changes: 33 additions & 17 deletions OpenActive.NET/models/FacilityUse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,22 @@ public override string ToString()
public virtual List<Concept> Activity { get; set; }


/// <summary>
/// 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`.
/// </summary>
/// <example>
/// <code>
/// "additionalAdmissionRestriction": [
/// "Participants younger than 12 must be accompanied by an adult",
/// "Participants must be comfortable standing for long periods of time"
/// ]
/// </code>
/// </example>
[DataMember(Name = "additionalAdmissionRestriction", EmitDefaultValue = false, Order = 13)]
[JsonConverter(typeof(ValuesConverter))]
public virtual List<string> AdditionalAdmissionRestriction { get; set; }


/// <summary>
/// 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.
/// </summary>
Expand All @@ -147,7 +163,7 @@ public override string ToString()
/// "attendeeInstructions": "The tennis court is locked with a keycode, so please ensure you book online in advance to gain access."
/// </code>
/// </example>
[DataMember(Name = "attendeeInstructions", EmitDefaultValue = false, Order = 13)]
[DataMember(Name = "attendeeInstructions", EmitDefaultValue = false, Order = 14)]
[JsonConverter(typeof(ValuesConverter))]
public virtual string AttendeeInstructions { get; set; }

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

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


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

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

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

Expand Down Expand Up @@ -268,7 +284,7 @@ public override string ToString()
/// }
/// </code>
/// </example>
[DataMember(Name = "location", EmitDefaultValue = false, Order = 19)]
[DataMember(Name = "location", EmitDefaultValue = false, Order = 20)]
[JsonConverter(typeof(ValuesConverter))]
public new virtual Place Location { get; set; }

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

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

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

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

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

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

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

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

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

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

Expand Down
37 changes: 27 additions & 10 deletions OpenActive.NET/models/Offer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public override string ToString()


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


/// <summary>
/// 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.
/// </summary>
/// <example>
/// <code>
/// "ageRestriction": {
/// "@type": "QuantitativeValue",
/// "minValue": 15,
/// "maxValue": 60
/// }
/// </code>
/// </example>
[DataMember(Name = "ageRestriction", EmitDefaultValue = false, Order = 13)]
[JsonConverter(typeof(ValuesConverter))]
public virtual QuantitativeValue AgeRestriction { get; set; }


/// <summary>
/// The channels through which a booking can be made.
/// </summary>
[DataMember(Name = "availableChannel", EmitDefaultValue = false, Order = 13)]
[DataMember(Name = "availableChannel", EmitDefaultValue = false, Order = 14)]
[JsonConverter(typeof(ValuesConverter))]
public new virtual List<AvailableChannelType> AvailableChannel { get; set; }


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


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

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

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

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

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


/// <summary>
/// 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.
/// </summary>
[DataMember(Name = "validFromBeforeStartDate", EmitDefaultValue = false, Order = 20)]
[DataMember(Name = "validFromBeforeStartDate", EmitDefaultValue = false, Order = 21)]
[JsonConverter(typeof(OpenActiveTimeSpanToISO8601DurationValuesConverter))]
public virtual TimeSpan? ValidFromBeforeStartDate { get; set; }

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

Expand Down
4 changes: 4 additions & 0 deletions OpenActive.NET/models/OfferOverride.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public override string ToString()
public override QuantitativeValue AgeRange { get; set; }


[Obsolete("This property is disinherited in this type, and must not be used.", true)]
public override QuantitativeValue AgeRestriction { get; set; }


[Obsolete("This property is disinherited in this type, and must not be used.", true)]
public override List<AvailableChannelType> AvailableChannel { get; set; }

Expand Down
26 changes: 26 additions & 0 deletions OpenActive.NET/models/OpeningHoursSpecification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,31 @@ public override string ToString()
[JsonConverter(typeof(OpenActiveDateTimeOffsetToISO8601TimeValuesConverter))]
public new virtual DateTimeOffset? Opens { get; set; }


/// <summary>
/// The date when the item becomes valid. The item will be valid at the beginning of the specified day.
/// </summary>
/// <example>
/// <code>
/// "validFrom": "2018-01-22"
/// </code>
/// </example>
[DataMember(Name = "validFrom", EmitDefaultValue = false, Order = 10)]
[JsonConverter(typeof(ValuesConverter))]
public new virtual string ValidFrom { get; set; }


/// <summary>
/// The date after which the item is no longer valid. The item will cease to be valid at the end of the specified day.
/// </summary>
/// <example>
/// <code>
/// "validThrough": "2018-01-27"
/// </code>
/// </example>
[DataMember(Name = "validThrough", EmitDefaultValue = false, Order = 11)]
[JsonConverter(typeof(ValuesConverter))]
public new virtual string ValidThrough { get; set; }

}
}
Loading

0 comments on commit 5f408eb

Please sign in to comment.