31 lines
1.6 KiB
Markdown
31 lines
1.6 KiB
Markdown
# Unofficial PureGym client
|
|
|
|

|
|
|
|
*With thanks to [Tom Hollingsworth](https://github.com/2t6h/puregym-attendance/blob/64dcd830bd874dc0150c7767f5cc6c75ed0b9dad/puregym.py).*
|
|
|
|
## Usage
|
|
|
|
* With Nix: `nix run` (you can refer to this flake).
|
|
* Manually: `git clone` and then `dotnet run --project PureGym.App/PureGym.App.fsproj`.
|
|
|
|
(Something is up on Darwin: `nix run` currently produces an executable which dies instantly.
|
|
Workaround: `nix build` and then `nix develop --command dotnet exec ./result/lib/puregym/PureGym.App.dll`.)
|
|
|
|
The available subcommands can be viewed in the `subcommands` map defined in [Program.fs](./PureGym.App/Program.fs).
|
|
As of this writing, the following are implemented:
|
|
|
|
* `activity`: get the logged-in user's activity stats. I have no idea what the semantics of these numbers are!
|
|
* `fullness`: determine how full a given gym is right now.
|
|
* `lookup-gym`: give information about the gym's physical instantiation (e.g. its address).
|
|
|
|
### Authentication
|
|
|
|
You can authenticate with your PureGym email address and PIN combination, or (probably better) you can call `PureGym.App auth` to obtain a token.
|
|
Use this token in subsequent commands by setting the `PUREGYM_BEARER_TOKEN` environment variable or supplying it as `--bearer-token`.
|
|
|
|
## Structure
|
|
|
|
* The REST client is at [Api.fs](./PureGym/Api.fs).
|
|
* The standalone application is at [PureGym.App](./PureGym.App). It uses a ghastly mix of hand-rolled argument parsing and [Argu](https://fsprojects.github.io/Argu/), because Argu does not *quite* want to do what I want an argument parser to do.
|