pub struct Messaging<'a> { /* private fields */ }
Implementations§
Source§impl<'a> Messaging<'a>
impl<'a> Messaging<'a>
Sourcepub async fn send(
&self,
message: MessageRequest,
) -> Result<MessageResponse, HttpError>
pub async fn send( &self, message: MessageRequest, ) -> Result<MessageResponse, HttpError>
Send a message to a recipient.
§Examples
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);
Sourcepub async fn send_bulk(
&self,
message: MessageBulkRequest,
) -> Result<MessageBulkResponse, HttpError>
pub async fn send_bulk( &self, message: MessageBulkRequest, ) -> Result<MessageBulkResponse, HttpError>
Send a message to multiple recipients.
§Examples
use termii_rust::{
async_impl::rest::termii,
common::switch::messaging::{
Channel, MessageBulkRequest, MessageBulkResponse, MessageType,
},
};
let client = termii::Termii::new("Your API key");
let message_bulk_payload = MessageBulkRequest::new(
vec!["234XXXXXXXXXX".to_string(), "234XXXXXXXXXX".to_string()],
"Your org sender id".to_string(),
"Your message".to_string(),
MessageType::Plain,
Channel::Generic,
);
let message_bulk_response = client
.switch
.messaging
.send_bulk(message_bulk_payload)
.await
.unwrap();
println!("{:?}", message_bulk_response);
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Messaging<'a>
impl<'a> !RefUnwindSafe for Messaging<'a>
impl<'a> Send for Messaging<'a>
impl<'a> Sync for Messaging<'a>
impl<'a> Unpin for Messaging<'a>
impl<'a> !UnwindSafe for Messaging<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more