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 add_title(self, title: &str) -> MessageBuilder

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 add_url(self, url: &str, url_title: Option<&str>) -> MessageBuilder

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 add_device(self, device_name: &str) -> MessageBuilder

Add a device name to send the notification to.

Ignores if the device name is already in the list.

source

pub fn set_devices(self, device_names: Vec<&str>) -> MessageBuilder

Overrides the current devices list with device_names

source

pub fn merge_devices(self, device_names: Vec<&str>) -> MessageBuilder

Merges the current devices list with device_names, duplicates are eliminated

source

pub fn clear_devices_list(self) -> MessageBuilder

Clears the devices list entirely

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · 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 Twhere U: From<T>,

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · 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