From 652cd200912f77bea25ef6ee0002037833066ad3 Mon Sep 17 00:00:00 2001 From: Smaug123 Date: Mon, 29 Jan 2024 22:53:14 +0000 Subject: [PATCH] And for base URI --- PureGym/Api.fs | 2 -- PureGym/Client.fs | 1 + PureGym/GeneratedClient.fs | 48 +++++--------------------------------- 3 files changed, 7 insertions(+), 44 deletions(-) diff --git a/PureGym/Api.fs b/PureGym/Api.fs index bd3680e..88b3617 100644 --- a/PureGym/Api.fs +++ b/PureGym/Api.fs @@ -105,7 +105,6 @@ module Api = task { let client = new HttpClient () - client.BaseAddress <- Uri "https://capi.puregym.com/api/" return PureGymApi.make (getToken >> _.AccessToken >> sprintf "Bearer %s") client, cache } @@ -119,7 +118,6 @@ module Api = | Auth.User cred -> AuthToken.get cred ct let client = new HttpClient () - client.BaseAddress <- Uri "https://capi.puregym.com/api/" return PureGymApi.make (fun () -> $"Bearer %s{token.AccessToken}") client } diff --git a/PureGym/Client.fs b/PureGym/Client.fs index f994de1..61311f9 100644 --- a/PureGym/Client.fs +++ b/PureGym/Client.fs @@ -9,6 +9,7 @@ open RestEase /// The PureGym REST API. You probably want to instantiate one of these with `Api.make`. [] [] +[] type IPureGymApi = [
] abstract AuthHeader : string diff --git a/PureGym/GeneratedClient.fs b/PureGym/GeneratedClient.fs index 0fedd9e..1b95858 100644 --- a/PureGym/GeneratedClient.fs +++ b/PureGym/GeneratedClient.fs @@ -30,13 +30,7 @@ module PureGymApi = let uri = 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." - ) - ) + | null -> System.Uri "https://capi.puregym.com/api/" | v -> v), System.Uri ("v1/gyms/", System.UriKind.Relative) ) @@ -68,13 +62,7 @@ module PureGymApi = let uri = 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." - ) - ) + | null -> System.Uri "https://capi.puregym.com/api/" | v -> v), System.Uri ("v1/member", System.UriKind.Relative) ) @@ -106,13 +94,7 @@ module PureGymApi = let uri = 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." - ) - ) + | null -> System.Uri "https://capi.puregym.com/api/" | v -> v), System.Uri ( "v1/gyms/{gym_id}/attendance" @@ -148,13 +130,7 @@ module PureGymApi = let uri = 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." - ) - ) + | null -> System.Uri "https://capi.puregym.com/api/" | v -> v), System.Uri ( "v1/gyms/{gym_id}" @@ -190,13 +166,7 @@ module PureGymApi = let uri = 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." - ) - ) + | null -> System.Uri "https://capi.puregym.com/api/" | v -> v), System.Uri ("v1/member/activity", System.UriKind.Relative) ) @@ -228,13 +198,7 @@ module PureGymApi = let uri = 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." - ) - ) + | null -> System.Uri "https://capi.puregym.com/api/" | v -> v), System.Uri ( ("v2/gymSessions/member"