//------------------------------------------------------------------------------ // This code was generated by myriad. // Changes to this file will be lost when the code is regenerated. //------------------------------------------------------------------------------ namespace PureGym /// Module containing JSON parsing methods for the GymOpeningHours type [] [] module GymOpeningHours = /// Parse from a JSON node. let jsonParse (node : System.Text.Json.Nodes.JsonNode) : GymOpeningHours = let OpeningHours = node.["openingHours"].AsArray () |> Seq.map (fun elt -> elt.AsValue().GetValue ()) |> List.ofSeq let IsAlwaysOpen = node.["isAlwaysOpen"].AsValue().GetValue () { IsAlwaysOpen = IsAlwaysOpen OpeningHours = OpeningHours } namespace PureGym /// Module containing JSON parsing methods for the GymAccessOptions type [] [] module GymAccessOptions = /// Parse from a JSON node. let jsonParse (node : System.Text.Json.Nodes.JsonNode) : GymAccessOptions = let QrCodeAccess = node.["qrCodeAccess"].AsValue().GetValue () let PinAccess = node.["pinAccess"].AsValue().GetValue () { PinAccess = PinAccess QrCodeAccess = QrCodeAccess } namespace PureGym /// Module containing JSON parsing methods for the GymLocation type [] [] module GymLocation = /// Parse from a JSON node. let jsonParse (node : System.Text.Json.Nodes.JsonNode) : GymLocation = let Latitude = try node.["latitude"].AsValue().GetValue () with :? System.InvalidOperationException as exc -> if exc.Message.Contains "cannot be converted to" then if System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString then node.["latitude"].AsValue().GetValue () |> System.Double.Parse else reraise () else reraise () let Longitude = try node.["longitude"].AsValue().GetValue () with :? System.InvalidOperationException as exc -> if exc.Message.Contains "cannot be converted to" then if System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString then node.["longitude"].AsValue().GetValue () |> System.Double.Parse else reraise () else reraise () { Longitude = Longitude Latitude = Latitude } namespace PureGym /// Module containing JSON parsing methods for the GymAddress type [] [] module GymAddress = /// Parse from a JSON node. let jsonParse (node : System.Text.Json.Nodes.JsonNode) : GymAddress = let Postcode = node.["postcode"].AsValue().GetValue () let County = match node.["county"] with | null -> None | v -> v.AsValue().GetValue () |> Some let Town = node.["town"].AsValue().GetValue () let AddressLine3 = match node.["addressLine3"] with | null -> None | v -> v.AsValue().GetValue () |> Some let AddressLine2 = match node.["addressLine2"] with | null -> None | v -> v.AsValue().GetValue () |> Some let AddressLine1 = node.["addressLine1"].AsValue().GetValue () { AddressLine1 = AddressLine1 AddressLine2 = AddressLine2 AddressLine3 = AddressLine3 Town = Town County = County Postcode = Postcode } namespace PureGym /// Module containing JSON parsing methods for the Gym type [] [] module Gym = /// Parse from a JSON node. let jsonParse (node : System.Text.Json.Nodes.JsonNode) : Gym = let ReopenDate = node.["reopenDate"].AsValue().GetValue () let TimeZone = node.["timeZone"].AsValue().GetValue () let Location = GymLocation.jsonParse node.["location"] let AccessOptions = GymAccessOptions.jsonParse node.["accessOptions"] let GymOpeningHours = GymOpeningHours.jsonParse node.["gymOpeningHours"] let EmailAddress = node.["emailAddress"].AsValue().GetValue () let PhoneNumber = node.["phoneNumber"].AsValue().GetValue () let Address = GymAddress.jsonParse node.["address"] let Status = node.["status"].AsValue().GetValue () let Id = node.["id"].AsValue().GetValue () let Name = node.["name"].AsValue().GetValue () { Name = Name Id = Id Status = Status Address = Address PhoneNumber = PhoneNumber EmailAddress = EmailAddress GymOpeningHours = GymOpeningHours AccessOptions = AccessOptions Location = Location TimeZone = TimeZone ReopenDate = ReopenDate } namespace PureGym /// Module containing JSON parsing methods for the Member type [] [] module Member = /// Parse from a JSON node. let jsonParse (node : System.Text.Json.Nodes.JsonNode) : Member = let MemberStatus = node.["memberStatus"].AsValue().GetValue () let SuspendedReason = node.["suspendedReason"].AsValue().GetValue () let MembershipLevel = node.["membershipLevel"].AsValue().GetValue () let MembershipName = node.["membershipName"].AsValue().GetValue () let Postcode = node.["postCode"].AsValue().GetValue () let MobileNumber = node.["mobileNumber"].AsValue().GetValue () let DateOfBirth = node.["dateofBirth"].AsValue().GetValue () |> System.DateOnly.Parse let GymAccessPin = node.["gymAccessPin"].AsValue().GetValue () let EmailAddress = node.["emailAddress"].AsValue().GetValue () let HomeGymName = node.["homeGymName"].AsValue().GetValue () let HomeGymId = node.["homeGymId"].AsValue().GetValue () let LastName = node.["lastName"].AsValue().GetValue () let FirstName = node.["firstName"].AsValue().GetValue () let CompoundMemberId = node.["compoundMemberId"].AsValue().GetValue () let Id = node.["id"].AsValue().GetValue () { Id = Id CompoundMemberId = CompoundMemberId FirstName = FirstName LastName = LastName HomeGymId = HomeGymId HomeGymName = HomeGymName EmailAddress = EmailAddress GymAccessPin = GymAccessPin DateOfBirth = DateOfBirth MobileNumber = MobileNumber Postcode = Postcode MembershipName = MembershipName MembershipLevel = MembershipLevel SuspendedReason = SuspendedReason MemberStatus = MemberStatus } namespace PureGym /// Module containing JSON parsing methods for the GymAttendance type [] [] module GymAttendance = /// Parse from a JSON node. let jsonParse (node : System.Text.Json.Nodes.JsonNode) : GymAttendance = let MaximumCapacity = node.["maximumCapacity"].AsValue().GetValue () let LastRefreshedPeopleInClasses = node.["lastRefreshedPeopleInClasses"].AsValue().GetValue () |> System.DateTime.Parse let LastRefreshed = node.["lastRefreshed"].AsValue().GetValue () |> System.DateTime.Parse let AttendanceTime = node.["attendanceTime"].AsValue().GetValue () |> System.DateTime.Parse let IsApproximate = node.["isApproximate"].AsValue().GetValue () let TotalPeopleSuffix = match node.["totalPeopleSuffix"] with | null -> None | v -> v.AsValue().GetValue () |> Some let TotalPeopleInClasses = node.["totalPeopleInClasses"].AsValue().GetValue () let TotalPeopleInGym = node.["totalPeopleInGym"].AsValue().GetValue () let Description = node.["description"].AsValue().GetValue () { Description = Description TotalPeopleInGym = TotalPeopleInGym TotalPeopleInClasses = TotalPeopleInClasses TotalPeopleSuffix = TotalPeopleSuffix IsApproximate = IsApproximate AttendanceTime = AttendanceTime LastRefreshed = LastRefreshed LastRefreshedPeopleInClasses = LastRefreshedPeopleInClasses MaximumCapacity = MaximumCapacity } namespace PureGym /// Module containing JSON parsing methods for the MemberActivityDto type [] [] module MemberActivityDto = /// Parse from a JSON node. let jsonParse (node : System.Text.Json.Nodes.JsonNode) : MemberActivityDto = let LastRefreshed = node.["lastRefreshed"].AsValue().GetValue () |> System.DateTime.Parse let IsEstimated = node.["isEstimated"].AsValue().GetValue () let TotalClasses = node.["totalClasses"].AsValue().GetValue () let TotalVisits = node.["totalVisits"].AsValue().GetValue () let AverageDuration = node.["averageDuration"].AsValue().GetValue () let TotalDuration = node.["totalDuration"].AsValue().GetValue () { TotalDuration = TotalDuration AverageDuration = AverageDuration TotalVisits = TotalVisits TotalClasses = TotalClasses IsEstimated = IsEstimated LastRefreshed = LastRefreshed } namespace PureGym /// Module containing JSON parsing methods for the SessionsAggregate type [] [] module SessionsAggregate = /// Parse from a JSON node. let jsonParse (node : System.Text.Json.Nodes.JsonNode) : SessionsAggregate = let Duration = node.["duration"].AsValue().GetValue () let Visits = node.["visits"].AsValue().GetValue () let Activities = node.["activities"].AsValue().GetValue () { Activities = Activities Visits = Visits Duration = Duration } namespace PureGym /// Module containing JSON parsing methods for the VisitGym type [] [] module VisitGym = /// Parse from a JSON node. let jsonParse (node : System.Text.Json.Nodes.JsonNode) : VisitGym = let Status = node.["status"].AsValue().GetValue () let Name = node.["name"].AsValue().GetValue () let Id = node.["id"].AsValue().GetValue () { Id = Id Name = Name Status = Status } namespace PureGym /// Module containing JSON parsing methods for the Visit type [] [] module Visit = /// Parse from a JSON node. let jsonParse (node : System.Text.Json.Nodes.JsonNode) : Visit = let Gym = VisitGym.jsonParse node.["gym"] let Duration = node.["duration"].AsValue().GetValue () let StartTime = node.["startTime"].AsValue().GetValue () |> System.DateTime.Parse let IsDurationEstimated = node.["isDurationEstimated"].AsValue().GetValue () { IsDurationEstimated = IsDurationEstimated StartTime = StartTime Duration = Duration Gym = Gym } namespace PureGym /// Module containing JSON parsing methods for the SessionsSummary type [] [] module SessionsSummary = /// Parse from a JSON node. let jsonParse (node : System.Text.Json.Nodes.JsonNode) : SessionsSummary = let ThisWeek = SessionsAggregate.jsonParse node.["thisWeek"] let Total = SessionsAggregate.jsonParse node.["total"] { Total = Total ThisWeek = ThisWeek } namespace PureGym /// Module containing JSON parsing methods for the Sessions type [] [] module Sessions = /// Parse from a JSON node. let jsonParse (node : System.Text.Json.Nodes.JsonNode) : Sessions = let Visits = node.["visits"].AsArray () |> Seq.map (fun elt -> Visit.jsonParse elt) |> List.ofSeq let Summary = SessionsSummary.jsonParse node.["summary"] { Summary = Summary Visits = Visits }