Skip to main content

clicksend_rs/
lib.rs

1#![warn(missing_docs)]
2
3//! Unofficial ClickSend SDK for Rust.
4//!
5//! Async by default. Enable the `blocking` feature for a sync mirror that
6//! does not pull in tokio at runtime (it uses [`reqwest::blocking`]).
7//!
8//! ```no_run
9//! # async fn run() -> Result<(), clicksend_rs::ClickSendError> {
10//! use clicksend_rs::{Client, SmsMessage, SmsMessageCollection};
11//! use std::time::Duration;
12//!
13//! let client = Client::builder("user", "key")
14//!     .timeout(Duration::from_secs(15))
15//!     .build()?;
16//!
17//! let coll = SmsMessageCollection::new(vec![
18//!     SmsMessage::new("+1234567890", "hello"),
19//! ]);
20//! let est = client.sms().price(&coll).await?;
21//! # let _ = est;
22//! # Ok(()) }
23//! ```
24
25pub mod client;
26pub mod errors;
27pub mod types;
28pub mod webhook;
29
30#[cfg(feature = "blocking")]
31pub mod blocking;
32
33pub use client::{
34    AccountApi, Client, ClientBuilder, EmailApi, MmsApi, RetryConfig, SmsApi, VoiceApi,
35};
36pub use errors::ClickSendError;
37pub use types::{
38    AccountData, ApiEnvelope, Currency, DeliveryReceiptWebhook, Email, EmailFrom, EmailRecipient,
39    InboundSmsWebhook, MmsMessage, MmsMessageCollection, Paginated, SmsHistoryItem,
40    SmsInboundItem, SmsMessage, SmsMessageCollection, SmsReceiptItem, SmsSendData,
41    SmsSendMessageResult, VoiceMessage, VoiceMessageCollection,
42};
43
44#[cfg(feature = "blocking")]
45pub use blocking::{BlockingClient, BlockingClientBuilder};