refactor(hive-forge): port CLI verbs to forgejo-api

This commit is contained in:
müde 2026-07-07 09:24:53 +02:00
commit 4636987469
36 changed files with 1463 additions and 1153 deletions

View file

@ -11,10 +11,11 @@
use anyhow::{Result, bail};
use clap::Args as ClapArgs;
use forgejo_api::structs::CreateIssueCommentOption;
use serde_json::json;
use crate::body;
use crate::client::Client;
use crate::client::{Client, index};
use crate::notify;
use crate::verbs::print_json;
@ -63,12 +64,21 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
}
}
let resp = client.post_json(
&format!("/repos/{repo}/issues/{}/comments", args.number),
&json!({ "body": body }),
)?;
let (owner, name) = client.owner_repo()?;
let resp = client
.api()
.issue_create_comment(
owner,
name,
index(args.number)?,
CreateIssueCommentOption {
body,
updated_at: None,
},
)
.send()?;
print_json(&json!({
"id": resp.get("id"),
"url": resp.get("html_url"),
"id": resp.id,
"url": resp.html_url,
}))
}