Make reopen date optional
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/all-checks-complete Pipeline was successful
ci/woodpecker/pr/build Pipeline failed
ci/woodpecker/pr/all-checks-complete unknown status

This commit is contained in:
Smaug123
2024-02-02 16:00:38 +00:00
parent e96ae78665
commit 52b173817a
6 changed files with 283 additions and 316 deletions

View File

@@ -124,7 +124,7 @@ module TestJson =
Latitude = 51.480401
}
TimeZone = "Europe/London"
ReopenDate = "2021-04-12T00:00:00+01 Europe/London"
ReopenDate = Some "2021-04-12T00:00:00+01 Europe/London"
}
[ ovalJson, oval ] |> List.map TestCaseData

View File

@@ -125,7 +125,7 @@ type Gym =
[<JsonRequired>]
TimeZone : string
/// This is a date-time in the format yyyy-MM-ddTHH:mm:ss+01 Europe/London
ReopenDate : string
ReopenDate : string option
}
/// Human-readable representation of the most important information about this gym

View File

@@ -228,5 +228,5 @@ module PureGymApi =
return Sessions.jsonParse jsonNode
}
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))
}
|> (fun a -> Async.StartAsTask(a, ?cancellationToken = ct)) }

View File

@@ -38,10 +38,8 @@ module GymOpeningHours =
.AsValue()
.GetValue<bool>()
{
IsAlwaysOpen = IsAlwaysOpen
OpeningHours = OpeningHours
}
{ IsAlwaysOpen = IsAlwaysOpen
OpeningHours = OpeningHours }
namespace PureGym
/// Module containing JSON parsing methods for the GymAccessOptions type
@@ -74,10 +72,8 @@ module GymAccessOptions =
.AsValue()
.GetValue<bool>()
{
PinAccess = PinAccess
QrCodeAccess = QrCodeAccess
}
{ PinAccess = PinAccess
QrCodeAccess = QrCodeAccess }
namespace PureGym
/// Module containing JSON parsing methods for the GymLocation type
@@ -152,10 +148,8 @@ module GymLocation =
else
reraise ()
{
Longitude = Longitude
Latitude = Latitude
}
{ Longitude = Longitude
Latitude = Latitude }
namespace PureGym
/// Module containing JSON parsing methods for the GymAddress type
@@ -215,14 +209,12 @@ module GymAddress =
.AsValue()
.GetValue<string>()
{
AddressLine1 = AddressLine1
{ AddressLine1 = AddressLine1
AddressLine2 = AddressLine2
AddressLine3 = AddressLine3
Town = Town
County = County
Postcode = Postcode
}
Postcode = Postcode }
namespace PureGym
/// Module containing JSON parsing methods for the Gym type
@@ -232,16 +224,9 @@ module Gym =
/// Parse from a JSON node.
let jsonParse (node: System.Text.Json.Nodes.JsonNode) : Gym =
let ReopenDate =
(match node.["reopenDate"] with
| null ->
raise (
System.Collections.Generic.KeyNotFoundException (
sprintf "Required key '%s' not found on JSON object" ("reopenDate")
)
)
| v -> v)
.AsValue()
.GetValue<string> ()
match node.["reopenDate"] with
| null -> None
| v -> v.AsValue().GetValue<string>() |> Some
let TimeZone =
(match node.["timeZone"] with
@@ -363,8 +348,7 @@ module Gym =
.AsValue()
.GetValue<string>()
{
Name = Name
{ Name = Name
Id = Id
Status = Status
Address = Address
@@ -374,8 +358,7 @@ module Gym =
AccessOptions = AccessOptions
Location = Location
TimeZone = TimeZone
ReopenDate = ReopenDate
}
ReopenDate = ReopenDate }
namespace PureGym
/// Module containing JSON parsing methods for the Member type
@@ -565,8 +548,7 @@ module Member =
.AsValue()
.GetValue<int>()
{
Id = Id
{ Id = Id
CompoundMemberId = CompoundMemberId
FirstName = FirstName
LastName = LastName
@@ -580,8 +562,7 @@ module Member =
MembershipName = MembershipName
MembershipLevel = MembershipLevel
SuspendedReason = SuspendedReason
MemberStatus = MemberStatus
}
MemberStatus = MemberStatus }
namespace PureGym
/// Module containing JSON parsing methods for the GymAttendance type
@@ -694,8 +675,7 @@ module GymAttendance =
.AsValue()
.GetValue<string>()
{
Description = Description
{ Description = Description
TotalPeopleInGym = TotalPeopleInGym
TotalPeopleInClasses = TotalPeopleInClasses
TotalPeopleSuffix = TotalPeopleSuffix
@@ -703,8 +683,7 @@ module GymAttendance =
AttendanceTime = AttendanceTime
LastRefreshed = LastRefreshed
LastRefreshedPeopleInClasses = LastRefreshedPeopleInClasses
MaximumCapacity = MaximumCapacity
}
MaximumCapacity = MaximumCapacity }
namespace PureGym
/// Module containing JSON parsing methods for the MemberActivityDto type
@@ -786,14 +765,12 @@ module MemberActivityDto =
.AsValue()
.GetValue<int>()
{
TotalDuration = TotalDuration
{ TotalDuration = TotalDuration
AverageDuration = AverageDuration
TotalVisits = TotalVisits
TotalClasses = TotalClasses
IsEstimated = IsEstimated
LastRefreshed = LastRefreshed
}
LastRefreshed = LastRefreshed }
namespace PureGym
/// Module containing JSON parsing methods for the SessionsAggregate type
@@ -838,11 +815,9 @@ module SessionsAggregate =
.AsValue()
.GetValue<int>()
{
Activities = Activities
{ Activities = Activities
Visits = Visits
Duration = Duration
}
Duration = Duration }
namespace PureGym
/// Module containing JSON parsing methods for the VisitGym type
@@ -887,11 +862,9 @@ module VisitGym =
.AsValue()
.GetValue<int>()
{
Id = Id
{ Id = Id
Name = Name
Status = Status
}
Status = Status }
namespace PureGym
/// Module containing JSON parsing methods for the Visit type
@@ -949,12 +922,10 @@ module Visit =
.AsValue()
.GetValue<bool>()
{
IsDurationEstimated = IsDurationEstimated
{ IsDurationEstimated = IsDurationEstimated
StartTime = StartTime
Duration = Duration
Gym = Gym
}
Gym = Gym }
namespace PureGym
/// Module containing JSON parsing methods for the SessionsSummary type
@@ -987,10 +958,7 @@ module SessionsSummary =
| v -> v
)
{
Total = Total
ThisWeek = ThisWeek
}
{ Total = Total; ThisWeek = ThisWeek }
namespace PureGym
/// Module containing JSON parsing methods for the Sessions type
@@ -1024,7 +992,6 @@ module Sessions =
| v -> v
)
{
Summary = Summary
Visits = Visits
}
{ Summary = Summary; Visits = Visits }

View File

@@ -39,7 +39,7 @@ PureGym.AuthTokenModule inherit obj
PureGym.AuthTokenModule.get [static method]: PureGym.UsernamePin -> System.Threading.CancellationToken -> PureGym.AuthToken System.Threading.Tasks.Task
PureGym.AuthTokenModule.ofBearerToken [static method]: string -> PureGym.AuthToken
PureGym.Gym inherit obj, implements PureGym.Gym System.IEquatable, System.Collections.IStructuralEquatable, PureGym.Gym System.IComparable, System.IComparable, System.Collections.IStructuralComparable
PureGym.Gym..ctor [constructor]: (string, int, int, PureGym.GymAddress, string, string, PureGym.GymOpeningHours, PureGym.GymAccessOptions, PureGym.GymLocation, string, string)
PureGym.Gym..ctor [constructor]: (string, int, int, PureGym.GymAddress, string, string, PureGym.GymOpeningHours, PureGym.GymAccessOptions, PureGym.GymLocation, string, string option)
PureGym.Gym.AccessOptions [property]: [read-only] PureGym.GymAccessOptions
PureGym.Gym.Address [property]: [read-only] PureGym.GymAddress
PureGym.Gym.EmailAddress [property]: [read-only] string
@@ -51,7 +51,7 @@ PureGym.Gym.get_Id [method]: unit -> int
PureGym.Gym.get_Location [method]: unit -> PureGym.GymLocation
PureGym.Gym.get_Name [method]: unit -> string
PureGym.Gym.get_PhoneNumber [method]: unit -> string
PureGym.Gym.get_ReopenDate [method]: unit -> string
PureGym.Gym.get_ReopenDate [method]: unit -> string option
PureGym.Gym.get_Status [method]: unit -> int
PureGym.Gym.get_TimeZone [method]: unit -> string
PureGym.Gym.GymOpeningHours [property]: [read-only] PureGym.GymOpeningHours
@@ -59,7 +59,7 @@ PureGym.Gym.Id [property]: [read-only] int
PureGym.Gym.Location [property]: [read-only] PureGym.GymLocation
PureGym.Gym.Name [property]: [read-only] string
PureGym.Gym.PhoneNumber [property]: [read-only] string
PureGym.Gym.ReopenDate [property]: [read-only] string
PureGym.Gym.ReopenDate [property]: [read-only] string option
PureGym.Gym.Status [property]: [read-only] int
PureGym.Gym.TimeZone [property]: [read-only] string
PureGym.GymAccessOptions inherit obj, implements PureGym.GymAccessOptions System.IEquatable, System.Collections.IStructuralEquatable, PureGym.GymAccessOptions System.IComparable, System.IComparable, System.Collections.IStructuralComparable

View File

@@ -1,5 +1,5 @@
{
"version": "4.0",
"version": "5.0",
"publicReleaseRefSpec": [
"^refs/heads/main$"
],