summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorCyborus <cyborus@cyborus.xyz>2023-11-17 19:31:36 +0100
committerCyborus <cyborus@cyborus.xyz>2023-11-17 19:31:36 +0100
commit6f5f95dc23d11109c0923ca10fbc6f3165472e63 (patch)
tree3c1f06cf288dcc62bf5af0ccef6e5c90bf0d0d20 /src/lib.rs
parentMerge pull request 'add base pr functionality' (#4) from pr into main (diff)
downloadforgejo-api-6f5f95dc23d11109c0923ca10fbc6f3165472e63.tar.xz
forgejo-api-6f5f95dc23d11109c0923ca10fbc6f3165472e63.zip
add release functionality
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index de92123..39abdaa 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -95,6 +95,16 @@ impl Forgejo {
self.execute(request).await
}
+ async fn post_form<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.post(url).form(body).build()?;
+ 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()?;