pub struct Client { /* private fields */ }
Expand description
HTTP client for CUFinder API
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(config: ClientConfig) -> Result<Self>
pub fn new(config: ClientConfig) -> Result<Self>
Create a new client with the given configuration
Sourcepub fn with_api_key(api_key: String) -> Result<Self>
pub fn with_api_key(api_key: String) -> Result<Self>
Create a new client with just an API key
Sourcepub async fn post<T>(&self, endpoint: &str, data: &T) -> Result<Value>where
T: Serialize,
pub async fn post<T>(&self, endpoint: &str, data: &T) -> Result<Value>where
T: Serialize,
Send a POST request to the API
Sourcepub fn http_client(&self) -> &ReqwestClient
pub fn http_client(&self) -> &ReqwestClient
Get the underlying HTTP client for advanced usage
Sourcepub fn config(&self) -> &ClientConfig
pub fn config(&self) -> &ClientConfig
Get the client configuration
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 !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