Edit in GitHubLog an issue

ContentCardSchemaData

Represents the proposition response object containing a content-card schema.

iOS Interface

Copied to your clipboard
@objc(AEPContentCardSchemaData)
@objcMembers
public 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 seconds
public let publishedDate: Int?
/// Date and time this content card will expire represented as epoch seconds
public let expiryDate: Int?
/// Dictionary containing any additional meta data for this content card
public let meta: [String: Any]?
...
}

Public functions


getContentCard - DEPRECATED

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 clipboard
func getContentCard() -> ContentCard?

Example

Copied to your clipboard
var propositionItem: PropositionItem
if 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 clipboard
public 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 clipboard
var contentCardSchemaData: ContentCardSchemaData
// tracking a display
contentCardSchemaData.track(withEdgeEventType: .display)
// tracking a user interaction
contentCardSchemaData.track("itemSelected", withEdgeEventType: .interact)

Android Interface

Copied to your clipboard
public class ContentCardSchemaData implements SchemaData {
private Object content;
private ContentType contentType;
private int publishedDate;
private int expiryDate;
private Map<String, Object> meta;
@Override
public 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

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 clipboard
val propisitionItem: PropositionItem
val contentCardData = item?.contentCardSchemaData
val contentCard = contentCardData?.contentCard
contentCard?.let {
// do something with the ContentCard object
}

Java

Copied to your clipboard
PropositionItem 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 clipboard
public 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 clipboard
val contentCardSchemaData = item?.contentCardSchemaData
// tracking a display
contentCardSchemaData?.track(null, MessagingEdgeEventType.DISPLAY)
// tracking a user interaction
contentCardSchemaData?.track("itemSelected", MessagingEdgeEventType.INTERACT)

Java

Copied to your clipboard
ContentCardSchemaData contentCardSchemaData;
// tracking a display
contentCardSchemaData.track(null, MessagingEdgeEventType.DISPLAY);
// tracking a user interaction
contentCardSchemaData.track("itemSelected", MessagingEdgeEventType.INTERACT);
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.