diff options
author | Cyborus <87248184+Cyborus04@users.noreply.github.com> | 2023-11-13 23:20:29 +0100 |
---|---|---|
committer | Cyborus <87248184+Cyborus04@users.noreply.github.com> | 2023-11-13 23:20:29 +0100 |
commit | 5d76734498225c396ac7664f13b2c3039af1f037 (patch) | |
tree | f5ce21132194fdb029c97b4723221294ccbc672b /src/lib.rs | |
parent | support `POST /repos/{owner}/{repo}/issues` (diff) | |
download | forgejo-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.rs | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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() { |