And for base URI
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/all-checks-complete Pipeline was successful
ci/woodpecker/pr/build Pipeline failed
ci/woodpecker/pr/all-checks-complete unknown status

This commit is contained in:
Smaug123
2024-01-29 22:53:14 +00:00
parent 5b7a29f27f
commit 652cd20091
3 changed files with 7 additions and 44 deletions

View File

@@ -105,7 +105,6 @@ module Api =
task { task {
let client = new HttpClient () let client = new HttpClient ()
client.BaseAddress <- Uri "https://capi.puregym.com/api/"
return PureGymApi.make (getToken >> _.AccessToken >> sprintf "Bearer %s") client, cache return PureGymApi.make (getToken >> _.AccessToken >> sprintf "Bearer %s") client, cache
} }
@@ -119,7 +118,6 @@ module Api =
| Auth.User cred -> AuthToken.get cred ct | Auth.User cred -> AuthToken.get cred ct
let client = new HttpClient () let client = new HttpClient ()
client.BaseAddress <- Uri "https://capi.puregym.com/api/"
return PureGymApi.make (fun () -> $"Bearer %s{token.AccessToken}") client return PureGymApi.make (fun () -> $"Bearer %s{token.AccessToken}") client
} }

View File

@@ -9,6 +9,7 @@ open RestEase
/// The PureGym REST API. You probably want to instantiate one of these with `Api.make`. /// The PureGym REST API. You probably want to instantiate one of these with `Api.make`.
[<WoofWare.Myriad.Plugins.HttpClient>] [<WoofWare.Myriad.Plugins.HttpClient>]
[<Header("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")>] [<Header("User-Agent", "PureGym/1523 CFNetwork/1312 Darwin/21.0.0")>]
[<BaseAddress "https://capi.puregym.com/api/">]
type IPureGymApi = type IPureGymApi =
[<Header "Authorization">] [<Header "Authorization">]
abstract AuthHeader : string abstract AuthHeader : string

View File

@@ -30,13 +30,7 @@ module PureGymApi =
let uri = let uri =
System.Uri ( System.Uri (
(match client.BaseAddress with (match client.BaseAddress with
| null -> | null -> System.Uri "https://capi.puregym.com/api/"
raise (
System.ArgumentNullException (
nameof (client.BaseAddress),
"No base address was supplied on the type, and no BaseAddress was on the HttpClient."
)
)
| v -> v), | v -> v),
System.Uri ("v1/gyms/", System.UriKind.Relative) System.Uri ("v1/gyms/", System.UriKind.Relative)
) )
@@ -68,13 +62,7 @@ module PureGymApi =
let uri = let uri =
System.Uri ( System.Uri (
(match client.BaseAddress with (match client.BaseAddress with
| null -> | null -> System.Uri "https://capi.puregym.com/api/"
raise (
System.ArgumentNullException (
nameof (client.BaseAddress),
"No base address was supplied on the type, and no BaseAddress was on the HttpClient."
)
)
| v -> v), | v -> v),
System.Uri ("v1/member", System.UriKind.Relative) System.Uri ("v1/member", System.UriKind.Relative)
) )
@@ -106,13 +94,7 @@ module PureGymApi =
let uri = let uri =
System.Uri ( System.Uri (
(match client.BaseAddress with (match client.BaseAddress with
| null -> | null -> System.Uri "https://capi.puregym.com/api/"
raise (
System.ArgumentNullException (
nameof (client.BaseAddress),
"No base address was supplied on the type, and no BaseAddress was on the HttpClient."
)
)
| v -> v), | v -> v),
System.Uri ( System.Uri (
"v1/gyms/{gym_id}/attendance" "v1/gyms/{gym_id}/attendance"
@@ -148,13 +130,7 @@ module PureGymApi =
let uri = let uri =
System.Uri ( System.Uri (
(match client.BaseAddress with (match client.BaseAddress with
| null -> | null -> System.Uri "https://capi.puregym.com/api/"
raise (
System.ArgumentNullException (
nameof (client.BaseAddress),
"No base address was supplied on the type, and no BaseAddress was on the HttpClient."
)
)
| v -> v), | v -> v),
System.Uri ( System.Uri (
"v1/gyms/{gym_id}" "v1/gyms/{gym_id}"
@@ -190,13 +166,7 @@ module PureGymApi =
let uri = let uri =
System.Uri ( System.Uri (
(match client.BaseAddress with (match client.BaseAddress with
| null -> | null -> System.Uri "https://capi.puregym.com/api/"
raise (
System.ArgumentNullException (
nameof (client.BaseAddress),
"No base address was supplied on the type, and no BaseAddress was on the HttpClient."
)
)
| v -> v), | v -> v),
System.Uri ("v1/member/activity", System.UriKind.Relative) System.Uri ("v1/member/activity", System.UriKind.Relative)
) )
@@ -228,13 +198,7 @@ module PureGymApi =
let uri = let uri =
System.Uri ( System.Uri (
(match client.BaseAddress with (match client.BaseAddress with
| null -> | null -> System.Uri "https://capi.puregym.com/api/"
raise (
System.ArgumentNullException (
nameof (client.BaseAddress),
"No base address was supplied on the type, and no BaseAddress was on the HttpClient."
)
)
| v -> v), | v -> v),
System.Uri ( System.Uri (
("v2/gymSessions/member" ("v2/gymSessions/member"