feat(hive-forge): add repo-create + repo-add-collaborator verbs

This commit is contained in:
atlas 2026-06-14 21:33:34 +02:00 committed by mara
commit 3790faf318
5 changed files with 168 additions and 0 deletions

View file

@ -206,6 +206,23 @@ impl Client {
decode_json(resp, &format!("PUT {url}"))
}
/// PUT a JSON body to `<api>/<path>` for an endpoint that returns
/// `204 No Content` (empty body), so there is nothing to decode.
/// Used by `repo-add-collaborator` (Forgejo's add-collaborator PUT
/// answers 204 on success).
pub fn put_no_content<B: Serialize>(&self, path: &str, body: &B) -> Result<()> {
let url = format!("{}{}", self.api(), path);
let resp = self
.http
.put(&url)
.header(CONTENT_TYPE, "application/json")
.json(body)
.send()
.context("PUT")?;
check_status(resp, &format!("PUT {url}"))?;
Ok(())
}
/// DELETE `<api>/<path>`. Optional JSON body for endpoints that
/// need it (Forgejo's subscription unwatch uses bodyless DELETE).
pub fn delete(&self, path: &str, body: Option<&Value>) -> Result<()> {