pub struct Client { /* private fields */ }Expand description
Async ClickSend client. Cheap to clone (Arc inside).
Debug redacts the api key.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(username: impl Into<String>, api_key: impl Into<String>) -> Self
pub fn new(username: impl Into<String>, api_key: impl Into<String>) -> Self
New client with default settings (30s timeout, 10s connect, no retry,
clicksend-rs/<version> UA). Use Client::builder for more control.
§Panics
If username or api_key is empty. For non-panicking construction,
use ClientBuilder::build.
Sourcepub fn builder(
username: impl Into<String>,
api_key: impl Into<String>,
) -> ClientBuilder
pub fn builder( username: impl Into<String>, api_key: impl Into<String>, ) -> ClientBuilder
Configurable builder — set timeout, retry, custom HTTP client, base URL.
Sourcepub fn account(&self) -> AccountApi<'_>
pub fn account(&self) -> AccountApi<'_>
/account endpoints.
Sourcepub fn raw_request(&self, method: Method, path: &str) -> RequestBuilder
pub fn raw_request(&self, method: Method, path: &str) -> RequestBuilder
Pre-authenticated RequestBuilder for any path, for endpoints not
yet wrapped by this crate. path is appended to the base URL.
let resp: serde_json::Value = client
.raw_request(reqwest::Method::GET, "/contacts/lists")
.send().await?
.json().await?;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