pub struct Client { /* private fields */ }Expand description
HTTP client for making API requests
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(api_key: &str, options: SevkOptions) -> Self
pub fn new(api_key: &str, options: SevkOptions) -> Self
Create a new client with the given API key and options
Sourcepub async fn get<T: DeserializeOwned>(&self, path: &str) -> Result<T, Error>
pub async fn get<T: DeserializeOwned>(&self, path: &str) -> Result<T, Error>
Make a GET request
Sourcepub async fn get_with_params<T: DeserializeOwned>(
&self,
path: &str,
params: &[(&str, String)],
) -> Result<T, Error>
pub async fn get_with_params<T: DeserializeOwned>( &self, path: &str, params: &[(&str, String)], ) -> Result<T, Error>
Make a GET request with query parameters
Sourcepub async fn post<T: DeserializeOwned, B: Serialize>(
&self,
path: &str,
body: &B,
) -> Result<T, Error>
pub async fn post<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T, Error>
Make a POST request
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more