rust api: patch

This commit is contained in:
Quaternions 2024-12-05 18:27:25 -08:00
parent 329eb1663c
commit 005f2ddaee

View File

@ -77,6 +77,11 @@ impl Context{
self.client.get(url) self.client.get(url)
.send().await .send().await
} }
async fn patch(&self,url:impl reqwest::IntoUrl,body:impl Into<reqwest::Body>)->Result<reqwest::Response,reqwest::Error>{
self.client.patch(url)
.body(body)
.send().await
}
pub async fn get_script(&self,config:GetScriptRequest)->Result<ScriptResponse,GetError>{ pub async fn get_script(&self,config:GetScriptRequest)->Result<ScriptResponse,GetError>{
let url_raw=format!("{}/scripts/{}",self.base_url,config.ScriptID.0); let url_raw=format!("{}/scripts/{}",self.base_url,config.ScriptID.0);
let url=reqwest::Url::parse(url_raw.as_str()).map_err(GetError::ParseError)?; let url=reqwest::Url::parse(url_raw.as_str()).map_err(GetError::ParseError)?;