add shared forge-client crate; hive-forge and hive-forge-notify use it
This commit is contained in:
parent
687683a4f0
commit
e59e41ec90
1 changed files with 502 additions and 214 deletions
26
forge-client/README.md
Normal file
26
forge-client/README.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# forge-client
|
||||
|
||||
The one place hyperhive builds a Forgejo client and reads a Forgejo
|
||||
notification. `hive-forge` (the blocking CLI) and `hive-forge-notify` (the
|
||||
async poller) share it, so a Forgejo schema change that `forgejo-api` does not
|
||||
yet model is fixed here once.
|
||||
|
||||
## When to use it
|
||||
|
||||
- Building a `forgejo_api` client from a base URL and a token: `async_client`,
|
||||
and with the `sync` feature `sync_client`.
|
||||
- Building the raw `reqwest` client for Forgejo's web-router-only routes (the
|
||||
`sync` feature): `raw_blocking_client`.
|
||||
- Deciding how long a forge call may take: `TimeoutPolicy`. A caller names its
|
||||
policy (`TimeoutPolicy::CLI`, or its own value) and reads its bounds from it.
|
||||
- Parsing a notification thread from the forge: `NotificationThread`. Every
|
||||
field is optional and lenient, so an unknown or reshaped field cannot fail
|
||||
the page the way `forgejo_api::structs::NotificationThread` does.
|
||||
- Supplying the token: `TokenSource`. `StaticToken` is a fixed string; a
|
||||
caller whose token can change implements the trait and rebuilds its client
|
||||
when `current()` returns a different value.
|
||||
|
||||
## Not here
|
||||
|
||||
Anything that decides what a notification means (delivery, read-state,
|
||||
filtering): that stays in `hive-forge-notify` and `hive-forge`.
|
||||
Loading…
Reference in a new issue