Skip to content

Commit

Permalink
Merge pull request #632 from sbenedicadb/content-cards
Browse files Browse the repository at this point in the history
adding docs for content cards release
  • Loading branch information
sbenedicadb authored Jun 25, 2024
2 parents 6a4e057 + 1e51d97 commit d9d0510
Show file tree
Hide file tree
Showing 12 changed files with 741 additions and 43 deletions.
36 changes: 30 additions & 6 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,15 @@ module.exports = {
]
},
{
title: "Code-based Experiences",
title: "Code-based Experiences & Content Cards",
path: "/edge/adobe-journey-optimizer/code-based",
pages: [
{
title: "API reference",
path: "/edge/adobe-journey-optimizer/code-based/api-reference"
},
{
title: "Tutorial",
title: "Code-based Tutorial",
path: "/edge/adobe-journey-optimizer/code-based/tutorial"
}
]
Expand All @@ -258,12 +258,28 @@ module.exports = {
path: "/edge/adobe-journey-optimizer/public-classes",
pages: [
{
title: "MessagingPushPayload",
path: "/edge/adobe-journey-optimizer/public-classes/messaging-push-payload"
title: "ContentCard",
path: "/edge/adobe-journey-optimizer/public-classes/content-card"
},
{
title: "PushTrackingStatus",
path: "/edge/adobe-journey-optimizer/public-classes/push-tracking-status"
title: "ContentCardSchemaData",
path: "/edge/adobe-journey-optimizer/public-classes/content-card-schema-data"
},
{
title: "ContentType",
path: "/edge/adobe-journey-optimizer/public-classes/content-type"
},
{
title: "HtmlContentSchemaData",
path: "/edge/adobe-journey-optimizer/public-classes/html-content-schema-data"
},
{
title: "InAppSchemaData",
path: "/edge/adobe-journey-optimizer/public-classes/inapp-schema-data"
},
{
title: "JsonContentSchemaData",
path: "/edge/adobe-journey-optimizer/public-classes/json-content-schema-data"
},
{
title: "Message",
Expand All @@ -273,6 +289,10 @@ module.exports = {
title: "MessagingEdgeEventType",
path: "/edge/adobe-journey-optimizer/public-classes/messaging-edge-event-type"
},
{
title: "MessagingPushPayload",
path: "/edge/adobe-journey-optimizer/public-classes/messaging-push-payload"
},
{
title: "Proposition",
path: "/edge/adobe-journey-optimizer/public-classes/proposition"
Expand All @@ -281,6 +301,10 @@ module.exports = {
title: "PropositionItem",
path: "/edge/adobe-journey-optimizer/public-classes/proposition-item"
},
{
title: "PushTrackingStatus",
path: "/edge/adobe-journey-optimizer/public-classes/push-tracking-status"
},
{
title: "Surface",
path: "/edge/adobe-journey-optimizer/public-classes/surface"
Expand Down
13 changes: 9 additions & 4 deletions src/pages/edge/adobe-journey-optimizer/code-based/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ This document guides you to integrating code-based experiences in your applicati

## Public Classes and Enums

* [Class - Proposition](../public-classes/proposition.md)
* [Class - PropositionItem](../public-classes/proposition-item.md)
* [Enum - MessagingEdgeEventType](../public-classes/messaging-edge-event-type.md)
* [Class - Surface](../public-classes/surface.md)
* [Class - ContentCard](./../public-classes/content-card.md)
* [Class - Proposition](./../public-classes/proposition.md)
* [Class - PropositionItem](./../public-classes/proposition-item.md)
* [Class - Surface](./../public-classes/surface.md)
* [Enum - MessagingEdgeEventType](./../public-classes/messaging-edge-event-type.md)
* [Schema Class - ContentCardSchemaData](./../public-classes/content-card-schema-data.md)
* [Schema Class - HtmlContentSchemaData](./../public-classes/html-content-schema-data.md)
* [Schema Class - InAppSchemaData](./../public-classes/inapp-schema-data.md)
* [Schema Class - JsonContentSchemaData](./../public-classes/json-content-schema-data.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
---
title: ContentCardSchemaData
description: The `ContentCardSchemaData` class represents a "content-card" proposition received from the remote, upon a personalization query request to the Experience Edge network.
keywords:
- Adobe Journey Optimizer
- Messaging
- Proposition
- Interface
- Android
- iOS
- Code-based Experiences
- Content Cards
---

# ContentCardSchemaData

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

## iOS Interface

```swift
@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

Tries to convert the `content` of this `ContentCardSchemaData` into a [`ContentCard`](./content-card.md) object.

Returns `nil` if the `contentType` is not equal to `.applicationJson` or the data in `content` is not decodable into a `ContentCard`.

#### Syntax

```swift
func getContentCard() -> ContentCard?
```

#### Example

```swift
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

```swift
public func track(_ interaction: String? = nil, withEdgeEventType eventType: MessagingEdgeEventType)
```

#### Parameters

* _interaction_ - a custom `String` value to be recorded in the interaction
* _eventType_ - the [`MessagingEdgeEventType`](./messaging-edge-event-type.md) to be used for the ensuing Edge Event

#### Example

```swift
var contentCardSchemaData: ContentCardSchemaData

// tracking a display
contentCardSchemaData.track(withEdgeEventType: .display)

// tracking a user interaction
contentCardSchemaData.track("itemSelected", withEdgeEventType: .interact)
```

## Android Interface

```java
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

Tries to convert the `content` of this `ContentCardSchemaData` into a [`ContentCard`](./content-card.md) object.

Returns `nil` if the `contentType` is not equal to `.applicationJson` or the data in `content` is not decodable into a `ContentCard`.

#### Syntax

```java
@Nullable public ContentCard getContentCard();
```

#### Example

```java
PropositionItem propositionItem;
ContentCardSchemaData contentCardSchemaData = propositionItem.getContentCardSchemaData();
if (contentCardSchemaData != null) {
ContentCard contentCard = contentCardSchemaData.getContentCard();
if (contentCard != null) {
// do something with the ContentCard object
}
}
```

### track

Tracks an interaction with the given `ContentCardSchemaData`.

#### Syntax

```java
public void track(final String interaction, final MessagingEdgeEventType eventType);
```

#### Parameters

* _interaction_ - a custom `String` value to be recorded in the interaction
* _eventType_ - the [`MessagingEdgeEventType`](./messaging-edge-event-type.md) to be used for the ensuing Edge Event

#### Example

```java
ContentCardSchemaData contentCardSchemaData;

// tracking a display
contentCardSchemaData.track(null, MessagingEdgeEventType.display);

// tracking a user interaction
contentCardSchemaData.track("itemSelected", MessagingEdgeEventType.interact);
```
Loading

0 comments on commit d9d0510

Please sign in to comment.