mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-03 06:44:12 +00:00
23 lines
606 B
Rust
23 lines
606 B
Rust
use std::collections::HashMap;
|
|
|
|
use anyhow::Error;
|
|
use http::{Request, Response};
|
|
|
|
pub trait HttpClient<RequestBody, ResponseBody> {
|
|
fn get(
|
|
&self,
|
|
uri: &str,
|
|
extra_headers: Option<&HashMap<String, String>>,
|
|
) -> Result<Response<ResponseBody>, Error>;
|
|
|
|
fn post(
|
|
&self,
|
|
uri: &str,
|
|
body: Option<RequestBody>,
|
|
content_type: Option<&str>,
|
|
extra_headers: Option<&HashMap<String, String>>,
|
|
) -> Result<Response<ResponseBody>, Error>;
|
|
|
|
fn request(&self, request: Request<RequestBody>) -> Result<Response<ResponseBody>, Error>;
|
|
}
|