pub struct Client { /* private fields */ }Expand description
Async HTTP client for the Pakasir REST API.
Cloning a Client is cheap (the inner reqwest::Client is reference
counted) and safe across tasks. Build one with Client::new or
Client::builder and pass it into the service types.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(project: impl Into<String>, api_key: impl Into<String>) -> Self
pub fn new(project: impl Into<String>, api_key: impl Into<String>) -> Self
Build a client with default settings.
Same as Client::builder(project, api_key).build(). Credential
validation is deferred until the first Client::do_request call,
so this never fails.
Sourcepub fn builder(
project: impl Into<String>,
api_key: impl Into<String>,
) -> ClientBuilder
pub fn builder( project: impl Into<String>, api_key: impl Into<String>, ) -> ClientBuilder
Start a ClientBuilder.
Sourcepub fn qr(&self) -> &QrGenerator
pub fn qr(&self) -> &QrGenerator
Borrow the QR generator attached to this client.
Available only when the qr feature is enabled.
Sourcepub async fn do_request(
&self,
method: Method,
path: &str,
body: Option<Vec<u8>>,
) -> Result<Vec<u8>>
pub async fn do_request( &self, method: Method, path: &str, body: Option<Vec<u8>>, ) -> Result<Vec<u8>>
Send a request to the API.
This is the low-level entry point used by the service modules. It
validates credentials, builds the URL from base_url + path, applies
retry / backoff / Retry-After, enforces the response size limit,
and turns non-success responses into Error::Api.
The returned bytes are the raw response body; JSON decoding is left to the caller.