Skip to content

Commit

Permalink
Updated logic and documentation related to the structure of the type …
Browse files Browse the repository at this point in the history
…returned from getPlacement() function
  • Loading branch information
jahudzik committed Nov 10, 2020
1 parent dc107c9 commit 10b9cb6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
8 changes: 3 additions & 5 deletions BridgeAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,14 @@ Returns Placement for given parameters.
- Description: Experience identifier

### Result
Promise with a map describing Placement object. Example:
Promise with a map describing Placement object:

{
"image": "https://image.store.com/images/example.jpeg",
"message": "Hello World",
"url": "https://www.qubit.com"
"content": { ... }
"impressionUrl": "https://api.qubit.com/placements/callback?data=ggW4eyJtZXRhIjp7ImlkIjo",
"clickthroughUrl": "https://api.qubit.com/placements/callback?data=mQW4eyJtZXRhIjp7Imlkx"
}

The structure of response content depends on the type of placement that is being called.

### Exceptions
- Exception is thrown, when SDK is not initialized.
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ async () => {
}

{
"image": "https://image.store.com/images/example.jpeg",
"message": "Hello World",
"url": "https://www.qubit.com"
"content": { ... }
"impressionUrl": "https://api.qubit.com/placements/callback?data=ggW4eyJtZXRhIjp7ImlkIjo",
"clickthroughUrl": "https://api.qubit.com/placements/callback?data=mQW4eyJtZXRhIjp7Imlkx"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ public void getPlacement(
getAttributesJson(attributes),
new PlacementPreviewOptions(campaignId, experienceId),
placement -> {
JsonObject placementJson = placement.getContent();
JsonObject placementJson = new JsonObject();
placementJson.add("content", placement.getContent());
placementJson.addProperty("impressionUrl", placement.getImpressionUrl());
placementJson.addProperty("clickthroughUrl", placement.getClickthroughUrl());
placementPromise.resolve(WritableMapConverter.convertJsonToMap(placementJson));
Expand Down
4 changes: 1 addition & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,7 @@ class QubitSDK {
* }
*
* {
* "image": "https://image.store.com/images/example.jpeg",
* "message": "Hello World",
* "url": "https://www.qubit.com"
* "content": { ... }
* "impressionUrl": "https://api.qubit.com/placements/callback?data=ggW4eyJtZXRhIjp7ImlkIjo",
* "clickthroughUrl": "https://api.qubit.com/placements/callback?data=mQW4eyJtZXRhIjp7Imlkx"
* }
Expand Down

0 comments on commit 10b9cb6

Please sign in to comment.