CarouselItem

Package 

com.salesforce.marketingcloud.pushmodels.rich.carousel

Class Declaration 

1data class CarouselItem(
2    val identifier: String,
3    val media: Media,
4    val title: Text? = null,
5    val subTitle: Text? = null,
6    val style: Style? = null,
7    val actions: List<Action>? = listOf(Action.OpenApp)
8) : Parcelable, PushView

Description 

A data class representing an individual item within a carousel template for Salesforce Marketing Cloud push notifications. This class implements both Parcelable for Android serialization and PushView interface.

Inheritance 

  • android.os.Parcelable
  • com.salesforce.marketingcloud.pushmodels.data.PushView

Constructors 

Primary Constructor 

1constructor(
2    identifier: String,
3    media: Media,
4    title: Text? = null,
5    subTitle: Text? = null,
6    style: Style? = null,
7    actions: List<Action>? = listOf(Action.OpenApp)
8)

Properties 

identifier 

1val identifier: String

Unique identifier for the carousel item.

media 

1val media: Media

Media content associated with this carousel item.

title 

1val title: Text?

Optional title text for the carousel item. Default is null.

subTitle 

1val subTitle: Text?

Optional subtitle text for the carousel item. Default is null.

style 

1open override val style: Style?

Optional styling configuration for the carousel item. Default is null. Overrides the style property from PushView.

actions 

1open override val actions: List<Action>?

Optional list of actions for the carousel item. Defaults to listOf(Action.OpenApp). Overrides the actions property from PushView.

Methods 

toJson 

1fun toJson(): JSONObject

Converts the carousel item to a JSON object representation.

Returns: JSONObject - JSON representation of the carousel item.

toString 

1open override fun toString(): String

Returns a string representation of the carousel item.

Returns: String - String representation of the object.