Make reopen date optional
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -19,214 +19,214 @@ open RestEase
|
||||
[<RequireQualifiedAccess>]
|
||||
module PureGymApi =
|
||||
/// Create a REST client. The input functions will be re-evaluated on every HTTP request to obtain the required values for the corresponding header properties.
|
||||
let make (authHeader : unit -> string) (client : System.Net.Http.HttpClient) : IPureGymApi =
|
||||
let make (authHeader: unit -> string) (client: System.Net.Http.HttpClient) : IPureGymApi =
|
||||
{ new IPureGymApi with
|
||||
member _.AuthHeader : string = authHeader ()
|
||||
member _.AuthHeader: string = authHeader ()
|
||||
|
||||
member this.GetGyms (ct : CancellationToken option) =
|
||||
member this.GetGyms(ct: CancellationToken option) =
|
||||
async {
|
||||
let! ct = Async.CancellationToken
|
||||
|
||||
let uri =
|
||||
System.Uri (
|
||||
System.Uri(
|
||||
(match client.BaseAddress with
|
||||
| null -> System.Uri "https://capi.puregym.com/api/"
|
||||
| v -> v),
|
||||
System.Uri ("v1/gyms/", System.UriKind.Relative)
|
||||
System.Uri("v1/gyms/", System.UriKind.Relative)
|
||||
)
|
||||
|
||||
let httpMessage =
|
||||
new System.Net.Http.HttpRequestMessage (
|
||||
new System.Net.Http.HttpRequestMessage(
|
||||
Method = System.Net.Http.HttpMethod.Get,
|
||||
RequestUri = uri
|
||||
)
|
||||
|
||||
do httpMessage.Headers.Add ("Authorization", this.AuthHeader.ToString ())
|
||||
do httpMessage.Headers.Add ("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")
|
||||
let! response = client.SendAsync (httpMessage, ct) |> Async.AwaitTask
|
||||
let response = response.EnsureSuccessStatusCode ()
|
||||
do httpMessage.Headers.Add("Authorization", this.AuthHeader.ToString())
|
||||
do httpMessage.Headers.Add("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")
|
||||
let! response = client.SendAsync(httpMessage, ct) |> Async.AwaitTask
|
||||
let response = response.EnsureSuccessStatusCode()
|
||||
let! responseStream = response.Content.ReadAsStreamAsync ct |> Async.AwaitTask
|
||||
|
||||
let! jsonNode =
|
||||
System.Text.Json.Nodes.JsonNode.ParseAsync (responseStream, cancellationToken = ct)
|
||||
System.Text.Json.Nodes.JsonNode.ParseAsync(responseStream, cancellationToken = ct)
|
||||
|> Async.AwaitTask
|
||||
|
||||
return jsonNode.AsArray () |> Seq.map (fun elt -> Gym.jsonParse elt) |> List.ofSeq
|
||||
return jsonNode.AsArray() |> Seq.map (fun elt -> Gym.jsonParse elt) |> List.ofSeq
|
||||
}
|
||||
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))
|
||||
|> (fun a -> Async.StartAsTask(a, ?cancellationToken = ct))
|
||||
|
||||
member this.GetMember (ct : CancellationToken option) =
|
||||
member this.GetMember(ct: CancellationToken option) =
|
||||
async {
|
||||
let! ct = Async.CancellationToken
|
||||
|
||||
let uri =
|
||||
System.Uri (
|
||||
System.Uri(
|
||||
(match client.BaseAddress with
|
||||
| null -> System.Uri "https://capi.puregym.com/api/"
|
||||
| v -> v),
|
||||
System.Uri ("v1/member", System.UriKind.Relative)
|
||||
System.Uri("v1/member", System.UriKind.Relative)
|
||||
)
|
||||
|
||||
let httpMessage =
|
||||
new System.Net.Http.HttpRequestMessage (
|
||||
new System.Net.Http.HttpRequestMessage(
|
||||
Method = System.Net.Http.HttpMethod.Get,
|
||||
RequestUri = uri
|
||||
)
|
||||
|
||||
do httpMessage.Headers.Add ("Authorization", this.AuthHeader.ToString ())
|
||||
do httpMessage.Headers.Add ("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")
|
||||
let! response = client.SendAsync (httpMessage, ct) |> Async.AwaitTask
|
||||
let response = response.EnsureSuccessStatusCode ()
|
||||
do httpMessage.Headers.Add("Authorization", this.AuthHeader.ToString())
|
||||
do httpMessage.Headers.Add("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")
|
||||
let! response = client.SendAsync(httpMessage, ct) |> Async.AwaitTask
|
||||
let response = response.EnsureSuccessStatusCode()
|
||||
let! responseStream = response.Content.ReadAsStreamAsync ct |> Async.AwaitTask
|
||||
|
||||
let! jsonNode =
|
||||
System.Text.Json.Nodes.JsonNode.ParseAsync (responseStream, cancellationToken = ct)
|
||||
System.Text.Json.Nodes.JsonNode.ParseAsync(responseStream, cancellationToken = ct)
|
||||
|> Async.AwaitTask
|
||||
|
||||
return Member.jsonParse jsonNode
|
||||
}
|
||||
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))
|
||||
|> (fun a -> Async.StartAsTask(a, ?cancellationToken = ct))
|
||||
|
||||
member this.GetGymAttendance (gymId : int, ct : CancellationToken option) =
|
||||
member this.GetGymAttendance(gymId: int, ct: CancellationToken option) =
|
||||
async {
|
||||
let! ct = Async.CancellationToken
|
||||
|
||||
let uri =
|
||||
System.Uri (
|
||||
System.Uri(
|
||||
(match client.BaseAddress with
|
||||
| null -> System.Uri "https://capi.puregym.com/api/"
|
||||
| v -> v),
|
||||
System.Uri (
|
||||
System.Uri(
|
||||
"v1/gyms/{gym_id}/attendance"
|
||||
.Replace ("{gym_id}", gymId.ToString () |> System.Web.HttpUtility.UrlEncode),
|
||||
.Replace("{gym_id}", gymId.ToString() |> System.Web.HttpUtility.UrlEncode),
|
||||
System.UriKind.Relative
|
||||
)
|
||||
)
|
||||
|
||||
let httpMessage =
|
||||
new System.Net.Http.HttpRequestMessage (
|
||||
new System.Net.Http.HttpRequestMessage(
|
||||
Method = System.Net.Http.HttpMethod.Get,
|
||||
RequestUri = uri
|
||||
)
|
||||
|
||||
do httpMessage.Headers.Add ("Authorization", this.AuthHeader.ToString ())
|
||||
do httpMessage.Headers.Add ("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")
|
||||
let! response = client.SendAsync (httpMessage, ct) |> Async.AwaitTask
|
||||
let response = response.EnsureSuccessStatusCode ()
|
||||
do httpMessage.Headers.Add("Authorization", this.AuthHeader.ToString())
|
||||
do httpMessage.Headers.Add("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")
|
||||
let! response = client.SendAsync(httpMessage, ct) |> Async.AwaitTask
|
||||
let response = response.EnsureSuccessStatusCode()
|
||||
let! responseStream = response.Content.ReadAsStreamAsync ct |> Async.AwaitTask
|
||||
|
||||
let! jsonNode =
|
||||
System.Text.Json.Nodes.JsonNode.ParseAsync (responseStream, cancellationToken = ct)
|
||||
System.Text.Json.Nodes.JsonNode.ParseAsync(responseStream, cancellationToken = ct)
|
||||
|> Async.AwaitTask
|
||||
|
||||
return GymAttendance.jsonParse jsonNode
|
||||
}
|
||||
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))
|
||||
|> (fun a -> Async.StartAsTask(a, ?cancellationToken = ct))
|
||||
|
||||
member this.GetGym (gymId : int, ct : CancellationToken option) =
|
||||
member this.GetGym(gymId: int, ct: CancellationToken option) =
|
||||
async {
|
||||
let! ct = Async.CancellationToken
|
||||
|
||||
let uri =
|
||||
System.Uri (
|
||||
System.Uri(
|
||||
(match client.BaseAddress with
|
||||
| null -> System.Uri "https://capi.puregym.com/api/"
|
||||
| v -> v),
|
||||
System.Uri (
|
||||
System.Uri(
|
||||
"v1/gyms/{gym_id}"
|
||||
.Replace ("{gym_id}", gymId.ToString () |> System.Web.HttpUtility.UrlEncode),
|
||||
.Replace("{gym_id}", gymId.ToString() |> System.Web.HttpUtility.UrlEncode),
|
||||
System.UriKind.Relative
|
||||
)
|
||||
)
|
||||
|
||||
let httpMessage =
|
||||
new System.Net.Http.HttpRequestMessage (
|
||||
new System.Net.Http.HttpRequestMessage(
|
||||
Method = System.Net.Http.HttpMethod.Get,
|
||||
RequestUri = uri
|
||||
)
|
||||
|
||||
do httpMessage.Headers.Add ("Authorization", this.AuthHeader.ToString ())
|
||||
do httpMessage.Headers.Add ("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")
|
||||
let! response = client.SendAsync (httpMessage, ct) |> Async.AwaitTask
|
||||
let response = response.EnsureSuccessStatusCode ()
|
||||
do httpMessage.Headers.Add("Authorization", this.AuthHeader.ToString())
|
||||
do httpMessage.Headers.Add("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")
|
||||
let! response = client.SendAsync(httpMessage, ct) |> Async.AwaitTask
|
||||
let response = response.EnsureSuccessStatusCode()
|
||||
let! responseStream = response.Content.ReadAsStreamAsync ct |> Async.AwaitTask
|
||||
|
||||
let! jsonNode =
|
||||
System.Text.Json.Nodes.JsonNode.ParseAsync (responseStream, cancellationToken = ct)
|
||||
System.Text.Json.Nodes.JsonNode.ParseAsync(responseStream, cancellationToken = ct)
|
||||
|> Async.AwaitTask
|
||||
|
||||
return Gym.jsonParse jsonNode
|
||||
}
|
||||
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))
|
||||
|> (fun a -> Async.StartAsTask(a, ?cancellationToken = ct))
|
||||
|
||||
member this.GetMemberActivity (ct : CancellationToken option) =
|
||||
member this.GetMemberActivity(ct: CancellationToken option) =
|
||||
async {
|
||||
let! ct = Async.CancellationToken
|
||||
|
||||
let uri =
|
||||
System.Uri (
|
||||
System.Uri(
|
||||
(match client.BaseAddress with
|
||||
| null -> System.Uri "https://capi.puregym.com/api/"
|
||||
| v -> v),
|
||||
System.Uri ("v1/member/activity", System.UriKind.Relative)
|
||||
System.Uri("v1/member/activity", System.UriKind.Relative)
|
||||
)
|
||||
|
||||
let httpMessage =
|
||||
new System.Net.Http.HttpRequestMessage (
|
||||
new System.Net.Http.HttpRequestMessage(
|
||||
Method = System.Net.Http.HttpMethod.Get,
|
||||
RequestUri = uri
|
||||
)
|
||||
|
||||
do httpMessage.Headers.Add ("Authorization", this.AuthHeader.ToString ())
|
||||
do httpMessage.Headers.Add ("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")
|
||||
let! response = client.SendAsync (httpMessage, ct) |> Async.AwaitTask
|
||||
let response = response.EnsureSuccessStatusCode ()
|
||||
do httpMessage.Headers.Add("Authorization", this.AuthHeader.ToString())
|
||||
do httpMessage.Headers.Add("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")
|
||||
let! response = client.SendAsync(httpMessage, ct) |> Async.AwaitTask
|
||||
let response = response.EnsureSuccessStatusCode()
|
||||
let! responseStream = response.Content.ReadAsStreamAsync ct |> Async.AwaitTask
|
||||
|
||||
let! jsonNode =
|
||||
System.Text.Json.Nodes.JsonNode.ParseAsync (responseStream, cancellationToken = ct)
|
||||
System.Text.Json.Nodes.JsonNode.ParseAsync(responseStream, cancellationToken = ct)
|
||||
|> Async.AwaitTask
|
||||
|
||||
return MemberActivityDto.jsonParse jsonNode
|
||||
}
|
||||
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))
|
||||
|> (fun a -> Async.StartAsTask(a, ?cancellationToken = ct))
|
||||
|
||||
member this.GetSessions (fromDate : DateOnly, toDate : DateOnly, ct : CancellationToken option) =
|
||||
member this.GetSessions(fromDate: DateOnly, toDate: DateOnly, ct: CancellationToken option) =
|
||||
async {
|
||||
let! ct = Async.CancellationToken
|
||||
|
||||
let uri =
|
||||
System.Uri (
|
||||
System.Uri(
|
||||
(match client.BaseAddress with
|
||||
| null -> System.Uri "https://capi.puregym.com/api/"
|
||||
| v -> v),
|
||||
System.Uri (
|
||||
System.Uri(
|
||||
("v2/gymSessions/member"
|
||||
+ "?fromDate="
|
||||
+ ((fromDate.ToString "yyyy-MM-dd") |> System.Web.HttpUtility.UrlEncode)
|
||||
+ "&toDate="
|
||||
+ ((toDate.ToString "yyyy-MM-dd") |> System.Web.HttpUtility.UrlEncode)),
|
||||
+ ((fromDate.ToString "yyyy-MM-dd") |> System.Web.HttpUtility.UrlEncode)
|
||||
+ "&toDate="
|
||||
+ ((toDate.ToString "yyyy-MM-dd") |> System.Web.HttpUtility.UrlEncode)),
|
||||
System.UriKind.Relative
|
||||
)
|
||||
)
|
||||
|
||||
let httpMessage =
|
||||
new System.Net.Http.HttpRequestMessage (
|
||||
new System.Net.Http.HttpRequestMessage(
|
||||
Method = System.Net.Http.HttpMethod.Get,
|
||||
RequestUri = uri
|
||||
)
|
||||
|
||||
do httpMessage.Headers.Add ("Authorization", this.AuthHeader.ToString ())
|
||||
do httpMessage.Headers.Add ("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")
|
||||
let! response = client.SendAsync (httpMessage, ct) |> Async.AwaitTask
|
||||
let response = response.EnsureSuccessStatusCode ()
|
||||
do httpMessage.Headers.Add("Authorization", this.AuthHeader.ToString())
|
||||
do httpMessage.Headers.Add("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")
|
||||
let! response = client.SendAsync(httpMessage, ct) |> Async.AwaitTask
|
||||
let response = response.EnsureSuccessStatusCode()
|
||||
let! responseStream = response.Content.ReadAsStreamAsync ct |> Async.AwaitTask
|
||||
|
||||
let! jsonNode =
|
||||
System.Text.Json.Nodes.JsonNode.ParseAsync (responseStream, cancellationToken = ct)
|
||||
System.Text.Json.Nodes.JsonNode.ParseAsync(responseStream, cancellationToken = ct)
|
||||
|> Async.AwaitTask
|
||||
|
||||
return Sessions.jsonParse jsonNode
|
||||
}
|
||||
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))
|
||||
}
|
||||
|> (fun a -> Async.StartAsTask(a, ?cancellationToken = ct)) }
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "4.0",
|
||||
"version": "5.0",
|
||||
"publicReleaseRefSpec": [
|
||||
"^refs/heads/main$"
|
||||
],
|
||||
|
Reference in New Issue
Block a user