1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//! # smsdev
//!
//! An async Rust SDK for the [SMSDev](https://www.smsdev.com.br/en/) SMS Gateway API.
//!
//! ## Features
//!
//! | Method | Description |
//! |---------------------|--------------------------------------------------|
//! | `send_sms` | Send one or many SMS messages (bulk supported) |
//! | `send_one` | Convenience wrapper to send a single SMS |
//! | `cancel` | Cancel scheduled messages by ID |
//! | `inbox` | Query received (MO) messages |
//! | `dlr` | Query delivery status of sent messages |
//! | `balance` | Get account SMS credit balance |
//! | `report` | Fetch a usage summary report by date range |
//!
//! ## Quick Start
//!
//! Add the dependency to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! smsdev = "0.1"
//! tokio = { version = "1", features = ["full"] }
//! ```
//!
//! ### Send an SMS
//!
//! ```rust,no_run
//! use smsdev::{SmsDev, models::SendSmsRequest};
//!
//! #[tokio::main]
//! async fn main() -> smsdev::Result<()> {
//! let client = SmsDev::new("YOUR_API_KEY");
//!
//! let result = client
//! .send_one(SendSmsRequest::new(
//! "YOUR_API_KEY",
//! 5511988887777_u64,
//! "Hello from the smsdev Rust SDK!",
//! ))
//! .await?;
//!
//! println!("Message queued with id: {}", result.id);
//! Ok(())
//! }
//! ```
//!
//! ### Check Account Balance
//!
//! ```rust,no_run
//! use smsdev::SmsDev;
//!
//! #[tokio::main]
//! async fn main() -> smsdev::Result<()> {
//! let client = SmsDev::new("YOUR_API_KEY");
//! let balance = client.balance().await?;
//! println!("SMS credits: {}", balance.sms_balance);
//! Ok(())
//! }
//! ```
//!
//! ### Bulk Send
//!
//! ```rust,no_run
//! use smsdev::{SmsDev, models::SendSmsRequest};
//!
//! #[tokio::main]
//! async fn main() -> smsdev::Result<()> {
//! let client = SmsDev::new("YOUR_API_KEY");
//!
//! let messages = vec![
//! SendSmsRequest::new("YOUR_API_KEY", 5511988887777, "Hi Alice!"),
//! SendSmsRequest::new("YOUR_API_KEY", 5521977776666, "Hi Bob!")
//! .refer("campaign-123"),
//! ];
//!
//! let results = client.send_sms(messages).await?;
//! for r in results {
//! println!("id={} ok={}", r.id, r.is_ok());
//! }
//! Ok(())
//! }
//! ```
//!
//! ## Authentication
//!
//! All requests are authenticated via an API key (*Chave Key*) which you can
//! find in your [SMSDev account profile](https://painel.smsdev.com.br/configuracao/conta/perfil).
//! Pass it once when constructing [`SmsDev`]; the client attaches it automatically
//! to every request.
pub use SmsDev;
pub use ;