Add all-gyms
This commit is contained in:
@@ -23,21 +23,23 @@ module Api =
|
||||
let cache = new Cache<_> (AuthToken.get cred, _.ExpiryTime)
|
||||
cache :> _, (fun () -> Async.RunSynchronously (cache.GetCurrentValue ()))
|
||||
|
||||
task {
|
||||
async {
|
||||
let client = new HttpClient ()
|
||||
|
||||
return PureGymApi.make (getToken >> _.AccessToken >> sprintf "Bearer %s") client, cache
|
||||
}
|
||||
|> Async.StartAsTask
|
||||
|
||||
/// Create a REST client, authenticated as the specified user. Do not refresh creds.
|
||||
let makeWithoutRefresh (ct : CancellationToken) (auth : Auth) : IPureGymApi Task =
|
||||
task {
|
||||
async {
|
||||
let! token =
|
||||
match auth with
|
||||
| Auth.Token t -> Task.FromResult<_> t
|
||||
| Auth.User cred -> AuthToken.get cred ct
|
||||
| Auth.Token t -> async.Return t
|
||||
| Auth.User cred -> Async.AwaitTask (AuthToken.get cred ct)
|
||||
|
||||
let client = new HttpClient ()
|
||||
|
||||
return PureGymApi.make (fun () -> $"Bearer %s{token.AccessToken}") client
|
||||
}
|
||||
|> Async.StartAsTask
|
||||
|
Reference in New Issue
Block a user