From 45f5dd36e62ad519fcb0f872ccaf2b5450e7fcb8 Mon Sep 17 00:00:00 2001 From: saquib-adobe Date: Wed, 20 Nov 2024 12:42:40 +0530 Subject: [PATCH 1/8] [MOB-22145] Update and Get propositions configurable timeout API docs --- .../tabs/api-reference.md | 275 +++++++++++++++++- 1 file changed, 273 insertions(+), 2 deletions(-) diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md b/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md index 40c1b332db..aa9fa36de3 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md @@ -140,6 +140,53 @@ Optimize.getPropositions(scopes, new AdobeCallbackWithError + +#### Java + +#### Syntax + +```java +public static void getPropositions(final List decisionScopes, final long timeoutMillis, final AdobeCallback> callback) +``` + +* _decisionScopes_ is a list of decision scopes for which propositions are requested. +* _timeoutMillis_ is a duration in milliseconds specifying the maximum time to wait for the event to complete. +* _callback_ `call` method is invoked with propositions map of type `Map`. If the callback is an instance of [AdobeCallbackWithError](../../home/base/mobile-core/api-reference.md#adobecallbackwitherror), and if the operation times out or an error occurs in retrieving propositions, the `fail` method is invoked with the appropriate [AdobeError](../../home/base/mobile-core/api-reference.md#adobeerror). + +#### Example + +```java +final DecisionScope decisionScope1 = DecisionScope("xcore:offer-activity:1111111111111111", "xcore:offer-placement:1111111111111111", 2); +final DecisionScope decisionScope2 = new DecisionScope("myScope"); + +final List decisionScopes = new ArrayList<>(); +decisionScopes.add(decisionScope1); +decisionScopes.add(decisionScope2); + +Optimize.getPropositions(scopes, 10000L, new AdobeCallbackWithError>() { + @Override + public void fail(final AdobeError adobeError) { + // handle error + } + + @Override + public void call(Map propositionsMap) { + if (propositionsMap != null && !propositionsMap.isEmpty()) { + // get the propositions for the given decision scopes + if (propositionsMap.contains(decisionScope1)) { + final OptimizeProposition proposition1 = propsMap.get(decisionScope1) + // read proposition1 offers + } + if (propositionsMap.contains(decisionScope2)) { + final OptimizeProposition proposition2 = propsMap.get(decisionScope2) + // read proposition2 offers + } + } + } +}); +``` + #### Swift @@ -218,6 +265,91 @@ AEPDecisionScope* decisionScope2 = [[AEPDecisionScope alloc] initWithName: @"myS }]; ``` + + +#### Swift + +#### Syntax + +```swift +static func getPropositions(for decisionScopes: [DecisionScope], timeout: TimeInterval, + _ completion: @escaping ([DecisionScope: OptimizeProposition]?, Error?) -> Void) +``` + +* _decisionScopes_ is an array of decision scopes for which propositions are requested. +* _timeout_ is a duration in seconds specifying the maximum time to wait for the event to complete. +* _completion_ is invoked with propositions dictionary of type `[DecisionScope: OptimizeProposition]`. An `Error` is returned if SDK fails to retrieve the propositions. + +#### Example + +```swift +let decisionScope1 = DecisionScope(activityId: "xcore:offer-activity:1111111111111111", + placementId: "xcore:offer-placement:1111111111111111" + itemCount: 2) +let decisionScope2 = DecisionScope(name: "myScope") + +Optimize.getPropositions(for: [decisionScope1, decisionScope2], timeout: 1.0) { propositionsDict, error in + + if let error = error { + // handle error + return + } + + if let propositionsDict = propositionsDict { + // get the propositions for the given decision scopes + + if let proposition1 = propositionsDict[decisionScope1] { + // read proposition1 offers + } + + if let proposition2 = propositionsDict[decisionScope2] { + // read proposition2 offers + } + } +} +``` + +#### Objective-C + +#### Syntax + +```objc ++ (void)getPropositions:(NSArray *_Nonnull) decisionScopes + timeout:(NSTimeInterval) timeout + completion:(void (^_Nonnull)(NSDictionary *_Nullable propositionsDict, NSError *_Nullable error)) completion; + +``` + + +* _decisionScopes_ is an array of decision scopes for which propositions are requested. +* _timeout_ is a duration in seconds specifying the maximum time to wait for the event to complete. +* _completion_ is invoked with propositions dictionary of type `NSDictionary`. An `NSError` is returned if SDK fails to retrieve the propositions. + +#### Example + +```objc +AEPDecisionScope* decisionScope1 = [[AEPDecisionScope alloc] initWithActivityId: @"xcore:offer-activity:1111111111111111" + placementId: @"xcore:offer-placement:1111111111111111" + itemCount: 2]; +AEPDecisionScope* decisionScope2 = [[AEPDecisionScope alloc] initWithName: @"myScope"]; + +[AEPMobileOptimize getPropositions: @[decisionScope1, decisionScope2] + timeout:1.0 + completion: ^(NSDictionary* propositionsDict, NSError* error) { + if (error != nil) { + // handle error + return; + } + + AEPOptimizeProposition* proposition1 = propositionsDict[decisionScope1]; + // read proposition1 offers + + AEPOptimizeProposition* proposition2 = propositionsDict[decisionScope2]; + // read proposition2 offers +}]; +``` + + #### Java @@ -336,7 +468,59 @@ Optimize.updatePropositions(decisionScopes, }); ``` - + + +#### Java + +#### Syntax + +```java +public static void updatePropositions(final List decisionScopes, + final Map xdm, + final Map data, + final AdobeCallback> callback) +``` + +* _decisionScopes_ is a list of decision scopes for which propositions need updating. +* _xdm_ is a map containing additional xdm formatted data to be attached to the Experience Event. +* _data_ is a map containing additional freeform data to be attached to the Experience Event. +* _callback_ is an optional completion handler that is invoked at the completion of the edge request. `call` method is invoked with propositions map of type `Map`. If the callback is an instance of `AdobeCallbackWithOptimizeError`, and if the operation times out or an error occurs in retrieving propositions, the `fail` method is invoked with the appropriate [AEPOptimizeError](../api-reference.md#aepoptimizeerror). _Note:_ In certain cases, both the success and failure callbacks may be triggered. To handle these cases, ensure that your implementation checks for both successful propositions and errors within the callback, as both may be present simultaneously. + +#### Example + +```java +final DecisionScope decisionScope1 = DecisionScope("xcore:offer-activity:1111111111111111", "xcore:offer-placement:1111111111111111", 2); +final DecisionScope decisionScope2 = new DecisionScope("myScope"); + +final List decisionScopes = new ArrayList<>(); +decisionScopes.add(decisionScope1); +decisionScopes.add(decisionScope2); + +Optimize.updatePropositions(decisionScopes, + new HashMap() { + { + put("xdmKey", "xdmValue"); + } + }, + new HashMap() { + { + put("dataKey", "dataValue"); + } + }, + new AdobeCallbackWithOptimizeError>() { + @Override + public void fail(AEPOptimizeError optimizeError) { + responseError = optimizeError; + } + + @Override + public void call(Map propositionsMap) { + responseMap = propositionsMap; + } + }); +``` + + #### Java @@ -346,12 +530,14 @@ Optimize.updatePropositions(decisionScopes, public static void updatePropositions(final List decisionScopes, final Map xdm, final Map data, + final long timeoutMillis, final AdobeCallback> callback) ``` * _decisionScopes_ is a list of decision scopes for which propositions need updating. * _xdm_ is a map containing additional xdm formatted data to be attached to the Experience Event. * _data_ is a map containing additional freeform data to be attached to the Experience Event. +* _timeoutMillis_ is a duration in milliseconds specifying the maximum time to wait for the event to complete. * _callback_ is an optional completion handler that is invoked at the completion of the edge request. `call` method is invoked with propositions map of type `Map`. If the callback is an instance of `AdobeCallbackWithOptimizeError`, and if the operation times out or an error occurs in retrieving propositions, the `fail` method is invoked with the appropriate [AEPOptimizeError](../api-reference.md#aepoptimizeerror). _Note:_ In certain cases, both the success and failure callbacks may be triggered. To handle these cases, ensure that your implementation checks for both successful propositions and errors within the callback, as both may be present simultaneously. #### Example @@ -375,6 +561,7 @@ Optimize.updatePropositions(decisionScopes, put("dataKey", "dataValue"); } }, + 10000L, new AdobeCallbackWithOptimizeError>() { @Override public void fail(AEPOptimizeError optimizeError) { @@ -444,7 +631,7 @@ AEPDecisionScope* decisionScope2 = [[AEPDecisionScope alloc] initWithName: @"myS andData: @{@"dataKey": @"dataValue"}]; ``` - + #### Swift @@ -521,6 +708,90 @@ AEPDecisionScope* decisionScope2 = [[AEPDecisionScope alloc] initWithName: @"myS }]; ``` + + +#### Swift + +#### Syntax + +```swift +static func updatePropositions(for decisionScopes: [DecisionScope], + withXdm xdm: [String: Any]?, + andData data: [String: Any]? = nil, + timeout: TimeInterval, + _completion: (([DecisionScope: OptimizeProposition]?, Error?) -> Void)? = nil) +``` + +* _decisionScopes_ is an array of decision scopes for which propositions need updating. +* _xdm_ is a dictionary containing additional xdm formatted data to be attached to the Experience Event. +* _data_ is a dictionary containing additional freeform data to be attached to the Experience Event. +* _timeout_ is a duration in seconds specifying the maximum time to wait for the event to complete. +* _completion_ is a optional completion handler invoked at the completion of the edge request with map of successful decision scopes to propositions and errors, if any. + +#### Example + +```swift +let decisionScope1 = DecisionScope(activityId: "xcore:offer-activity:1111111111111111", + placementId: "xcore:offer-placement:1111111111111111" + itemCount: 2) +let decisionScope2 = DecisionScope(name: "myScope") + +Optimize.updatePropositions(for: [decisionScope1, decisionScope2] + withXdm: ["xdmKey": "xdmValue"] + andData: ["dataKey": "dataValue"], + timeout: 1.0) { data, error in + if let error = error as? AEPOptimizeError { + // handle error + } + } +``` + +#### Objective-C + +#### Syntax + +```objc ++ (void) updatePropositions: (NSArray* _Nonnull) decisionScopes + withXdm: (NSDictionary* _Nullable) xdm + andData: (NSDictionary* _Nullable) data + timeout:(NSTimeInterval) timeout + completion: (void (^ _Nonnull)(NSDictionary* _Nullable propositionsDict, NSError* _Nullable error)) completion; +``` + +* _decisionScopes_ is an array of decision scopes for which propositions are requested. +* _xdm_ is a dictionary containing additional xdm formatted data to be attached to the Experience Event. +* _data_ is a dictionary containing additional freeform data to be attached to the Experience Event. +* _timeout_ is a duration in seconds specifying the maximum time to wait for the event to complete. +* _completion_ is invoked with propositions dictionary of type `NSDictionary`. An `NSError` is returned if SDK fails to retrieve the propositions. + +#### Example + +```objc + +AEPDecisionScope* decisionScope1 = [[AEPDecisionScope alloc] initWithActivityId: @"xcore:offer-activity:1111111111111111" + placementId: @"xcore:offer-placement:1111111111111111" + itemCount: 2]; +AEPDecisionScope* decisionScope2 = [[AEPDecisionScope alloc] initWithName: @"myScope"]; + +[AEPMobileOptimize updatePropositions: @[decisionScope1, decisionScope2] + withXdm: @{@"xdmKey": @"xdmValue"} + andData: @{@"dataKey": @"dataValue"}] + timeout:1.0 + completion: ^(NSDictionary* propositionsDict, NSError* error) { + if (error != nil) { + // handle error + return; + } + + AEPOptimizeProposition* proposition1 = propositionsDict[decisionScope1]; + // read proposition1 offers + + AEPOptimizeProposition* proposition2 = propositionsDict[decisionScope2]; + // read proposition2 offers +}]; +``` + + ##### Java From 86e7e4a98cede75a8d48117a3e10c5c095d9c6ec Mon Sep 17 00:00:00 2001 From: saquib-adobe Date: Tue, 26 Nov 2024 01:40:02 +0530 Subject: [PATCH 2/8] Added the referrences of new API to the home page --- .../api-reference.md | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md index 95a32d7da0..6e2685a018 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md @@ -53,6 +53,22 @@ iOS +## getPropositionsWithTimeout + +This API retrieves the previously fetched propositions for the provided decision scopes from the in-memory extension propositions cache, similar to `getPropositions`. The completion callback is invoked with the decision propositions corresponding to the given decision scopes. If a certain decision scope has not been fetched prior to this API call, it will not be included in the returned propositions. + +Additionally, this API allows specifying a timeout for the operation. If the propositions retrieval does not complete within the given timeout, an error is returned, providing improved control over handling delays and ensuring timely application responses. + + + +Android + + + +iOS + + + ## onPropositionsUpdate This API registers a permanent callback which is invoked whenever the Edge extension dispatches a response event with an `eventType` of `personalization.response`. Additionally, the callback is only invoked if the response event contains at least one valid offer. The personalization response can be triggered by the `updatePropositions` API. @@ -116,11 +132,31 @@ Completion callback passed to `updatePropositions` supports network timeout and Android - + + +iOS + + + +## updatePropositionsWithCompletionHandlerWithCompletionTimeout + +This API dispatches an event for the Edge network extension to fetch decision propositions for the provided decision scopes array from the decisioning services enabled in the Experience Edge. Similar to `updatePropositionsWithCompletionHandler`, the returned decision propositions are cached in-memory within the Optimize SDK extension and can be retrieved using the `getPropositions` API. + +Additionally, this API allows specifying a completion timeout, ensuring that the operation either completes within the given time frame or returns an error indicating a timeout. This feature provides better control over the responsiveness of the application when interacting with decisioning services. + + + +Completion callback passed to `updatePropositions` supports network timeout and fatal errors returned by edge network along with fetched propositions data. The SDK's internal retry mechanism handles the recoverable HTTP errors. As a result, recoverable HTTP errors are not returned through this callback. + + + +Android + + iOS - + ## Public classes From 588ca6246d44f1d4d37caf4aa95b8cfe75232ac6 Mon Sep 17 00:00:00 2001 From: saquib-adobe Date: Tue, 26 Nov 2024 13:57:23 +0530 Subject: [PATCH 3/8] PR comments resolved PR comments resolved PR comments resolved Addressing the PR comments PR comment resolved PR comments resolved --- .../api-reference.md | 2 +- .../tabs/api-reference.md | 55 ++++++++++--------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md index 6e2685a018..6d772be599 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md @@ -138,7 +138,7 @@ iOS -## updatePropositionsWithCompletionHandlerWithCompletionTimeout +## updatePropositionsWithCompletionHandlerAndTimeout This API dispatches an event for the Edge network extension to fetch decision propositions for the provided decision scopes array from the decisioning services enabled in the Experience Edge. Similar to `updatePropositionsWithCompletionHandler`, the returned decision propositions are cached in-memory within the Optimize SDK extension and can be retrieved using the `getPropositions` API. diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md b/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md index aa9fa36de3..7d522c9e33 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md @@ -151,7 +151,7 @@ public static void getPropositions(final List decisionScopes, fin ``` * _decisionScopes_ is a list of decision scopes for which propositions are requested. -* _timeoutMillis_ is a duration in milliseconds specifying the maximum time to wait for the event to complete. +* _timeoutMillis_ is a duration in milliseconds specifying the maximum time `getProposition` will wait for completion before returning [AdobeError](../../home/base/mobile-core/api-reference.md#adobeerror). * _callback_ `call` method is invoked with propositions map of type `Map`. If the callback is an instance of [AdobeCallbackWithError](../../home/base/mobile-core/api-reference.md#adobecallbackwitherror), and if the operation times out or an error occurs in retrieving propositions, the `fail` method is invoked with the appropriate [AdobeError](../../home/base/mobile-core/api-reference.md#adobeerror). #### Example @@ -205,7 +205,7 @@ static func getPropositions(for decisionScopes: [DecisionScope], ```swift let decisionScope1 = DecisionScope(activityId: "xcore:offer-activity:1111111111111111", - placementId: "xcore:offer-placement:1111111111111111" + placementId: "xcore:offer-placement:1111111111111111", itemCount: 2) let decisionScope2 = DecisionScope(name: "myScope") @@ -272,19 +272,20 @@ AEPDecisionScope* decisionScope2 = [[AEPDecisionScope alloc] initWithName: @"myS #### Syntax ```swift -static func getPropositions(for decisionScopes: [DecisionScope], timeout: TimeInterval, +static func getPropositions(for decisionScopes: [DecisionScope], + timeout: TimeInterval, _ completion: @escaping ([DecisionScope: OptimizeProposition]?, Error?) -> Void) ``` * _decisionScopes_ is an array of decision scopes for which propositions are requested. -* _timeout_ is a duration in seconds specifying the maximum time to wait for the event to complete. +* _timeout_ is a duration in seconds specifying the maximum time `getProposition` will wait for completion before returning `Error`. * _completion_ is invoked with propositions dictionary of type `[DecisionScope: OptimizeProposition]`. An `Error` is returned if SDK fails to retrieve the propositions. #### Example ```swift let decisionScope1 = DecisionScope(activityId: "xcore:offer-activity:1111111111111111", - placementId: "xcore:offer-placement:1111111111111111" + placementId: "xcore:offer-placement:1111111111111111", itemCount: 2) let decisionScope2 = DecisionScope(name: "myScope") @@ -322,7 +323,7 @@ Optimize.getPropositions(for: [decisionScope1, decisionScope2], timeout: 1.0) { * _decisionScopes_ is an array of decision scopes for which propositions are requested. -* _timeout_ is a duration in seconds specifying the maximum time to wait for the event to complete. +* _timeout_ is a duration in seconds specifying the maximum time `getProposition` will wait for completion before returning `NSError`. * _completion_ is invoked with propositions dictionary of type `NSDictionary`. An `NSError` is returned if SDK fails to retrieve the propositions. #### Example @@ -442,7 +443,7 @@ public static void updatePropositions(final List decisionScopes, ``` * _decisionScopes_ is a list of decision scopes for which propositions need updating. -* _xdm_ is a map containing additional xdm formatted data to be attached to the Experience Event. +* _xdm_ is a map containing additional XDM formatted data to be attached to the Experience Event. * _data_ is a map containing additional freeform data to be attached to the Experience Event. #### Example @@ -482,9 +483,9 @@ public static void updatePropositions(final List decisionScopes, ``` * _decisionScopes_ is a list of decision scopes for which propositions need updating. -* _xdm_ is a map containing additional xdm formatted data to be attached to the Experience Event. +* _xdm_ is a map containing additional XDM formatted data to be attached to the Experience Event. * _data_ is a map containing additional freeform data to be attached to the Experience Event. -* _callback_ is an optional completion handler that is invoked at the completion of the edge request. `call` method is invoked with propositions map of type `Map`. If the callback is an instance of `AdobeCallbackWithOptimizeError`, and if the operation times out or an error occurs in retrieving propositions, the `fail` method is invoked with the appropriate [AEPOptimizeError](../api-reference.md#aepoptimizeerror). _Note:_ In certain cases, both the success and failure callbacks may be triggered. To handle these cases, ensure that your implementation checks for both successful propositions and errors within the callback, as both may be present simultaneously. +* _callback_ is an optional completion handler that is invoked at the completion of the edge request. The `call` method is invoked with propositions map of type `Map`. If the callback is an instance of `AdobeCallbackWithOptimizeError`, and if the operation times out or an error occurs in retrieving propositions, the `fail` method is invoked with the appropriate [AEPOptimizeError](../api-reference.md#aepoptimizeerror). _Note:_ In certain cases, both the success and failure callbacks may be triggered. To handle these cases, ensure that your implementation checks for both successful propositions and errors within the callback, as both may be present simultaneously. #### Example @@ -535,10 +536,10 @@ public static void updatePropositions(final List decisionScopes, ``` * _decisionScopes_ is a list of decision scopes for which propositions need updating. -* _xdm_ is a map containing additional xdm formatted data to be attached to the Experience Event. +* _xdm_ is a map containing additional XDM formatted data to be attached to the Experience Event. * _data_ is a map containing additional freeform data to be attached to the Experience Event. -* _timeoutMillis_ is a duration in milliseconds specifying the maximum time to wait for the event to complete. -* _callback_ is an optional completion handler that is invoked at the completion of the edge request. `call` method is invoked with propositions map of type `Map`. If the callback is an instance of `AdobeCallbackWithOptimizeError`, and if the operation times out or an error occurs in retrieving propositions, the `fail` method is invoked with the appropriate [AEPOptimizeError](../api-reference.md#aepoptimizeerror). _Note:_ In certain cases, both the success and failure callbacks may be triggered. To handle these cases, ensure that your implementation checks for both successful propositions and errors within the callback, as both may be present simultaneously. +* _timeoutMillis_ is a duration in milliseconds specifying the maximum time `updateProposition` will wait for completion before returning [AEPOptimizeError](../api-reference.md#aepoptimizeerror) which contains [AdobeError.CALLBACK_TIMEOUT](../../home/base/mobile-core/api-reference.md#adobeerror). +* _callback_ is an optional completion handler that is invoked at the completion of the edge request. The `call` method is invoked with propositions map of type `Map`. If the callback is an instance of `AdobeCallbackWithOptimizeError`, and if the operation times out or an error occurs in retrieving propositions, the `fail` method is invoked with the appropriate [AEPOptimizeError](../api-reference.md#aepoptimizeerror). _Note:_ In certain cases, both the success and failure callbacks may be triggered. To handle these cases, ensure that your implementation checks for both successful propositions and errors within the callback, as both may be present simultaneously. #### Example @@ -588,14 +589,14 @@ static func updatePropositions(for decisionScopes: [DecisionScope], ``` * _decisionScopes_ is an array of decision scopes for which propositions need updating. -* _xdm_ is a dictionary containing additional xdm formatted data to be attached to the Experience Event. +* _xdm_ is a dictionary containing additional XDM formatted data to be attached to the Experience Event. * _data_ is a dictionary containing additional freeform data to be attached to the Experience Event. #### Example ```swift let decisionScope1 = DecisionScope(activityId: "xcore:offer-activity:1111111111111111", - placementId: "xcore:offer-placement:1111111111111111" + placementId: "xcore:offer-placement:1111111111111111", itemCount: 2) let decisionScope2 = DecisionScope(name: "myScope") @@ -615,7 +616,7 @@ Optimize.updatePropositions(for: [decisionScope1, decisionScope2] ``` * _decisionScopes_ is an array of decision scopes for which propositions need updating. -* _xdm_ is a dictionary containing additional xdm formatted data to be attached to the Experience Event. +* _xdm_ is a dictionary containing additional XDM formatted data to be attached to the Experience Event. * _data_ is a dictionary containing additional freeform data to be attached to the Experience Event. #### Example @@ -645,7 +646,7 @@ static func updatePropositions(for decisionScopes: [DecisionScope], ``` * _decisionScopes_ is an array of decision scopes for which propositions need updating. -* _xdm_ is a dictionary containing additional xdm formatted data to be attached to the Experience Event. +* _xdm_ is a dictionary containing additional XDM formatted data to be attached to the Experience Event. * _data_ is a dictionary containing additional freeform data to be attached to the Experience Event. * _completion_ is a optional completion handler invoked at the completion of the edge request with map of successful decision scopes to propositions and errors, if any. @@ -653,7 +654,7 @@ static func updatePropositions(for decisionScopes: [DecisionScope], ```swift let decisionScope1 = DecisionScope(activityId: "xcore:offer-activity:1111111111111111", - placementId: "xcore:offer-placement:1111111111111111" + placementId: "xcore:offer-placement:1111111111111111", itemCount: 2) let decisionScope2 = DecisionScope(name: "myScope") @@ -678,7 +679,7 @@ Optimize.updatePropositions(for: [decisionScope1, decisionScope2] ``` * _decisionScopes_ is an array of decision scopes for which propositions are requested. -* _xdm_ is a dictionary containing additional xdm formatted data to be attached to the Experience Event. +* _xdm_ is a dictionary containing additional XDM formatted data to be attached to the Experience Event. * _data_ is a dictionary containing additional freeform data to be attached to the Experience Event. * _completion_ is invoked with propositions dictionary of type `NSDictionary`. An `NSError` is returned if SDK fails to retrieve the propositions. @@ -718,26 +719,26 @@ AEPDecisionScope* decisionScope2 = [[AEPDecisionScope alloc] initWithName: @"myS static func updatePropositions(for decisionScopes: [DecisionScope], withXdm xdm: [String: Any]?, andData data: [String: Any]? = nil, - timeout: TimeInterval, + timeout: TimeInterval, _completion: (([DecisionScope: OptimizeProposition]?, Error?) -> Void)? = nil) ``` * _decisionScopes_ is an array of decision scopes for which propositions need updating. -* _xdm_ is a dictionary containing additional xdm formatted data to be attached to the Experience Event. +* _xdm_ is a dictionary containing additional XDM formatted data to be attached to the Experience Event. * _data_ is a dictionary containing additional freeform data to be attached to the Experience Event. -* _timeout_ is a duration in seconds specifying the maximum time to wait for the event to complete. -* _completion_ is a optional completion handler invoked at the completion of the edge request with map of successful decision scopes to propositions and errors, if any. +* _timeout_ is a duration in seconds specifying the maximum time `updateProposition` will wait for completion before returning `AEPOptimizeError`. +* _completion_ is a optional completion handler invoked at the completion of the edge request with map of successful decision scopes to propositions and `AEPOptimizeError`, if any. #### Example ```swift let decisionScope1 = DecisionScope(activityId: "xcore:offer-activity:1111111111111111", - placementId: "xcore:offer-placement:1111111111111111" + placementId: "xcore:offer-placement:1111111111111111", itemCount: 2) let decisionScope2 = DecisionScope(name: "myScope") -Optimize.updatePropositions(for: [decisionScope1, decisionScope2] - withXdm: ["xdmKey": "xdmValue"] +Optimize.updatePropositions(for: [decisionScope1, decisionScope2], + withXdm: ["xdmKey": "xdmValue"], andData: ["dataKey": "dataValue"], timeout: 1.0) { data, error in if let error = error as? AEPOptimizeError { @@ -759,9 +760,9 @@ Optimize.updatePropositions(for: [decisionScope1, decisionScope2] ``` * _decisionScopes_ is an array of decision scopes for which propositions are requested. -* _xdm_ is a dictionary containing additional xdm formatted data to be attached to the Experience Event. +* _xdm_ is a dictionary containing additional XDM formatted data to be attached to the Experience Event. * _data_ is a dictionary containing additional freeform data to be attached to the Experience Event. -* _timeout_ is a duration in seconds specifying the maximum time to wait for the event to complete. +* _timeout_ is a duration in seconds specifying the maximum time `updateProposition` will wait for completion before returning `NSError`. * _completion_ is invoked with propositions dictionary of type `NSDictionary`. An `NSError` is returned if SDK fails to retrieve the propositions. #### Example From 1ea3deb7dba9b0006e5ae08aa7fd6aaf39b91054 Mon Sep 17 00:00:00 2001 From: saquib-adobe Date: Wed, 4 Dec 2024 12:28:42 +0530 Subject: [PATCH 4/8] Timeout scale changed from milliseconds to seconds --- .../tabs/api-reference.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md b/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md index 7d522c9e33..a8e49bfd81 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md @@ -147,11 +147,11 @@ Optimize.getPropositions(scopes, new AdobeCallbackWithError decisionScopes, final long timeoutMillis, final AdobeCallback> callback) +public static void getPropositions(final List decisionScopes, final double timeoutSeconds, final AdobeCallback> callback) ``` * _decisionScopes_ is a list of decision scopes for which propositions are requested. -* _timeoutMillis_ is a duration in milliseconds specifying the maximum time `getProposition` will wait for completion before returning [AdobeError](../../home/base/mobile-core/api-reference.md#adobeerror). +* _timeoutSeconds_ is a duration in seconds specifying the maximum time `getProposition` will wait for completion before returning [AdobeError](../../home/base/mobile-core/api-reference.md#adobeerror). * _callback_ `call` method is invoked with propositions map of type `Map`. If the callback is an instance of [AdobeCallbackWithError](../../home/base/mobile-core/api-reference.md#adobecallbackwitherror), and if the operation times out or an error occurs in retrieving propositions, the `fail` method is invoked with the appropriate [AdobeError](../../home/base/mobile-core/api-reference.md#adobeerror). #### Example @@ -164,7 +164,7 @@ final List decisionScopes = new ArrayList<>(); decisionScopes.add(decisionScope1); decisionScopes.add(decisionScope2); -Optimize.getPropositions(scopes, 10000L, new AdobeCallbackWithError>() { +Optimize.getPropositions(scopes, 10.0, new AdobeCallbackWithError>() { @Override public void fail(final AdobeError adobeError) { // handle error @@ -531,14 +531,14 @@ Optimize.updatePropositions(decisionScopes, public static void updatePropositions(final List decisionScopes, final Map xdm, final Map data, - final long timeoutMillis, + final double timeoutSeconds, final AdobeCallback> callback) ``` * _decisionScopes_ is a list of decision scopes for which propositions need updating. * _xdm_ is a map containing additional XDM formatted data to be attached to the Experience Event. * _data_ is a map containing additional freeform data to be attached to the Experience Event. -* _timeoutMillis_ is a duration in milliseconds specifying the maximum time `updateProposition` will wait for completion before returning [AEPOptimizeError](../api-reference.md#aepoptimizeerror) which contains [AdobeError.CALLBACK_TIMEOUT](../../home/base/mobile-core/api-reference.md#adobeerror). +* _timeoutSeconds_ is a duration in seconds specifying the maximum time `updateProposition` will wait for completion before returning [AEPOptimizeError](../api-reference.md#aepoptimizeerror) which contains [AdobeError.CALLBACK_TIMEOUT](../../home/base/mobile-core/api-reference.md#adobeerror). * _callback_ is an optional completion handler that is invoked at the completion of the edge request. The `call` method is invoked with propositions map of type `Map`. If the callback is an instance of `AdobeCallbackWithOptimizeError`, and if the operation times out or an error occurs in retrieving propositions, the `fail` method is invoked with the appropriate [AEPOptimizeError](../api-reference.md#aepoptimizeerror). _Note:_ In certain cases, both the success and failure callbacks may be triggered. To handle these cases, ensure that your implementation checks for both successful propositions and errors within the callback, as both may be present simultaneously. #### Example @@ -562,7 +562,7 @@ Optimize.updatePropositions(decisionScopes, put("dataKey", "dataValue"); } }, - 10000L, + 10.0, new AdobeCallbackWithOptimizeError>() { @Override public void fail(AEPOptimizeError optimizeError) { From b09b0871653e121dcff81e703577c1db1a545921 Mon Sep 17 00:00:00 2001 From: saquib-adobe Date: Wed, 4 Dec 2024 16:15:52 +0530 Subject: [PATCH 5/8] Marking the updatePropostions API without callback as deprecated --- .../adobe-journey-optimizer-decisioning/api-reference.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md index 6d772be599..ec1b606f3b 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md @@ -108,6 +108,12 @@ For details on syntax, usage and availability, refer to [Mobile Core - Reset ide ## updatePropositions + + +This API has been deprecated starting in v3.2.2 and removed in v3.3.0 of the Android mobile extension. + +Use [`Optimize.updatePropositions`](../api-reference.md#updatepropositionswithcompletionhandler) or [`Optimize.updatePropositions`](../api-reference.md#updatepropositionswithcompletionhandlerandtimeout) APIs instead. + This API dispatches an Event for the Edge network extension to fetch decision propositions, for the provided decision scopes array, from the decisioning services enabled in the Experience Edge. The returned decision propositions are cached in-memory in the Optimize SDK extension and can be retrieved using `getPropositions` API. From 1e8e5706633c1d739b62e036766386dc5dcdcf57 Mon Sep 17 00:00:00 2001 From: saquib-adobe Date: Fri, 6 Dec 2024 23:29:07 +0530 Subject: [PATCH 6/8] Addressing PR comments --- .../edge/adobe-journey-optimizer-decisioning/api-reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md index ec1b606f3b..26b878073b 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md @@ -110,7 +110,7 @@ For details on syntax, usage and availability, refer to [Mobile Core - Reset ide -This API has been deprecated starting in v3.2.2 and removed in v3.3.0 of the Android mobile extension. +This API has been deprecated. They will be removed in the next major release of the Optimize SDK. Use [`Optimize.updatePropositions`](../api-reference.md#updatepropositionswithcompletionhandler) or [`Optimize.updatePropositions`](../api-reference.md#updatepropositionswithcompletionhandlerandtimeout) APIs instead. From bff5ef96a8e3857b6a17626ee0d2714676cbd5ea Mon Sep 17 00:00:00 2001 From: saquib-adobe Date: Sat, 7 Dec 2024 00:33:04 +0530 Subject: [PATCH 7/8] Addressing PR comments --- .../edge/adobe-journey-optimizer-decisioning/api-reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md index 26b878073b..2c49e0ee7a 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md @@ -110,7 +110,7 @@ For details on syntax, usage and availability, refer to [Mobile Core - Reset ide -This API has been deprecated. They will be removed in the next major release of the Optimize SDK. +This API has been deprecated starting in v3.2.2(Android) and v5.2.0(iOS). They will be removed in the next major release of the Optimize SDK. Use [`Optimize.updatePropositions`](../api-reference.md#updatepropositionswithcompletionhandler) or [`Optimize.updatePropositions`](../api-reference.md#updatepropositionswithcompletionhandlerandtimeout) APIs instead. From 3b11b8a6fa6afa0ce4d1e2ff074ee1cf986b87d9 Mon Sep 17 00:00:00 2001 From: saquib-adobe Date: Mon, 9 Dec 2024 21:11:57 +0530 Subject: [PATCH 8/8] Fixing lint issues --- .../edge/adobe-journey-optimizer-decisioning/api-reference.md | 4 ++-- .../adobe-journey-optimizer-decisioning/tabs/api-reference.md | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md index 2c49e0ee7a..8b205c785a 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md @@ -55,7 +55,7 @@ iOS ## getPropositionsWithTimeout -This API retrieves the previously fetched propositions for the provided decision scopes from the in-memory extension propositions cache, similar to `getPropositions`. The completion callback is invoked with the decision propositions corresponding to the given decision scopes. If a certain decision scope has not been fetched prior to this API call, it will not be included in the returned propositions. +This API retrieves the previously fetched propositions for the provided decision scopes from the in-memory extension propositions cache, similar to `getPropositions`. The completion callback is invoked with the decision propositions corresponding to the given decision scopes. If a certain decision scope has not been fetched prior to this API call, it will not be included in the returned propositions. Additionally, this API allows specifying a timeout for the operation. If the propositions retrieval does not complete within the given timeout, an error is returned, providing improved control over handling delays and ensuring timely application responses. @@ -146,7 +146,7 @@ iOS ## updatePropositionsWithCompletionHandlerAndTimeout -This API dispatches an event for the Edge network extension to fetch decision propositions for the provided decision scopes array from the decisioning services enabled in the Experience Edge. Similar to `updatePropositionsWithCompletionHandler`, the returned decision propositions are cached in-memory within the Optimize SDK extension and can be retrieved using the `getPropositions` API. +This API dispatches an event for the Edge network extension to fetch decision propositions for the provided decision scopes array from the decisioning services enabled in the Experience Edge. Similar to `updatePropositionsWithCompletionHandler`, the returned decision propositions are cached in-memory within the Optimize SDK extension and can be retrieved using the `getPropositions` API. Additionally, this API allows specifying a completion timeout, ensuring that the operation either completes within the given time frame or returns an error indicating a timeout. This feature provides better control over the responsiveness of the application when interacting with decisioning services. diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md b/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md index a8e49bfd81..e14c6289e1 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md @@ -321,7 +321,6 @@ Optimize.getPropositions(for: [decisionScope1, decisionScope2], timeout: 1.0) { ``` - * _decisionScopes_ is an array of decision scopes for which propositions are requested. * _timeout_ is a duration in seconds specifying the maximum time `getProposition` will wait for completion before returning `NSError`. * _completion_ is invoked with propositions dictionary of type `NSDictionary`. An `NSError` is returned if SDK fails to retrieve the propositions. @@ -350,7 +349,6 @@ AEPDecisionScope* decisionScope2 = [[AEPDecisionScope alloc] initWithName: @"myS }]; ``` - #### Java @@ -792,7 +790,6 @@ AEPDecisionScope* decisionScope2 = [[AEPDecisionScope alloc] initWithName: @"myS }]; ``` - ##### Java