diff options
Diffstat (limited to 'cli/src/api/connection.rs')
-rw-r--r-- | cli/src/api/connection.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/src/api/connection.rs b/cli/src/api/connection.rs index f1d7f1c..5505afb 100644 --- a/cli/src/api/connection.rs +++ b/cli/src/api/connection.rs @@ -33,4 +33,12 @@ impl Connection { .send_json(&data)? .into_string()?) } + + pub fn patch(&self, resource: &str, data: &str) -> Result<String, Box<dyn Error>> { + Ok(ureq::patch(&format!("{}/{}", &self.url, resource)) + .set("Authorization", &format!("Bearer {}", self.jwt_token)) + .set("Content-Type", "application/json") + .send_string(&data)? + .into_string()?) + } } |