Make reopen date optional (#10)
It turns out that the API doesn't necessarily give you this. Co-authored-by: Smaug123 <patrick+github@patrickstevens.co.uk> Reviewed-on: #10
This commit is contained in:
@@ -124,7 +124,7 @@ module TestJson =
|
|||||||
Latitude = 51.480401
|
Latitude = 51.480401
|
||||||
}
|
}
|
||||||
TimeZone = "Europe/London"
|
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
|
[ ovalJson, oval ] |> List.map TestCaseData
|
||||||
|
@@ -125,7 +125,7 @@ type Gym =
|
|||||||
[<JsonRequired>]
|
[<JsonRequired>]
|
||||||
TimeZone : string
|
TimeZone : string
|
||||||
/// This is a date-time in the format yyyy-MM-ddTHH:mm:ss+01 Europe/London
|
/// 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
|
/// Human-readable representation of the most important information about this gym
|
||||||
|
@@ -232,16 +232,9 @@ module Gym =
|
|||||||
/// Parse from a JSON node.
|
/// Parse from a JSON node.
|
||||||
let jsonParse (node : System.Text.Json.Nodes.JsonNode) : Gym =
|
let jsonParse (node : System.Text.Json.Nodes.JsonNode) : Gym =
|
||||||
let ReopenDate =
|
let ReopenDate =
|
||||||
(match node.["reopenDate"] with
|
match node.["reopenDate"] with
|
||||||
| null ->
|
| null -> None
|
||||||
raise (
|
| v -> v.AsValue().GetValue<string> () |> Some
|
||||||
System.Collections.Generic.KeyNotFoundException (
|
|
||||||
sprintf "Required key '%s' not found on JSON object" ("reopenDate")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
| v -> v)
|
|
||||||
.AsValue()
|
|
||||||
.GetValue<string> ()
|
|
||||||
|
|
||||||
let TimeZone =
|
let TimeZone =
|
||||||
(match node.["timeZone"] with
|
(match node.["timeZone"] with
|
||||||
|
@@ -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.get [static method]: PureGym.UsernamePin -> System.Threading.CancellationToken -> PureGym.AuthToken System.Threading.Tasks.Task
|
||||||
PureGym.AuthTokenModule.ofBearerToken [static method]: string -> PureGym.AuthToken
|
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 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.AccessOptions [property]: [read-only] PureGym.GymAccessOptions
|
||||||
PureGym.Gym.Address [property]: [read-only] PureGym.GymAddress
|
PureGym.Gym.Address [property]: [read-only] PureGym.GymAddress
|
||||||
PureGym.Gym.EmailAddress [property]: [read-only] string
|
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_Location [method]: unit -> PureGym.GymLocation
|
||||||
PureGym.Gym.get_Name [method]: unit -> string
|
PureGym.Gym.get_Name [method]: unit -> string
|
||||||
PureGym.Gym.get_PhoneNumber [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_Status [method]: unit -> int
|
||||||
PureGym.Gym.get_TimeZone [method]: unit -> string
|
PureGym.Gym.get_TimeZone [method]: unit -> string
|
||||||
PureGym.Gym.GymOpeningHours [property]: [read-only] PureGym.GymOpeningHours
|
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.Location [property]: [read-only] PureGym.GymLocation
|
||||||
PureGym.Gym.Name [property]: [read-only] string
|
PureGym.Gym.Name [property]: [read-only] string
|
||||||
PureGym.Gym.PhoneNumber [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.Status [property]: [read-only] int
|
||||||
PureGym.Gym.TimeZone [property]: [read-only] string
|
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
|
PureGym.GymAccessOptions inherit obj, implements PureGym.GymAccessOptions System.IEquatable, System.Collections.IStructuralEquatable, PureGym.GymAccessOptions System.IComparable, System.IComparable, System.Collections.IStructuralComparable
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "4.0",
|
"version": "5.0",
|
||||||
"publicReleaseRefSpec": [
|
"publicReleaseRefSpec": [
|
||||||
"^refs/heads/main$"
|
"^refs/heads/main$"
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user