Struct Client

Source
pub struct Client { /* private fields */ }
Expand description

Client exposes the Postmark functionality to be easily used within rust applications.

The client can create its own internal reqwest::Client or one can be provided if there are specific configurations desired by the application.

Implementations§

Source§

impl Client

Source

pub async fn send_batch_emails( &self, emails: &[Email], ) -> Result<Vec<EmailResponse>, PostmarkClientError>

Sends a batch of Emails in a single request, each email in the batch has a corresponding EmailResponse in the result of this function.

https://postmarkapp.com/developer/api/email-api#send-batch-emails

Source

pub async fn send_batch_template_emails<M>( &self, email: &[TemplatedEmail<M>], ) -> Result<EmailResponse, PostmarkClientError>
where M: Serialize,

Sends a batch of template emails in a single request, each email in the batch has a corresponding EmailResoinse in the result of this function.

https://postmarkapp.com/developer/api/templates-api#send-batch-with-templates

Source

pub async fn send_email( &self, email: &Email, ) -> Result<EmailResponse, PostmarkClientError>

Source

pub async fn send_template_email<M>( &self, email: &TemplatedEmail<M>, ) -> Result<EmailResponse, PostmarkClientError>
where M: Serialize,

Source§

impl Client

Source

pub async fn get_delivery_stats( &self, ) -> Result<DeliveryStatsResponse, PostmarkClientError>

Lists all the bounce stats for the server the token is associated with.

https://postmarkapp.com/developer/api/bounce-api#delivery-stats

Source

pub async fn get_bounces( &self, query: &BouncesQueryParamaters, ) -> Result<BouncedEmailsReponse, PostmarkClientError>

The bounces search allows you to return up-to 10,000 bounces in a search. For searches where you’re looking to retrieve more than 10,000 bounces use parameters like todate and fromdate to filter the messages.

https://postmarkapp.com/developer/api/bounce-api#bounces

Source

pub async fn get_bounce( &self, bounce_id: &str, ) -> Result<BouncedEmail, PostmarkClientError>

Gets a single bounced email using the provided ID.

https://postmarkapp.com/developer/api/bounce-api#single-bounce

Source

pub async fn get_bounce_dump( &self, bounce_id: &str, ) -> Result<BounceDumpResponse, PostmarkClientError>

Gets the SMTP dump for the bounced email.

https://postmarkapp.com/developer/api/bounce-api#bounce-dump

Source

pub async fn activate_bounce( &self, bounce_id: &str, ) -> Result<ActivateBounceResponse, PostmarkClientError>

Reactivates thes email address in the bounced email

https://postmarkapp.com/developer/api/bounce-api#activate-bounce

Source§

impl Client

Source

pub fn new(token: String) -> Client

Create a new postmark client with the provided token

Source

pub fn new_with_client(token: String, http_client: Client) -> Client

Create a new postmark client with the provided reqwest client and token

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,