pub struct MessageBuilder { /* private fields */ }
Expand description
Helps build a correct Pushover request.
Implementations§
Source§impl MessageBuilder
impl MessageBuilder
Sourcepub fn new(user_key: &str, application_token: &str, message: &str) -> Self
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)
Sourcepub fn modify_message(self, message: &str) -> MessageBuilder
pub fn modify_message(self, message: &str) -> MessageBuilder
Modifies the existing message.
Sourcepub fn set_title(self, title: &str) -> MessageBuilder
pub fn set_title(self, title: &str) -> MessageBuilder
Sets a title to your message
Sourcepub fn add_title(self, title: &str) -> MessageBuilder
👎Deprecated since 0.3.12: Please use set_title instead.
pub fn add_title(self, title: &str) -> MessageBuilder
Adds a title to your message
Sourcepub fn remove_title(self) -> MessageBuilder
pub fn remove_title(self) -> MessageBuilder
Removes the title. The title will be defaulted to your application name.
Sourcepub fn set_url(self, url: &str, url_title: Option<&str>) -> MessageBuilder
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.
Sourcepub fn add_url(self, url: &str, url_title: Option<&str>) -> MessageBuilder
👎Deprecated since 0.3.12: Please use set_url instead.
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.
Sourcepub fn remove_url(self) -> MessageBuilder
pub fn remove_url(self) -> MessageBuilder
Removes both the url and url title from your message
Sourcepub fn set_priority(self, priority: i8) -> MessageBuilder
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.
Sourcepub fn remove_priority(self) -> MessageBuilder
pub fn remove_priority(self) -> MessageBuilder
Resets the priority to default (0, normal)
Sourcepub fn set_sound(self, sound: PushoverSound) -> MessageBuilder
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
Sourcepub fn remove_sound(self) -> MessageBuilder
pub fn remove_sound(self) -> MessageBuilder
Removes the custom sound and reverts to the default sound.
Sourcepub fn set_timestamp(self, unix_timestamp: u64) -> MessageBuilder
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
Sourcepub fn remove_timestamp(self) -> MessageBuilder
pub fn remove_timestamp(self) -> MessageBuilder
Resets the custom unix timestamp
Sourcepub fn set_device(self, device_name: &str) -> MessageBuilder
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.
Sourcepub fn remove_device(self) -> MessageBuilder
pub fn remove_device(self) -> MessageBuilder
Clears the device if set.
Sourcepub fn set_ttl(self, ttl_secs: u32) -> MessageBuilder
pub fn set_ttl(self, ttl_secs: u32) -> MessageBuilder
Set the TTL (Time to Live), in seconds