#api-client #client #api #rust

smsaero

Library for sending SMS messages using the SmsAero API

1 stable release

1.0.0 Jul 22, 2024

#2095 in Web programming

MIT license

13KB
234 lines

SmsAero Rust Api client

Crates.io License: MIT

Library for sending SMS messages using the SmsAero API. Written in Rust.

Installation:

cargo install smsaero

Usage example:

Get credentials from account settings page: https://smsaero.ru/cabinet/settings/apikey/

use chrono::Utc;
use serde_json::Value;
use std::error::Error;
use smsaero::SmsAero;

const SMSAERO_EMAIL: &str = "your email";
const SMSAERO_API_KEY: &str = "your api key";

fn main() -> Result<(), Box<dyn Error>> {
    let client = SmsAero::new(
        SMSAERO_EMAIL.to_string(),
        SMSAERO_API_KEY.to_string(),
        None,
        None,
    );

    match client.send_sms("70000000000", "Hello, world!", None, None) {
        Ok(result) => println!("{}", result),
        Err(e) => eprintln!("SmsAero error: {}", e),
    }

    Ok(())
}

License

MIT License

Dependencies

~5–16MB
~210K SLoC