pub struct ApiClient { /* private fields */ }Implementations§
Source§impl ApiClient
impl ApiClient
pub fn new(base_url: impl AsRef<str>) -> Result<Self>
pub fn with_basic_auth( self, username: impl Into<String>, token: impl Into<String>, ) -> Self
pub fn with_bearer_token(self, token: impl Into<String>) -> Self
pub fn with_genie_key(self, api_key: impl Into<String>) -> Self
pub fn with_retry_config(self, config: RetryConfig) -> Self
pub fn base_url(&self) -> &str
Sourcepub fn http_client(&self) -> &Client
pub fn http_client(&self) -> &Client
Returns a reference to the underlying HTTP client for raw requests (e.g., multipart uploads).
pub async fn get<T: DeserializeOwned>(&self, path: &str) -> Result<T>
pub async fn post<T: DeserializeOwned, B: Serialize + ?Sized>( &self, path: &str, body: &B, ) -> Result<T>
pub async fn put<T: DeserializeOwned, B: Serialize + ?Sized>( &self, path: &str, body: &B, ) -> Result<T>
pub async fn delete<T: DeserializeOwned>(&self, path: &str) -> Result<T>
pub async fn delete_with_body<T: DeserializeOwned, B: Serialize + ?Sized>( &self, path: &str, body: &B, ) -> Result<T>
Sourcepub async fn delete_no_content(&self, path: &str) -> Result<()>
pub async fn delete_no_content(&self, path: &str) -> Result<()>
DELETE that expects 204 No Content (no response body).
Sourcepub async fn get_text(&self, path: &str) -> Result<String>
pub async fn get_text(&self, path: &str) -> Result<String>
Get plain text content from an endpoint. Sets Accept: text/plain; charset=utf-8 header. Includes retry logic and rate limiting.
Sourcepub async fn get_bytes(&self, path: &str) -> Result<Vec<u8>>
pub async fn get_bytes(&self, path: &str) -> Result<Vec<u8>>
Get binary content from an endpoint. Includes retry logic and rate limiting.
pub async fn request<T: DeserializeOwned, B: Serialize + ?Sized>( &self, method: Method, path: &str, body: Option<&B>, ) -> Result<T>
pub fn apply_auth(&self, request: RequestBuilder) -> RequestBuilder
pub fn rate_limiter(&self) -> &RateLimiter
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ApiClient
impl !RefUnwindSafe for ApiClient
impl Send for ApiClient
impl Sync for ApiClient
impl Unpin for ApiClient
impl UnsafeUnpin for ApiClient
impl !UnwindSafe for ApiClient
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