Struct pushover_rs::MessageBuilder
source · 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 add_title(self, title: &str) -> MessageBuilder
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 add_url(self, url: &str, url_title: Option<&str>) -> MessageBuilder
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 add_device(self, device_name: &str) -> MessageBuilder
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.
sourcepub fn set_devices(self, device_names: Vec<&str>) -> MessageBuilder
pub fn set_devices(self, device_names: Vec<&str>) -> MessageBuilder
Overrides the current devices list with device_names
sourcepub fn merge_devices(self, device_names: Vec<&str>) -> MessageBuilder
pub fn merge_devices(self, device_names: Vec<&str>) -> MessageBuilder
Merges the current devices list with device_names, duplicates are eliminated
sourcepub fn clear_devices_list(self) -> MessageBuilder
pub fn clear_devices_list(self) -> MessageBuilder
Clears the devices list entirely