started gitea api impl #2
+13
-4
@@ -47,6 +47,10 @@ impl GiteaAPI {
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
if !res.status().is_success() {
|
||||
return Err(anyhow::anyhow!("Failed to comment: {}", res.status()));
|
||||
}
|
||||
|
||||
res.json::<Comment>().await.map_err(anyhow::Error::from)
|
||||
}
|
||||
|
||||
@@ -61,15 +65,20 @@ impl GiteaAPI {
|
||||
self.base_url, full_name, comment_id
|
||||
);
|
||||
|
||||
self.client
|
||||
let res = self
|
||||
.client
|
||||
.patch(url)
|
||||
.json(&json!({
|
||||
"body": body
|
||||
}))
|
||||
.send()
|
||||
.await
|
||||
.map(|_| ())
|
||||
.map_err(anyhow::Error::from)
|
||||
.await?;
|
||||
|
||||
if !res.status().is_success() {
|
||||
return Err(anyhow::anyhow!("Failed to comment: {}", res.status()));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user