1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
//! Send messages, bulk messages, fetch/request sender ids, CRUD phonebooks.
//! # Examples
//!
//! ## Fetch Phonebooks.
//!
//! ```rust
//! use termii_rust::{async_impl::rest::termii, common::switch::campaign::PhoneBookItem};
//!
//! let client = termii::Termii::new("Your API key");
//!
//! let phonebooks: Vec<PhoneBookItem> = client.switch.campaign.get(Some(1)).await.unwrap();
//!
//! println!("{:?}", phonebooks);
//! ```
//! ### The above code is limited by termii's pagination. You can get all your phonebooks with the **all** function like such
//!
//! ```rust
//! let phonebooks: Vec<PhoneBookItem> = client.switch.campaign.all().await.unwrap();
//! ```
//!
//!
//! ## Send a message to a recipient.
//!
//! ```rust
//! use termii_rust::{
//! async_impl::rest::termii,
//! common::switch::messaging::{Channel, MessageRequest, MessageType},
//! };
//!
//! let client = termii::Termii::new("Your API key");
//!
//! let message_payload = MessageRequest::new(
//! "234XXXXXXXXXX".to_string(),
//! "Your org sender id".to_string(),
//! "Your message".to_string(),
//! MessageType::Plain,
//! Channel::Generic,
//! );
//!
//! let message_response = client.switch.messaging.send(message_payload).await.unwrap();
//!
//! println!("{:?}", message_response);
//! ```
//!
//!
//! ## Send a message to a recipient using termii's auto generated number.
//!
//! ```rust
//! use termii_rust::{async_impl::rest::termii, common::switch::number::NumberMessageRequest};
//!
//! let client = termii::Termii::new("Your API key");
//!
//! let message_payload =
//! NumberMessageRequest::new("234XXXXXXXXXX".to_string(), "Your message".to_string());
//!
//! let message_response = client.switch.number.send(message_payload).await.unwrap();
//!
//! println!("{:?}", message_response);
//! ```
//!
//!
//! ## Fetch your organization's sender ID's.
//!
//! ```rust
//! use termii_rust::async_impl::rest::termii;
//!
//! let client = termii::Termii::new("Your API key");
//!
//! let sender_id = client.switch.sender_id.get(Some("1")).await.unwrap();
//!
//! println!("{:?}", sender_id);
//! ```
//! ### The above code is limited by termii's pagination. You can get all your sender ID's with the **all** function like such
//!
//! ```rust
//! let sender_ids = client.switch.sender_id.all().await.unwrap();
//! ```
//!
//!
//! ## Set a template for your org's one time pin.
//!
//! ```rust
//! use termii_rust::{
//! async_impl::rest::termii,
//! common::switch::templates::{TemplatesData, TemplatesRequest},
//! };
//!
//! let client = termii::Termii::new("Your API key");
//!
//! let templates_data =
//! TemplatesData::new("Termii", "325821".to_string(), "10 minutes".to_string());
//!
//! let templates_payload = TemplatesRequest::new(
//! "+234XXXXXXXXXX".to_string(),
//! "talert".to_string(),
//! "1493-csdn3-ns34w-sd3434-dfdf".to_string(),
//! templates_data,
//! );
//!
//! let templates_response = client
//! .switch
//! .templates
//! .send(templates_payload)
//! .await
//! .unwrap();
//!
//! println!("{:?}", templates_response);
//! ```
pub mod switch;
pub use switch::*;
pub mod templates;
pub use templates::*;
pub mod sender_id;
pub use sender_id::*;
pub mod campaign;
pub use campaign::*;
pub mod number;
pub use number::*;
pub mod messaging;
pub use messaging::*;