📞 SignalWire SDK for Rust 🦀
The unofficial SDK for interacting with SignalWire's API using Rust. This library currently provides methods for authentication and managing phone numbers as it's still in development.
🚀 Features
- 🔐 Authenticate: Obtain JWT tokens for secure API access.
- 📞 Phone Number Management: Retrieve available and owned phone numbers.
- ⚡ Asynchronous Support: Built with async/await using Tokio.
- 🕛 Blocking Support: Support for synchronous operations.
📦 Installation
Add the following to your Cargo.toml:
[]
= "0.1.4"
= "0.15.0"
= { = "1.42.0", = ["full"] }
or install with cargo, in the root of your project:
or you can request the blocking version:
[]
= { = "0.1.4", = ["blocking"] }
⚙️ Configuration
You can use environment variables to manage sensitive data. Create a .env file in your project root:
SIGNALWIRE_SPACE_NAME=your_space_name
SIGNALWIRE_PROJECT_ID=your_project_id
SIGNALWIRE_API_KEY=your_api_key
📚 Usage ( Async )
Initialize the Client
use ;
use dotenv;
use env;
async
Get Available Phone Numbers
let client = new;
let query_params = new.build;
let available_numbers = client.get_phone_numbers_available.await?;
println!;
Get Owned Phone Numbers
let client = new;
let query_params = new.build;
let owned_numbers = client.get_phone_numbers_owned.await?;
println!;
🛡️ Error Handling
The SDK provides a custom error type, SignalWireError , to handle various error scenarios, such as:
- HttpError : Issues with HTTP requests.
- Unauthorized : Authentication failures.
- Unexpected : Other unexpected errors.
📜 License
This project is licensed under the BSD-3-Clause License
🤝 Contributing
Contributions are welcome! Please open an issue or submit a pull request.
📧 Contact
For questions or feedback, reach out to chiarel@tragdate.ninja