From 5138a0d9c87fb34c4d888d6ccb710a5f1e0a90ac Mon Sep 17 00:00:00 2001 From: Smaug123 Date: Sat, 30 Dec 2023 11:47:30 +0000 Subject: [PATCH 1/3] Bump deps --- PureGym/PureGym.fsproj | 2 +- nix/deps.nix | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PureGym/PureGym.fsproj b/PureGym/PureGym.fsproj index de80c0f..5b0be4d 100644 --- a/PureGym/PureGym.fsproj +++ b/PureGym/PureGym.fsproj @@ -6,7 +6,7 @@ true FS3559 - 1.1.10 + 1.1.13 diff --git a/nix/deps.nix b/nix/deps.nix index a826e15..ff4c444 100644 --- a/nix/deps.nix +++ b/nix/deps.nix @@ -438,7 +438,7 @@ }) (fetchNuGet { pname = "WoofWare.Myriad.Plugins"; - version = "1.1.10"; - sha256 = "sha256-Z4dBuIhbFlbXgm+jucL4txSccTdpkRLiEg8kNyRPhxI="; + version = "1.1.13"; + sha256 = "sha256-TjR+3spu9vXb2kOoXM9p6yzjpt2rja1Tu7cAOmIMhog= "; }) ] -- 2.51.0 From 25d470e93bc623cf4e0746aa8aa8b8b35f654a36 Mon Sep 17 00:00:00 2001 From: Smaug123 Date: Sat, 30 Dec 2023 11:50:12 +0000 Subject: [PATCH 2/3] Update build --- PureGym/GeneratedClient.fs | 69 ++++++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 6 deletions(-) diff --git a/PureGym/GeneratedClient.fs b/PureGym/GeneratedClient.fs index da6c4d8..732902a 100644 --- a/PureGym/GeneratedClient.fs +++ b/PureGym/GeneratedClient.fs @@ -24,7 +24,18 @@ module PureGymApi = let! ct = Async.CancellationToken let uri = - System.Uri (client.BaseAddress, System.Uri ("v1/gyms/", System.UriKind.Relative)) + System.Uri ( + (match client.BaseAddress with + | null -> + raise ( + System.ArgumentNullException ( + nameof (client.BaseAddress), + "No base address was supplied on the type, and no BaseAddress was on the HttpClient." + ) + ) + | v -> v), + System.Uri ("v1/gyms/", System.UriKind.Relative) + ) let httpMessage = new System.Net.Http.HttpRequestMessage ( @@ -49,7 +60,18 @@ module PureGymApi = let! ct = Async.CancellationToken let uri = - System.Uri (client.BaseAddress, System.Uri ("v1/member", System.UriKind.Relative)) + System.Uri ( + (match client.BaseAddress with + | null -> + raise ( + System.ArgumentNullException ( + nameof (client.BaseAddress), + "No base address was supplied on the type, and no BaseAddress was on the HttpClient." + ) + ) + | v -> v), + System.Uri ("v1/member", System.UriKind.Relative) + ) let httpMessage = new System.Net.Http.HttpRequestMessage ( @@ -75,7 +97,15 @@ module PureGymApi = let uri = System.Uri ( - client.BaseAddress, + (match client.BaseAddress with + | null -> + raise ( + System.ArgumentNullException ( + nameof (client.BaseAddress), + "No base address was supplied on the type, and no BaseAddress was on the HttpClient." + ) + ) + | v -> v), System.Uri ( "v1/gyms/{gym_id}/attendance" .Replace ("{gym_id}", gymId.ToString () |> System.Web.HttpUtility.UrlEncode), @@ -107,7 +137,15 @@ module PureGymApi = let uri = System.Uri ( - client.BaseAddress, + (match client.BaseAddress with + | null -> + raise ( + System.ArgumentNullException ( + nameof (client.BaseAddress), + "No base address was supplied on the type, and no BaseAddress was on the HttpClient." + ) + ) + | v -> v), System.Uri ( "v1/gyms/{gym_id}" .Replace ("{gym_id}", gymId.ToString () |> System.Web.HttpUtility.UrlEncode), @@ -138,7 +176,18 @@ module PureGymApi = let! ct = Async.CancellationToken let uri = - System.Uri (client.BaseAddress, System.Uri ("v1/member/activity", System.UriKind.Relative)) + System.Uri ( + (match client.BaseAddress with + | null -> + raise ( + System.ArgumentNullException ( + nameof (client.BaseAddress), + "No base address was supplied on the type, and no BaseAddress was on the HttpClient." + ) + ) + | v -> v), + System.Uri ("v1/member/activity", System.UriKind.Relative) + ) let httpMessage = new System.Net.Http.HttpRequestMessage ( @@ -164,7 +213,15 @@ module PureGymApi = let uri = System.Uri ( - client.BaseAddress, + (match client.BaseAddress with + | null -> + raise ( + System.ArgumentNullException ( + nameof (client.BaseAddress), + "No base address was supplied on the type, and no BaseAddress was on the HttpClient." + ) + ) + | v -> v), System.Uri ( ("v2/gymSessions/member" + "?fromDate=" -- 2.51.0 From 8fd2baf5c488a2ea91ad4ae98f2b31c7edb910ce Mon Sep 17 00:00:00 2001 From: Smaug123 Date: Sat, 30 Dec 2023 11:52:41 +0000 Subject: [PATCH 3/3] Fix BaseAddress --- PureGym/Api.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PureGym/Api.fs b/PureGym/Api.fs index 8a52448..1e8ea7e 100644 --- a/PureGym/Api.fs +++ b/PureGym/Api.fs @@ -16,7 +16,7 @@ module Api = | Auth.User cred -> AuthToken.get cred let client = new HttpClient () - client.BaseAddress <- Uri "https://capi.puregym.com/api" + client.BaseAddress <- Uri "https://capi.puregym.com/api/" client.DefaultRequestHeaders.Authorization <- Headers.AuthenticationHeaderValue ("Bearer", token.AccessToken) -- 2.51.0