Crates.io | africastalking_gateway |
lib.rs | africastalking_gateway |
version | 0.1.0 |
source | src |
created_at | 2018-04-05 19:17:24.304884 |
updated_at | 2018-04-05 19:17:24.304884 |
description | A Rust library for communicating with the Africa's Talking REST API. |
homepage | https://github.com/rust-nairobi/africastalking-rust |
repository | https://github.com/rust-nairobi/africastalking-rust |
max_upload_size | |
id | 59123 |
size | 28,555 |
A Rust library for communicating with the Africa's Talking REST API.
cargo install --git https://github.com/rust-nairobi/africastalking-rust
extern crate africastalking_gateway;
use std::env;
use africastalking_gateway::AfricasTalkingGateway;
pub fn main() {
let username = "your-account-username";
let apikey = "your-api-key";
let env = "sandbox";
let gway = AfricasTalkingGateway::new(&username, &apikey, env);
println!(
"{}",
gway.send_message(
"+254702xxxxxx",
"hello Rustacean",
None, // these are optional parameters
None,
None,
None,
None,
None
).unwrap()
);
}
extern crate africastalking_gateway;
use std::env;
use africastalking_gateway::AfricasTalkingGateway;
pub fn main() {
let username = "your-account-username";
let apikey = "your-api-key";
let env = "sandbox";
let gway = AfricasTalkingGateway::new(&username, &apikey, &env);
println!("{}", gway.fetch_messages(0).unwrap());
}
extern crate africastalking_gateway;
extern crate serde_json;
use std::env;
use africastalking_gateway::AfricasTalkingGateway;
pub fn main() {
let username = "your-account-username";
let apikey = "your-api-key";
let env = "sandbox";
let gway = AfricasTalkingGateway::new(&username, &apikey, &env);
println!("{:?}", gateway.call("+254702xxxxxx", "+254702xxxxxx"));
// check queue status
println!("{:?}", gateway.get_queued_calls("+254702xxxxxx", None));
}
extern crate africastalking_gateway;
#[macro_use]
extern crate serde_json;
use std::env;
use africastalking_gateway::AfricasTalkingGateway;
pub fn main() {
let username = "your-account-username";
let apikey = "your-api-key";
let env = "sandbox";
let gway = AfricasTalkingGateway::new(&username, &apikey, &env);
let recipients = json!([
{
"phoneNumber": "+254702xxxxxx",
"amount": "KES 500"
}
]);
println!("{:?}", gateway.send_airtime(recipients));
}
This project is license used the MIT license. See LICENSE for more details.