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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//! Async Rust SDK for the [Infobip SMS API].
//!
//! This crate wraps the latest revision of every Infobip SMS endpoint into
//! strongly-typed Rust structs and async methods on a single [`Client`].
//! Requests and responses are JSON; XML responses are not supported.
//!
//! [Infobip SMS API]: https://www.infobip.com/docs/api/channels/sms
//!
//! # Quick start
//!
//! ```no_run
//! use infobip_sms::{Auth, Client};
//! use infobip_sms::models::send::{
//! SmsMessage, SmsMessageContent, SmsRequest, SmsTextMessageContent, SmsToDestination,
//! };
//!
//! # async fn run() -> Result<(), infobip_sms::Error> {
//! // Your account base URL is shown in the Infobip portal — usually
//! // something like `https://xxxxx.api.infobip.com`.
//! let client = Client::builder()
//! .base_url("https://xxxxx.api.infobip.com")
//! .auth(Auth::api_key("YOUR_API_KEY"))
//! .build()?;
//!
//! let request = SmsRequest {
//! messages: vec![SmsMessage {
//! sender: Some("InfoSMS".into()),
//! destinations: vec![SmsToDestination {
//! to: "41793026727".into(),
//! ..Default::default()
//! }],
//! content: SmsMessageContent::Text(SmsTextMessageContent {
//! text: "Hello from Rust!".into(),
//! ..Default::default()
//! }),
//! ..Default::default()
//! }],
//! options: None,
//! };
//!
//! let response = client.send_messages(&request).await?;
//! println!("Bulk ID: {:?}", response.bulk_id);
//! # Ok(())
//! # }
//! ```
//!
//! # Endpoints
//!
//! Only the **latest** version of every endpoint is exposed. Deprecated v1
//! and v2 send / log / report endpoints are intentionally omitted.
//!
//! | Method | Path | Client method |
//! |---|---|---|
//! | `POST` | `/sms/3/messages` | [`Client::send_messages`] |
//! | `POST` | `/sms/1/preview` | [`Client::preview_message`] |
//! | `GET` | `/sms/3/reports` | [`Client::get_delivery_reports`] |
//! | `GET` | `/sms/3/logs` | [`Client::get_logs`] |
//! | `GET` | `/sms/1/inbox/reports` | [`Client::get_inbound_messages`] |
//! | `GET` | `/sms/1/bulks` | [`Client::get_scheduled_bulk`] |
//! | `PUT` | `/sms/1/bulks` | [`Client::reschedule_bulk`] |
//! | `GET` | `/sms/1/bulks/status` | [`Client::get_bulk_status`] |
//! | `PUT` | `/sms/1/bulks/status` | [`Client::update_bulk_status`] |
//! | `POST` | `/ct/1/log/end/{messageId}` | [`Client::end_conversion_log`] |
//!
//! # Authentication
//!
//! Every Infobip endpoint accepts four authentication schemes. Pick one
//! that matches what your account is provisioned for:
//!
//! ```no_run
//! use infobip_sms::Auth;
//!
//! // `Authorization: App <key>` — recommended for service-to-service.
//! let _ = Auth::api_key("YOUR_API_KEY");
//!
//! // HTTP Basic auth.
//! let _ = Auth::basic("username", "password");
//!
//! // `Authorization: IBSSO <token>` — Infobip Single Sign-On.
//! let _ = Auth::ibsso("YOUR_IBSSO_TOKEN");
//!
//! // `Authorization: Bearer <token>` — OAuth2 client credentials.
//! let _ = Auth::bearer("YOUR_OAUTH2_TOKEN");
//! ```
//!
//! See [`Auth`] for details.
//!
//! # Error handling
//!
//! Every fallible call returns [`Result<T, Error>`](Error). The two main
//! error variants you care about are:
//!
//! - [`Error::Api`] — emitted by the v3 endpoints (`/sms/3/*`). Wraps a
//! structured [`ApiError`] with `errorCode`, `description`, `action`,
//! and a list of validation violations.
//! - [`Error::Exception`] — emitted by the legacy `/sms/1/*` endpoints.
//! Wraps an [`ApiException`] with a `messageId` / `text` pair.
//!
//! Inspect the HTTP status via the `status` field on either variant. See
//! the [`error`] module for the full type tree.
//!
//! # Models and webhooks
//!
//! All wire schemas live in [`models`]. The [`models::webhooks`] module
//! exposes the payload shapes Infobip POSTs to your callback URLs — use
//! them as `Deserialize` targets in your webhook handlers.
//!
//! # Building blocks
//!
//! - [`Client`] — async, cheaply cloneable wrapper around a
//! [`reqwest::Client`].
//! - [`ClientBuilder`] — configure base URL, auth, timeout, user-agent,
//! or supply a custom `reqwest::Client`.
//! - [`Auth`] — authentication scheme.
//!
//! # Cargo features
//!
//! No optional features are exposed in this version. The default feature
//! set links `reqwest` with `rustls-tls`; if you need `native-tls`
//! instead, build a `reqwest::Client` yourself and hand it to
//! [`ClientBuilder::http_client`].
//!
//! # MSRV
//!
//! Edition 2024. The crate tracks the latest stable Rust release.
pub use ;
pub use ;