API reference
A forge-dashboard API client.
Every operation except :meth:health, :meth:get_version and the two
webhook receivers requires an authenticated session. forge-dashboard
accepts either a browser's passkey session cookie or a personal API
token (Authorization: Bearer <token>, minted via POST
/api/tokens) -- see the spec's auth tag. This wrapper only speaks
the bearer-token half, the headless-friendly one: pass a token as
api_token or set FORGE_DASHBOARD_API_TOKEN in the environment --
the constructor argument wins when both are given.
The underlying generated client is available as :attr:raw for any
operation this wrapper doesn't have a dedicated method for; every
generated forge_dashboard._generated.api.<tag>.<operation> module's
sync_detailed/asyncio_detailed functions take it as their
client argument.
raw
property
The underlying generated Client.
aget_version()
async
Async counterpart of :meth:get_version.
ahealth()
async
Async counterpart of :meth:health.
get_version()
The running server's build version. Needs no session.
health()
Liveness. Needs no session -- a good first call to prove the client reaches the server at all.
Bases: Exception
Raised for any forge-dashboard response carrying an error body.
Attributes:
| Name | Type | Description |
|---|---|---|
status_code |
The HTTP status code. |
|
message |
The API's own error message (empty string if the body
wasn't the documented |
Build an :class:APIError from response, or return None if
its status code isn't an error.
Decodes response.content directly rather than trusting the
generated per-operation .parsed field, which is only populated for
status codes the spec documents on that specific operation -- a 500 or
429 that survived every retry attempt still needs an APIError, and
the API returns the same {error} shape for those too.
Usage::
response = sync_detailed(client=client.raw, ...)
if error := decode_error(response):
raise error