//------------------------------------------------------------------------------ // 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 = (match node.["openingHours"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("openingHours") ) ) | v -> v) .AsArray () |> Seq.map (fun elt -> elt.AsValue().GetValue ()) |> List.ofSeq let IsAlwaysOpen = (match node.["isAlwaysOpen"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("isAlwaysOpen") ) ) | v -> v) .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 = (match node.["qrCodeAccess"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("qrCodeAccess") ) ) | v -> v) .AsValue() .GetValue () let PinAccess = (match node.["pinAccess"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("pinAccess") ) ) | v -> v) .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 (match node.["latitude"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("latitude") ) ) | v -> v) .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 (match node.["latitude"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("latitude") ) ) | v -> v) .AsValue() .GetValue () |> System.Double.Parse else reraise () else reraise () let Longitude = try (match node.["longitude"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("longitude") ) ) | v -> v) .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 (match node.["longitude"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("longitude") ) ) | v -> v) .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 = (match node.["postcode"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("postcode") ) ) | v -> v) .AsValue() .GetValue () let County = match node.["county"] with | null -> None | v -> v.AsValue().GetValue () |> Some let Town = (match node.["town"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("town") ) ) | v -> v) .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 = (match node.["addressLine1"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("addressLine1") ) ) | v -> v) .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 = match node.["reopenDate"] with | null -> None | v -> v.AsValue().GetValue () |> Some let TimeZone = (match node.["timeZone"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("timeZone") ) ) | v -> v) .AsValue() .GetValue () let Location = GymLocation.jsonParse ( match node.["location"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("location") ) ) | v -> v ) let AccessOptions = GymAccessOptions.jsonParse ( match node.["accessOptions"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("accessOptions") ) ) | v -> v ) let GymOpeningHours = GymOpeningHours.jsonParse ( match node.["gymOpeningHours"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("gymOpeningHours") ) ) | v -> v ) let EmailAddress = (match node.["emailAddress"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("emailAddress") ) ) | v -> v) .AsValue() .GetValue () let PhoneNumber = (match node.["phoneNumber"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("phoneNumber") ) ) | v -> v) .AsValue() .GetValue () let Address = GymAddress.jsonParse ( match node.["address"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("address") ) ) | v -> v ) let Status = (match node.["status"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("status") ) ) | v -> v) .AsValue() .GetValue () let Id = (match node.["id"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("id") ) ) | v -> v) .AsValue() .GetValue () let Name = (match node.["name"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("name") ) ) | v -> v) .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 = (match node.["memberStatus"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("memberStatus") ) ) | v -> v) .AsValue() .GetValue () let SuspendedReason = (match node.["suspendedReason"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("suspendedReason") ) ) | v -> v) .AsValue() .GetValue () let MembershipLevel = (match node.["membershipLevel"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("membershipLevel") ) ) | v -> v) .AsValue() .GetValue () let MembershipName = (match node.["membershipName"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("membershipName") ) ) | v -> v) .AsValue() .GetValue () let Postcode = (match node.["postCode"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("postCode") ) ) | v -> v) .AsValue() .GetValue () let MobileNumber = (match node.["mobileNumber"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("mobileNumber") ) ) | v -> v) .AsValue() .GetValue () let DateOfBirth = (match node.["dateofBirth"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("dateofBirth") ) ) | v -> v) .AsValue() .GetValue () |> System.DateOnly.Parse let GymAccessPin = (match node.["gymAccessPin"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("gymAccessPin") ) ) | v -> v) .AsValue() .GetValue () let EmailAddress = (match node.["emailAddress"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("emailAddress") ) ) | v -> v) .AsValue() .GetValue () let HomeGymName = (match node.["homeGymName"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("homeGymName") ) ) | v -> v) .AsValue() .GetValue () let HomeGymId = (match node.["homeGymId"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("homeGymId") ) ) | v -> v) .AsValue() .GetValue () let LastName = (match node.["lastName"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("lastName") ) ) | v -> v) .AsValue() .GetValue () let FirstName = (match node.["firstName"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("firstName") ) ) | v -> v) .AsValue() .GetValue () let CompoundMemberId = (match node.["compoundMemberId"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("compoundMemberId") ) ) | v -> v) .AsValue() .GetValue () let Id = (match node.["id"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("id") ) ) | v -> v) .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 = (match node.["maximumCapacity"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("maximumCapacity") ) ) | v -> v) .AsValue() .GetValue () let LastRefreshedPeopleInClasses = (match node.["lastRefreshedPeopleInClasses"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("lastRefreshedPeopleInClasses") ) ) | v -> v) .AsValue() .GetValue () |> System.DateTime.Parse let LastRefreshed = (match node.["lastRefreshed"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("lastRefreshed") ) ) | v -> v) .AsValue() .GetValue () |> System.DateTime.Parse let AttendanceTime = (match node.["attendanceTime"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("attendanceTime") ) ) | v -> v) .AsValue() .GetValue () |> System.DateTime.Parse let IsApproximate = (match node.["isApproximate"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("isApproximate") ) ) | v -> v) .AsValue() .GetValue () let TotalPeopleSuffix = match node.["totalPeopleSuffix"] with | null -> None | v -> v.AsValue().GetValue () |> Some let TotalPeopleInClasses = (match node.["totalPeopleInClasses"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("totalPeopleInClasses") ) ) | v -> v) .AsValue() .GetValue () let TotalPeopleInGym = (match node.["totalPeopleInGym"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("totalPeopleInGym") ) ) | v -> v) .AsValue() .GetValue () let Description = (match node.["description"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("description") ) ) | v -> v) .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 = (match node.["lastRefreshed"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("lastRefreshed") ) ) | v -> v) .AsValue() .GetValue () |> System.DateTime.Parse let IsEstimated = (match node.["isEstimated"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("isEstimated") ) ) | v -> v) .AsValue() .GetValue () let TotalClasses = (match node.["totalClasses"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("totalClasses") ) ) | v -> v) .AsValue() .GetValue () let TotalVisits = (match node.["totalVisits"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("totalVisits") ) ) | v -> v) .AsValue() .GetValue () let AverageDuration = (match node.["averageDuration"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("averageDuration") ) ) | v -> v) .AsValue() .GetValue () let TotalDuration = (match node.["totalDuration"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("totalDuration") ) ) | v -> v) .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 = (match node.["Duration"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("Duration") ) ) | v -> v) .AsValue() .GetValue () let Visits = (match node.["Visits"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("Visits") ) ) | v -> v) .AsValue() .GetValue () let Activities = (match node.["Activities"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("Activities") ) ) | v -> v) .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 = (match node.["Status"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("Status") ) ) | v -> v) .AsValue() .GetValue () let Name = (match node.["Name"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("Name") ) ) | v -> v) .AsValue() .GetValue () let Id = (match node.["Id"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("Id") ) ) | v -> v) .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 ( match node.["Gym"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("Gym") ) ) | v -> v ) let Duration = (match node.["Duration"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("Duration") ) ) | v -> v) .AsValue() .GetValue () let StartTime = (match node.["StartTime"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("StartTime") ) ) | v -> v) .AsValue() .GetValue () |> System.DateTime.Parse let IsDurationEstimated = (match node.["IsDurationEstimated"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("IsDurationEstimated") ) ) | v -> v) .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 ( match node.["ThisWeek"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("ThisWeek") ) ) | v -> v ) let Total = SessionsAggregate.jsonParse ( match node.["Total"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("Total") ) ) | v -> v ) { 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 = (match node.["Visits"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("Visits") ) ) | v -> v) .AsArray () |> Seq.map (fun elt -> Visit.jsonParse elt) |> List.ofSeq let Summary = SessionsSummary.jsonParse ( match node.["Summary"] with | null -> raise ( System.Collections.Generic.KeyNotFoundException ( sprintf "Required key '%s' not found on JSON object" ("Summary") ) ) | v -> v ) { Summary = Summary Visits = Visits }