CitraClient.Generated (citra_client v0.3.0)
View SourceCompile-time entry point for the generated API client.
On every compile, the OpenAPI schema for the selected target is fetched,
cached to priv/openapi.{dev,prod}.json, and used to metaprogram:
- one struct module per component schema under
CitraClient.Schemas.* - one operations module per tag under
CitraClient.*(e.g.CitraClient.GroundStations)
Selecting a compile target
The generator reads CITRA_CLIENT_COMPILE_ENV:
dev(default) — fetches fromhttps://dev.api.citra.space/openapi.json. Dev is a superset of prod, so bindings compiled from it will work for every shared endpoint on either environment.prod— fetches fromhttps://api.citra.space/openapi.jsonto pin bindings to the stable prod schema. Dev-only endpoints are not generated.
Independently, CITRA_CLIENT_SPEC_URL overrides the fetch URL entirely
(for testing against a staging host), and CITRA_CLIENT_SPEC_PATH skips
the network and loads a local JSON file.
Note that the runtime :env setting (CitraClient.set_env/1) selects
which base URL to send requests to — it is independent of the compile
target. Bindings compiled from dev can be used against prod at runtime
for the 133 shared operations.
To force a refresh after the API changes, either delete the relevant
cache file under priv/ or run mix clean before rebuilding.
Summary
Functions
Absolute path to the cached OpenAPI JSON on disk.
The environment (:dev or :prod) whose schema the client was compiled against.
The raw parsed OpenAPI spec used to build the client (for introspection).
The URL the spec was fetched from at compile time.
Functions
@spec cache_path() :: String.t()
Absolute path to the cached OpenAPI JSON on disk.
@spec compile_env() :: :dev | :prod
The environment (:dev or :prod) whose schema the client was compiled against.
@spec spec() :: map()
The raw parsed OpenAPI spec used to build the client (for introspection).
@spec spec_url() :: String.t()
The URL the spec was fetched from at compile time.