Skip to content

Commit

Permalink
Merge pull request #539 from sbenedicadb/main
Browse files Browse the repository at this point in the history
-update outdated api reference section for messaging and optimize
  • Loading branch information
sbenedicadb authored Mar 25, 2024
2 parents 43e8d92 + 85badf2 commit f60b944
Show file tree
Hide file tree
Showing 21 changed files with 1,024 additions and 72 deletions.
22 changes: 22 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,16 @@ module.exports = {
}
]
},
{
title: "Code-based Experiences",
path: "/edge/adobe-journey-optimizer/code-based",
pages: [
{
title: "API reference",
path: "/edge/adobe-journey-optimizer/code-based/api-reference"
}
]
},
{
title: "Public classes and enums",
path: "/edge/adobe-journey-optimizer/public-classes",
Expand All @@ -258,6 +268,18 @@ module.exports = {
{
title: "MessagingEdgeEventType",
path: "/edge/adobe-journey-optimizer/public-classes/messaging-edge-event-type"
},
{
title: "Proposition",
path: "/edge/adobe-journey-optimizer/public-classes/proposition"
},
{
title: "PropositionItem",
path: "/edge/adobe-journey-optimizer/public-classes/proposition-item"
},
{
title: "Surface",
path: "/edge/adobe-journey-optimizer/public-classes/surface"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ iOS

## Public classes

| Type | Android | (AEP 3.x) Swift | (AEP 3.x) Objective-C |
| Type | Android | (AEP 5.x) Swift | (AEP 5.x) Objective-C |
| :--- | :--- | :--- | :--- |
| class | `DecisionScope` | `DecisionScope` | `AEPDecisionScope` |
| class | `Proposition` | `Proposition` | `AEPProposition` |
| class | `Proposition` | `OptimizeProposition` | `AEPOptimizeProposition` |
| class | `Offer` | `Offer` | `AEPOffer` |

### DecisionScope
Expand All @@ -123,7 +123,7 @@ iOS

<Tabs query="platform=ios&api=decisionscope"/>

### Proposition
### Proposition/OptimizeProposition

This class represents the decision propositions received from the decisioning services, upon a personalization query request to the Experience Edge network.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ iOS

### Proposition tracking using Edge extension API

For more advanced tracking use cases, additional public methods are available in the `Offer` and `Proposition` classes. These methods can be used to generate XDM formatted data for `Experience Event - Proposition Interactions` and `Experience Event - Proposition Reference` field groups.
For more advanced tracking use cases, additional public methods are available in the `Offer` and `Proposition`/`OptimizeProposition` classes. These methods can be used to generate XDM formatted data for `Experience Event - Proposition Interactions` and `Experience Event - Proposition Reference` field groups.

<TabsBlock orientation="horizontal" slots="heading, content" repeat="2"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ Optimize.getPropositions(scopes, new AdobeCallbackWithError<Map<DecisionScope, P

```swift
static func getPropositions(for decisionScopes: [DecisionScope],
_ completion: @escaping ([DecisionScope: Proposition]?, Error?) -> Void)
_ completion: @escaping ([DecisionScope: OptimizeProposition]?, Error?) -> Void)
```

* _decisionScopes_ is an array of decision scopes for which propositions are requested.
* _completion_ is invoked with propositions dictionary of type `[DecisionScope: Proposition]`. An `Error` is returned if SDK fails to retrieve the propositions.
* _completion_ is invoked with propositions dictionary of type `[DecisionScope: OptimizeProposition]`. An `Error` is returned if SDK fails to retrieve the propositions.

#### Example

Expand Down Expand Up @@ -189,11 +189,11 @@ Optimize.getPropositions(for: [decisionScope1, decisionScope2]) { propositionsDi

```objc
+ (void) getPropositions: (NSArray<AEPDecisionScope*>* _Nonnull) decisionScopes
completion: (void (^ _Nonnull)(NSDictionary<AEPDecisionScope*, AEPProposition*>* _Nullable propositionsDict, NSError* _Nullable error)) completion;
completion: (void (^ _Nonnull)(NSDictionary<AEPDecisionScope*, AEPOptimizeProposition*>* _Nullable propositionsDict, NSError* _Nullable error)) completion;
```

* _decisionScopes_ is an array of decision scopes for which propositions are requested.
* _completion_ is invoked with propositions dictionary of type `NSDictionary<AEPDecisionScope*, AEPProposition*>`. An `NSError` is returned if SDK fails to retrieve the propositions.
* _completion_ is invoked with propositions dictionary of type `NSDictionary<AEPDecisionScope*, AEPOptimizeProposition*>`. An `NSError` is returned if SDK fails to retrieve the propositions.

#### Example

Expand All @@ -204,16 +204,16 @@ AEPDecisionScope* decisionScope1 = [[AEPDecisionScope alloc] initWithActivityId:
AEPDecisionScope* decisionScope2 = [[AEPDecisionScope alloc] initWithName: @"myScope"];

[AEPMobileOptimize getPropositions: @[decisionScope1, decisionScope2]
completion: ^(NSDictionary<AEPDecisionScope*, AEPProposition*>* propositionsDict, NSError* error) {
completion: ^(NSDictionary<AEPDecisionScope*, AEPOptimizeProposition*>* propositionsDict, NSError* error) {
if (error != nil) {
// handle error
return;
}

AEPProposition* proposition1 = propositionsDict[decisionScope1];
AEPOptimizeProposition* proposition1 = propositionsDict[decisionScope1];
// read proposition1 offers

AEPProposition* proposition2 = propositionsDict[decisionScope2];
AEPOptimizeProposition* proposition2 = propositionsDict[decisionScope2];
// read proposition2 offers
}];
```
Expand Down Expand Up @@ -255,10 +255,10 @@ Optimize.onPropositionsUpdate(new AdobeCallbackWithError<Map<DecisionScope, Prop
#### Syntax

```swift
static func onPropositionsUpdate(perform action: @escaping ([DecisionScope: Proposition]?) -> Void)
static func onPropositionsUpdate(perform action: @escaping ([DecisionScope: OptimizeProposition]?) -> Void)
```

* _action_ is invoked with propositions dictionary of type `[DecisionScope: Proposition]`.
* _action_ is invoked with propositions dictionary of type `[DecisionScope: OptimizeProposition]`.

#### Example

Expand All @@ -275,15 +275,15 @@ Optimize.onPropositionsUpdate { propositionsDict in
#### Syntax

```objc
+ (void) onPropositionsUpdate: (void (^ _Nonnull)(NSDictionary<AEPDecisionScope*, AEPProposition*>* _Nullable)) action;
+ (void) onPropositionsUpdate: (void (^ _Nonnull)(NSDictionary<AEPDecisionScope*, AEPOptimizeProposition*>* _Nullable)) action;
```

* _action_ is invoked with propositions dictionary of type `NSDictionary<AEPDecisionScope*, AEPProposition*>`.
* _action_ is invoked with propositions dictionary of type `NSDictionary<AEPDecisionScope*, AEPOptimizeProposition*>`.

#### Example

```objc
[AEPMobileOptimize onPropositionsUpdate: ^(NSDictionary<AEPDecisionScope*, AEPProposition*>* propositionsDict) {
[AEPMobileOptimize onPropositionsUpdate: ^(NSDictionary<AEPDecisionScope*, AEPOptimizeProposition*>* propositionsDict) {
// handle propositions
}];
```
Expand Down Expand Up @@ -538,9 +538,9 @@ public class Proposition {
#### Swift

```swift
/// `Proposition` class
@objc(AEPProposition)
public class Proposition: NSObject, Codable {
/// `OptimizeProposition` class
@objc(AEPOptimizeProposition)
public class OptimizeProposition: NSObject, Codable {

/// Unique proposition identifier
@objc public let id: String
Expand All @@ -556,18 +556,18 @@ public class Proposition: NSObject, Codable {
}
```

The `Proposition` class extension provides a method for generating XDM data for Proposition Reference field group which can be used for proposition tracking.
The `OptimizeProposition` class extension provides a method for generating XDM data for Proposition Reference field group which can be used for proposition tracking.

```swift
/// `Proposition` extension
/// `OptimizeProposition` extension
@objc
public extension Proposition {
public extension OptimizeProposition {
/// Creates a dictionary containing XDM formatted data for `Experience Event - Proposition Reference` field group from the given proposition.
///
/// The Edge `sendEvent(experienceEvent:_:)` API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, or override dataset identifier.
///
/// - Note: The returned XDM data does not contain an `eventType` for the Experience Event.
/// - Returns A dictionary containing XDM data for the propositon reference.
/// - Returns A dictionary containing XDM data for the proposition reference.
func generateReferenceXdm() -> [String: Any] {...}
}
```
Expand Down Expand Up @@ -816,7 +816,7 @@ public extension Offer {
/// If the proposition reference within the option is released and no longer valid, the method returns `nil`.
///
/// - Note: The returned XDM data also contains the `eventType` for the Experience Event with value `decisioning.propositionDisplay`.
/// - Returns A dictionary containing XDM data for the propositon interactions.
/// - Returns A dictionary containing XDM data for the proposition interactions.
func generateDisplayInteractionXdm() -> [String: Any]? {...}

/// Creates a dictionary containing XDM formatted data for `Experience Event - Proposition Interactions` field group from the given proposition option.
Expand All @@ -825,7 +825,7 @@ public extension Offer {
/// If the proposition reference within the option is released and no longer valid, the method returns `nil`.
///
/// - Note: The returned XDM data also contains the `eventType` for the Experience Event with value `decisioning.propositionInteract`.
/// - Returns A dictionary containing XDM data for the propositon interactions.
/// - Returns A dictionary containing XDM data for the proposition interactions.
func generateTapInteractionXdm() -> [String: Any]? {...}

/// Dispatches an event for the Edge extension to send an Experience Event to the Edge network with the display interaction data for the given proposition item.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,27 +457,27 @@ public extension Offer {
/// The Edge `sendEvent(experienceEvent:_:)` API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, or override dataset identifier.
///
/// - Note: The returned XDM data also contains the `eventType` for the Experience Event with value `decisioning.propositionDisplay`.
/// - Returns A dictionary containing XDM data for the propositon interactions.
/// - Returns A dictionary containing XDM data for the proposition interactions.
func generateDisplayInteractionXdm() -> [String: Any] {...}

/// Creates a dictionary containing XDM formatted data for `Experience Event - Proposition Interactions` field group from the given proposition option.
///
/// The Edge `sendEvent(experienceEvent:_:)` API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, or override dataset identifier.
///
/// - Note: The returned XDM data also contains the `eventType` for the Experience Event with value `decisioning.propositionInteract`.
/// - Returns A dictionary containing XDM data for the propositon interactions.
/// - Returns A dictionary containing XDM data for the proposition interactions.
func generateTapInteractionXdm() -> [String: Any] {...}
}
```

```swift
public extension Proposition {
public extension OptimizeProposition {
/// Creates a dictionary containing XDM formatted data for `Experience Event - Proposition Reference` field group from the given proposition.
///
/// The Edge `sendEvent(experienceEvent:_:)` API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, or override dataset identifier.
///
/// - Note: The returned XDM data does not contain an `eventType` for the Experience Event.
/// - Returns A dictionary containing XDM data for the propositon reference.
/// - Returns A dictionary containing XDM data for the proposition reference.
func generateReferenceXdm() -> [String: Any] {...}
}
```
Expand Down
47 changes: 47 additions & 0 deletions src/pages/edge/adobe-journey-optimizer/code-based/api-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: Code-based Experiences - API Reference
description: This document lists the public APIs available in the Messaging extension for implementing code-based experiences.
keywords:
- Adobe Journey Optimizer
- API reference
- Messaging
- Code-based Experiences
---

import Tabs from './tabs/api-reference.md'

# Code-based Experiences - API reference

This document lists the public APIs available in the Messaging extension for implementing code-based experiences.

## getPropositionsForSurfaces

The `getPropositionsForSurfaces` API retrieves the previously fetched propositions from the SDK's in-memory propositions cache for the provided surfaces. The completion handler is invoked with the decision propositions corresponding to the given surfaces or `AEPError`, if it occurs.

If a requested surface was not previously cached prior to calling `getPropositionsForSurfaces` (using the `updatePropositionsForSurfaces` API), no propositions will be returned for that surface.

<TabsBlock orientation="horizontal" slots="heading, content" repeat="2"/>

Android

<Tabs query="platform=android&api=get-propositions-for-surfaces"/>

iOS

<Tabs query="platform=ios&api=get-propositions-for-surfaces"/>

## updatePropositionsForSurfaces

The `updatePropositionsForSurfaces` API dispatches an event for the Edge network extension to fetch personalization decisions from the AJO campaigns for the provided surfaces array. The returned decision propositions are cached in-memory by the Messaging extension.

To retrieve previously cached decision propositions, use `getPropositionsForSurfaces` API.

<TabsBlock orientation="horizontal" slots="heading, content" repeat="2"/>

Android

<Tabs query="platform=android&api=update-propositions-for-surfaces"/>

iOS

<Tabs query="platform=ios&api=update-propositions-for-surfaces"/>
23 changes: 23 additions & 0 deletions src/pages/edge/adobe-journey-optimizer/code-based/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Code-based Experiences
description: This document guides you to integrating code-based experiences in your application.
keywords:
- Adobe Journey Optimizer
- Guide
- Code-based experiences
---

# Code-based Experiences

This document guides you to integrating code-based experiences in your application.

## API reference

* [Code-based Experiences APIs](./api-reference.md)

## 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)
Loading

0 comments on commit f60b944

Please sign in to comment.