aws-sdk-pinpoint 1.49.0

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

/// <p>Specifies information about an event that reports data to Amazon Pinpoint.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Event {
    /// <p>The package name of the app that's recording the event.</p>
    pub app_package_name: ::std::option::Option<::std::string::String>,
    /// <p>The title of the app that's recording the event.</p>
    pub app_title: ::std::option::Option<::std::string::String>,
    /// <p>The version number of the app that's recording the event.</p>
    pub app_version_code: ::std::option::Option<::std::string::String>,
    /// <p>One or more custom attributes that are associated with the event.</p>
    pub attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    /// <p>The version of the SDK that's running on the client device.</p>
    pub client_sdk_version: ::std::option::Option<::std::string::String>,
    /// <p>The name of the event.</p>
    pub event_type: ::std::option::Option<::std::string::String>,
    /// <p>One or more custom metrics that are associated with the event.</p>
    pub metrics: ::std::option::Option<::std::collections::HashMap<::std::string::String, f64>>,
    /// <p>The name of the SDK that's being used to record the event.</p>
    pub sdk_name: ::std::option::Option<::std::string::String>,
    /// <p>Information about the session in which the event occurred.</p>
    pub session: ::std::option::Option<crate::types::Session>,
    /// <p>The date and time, in ISO 8601 format, when the event occurred.</p>
    pub timestamp: ::std::option::Option<::std::string::String>,
}
impl Event {
    /// <p>The package name of the app that's recording the event.</p>
    pub fn app_package_name(&self) -> ::std::option::Option<&str> {
        self.app_package_name.as_deref()
    }
    /// <p>The title of the app that's recording the event.</p>
    pub fn app_title(&self) -> ::std::option::Option<&str> {
        self.app_title.as_deref()
    }
    /// <p>The version number of the app that's recording the event.</p>
    pub fn app_version_code(&self) -> ::std::option::Option<&str> {
        self.app_version_code.as_deref()
    }
    /// <p>One or more custom attributes that are associated with the event.</p>
    pub fn attributes(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.attributes.as_ref()
    }
    /// <p>The version of the SDK that's running on the client device.</p>
    pub fn client_sdk_version(&self) -> ::std::option::Option<&str> {
        self.client_sdk_version.as_deref()
    }
    /// <p>The name of the event.</p>
    pub fn event_type(&self) -> ::std::option::Option<&str> {
        self.event_type.as_deref()
    }
    /// <p>One or more custom metrics that are associated with the event.</p>
    pub fn metrics(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, f64>> {
        self.metrics.as_ref()
    }
    /// <p>The name of the SDK that's being used to record the event.</p>
    pub fn sdk_name(&self) -> ::std::option::Option<&str> {
        self.sdk_name.as_deref()
    }
    /// <p>Information about the session in which the event occurred.</p>
    pub fn session(&self) -> ::std::option::Option<&crate::types::Session> {
        self.session.as_ref()
    }
    /// <p>The date and time, in ISO 8601 format, when the event occurred.</p>
    pub fn timestamp(&self) -> ::std::option::Option<&str> {
        self.timestamp.as_deref()
    }
}
impl Event {
    /// Creates a new builder-style object to manufacture [`Event`](crate::types::Event).
    pub fn builder() -> crate::types::builders::EventBuilder {
        crate::types::builders::EventBuilder::default()
    }
}

/// A builder for [`Event`](crate::types::Event).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct EventBuilder {
    pub(crate) app_package_name: ::std::option::Option<::std::string::String>,
    pub(crate) app_title: ::std::option::Option<::std::string::String>,
    pub(crate) app_version_code: ::std::option::Option<::std::string::String>,
    pub(crate) attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    pub(crate) client_sdk_version: ::std::option::Option<::std::string::String>,
    pub(crate) event_type: ::std::option::Option<::std::string::String>,
    pub(crate) metrics: ::std::option::Option<::std::collections::HashMap<::std::string::String, f64>>,
    pub(crate) sdk_name: ::std::option::Option<::std::string::String>,
    pub(crate) session: ::std::option::Option<crate::types::Session>,
    pub(crate) timestamp: ::std::option::Option<::std::string::String>,
}
impl EventBuilder {
    /// <p>The package name of the app that's recording the event.</p>
    pub fn app_package_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.app_package_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The package name of the app that's recording the event.</p>
    pub fn set_app_package_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.app_package_name = input;
        self
    }
    /// <p>The package name of the app that's recording the event.</p>
    pub fn get_app_package_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.app_package_name
    }
    /// <p>The title of the app that's recording the event.</p>
    pub fn app_title(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.app_title = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The title of the app that's recording the event.</p>
    pub fn set_app_title(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.app_title = input;
        self
    }
    /// <p>The title of the app that's recording the event.</p>
    pub fn get_app_title(&self) -> &::std::option::Option<::std::string::String> {
        &self.app_title
    }
    /// <p>The version number of the app that's recording the event.</p>
    pub fn app_version_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.app_version_code = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The version number of the app that's recording the event.</p>
    pub fn set_app_version_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.app_version_code = input;
        self
    }
    /// <p>The version number of the app that's recording the event.</p>
    pub fn get_app_version_code(&self) -> &::std::option::Option<::std::string::String> {
        &self.app_version_code
    }
    /// Adds a key-value pair to `attributes`.
    ///
    /// To override the contents of this collection use [`set_attributes`](Self::set_attributes).
    ///
    /// <p>One or more custom attributes that are associated with the event.</p>
    pub fn attributes(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut hash_map = self.attributes.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.attributes = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>One or more custom attributes that are associated with the event.</p>
    pub fn set_attributes(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
        self.attributes = input;
        self
    }
    /// <p>One or more custom attributes that are associated with the event.</p>
    pub fn get_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.attributes
    }
    /// <p>The version of the SDK that's running on the client device.</p>
    pub fn client_sdk_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.client_sdk_version = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The version of the SDK that's running on the client device.</p>
    pub fn set_client_sdk_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.client_sdk_version = input;
        self
    }
    /// <p>The version of the SDK that's running on the client device.</p>
    pub fn get_client_sdk_version(&self) -> &::std::option::Option<::std::string::String> {
        &self.client_sdk_version
    }
    /// <p>The name of the event.</p>
    /// This field is required.
    pub fn event_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.event_type = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the event.</p>
    pub fn set_event_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.event_type = input;
        self
    }
    /// <p>The name of the event.</p>
    pub fn get_event_type(&self) -> &::std::option::Option<::std::string::String> {
        &self.event_type
    }
    /// Adds a key-value pair to `metrics`.
    ///
    /// To override the contents of this collection use [`set_metrics`](Self::set_metrics).
    ///
    /// <p>One or more custom metrics that are associated with the event.</p>
    pub fn metrics(mut self, k: impl ::std::convert::Into<::std::string::String>, v: f64) -> Self {
        let mut hash_map = self.metrics.unwrap_or_default();
        hash_map.insert(k.into(), v);
        self.metrics = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>One or more custom metrics that are associated with the event.</p>
    pub fn set_metrics(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, f64>>) -> Self {
        self.metrics = input;
        self
    }
    /// <p>One or more custom metrics that are associated with the event.</p>
    pub fn get_metrics(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, f64>> {
        &self.metrics
    }
    /// <p>The name of the SDK that's being used to record the event.</p>
    pub fn sdk_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.sdk_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the SDK that's being used to record the event.</p>
    pub fn set_sdk_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.sdk_name = input;
        self
    }
    /// <p>The name of the SDK that's being used to record the event.</p>
    pub fn get_sdk_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.sdk_name
    }
    /// <p>Information about the session in which the event occurred.</p>
    pub fn session(mut self, input: crate::types::Session) -> Self {
        self.session = ::std::option::Option::Some(input);
        self
    }
    /// <p>Information about the session in which the event occurred.</p>
    pub fn set_session(mut self, input: ::std::option::Option<crate::types::Session>) -> Self {
        self.session = input;
        self
    }
    /// <p>Information about the session in which the event occurred.</p>
    pub fn get_session(&self) -> &::std::option::Option<crate::types::Session> {
        &self.session
    }
    /// <p>The date and time, in ISO 8601 format, when the event occurred.</p>
    /// This field is required.
    pub fn timestamp(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.timestamp = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The date and time, in ISO 8601 format, when the event occurred.</p>
    pub fn set_timestamp(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.timestamp = input;
        self
    }
    /// <p>The date and time, in ISO 8601 format, when the event occurred.</p>
    pub fn get_timestamp(&self) -> &::std::option::Option<::std::string::String> {
        &self.timestamp
    }
    /// Consumes the builder and constructs a [`Event`](crate::types::Event).
    pub fn build(self) -> crate::types::Event {
        crate::types::Event {
            app_package_name: self.app_package_name,
            app_title: self.app_title,
            app_version_code: self.app_version_code,
            attributes: self.attributes,
            client_sdk_version: self.client_sdk_version,
            event_type: self.event_type,
            metrics: self.metrics,
            sdk_name: self.sdk_name,
            session: self.session,
            timestamp: self.timestamp,
        }
    }
}