Crate ippanel_sms

Crate ippanel_sms 

Source
Expand description

§ippanel-sms

A Rust library for interacting with the IPPanel SMS web service.

§Features

  • Send single or bulk SMS messages
  • Send pattern-based (templated) messages
  • Fetch message statuses and details
  • Create message patterns
  • Retrieve account credit
  • Fetch inbox messages
  • Fully asynchronous
  • Strongly typed models for all API responses

§Examples

§Get Account Credit

use ippanel_sms::IppanelClient;
let client = IppanelClient::new(Some("YOUR_API_KEY".to_string()), None);
let credit = client.get_credit().await.unwrap();
println!("Credit: {}", credit);

§Send SMS

use ippanel_sms::IppanelClient;
let client = IppanelClient::new(Some("YOUR_API_KEY".to_string()), None);
let message_id = client.send("5000", &["09120000000"], "Hello from Rust!", "Test").await.unwrap();
println!("Message ID: {}", message_id);

§Get Message Info

use ippanel_sms::IppanelClient;
let client = IppanelClient::new(Some("YOUR_API_KEY".to_string()), None);
let msg = client.get_message(123456).await.unwrap();
println!("Message: {:?}", msg);

§Fetch Statuses

use ippanel_sms::IppanelClient;
let client = IppanelClient::new(Some("YOUR_API_KEY".to_string()), None);
let (statuses, page) = client.fetch_statuses(123456, 0, 10).await.unwrap();
println!("Statuses: {:?}, Page: {:?}", statuses, page);

§Fetch Inbox

use ippanel_sms::IppanelClient;
let client = IppanelClient::new(Some("YOUR_API_KEY".to_string()), None);
let (inbox, page) = client.fetch_inbox(1, 10).await.unwrap();
println!("Inbox: {:?}, Page: {:?}", inbox, page);

§Create Pattern

use ippanel_sms::IppanelClient;
let client = IppanelClient::new(Some("YOUR_API_KEY".to_string()), None);
let code = client.create_pattern("Your code is %code%", "Verification", &[("code".to_string(), "string".to_string())], "%", false).await.unwrap();
println!("Pattern code: {}", code);

§Send Pattern

use ippanel_sms::IppanelClient;
let client = IppanelClient::new(Some("YOUR_API_KEY".to_string()), None);
let message_id = client.send_pattern("PATTERN_CODE", "5000", "09120000000", &[("code".to_string(), "1234".to_string())]).await.unwrap();
println!("Pattern message ID: {}", message_id);

More documentation: GitHub

Re-exports§

pub use error::*;
pub use client::*;
pub use models::*;

Modules§

client
error
models