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
//! Async client for the [voip.ms](https://voip.ms) REST API.
//!
//! # Quick start
//!
//! ```no_run
//! use voip_ms::{Client, GetBalanceParams, GetBalanceResponse};
//!
//! # async fn run() -> voip_ms::Result<()> {
//! let client = Client::new("you@example.com", "your-api-password");
//! let balance: GetBalanceResponse = client
//! .get_balance(&GetBalanceParams { advanced: Some(true) })
//! .await?;
//! println!("{balance:#?}");
//! # Ok(()) }
//! ```
//!
//! # Design
//!
//! Every voip.ms API method gets a typed `*Params` request struct (with all
//! fields wrapped in [`Option`] and skipped when `None`) and a method on
//! [`Client`]. The default method deserializes into a generated `*Response`
//! struct; each generated method also has a `*_raw` variant that returns
//! [`serde_json::Value`]. The
//! crate ships a generated `*Response` struct per method (e.g.
//! `GetBalanceResponse`, `GetDIDsInfoResponse`) inferred from the official
//! API documentation's example output, so default calls can deserialize
//! into a known shape without callers writing their own structs.
//!
//! # Authentication
//!
//! voip.ms uses an `api_username` (your account email) and an `api_password`
//! that is **distinct** from your portal password — generate it under the
//! "SOAP and REST/JSON API" page in the customer portal and enable API access
//! there.
//!
//! ## IP allow-listing
//!
//! By default **no IP address** may consume the voip.ms API. Under
//! "Main Menu" → "SOAP & REST/JSON API" in the portal, add the IP address(es)
//! you'll call from and save. The portal accepts individual addresses, CIDR
//! ranges, wildcard forms (`192.168.1.*`), and DNS names. The sole exception
//! is `getIP` ([`Client::get_ip`]), which works without an allow-listed IP so
//! you can discover the address to add.
//!
//! # Wire format
//!
//! All calls are HTTP `GET` against the REST endpoint ([`DEFAULT_BASE_URL`],
//! `…/api/v1/rest.php`) with parameters in the query string. That endpoint
//! returns the `{ "status": ... }` JSON envelope directly, which this crate
//! deserializes — any status other than `success` surfaces as [`Error::Api`].
//! (The generic `…/api/v1/` endpoint instead defaults to `text/html` and
//! needs an explicit `content_type=json`; this crate does not use it.)
pub use ;
pub use ;
pub use *;
pub use ;