smsru
Typed Rust client for the SMS.RU HTTP API (sms/send).
This crate focuses on a small, explicit public API: strong domain types for inputs and a client that handles JSON responses. Transport details are internal and not exposed as public modules.
The client is async and expects a Tokio runtime.
MSRV
Minimum supported Rust version: 1.85 (edition 2024).
Quickstart
use ;
# async
Authentication
- API key:
Auth::api_id("...")? - Login + password:
Auth::login_password("login", "password")?
Request shapes
- One message to many recipients:
SendSms::to_many(Vec<RawPhoneNumber>, MessageText, SendOptions) - Per-recipient messages:
SendSms::per_recipient(BTreeMap<RawPhoneNumber, MessageText>, SendOptions)
use BTreeMap;
use ;
Phone numbers
RawPhoneNumberpreserves input as-is after trimming whitespace.PhoneNumber::parse(default_region, input)validates and normalizes to E.164. Convert toRawPhoneNumberwhen building requests.
Client configuration
Use SmsRuClient::builder(auth) to configure endpoint, timeout, and user_agent.
Responses and status codes
Responses preserve SMS.RU status codes via StatusCode. Known codes are mapped to KnownStatusCode through StatusCode::known_kind().
JSON-only transport
The client always sends json=1 and only supports JSON responses. JsonMode::Plain is rejected by the client.