ContentCardSchemaData
Represents the proposition response object containing a content-card
schema.
iOS Interface
Copied to your clipboard@objc(AEPContentCardSchemaData)@objcMemberspublic class ContentCardSchemaData: NSObject, Codable {/// Represents the content of the ContentCardSchemaData object. Its value's type is determined by `contentType`.public let content: Any/// Determines the value type of `content`.public let contentType: ContentType/// Date and time this content card was published represented as epoch secondspublic let publishedDate: Int?/// Date and time this content card will expire represented as epoch secondspublic let expiryDate: Int?/// Dictionary containing any additional meta data for this content cardpublic let meta: [String: Any]?...}
Public functions
getContentCard - DEPRECATED
Notice of deprecation
ContentCard
class is deprecated as of v5.2.0
(iOS) and will be removed in the next major release of the Messaging extension.
Tries to convert the content
of this ContentCardSchemaData
into a ContentCard
object.
Returns nil
if the contentType
is not equal to .applicationJson
or the data in content
is not decodable into a ContentCard
.
Syntax
Copied to your clipboardfunc getContentCard() -> ContentCard?
Example
Copied to your clipboardvar propositionItem: PropositionItemif let contentCardSchemaData = propositionItem.contentCardSchemaData,let contentCard = contentCardSchemaData.getContentCard() {// do something with the ContentCard object}
track(_:withEdgeEventType:)
Tracks an interaction with the given ContentCardSchemaData
.
Syntax
Copied to your clipboardpublic func track(_ interaction: String? = nil, withEdgeEventType eventType: MessagingEdgeEventType)
Parameters
- interaction - a custom
String
value to be recorded in the interaction - eventType - the
MessagingEdgeEventType
to be used for the ensuing Edge Event
Example
Copied to your clipboardvar contentCardSchemaData: ContentCardSchemaData// tracking a displaycontentCardSchemaData.track(withEdgeEventType: .display)// tracking a user interactioncontentCardSchemaData.track("itemSelected", withEdgeEventType: .interact)
Android Interface
Copied to your clipboardpublic class ContentCardSchemaData implements SchemaData {private Object content;private ContentType contentType;private int publishedDate;private int expiryDate;private Map<String, Object> meta;@Overridepublic Object getContent() {return content;}public ContentType getContentType() {return contentType;}public int getPublishedDate() {return publishedDate;}public int getExpiryDate() {return expiryDate;}@Nullable public Map<String, Object> getMeta() {return meta;}...}
Public functions
getContentCard - DEPRECATED
Notice of deprecation
ContentCard
class is deprecated as of v3.2.0
(Android) and will be removed in the next major release of the Messaging extension.
Tries to convert the content
of this ContentCardSchemaData
into a ContentCard
object.
Returns null
if the contentType
is not equal to ContentType.APPLICATION_JSON
or the data in content
is not decodable into a ContentCard
.
Syntax
Copied to your clipboard@Nullable public ContentCard getContentCard();
Example
Kotlin
Copied to your clipboardval propisitionItem: PropositionItemval contentCardData = item?.contentCardSchemaDataval contentCard = contentCardData?.contentCardcontentCard?.let {// do something with the ContentCard object}
Java
Copied to your clipboardPropositionItem propositionItem;ContentCardSchemaData contentCardSchemaData = propositionItem.getContentCardSchemaData();ContentCard contentCard = contentCardSchemaData.getContentCard();if (contentCard != null) {// do something with the ContentCard object}
track
Tracks an interaction with the given ContentCardSchemaData
.
Syntax
Copied to your clipboardpublic void track(final String interaction, final MessagingEdgeEventType eventType);
Parameters
- interaction - a custom
String
value to be recorded in the interaction - eventType - the
MessagingEdgeEventType
to be used for the ensuing Edge Event
Example
Kotlin
Copied to your clipboardval contentCardSchemaData = item?.contentCardSchemaData// tracking a displaycontentCardSchemaData?.track(null, MessagingEdgeEventType.DISPLAY)// tracking a user interactioncontentCardSchemaData?.track("itemSelected", MessagingEdgeEventType.INTERACT)
Java
Copied to your clipboardContentCardSchemaData contentCardSchemaData;// tracking a displaycontentCardSchemaData.track(null, MessagingEdgeEventType.DISPLAY);// tracking a user interactioncontentCardSchemaData.track("itemSelected", MessagingEdgeEventType.INTERACT);