Struct clickatell_api::one_api::Client
source · [−]pub struct Client { /* private fields */ }Expand description
Clickatell One messaging gateway client
Implementations
sourceimpl Client
impl Client
pub fn new(api_key: &str) -> Result<Self>
pub fn builder() -> ClientBuilder
sourcepub async fn send_messages(
&self,
send_messages_request: Request
) -> Result<Response>
pub async fn send_messages(
&self,
send_messages_request: Request
) -> Result<Response>
Send messages via the gateway
A return of Ok does not mean the messages have been successfully delivered, only that
the messages have been accepted by the gateway. Message status can be queried with
message_status.
ⓘ
let mut request = send_messages::Request::new();
request.add_message(Channel::SMS, to, "This is an SMS message");
request.add_message(Channel::WhatsApp, to, "This is a WhatsApp message");
let response = client.send_messages(request).await?;
for message_response in response.messages() {
println!("{} {}", message_response.to, message_response.message_id());
}sourcepub async fn message_status(&self, request: Request) -> Result<Response>
pub async fn message_status(&self, request: Request) -> Result<Response>
Query the delivery status of a message
ⓘ
let request = message_status::Request::new(message_id);
let status_response = client.message_status(request).await?;
println!("Status: {}", status_response.status())Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more