summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorCyborus <87248184+Cyborus04@users.noreply.github.com>2023-11-13 23:20:29 +0100
committerCyborus <87248184+Cyborus04@users.noreply.github.com>2023-11-13 23:20:29 +0100
commit5d76734498225c396ac7664f13b2c3039af1f037 (patch)
treef5ce21132194fdb029c97b4723221294ccbc672b /src/lib.rs
parentsupport `POST /repos/{owner}/{repo}/issues` (diff)
downloadforgejo-api-5d76734498225c396ac7664f13b2c3039af1f037.tar.xz
forgejo-api-5d76734498225c396ac7664f13b2c3039af1f037.zip
support getting, deleting, and patching issues
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 5cce27e..de92123 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -95,6 +95,22 @@ impl Forgejo {
self.execute(request).await
}
+ async fn delete(&self, path: &str) -> Result<(), ForgejoError> {
+ let url = self.url.join("api/v1/").unwrap().join(path).unwrap();
+ let request = self.client.delete(url).build()?;
+ self.execute(request).await
+ }
+
+ async fn patch<T: Serialize, U: DeserializeOwned>(
+ &self,
+ path: &str,
+ body: &T,
+ ) -> Result<U, ForgejoError> {
+ let url = self.url.join("api/v1/").unwrap().join(path).unwrap();
+ let request = self.client.patch(url).json(body).build()?;
+ self.execute(request).await
+ }
+
async fn execute<T: DeserializeOwned>(&self, request: Request) -> Result<T, ForgejoError> {
let response = self.client.execute(dbg!(request)).await?;
match response.status() {