Trait Client

Source
pub trait Client: Clone {
    type Error: Debug;

    // Required method
    fn request_with_body_and_query<B, Q, R>(
        &self,
        method: Method,
        path: &str,
        body: Option<&B>,
        query: Option<&Q>,
    ) -> Result<R, Self::Error>
       where B: Serialize,
             Q: Serialize,
             R: DeserializeOwned;

    // Provided methods
    fn request_with_body<B, R>(
        &self,
        method: Method,
        path: &str,
        body: &B,
    ) -> Result<R, Self::Error>
       where B: Serialize,
             R: DeserializeOwned { ... }
    fn request_with_query<Q, R>(
        &self,
        method: Method,
        path: &str,
        query: &Q,
    ) -> Result<R, Self::Error>
       where Q: Serialize,
             R: DeserializeOwned { ... }
    fn put<B, R>(&self, path: &str, body: &B) -> Result<R, Self::Error>
       where B: Serialize,
             R: DeserializeOwned { ... }
    fn post<B, R>(&self, path: &str, body: &B) -> Result<R, Self::Error>
       where B: Serialize,
             R: DeserializeOwned { ... }
    fn delete<B, R>(&self, path: &str, body: &B) -> Result<R, Self::Error>
       where B: Serialize,
             R: DeserializeOwned { ... }
    fn get<Q, R>(&self, path: &str, query: &Q) -> Result<R, Self::Error>
       where Q: Serialize,
             R: DeserializeOwned { ... }
}

Required Associated Types§

Required Methods§

Source

fn request_with_body_and_query<B, Q, R>( &self, method: Method, path: &str, body: Option<&B>, query: Option<&Q>, ) -> Result<R, Self::Error>

Transmit an authenticated request to a Proxmox VE API endpoint using the provided method, path, body, and query.

Provided Methods§

Source

fn request_with_body<B, R>( &self, method: Method, path: &str, body: &B, ) -> Result<R, Self::Error>

Source

fn request_with_query<Q, R>( &self, method: Method, path: &str, query: &Q, ) -> Result<R, Self::Error>

Source

fn put<B, R>(&self, path: &str, body: &B) -> Result<R, Self::Error>

Source

fn post<B, R>(&self, path: &str, body: &B) -> Result<R, Self::Error>

Source

fn delete<B, R>(&self, path: &str, body: &B) -> Result<R, Self::Error>

Source

fn get<Q, R>(&self, path: &str, query: &Q) -> Result<R, Self::Error>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> Client for &T
where T: Client,

Source§

type Error = <T as Client>::Error

Source§

fn request_with_body_and_query<B, Q, R>( &self, method: Method, path: &str, body: Option<&B>, query: Option<&Q>, ) -> Result<R, Self::Error>

Implementors§