MessageBuilder

Struct MessageBuilder 

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

Helps build a correct Pushover request.

Implementations§

Source§

impl MessageBuilder

Source

pub fn new(user_key: &str, application_token: &str, message: &str) -> Self

Creates a new MessageBuilder instance with the required minimal informations (User key, App token & Message)

Source

pub fn modify_message(self, message: &str) -> MessageBuilder

Modifies the existing message.

Source

pub fn set_title(self, title: &str) -> MessageBuilder

Sets a title to your message

Source

pub fn add_title(self, title: &str) -> MessageBuilder

👎Deprecated since 0.3.12: Please use set_title instead.

Adds a title to your message

Source

pub fn remove_title(self) -> MessageBuilder

Removes the title. The title will be defaulted to your application name.

Source

pub fn set_url(self, url: &str, url_title: Option<&str>) -> MessageBuilder

Sets an url (and optionally, an url title) to send along with your message.

If set, the URL title will be shown, otherwise the URL will be shown.

Source

pub fn add_url(self, url: &str, url_title: Option<&str>) -> MessageBuilder

👎Deprecated since 0.3.12: Please use set_url instead.

Adds an url (and optionally, an url title) to send along with your message.

If set, the URL title will be shown, otherwise the URL will be shown.

Source

pub fn remove_url(self) -> MessageBuilder

Removes both the url and url title from your message

Source

pub fn set_priority(self, priority: i8) -> MessageBuilder

Send as -2 to generate no notification/alert, -1 to always send as a quiet notification, 1 to display as high-priority and bypass the user’s quiet hours, or 2 to also require confirmation from the user.

Source

pub fn remove_priority(self) -> MessageBuilder

Resets the priority to default (0, normal)

Source

pub fn set_sound(self, sound: PushoverSound) -> MessageBuilder

Sets the sound to be used to notify the user.

See this list of available sounds: https://pushover.net/api#sounds

Source

pub fn remove_sound(self) -> MessageBuilder

Removes the custom sound and reverts to the default sound.

Source

pub fn set_timestamp(self, unix_timestamp: u64) -> MessageBuilder

Sets an Unix timestamp of your message’s date and time to display to the user, rather than the time your message is received by our API

Source

pub fn remove_timestamp(self) -> MessageBuilder

Resets the custom unix timestamp

Source

pub fn set_device(self, device_name: &str) -> MessageBuilder

Add a device name to send the notification to.

Overrides the current device if a new device name is set.

Source

pub fn remove_device(self) -> MessageBuilder

Clears the device if set.

Source

pub fn set_ttl(self, ttl_secs: u32) -> MessageBuilder

Set the TTL (Time to Live), in seconds

Source

pub fn build(self) -> Message

Transforms the MessageBuilder into a useable Message

Trait Implementations§

Source§

impl Debug for MessageBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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,