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