aws-sdk-pinpoint 1.94.0

AWS SDK for Amazon Pinpoint
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Specifies the content and settings for a push notification that's sent to recipients of a campaign.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Message {
    /// <p>The action to occur if a recipient taps the push notification. Valid values are:</p>
    /// <ul>
    /// <li>
    /// <p>OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action.</p></li>
    /// <li>
    /// <p>DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the deep-linking features of iOS and Android.</p></li>
    /// <li>
    /// <p>URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify.</p></li>
    /// </ul>
    pub action: ::std::option::Option<crate::types::Action>,
    /// <p>The body of the notification message. The maximum number of characters is 200.</p>
    pub body: ::std::option::Option<::std::string::String>,
    /// <p>The URL of the image to display as the push-notification icon, such as the icon for the app.</p>
    pub image_icon_url: ::std::option::Option<::std::string::String>,
    /// <p>The URL of the image to display as the small, push-notification icon, such as a small version of the icon for the app.</p>
    pub image_small_icon_url: ::std::option::Option<::std::string::String>,
    /// <p>The URL of an image to display in the push notification.</p>
    pub image_url: ::std::option::Option<::std::string::String>,
    /// <p>The JSON payload to use for a silent push notification.</p>
    pub json_body: ::std::option::Option<::std::string::String>,
    /// <p>The URL of the image or video to display in the push notification.</p>
    pub media_url: ::std::option::Option<::std::string::String>,
    /// <p>The raw, JSON-formatted string to use as the payload for the notification message. If specified, this value overrides all other content for the message.</p>
    pub raw_content: ::std::option::Option<::std::string::String>,
    /// <p>Specifies whether the notification is a silent push notification, which is a push notification that doesn't display on a recipient's device. Silent push notifications can be used for cases such as updating an app's configuration, displaying messages in an in-app message center, or supporting phone home functionality.</p>
    pub silent_push: ::std::option::Option<bool>,
    /// <p>The number of seconds that the push-notification service should keep the message, if the service is unable to deliver the notification the first time. This value is converted to an expiration value when it's sent to a push-notification service. If this value is 0, the service treats the notification as if it expires immediately and the service doesn't store or try to deliver the notification again.</p>
    /// <p>This value doesn't apply to messages that are sent through the Amazon Device Messaging (ADM) service.</p>
    pub time_to_live: ::std::option::Option<i32>,
    /// <p>The title to display above the notification message on a recipient's device.</p>
    pub title: ::std::option::Option<::std::string::String>,
    /// <p>The URL to open in a recipient's default mobile browser, if a recipient taps the push notification and the value of the Action property is URL.</p>
    pub url: ::std::option::Option<::std::string::String>,
}
impl Message {
    /// <p>The action to occur if a recipient taps the push notification. Valid values are:</p>
    /// <ul>
    /// <li>
    /// <p>OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action.</p></li>
    /// <li>
    /// <p>DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the deep-linking features of iOS and Android.</p></li>
    /// <li>
    /// <p>URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify.</p></li>
    /// </ul>
    pub fn action(&self) -> ::std::option::Option<&crate::types::Action> {
        self.action.as_ref()
    }
    /// <p>The body of the notification message. The maximum number of characters is 200.</p>
    pub fn body(&self) -> ::std::option::Option<&str> {
        self.body.as_deref()
    }
    /// <p>The URL of the image to display as the push-notification icon, such as the icon for the app.</p>
    pub fn image_icon_url(&self) -> ::std::option::Option<&str> {
        self.image_icon_url.as_deref()
    }
    /// <p>The URL of the image to display as the small, push-notification icon, such as a small version of the icon for the app.</p>
    pub fn image_small_icon_url(&self) -> ::std::option::Option<&str> {
        self.image_small_icon_url.as_deref()
    }
    /// <p>The URL of an image to display in the push notification.</p>
    pub fn image_url(&self) -> ::std::option::Option<&str> {
        self.image_url.as_deref()
    }
    /// <p>The JSON payload to use for a silent push notification.</p>
    pub fn json_body(&self) -> ::std::option::Option<&str> {
        self.json_body.as_deref()
    }
    /// <p>The URL of the image or video to display in the push notification.</p>
    pub fn media_url(&self) -> ::std::option::Option<&str> {
        self.media_url.as_deref()
    }
    /// <p>The raw, JSON-formatted string to use as the payload for the notification message. If specified, this value overrides all other content for the message.</p>
    pub fn raw_content(&self) -> ::std::option::Option<&str> {
        self.raw_content.as_deref()
    }
    /// <p>Specifies whether the notification is a silent push notification, which is a push notification that doesn't display on a recipient's device. Silent push notifications can be used for cases such as updating an app's configuration, displaying messages in an in-app message center, or supporting phone home functionality.</p>
    pub fn silent_push(&self) -> ::std::option::Option<bool> {
        self.silent_push
    }
    /// <p>The number of seconds that the push-notification service should keep the message, if the service is unable to deliver the notification the first time. This value is converted to an expiration value when it's sent to a push-notification service. If this value is 0, the service treats the notification as if it expires immediately and the service doesn't store or try to deliver the notification again.</p>
    /// <p>This value doesn't apply to messages that are sent through the Amazon Device Messaging (ADM) service.</p>
    pub fn time_to_live(&self) -> ::std::option::Option<i32> {
        self.time_to_live
    }
    /// <p>The title to display above the notification message on a recipient's device.</p>
    pub fn title(&self) -> ::std::option::Option<&str> {
        self.title.as_deref()
    }
    /// <p>The URL to open in a recipient's default mobile browser, if a recipient taps the push notification and the value of the Action property is URL.</p>
    pub fn url(&self) -> ::std::option::Option<&str> {
        self.url.as_deref()
    }
}
impl Message {
    /// Creates a new builder-style object to manufacture [`Message`](crate::types::Message).
    pub fn builder() -> crate::types::builders::MessageBuilder {
        crate::types::builders::MessageBuilder::default()
    }
}

/// A builder for [`Message`](crate::types::Message).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct MessageBuilder {
    pub(crate) action: ::std::option::Option<crate::types::Action>,
    pub(crate) body: ::std::option::Option<::std::string::String>,
    pub(crate) image_icon_url: ::std::option::Option<::std::string::String>,
    pub(crate) image_small_icon_url: ::std::option::Option<::std::string::String>,
    pub(crate) image_url: ::std::option::Option<::std::string::String>,
    pub(crate) json_body: ::std::option::Option<::std::string::String>,
    pub(crate) media_url: ::std::option::Option<::std::string::String>,
    pub(crate) raw_content: ::std::option::Option<::std::string::String>,
    pub(crate) silent_push: ::std::option::Option<bool>,
    pub(crate) time_to_live: ::std::option::Option<i32>,
    pub(crate) title: ::std::option::Option<::std::string::String>,
    pub(crate) url: ::std::option::Option<::std::string::String>,
}
impl MessageBuilder {
    /// <p>The action to occur if a recipient taps the push notification. Valid values are:</p>
    /// <ul>
    /// <li>
    /// <p>OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action.</p></li>
    /// <li>
    /// <p>DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the deep-linking features of iOS and Android.</p></li>
    /// <li>
    /// <p>URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify.</p></li>
    /// </ul>
    pub fn action(mut self, input: crate::types::Action) -> Self {
        self.action = ::std::option::Option::Some(input);
        self
    }
    /// <p>The action to occur if a recipient taps the push notification. Valid values are:</p>
    /// <ul>
    /// <li>
    /// <p>OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action.</p></li>
    /// <li>
    /// <p>DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the deep-linking features of iOS and Android.</p></li>
    /// <li>
    /// <p>URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify.</p></li>
    /// </ul>
    pub fn set_action(mut self, input: ::std::option::Option<crate::types::Action>) -> Self {
        self.action = input;
        self
    }
    /// <p>The action to occur if a recipient taps the push notification. Valid values are:</p>
    /// <ul>
    /// <li>
    /// <p>OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action.</p></li>
    /// <li>
    /// <p>DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the deep-linking features of iOS and Android.</p></li>
    /// <li>
    /// <p>URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify.</p></li>
    /// </ul>
    pub fn get_action(&self) -> &::std::option::Option<crate::types::Action> {
        &self.action
    }
    /// <p>The body of the notification message. The maximum number of characters is 200.</p>
    pub fn body(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.body = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The body of the notification message. The maximum number of characters is 200.</p>
    pub fn set_body(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.body = input;
        self
    }
    /// <p>The body of the notification message. The maximum number of characters is 200.</p>
    pub fn get_body(&self) -> &::std::option::Option<::std::string::String> {
        &self.body
    }
    /// <p>The URL of the image to display as the push-notification icon, such as the icon for the app.</p>
    pub fn image_icon_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.image_icon_url = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The URL of the image to display as the push-notification icon, such as the icon for the app.</p>
    pub fn set_image_icon_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.image_icon_url = input;
        self
    }
    /// <p>The URL of the image to display as the push-notification icon, such as the icon for the app.</p>
    pub fn get_image_icon_url(&self) -> &::std::option::Option<::std::string::String> {
        &self.image_icon_url
    }
    /// <p>The URL of the image to display as the small, push-notification icon, such as a small version of the icon for the app.</p>
    pub fn image_small_icon_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.image_small_icon_url = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The URL of the image to display as the small, push-notification icon, such as a small version of the icon for the app.</p>
    pub fn set_image_small_icon_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.image_small_icon_url = input;
        self
    }
    /// <p>The URL of the image to display as the small, push-notification icon, such as a small version of the icon for the app.</p>
    pub fn get_image_small_icon_url(&self) -> &::std::option::Option<::std::string::String> {
        &self.image_small_icon_url
    }
    /// <p>The URL of an image to display in the push notification.</p>
    pub fn image_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.image_url = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The URL of an image to display in the push notification.</p>
    pub fn set_image_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.image_url = input;
        self
    }
    /// <p>The URL of an image to display in the push notification.</p>
    pub fn get_image_url(&self) -> &::std::option::Option<::std::string::String> {
        &self.image_url
    }
    /// <p>The JSON payload to use for a silent push notification.</p>
    pub fn json_body(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.json_body = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The JSON payload to use for a silent push notification.</p>
    pub fn set_json_body(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.json_body = input;
        self
    }
    /// <p>The JSON payload to use for a silent push notification.</p>
    pub fn get_json_body(&self) -> &::std::option::Option<::std::string::String> {
        &self.json_body
    }
    /// <p>The URL of the image or video to display in the push notification.</p>
    pub fn media_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.media_url = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The URL of the image or video to display in the push notification.</p>
    pub fn set_media_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.media_url = input;
        self
    }
    /// <p>The URL of the image or video to display in the push notification.</p>
    pub fn get_media_url(&self) -> &::std::option::Option<::std::string::String> {
        &self.media_url
    }
    /// <p>The raw, JSON-formatted string to use as the payload for the notification message. If specified, this value overrides all other content for the message.</p>
    pub fn raw_content(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.raw_content = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The raw, JSON-formatted string to use as the payload for the notification message. If specified, this value overrides all other content for the message.</p>
    pub fn set_raw_content(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.raw_content = input;
        self
    }
    /// <p>The raw, JSON-formatted string to use as the payload for the notification message. If specified, this value overrides all other content for the message.</p>
    pub fn get_raw_content(&self) -> &::std::option::Option<::std::string::String> {
        &self.raw_content
    }
    /// <p>Specifies whether the notification is a silent push notification, which is a push notification that doesn't display on a recipient's device. Silent push notifications can be used for cases such as updating an app's configuration, displaying messages in an in-app message center, or supporting phone home functionality.</p>
    pub fn silent_push(mut self, input: bool) -> Self {
        self.silent_push = ::std::option::Option::Some(input);
        self
    }
    /// <p>Specifies whether the notification is a silent push notification, which is a push notification that doesn't display on a recipient's device. Silent push notifications can be used for cases such as updating an app's configuration, displaying messages in an in-app message center, or supporting phone home functionality.</p>
    pub fn set_silent_push(mut self, input: ::std::option::Option<bool>) -> Self {
        self.silent_push = input;
        self
    }
    /// <p>Specifies whether the notification is a silent push notification, which is a push notification that doesn't display on a recipient's device. Silent push notifications can be used for cases such as updating an app's configuration, displaying messages in an in-app message center, or supporting phone home functionality.</p>
    pub fn get_silent_push(&self) -> &::std::option::Option<bool> {
        &self.silent_push
    }
    /// <p>The number of seconds that the push-notification service should keep the message, if the service is unable to deliver the notification the first time. This value is converted to an expiration value when it's sent to a push-notification service. If this value is 0, the service treats the notification as if it expires immediately and the service doesn't store or try to deliver the notification again.</p>
    /// <p>This value doesn't apply to messages that are sent through the Amazon Device Messaging (ADM) service.</p>
    pub fn time_to_live(mut self, input: i32) -> Self {
        self.time_to_live = ::std::option::Option::Some(input);
        self
    }
    /// <p>The number of seconds that the push-notification service should keep the message, if the service is unable to deliver the notification the first time. This value is converted to an expiration value when it's sent to a push-notification service. If this value is 0, the service treats the notification as if it expires immediately and the service doesn't store or try to deliver the notification again.</p>
    /// <p>This value doesn't apply to messages that are sent through the Amazon Device Messaging (ADM) service.</p>
    pub fn set_time_to_live(mut self, input: ::std::option::Option<i32>) -> Self {
        self.time_to_live = input;
        self
    }
    /// <p>The number of seconds that the push-notification service should keep the message, if the service is unable to deliver the notification the first time. This value is converted to an expiration value when it's sent to a push-notification service. If this value is 0, the service treats the notification as if it expires immediately and the service doesn't store or try to deliver the notification again.</p>
    /// <p>This value doesn't apply to messages that are sent through the Amazon Device Messaging (ADM) service.</p>
    pub fn get_time_to_live(&self) -> &::std::option::Option<i32> {
        &self.time_to_live
    }
    /// <p>The title to display above the notification message on a recipient's device.</p>
    pub fn title(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.title = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The title to display above the notification message on a recipient's device.</p>
    pub fn set_title(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.title = input;
        self
    }
    /// <p>The title to display above the notification message on a recipient's device.</p>
    pub fn get_title(&self) -> &::std::option::Option<::std::string::String> {
        &self.title
    }
    /// <p>The URL to open in a recipient's default mobile browser, if a recipient taps the push notification and the value of the Action property is URL.</p>
    pub fn url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.url = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The URL to open in a recipient's default mobile browser, if a recipient taps the push notification and the value of the Action property is URL.</p>
    pub fn set_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.url = input;
        self
    }
    /// <p>The URL to open in a recipient's default mobile browser, if a recipient taps the push notification and the value of the Action property is URL.</p>
    pub fn get_url(&self) -> &::std::option::Option<::std::string::String> {
        &self.url
    }
    /// Consumes the builder and constructs a [`Message`](crate::types::Message).
    pub fn build(self) -> crate::types::Message {
        crate::types::Message {
            action: self.action,
            body: self.body,
            image_icon_url: self.image_icon_url,
            image_small_icon_url: self.image_small_icon_url,
            image_url: self.image_url,
            json_body: self.json_body,
            media_url: self.media_url,
            raw_content: self.raw_content,
            silent_push: self.silent_push,
            time_to_live: self.time_to_live,
            title: self.title,
            url: self.url,
        }
    }
}