ippanel-sms 0.1.0

A professional, asynchronous Rust client library for the IPPANEL SMS web service.
Documentation
# ippanel-sms


[![crates.io](https://img.shields.io/crates/v/ippanel-sms.svg)](https://crates.io/crates/ippanel-sms) [![docs.rs](https://docs.rs/ippanel-sms/badge.svg)](https://docs.rs/ippanel-sms/)

A professional, asynchronous Rust client library for the IPPANEL SMS web service. This crate provides a convenient and type-safe interface for sending SMS, managing patterns, checking credit, and more, making it easy to integrate IPPANEL SMS services into your Rust applications.

## [راهنما به زبان فارسی]README.fa.md


## 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

## Installation


Add this to your `Cargo.toml`:

```toml
[dependencies]
ippanel-sms = "<latest-version>"
```

Replace `<latest-version>` with the latest published version.

## Usage


```rust
use ippanel_sms::IppanelClient;

#[tokio::main]

async fn main() {
    let api_key = "your_api_key";
    let client = IppanelClient::new(Some(api_key.to_string()), None);
    let credit = client.get_credit().await.unwrap();
    println!("Your credit: {}", credit);
}
```


## Testing


Integration tests are provided in `tests/integration.rs`. To run the tests:

### Required Environment Variables


The following environment variables must be set before running the tests:

- `IPPANEL_API_KEY` – Your IPPANEL API key
- `IPPANEL_MOBILE_NUMBER` – A recipient mobile number (for sending tests)
- `IPPANEL_SENDER_NUMBER` – Your sender number (for sending tests)
- `IPPANEL_MESSAGE_ID` – A valid message ID (for status and message fetch tests)
- `IPPANEL_PATTERN_CODE` – A valid pattern code (for pattern send tests)

1. Set the required environment variables (see above).
2. Run:

```bash
cargo test --test integration
```

**Note:**
- The tests interact with the real IPPANEL API and may send actual SMS messages. Use test numbers and patterns where possible.
- Ensure your API key and other sensitive data are kept secure.

## License


This project is licensed under the MIT License.