aws-sdk-pinpoint 1.59.0

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

/// <p>Provides information about a session.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Session {
    /// <p>The duration of the session, in milliseconds.</p>
    pub duration: ::std::option::Option<i32>,
    /// <p>The unique identifier for the session.</p>
    pub id: ::std::option::Option<::std::string::String>,
    /// <p>The date and time when the session began.</p>
    pub start_timestamp: ::std::option::Option<::std::string::String>,
    /// <p>The date and time when the session ended.</p>
    pub stop_timestamp: ::std::option::Option<::std::string::String>,
}
impl Session {
    /// <p>The duration of the session, in milliseconds.</p>
    pub fn duration(&self) -> ::std::option::Option<i32> {
        self.duration
    }
    /// <p>The unique identifier for the session.</p>
    pub fn id(&self) -> ::std::option::Option<&str> {
        self.id.as_deref()
    }
    /// <p>The date and time when the session began.</p>
    pub fn start_timestamp(&self) -> ::std::option::Option<&str> {
        self.start_timestamp.as_deref()
    }
    /// <p>The date and time when the session ended.</p>
    pub fn stop_timestamp(&self) -> ::std::option::Option<&str> {
        self.stop_timestamp.as_deref()
    }
}
impl Session {
    /// Creates a new builder-style object to manufacture [`Session`](crate::types::Session).
    pub fn builder() -> crate::types::builders::SessionBuilder {
        crate::types::builders::SessionBuilder::default()
    }
}

/// A builder for [`Session`](crate::types::Session).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SessionBuilder {
    pub(crate) duration: ::std::option::Option<i32>,
    pub(crate) id: ::std::option::Option<::std::string::String>,
    pub(crate) start_timestamp: ::std::option::Option<::std::string::String>,
    pub(crate) stop_timestamp: ::std::option::Option<::std::string::String>,
}
impl SessionBuilder {
    /// <p>The duration of the session, in milliseconds.</p>
    pub fn duration(mut self, input: i32) -> Self {
        self.duration = ::std::option::Option::Some(input);
        self
    }
    /// <p>The duration of the session, in milliseconds.</p>
    pub fn set_duration(mut self, input: ::std::option::Option<i32>) -> Self {
        self.duration = input;
        self
    }
    /// <p>The duration of the session, in milliseconds.</p>
    pub fn get_duration(&self) -> &::std::option::Option<i32> {
        &self.duration
    }
    /// <p>The unique identifier for the session.</p>
    /// This field is required.
    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The unique identifier for the session.</p>
    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.id = input;
        self
    }
    /// <p>The unique identifier for the session.</p>
    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.id
    }
    /// <p>The date and time when the session began.</p>
    /// This field is required.
    pub fn start_timestamp(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.start_timestamp = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The date and time when the session began.</p>
    pub fn set_start_timestamp(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.start_timestamp = input;
        self
    }
    /// <p>The date and time when the session began.</p>
    pub fn get_start_timestamp(&self) -> &::std::option::Option<::std::string::String> {
        &self.start_timestamp
    }
    /// <p>The date and time when the session ended.</p>
    pub fn stop_timestamp(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.stop_timestamp = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The date and time when the session ended.</p>
    pub fn set_stop_timestamp(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.stop_timestamp = input;
        self
    }
    /// <p>The date and time when the session ended.</p>
    pub fn get_stop_timestamp(&self) -> &::std::option::Option<::std::string::String> {
        &self.stop_timestamp
    }
    /// Consumes the builder and constructs a [`Session`](crate::types::Session).
    pub fn build(self) -> crate::types::Session {
        crate::types::Session {
            duration: self.duration,
            id: self.id,
            start_timestamp: self.start_timestamp,
            stop_timestamp: self.stop_timestamp,
        }
    }
}