Skip to content

Commit 810d5d3

Browse files
committed
Added missing documentation
1 parent 9074df7 commit 810d5d3

File tree

3 files changed

+99
-54
lines changed

3 files changed

+99
-54
lines changed

BridgeAPI.md

Lines changed: 70 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ native modules for both platforms: Android and iOS.
2828
- getLookupData
2929
- getExperiences
3030
- experienceShown
31+
- getPlacement
32+
- placementImpression
33+
- placementClickthrough
3134

3235
-------------------------------------------------------
3336
## **init(trackingId, logLevel)**
@@ -330,34 +333,78 @@ Returns Placement for given parameters.
330333
### Result
331334
Promise with a map describing Placement object. Example:
332335

333-
{
334-
"data": {
335-
"placementContent": {
336-
"content": {
337-
"image": "https://image.store.com/images/example.jpeg",
338-
"message": "Hello World",
339-
"url": "https://www.qubit.com"
340-
},
341-
"callbacks": {
342-
"impression": "https://api.qubit.com/placements/callback?data=ggW4eyJtZXRhIjp7ImlkIjo",
343-
"clickthrough": "https://api.qubit.com/placements/callback?data=mQW4eyJtZXRhIjp7Imlkx"
344-
}
345-
}
346-
}
347-
}
336+
{
337+
"image": "https://image.store.com/images/example.jpeg",
338+
"message": "Hello World",
339+
"url": "https://www.qubit.com"
340+
"impressionUrl": "https://api.qubit.com/placements/callback?data=ggW4eyJtZXRhIjp7ImlkIjo",
341+
"clickthroughUrl": "https://api.qubit.com/placements/callback?data=mQW4eyJtZXRhIjp7Imlkx"
342+
}
348343

349344

350345
### Exceptions
351346
- Exception is thrown, when SDK is not initialized.
352347

353348
### Example
354349
async () => {
355-
const placement = await getPlacement(
356-
"placement_id",
357-
"LIVE",
358-
"{ \"color\": \"blue\"}",
359-
"campaign_id",
360-
"experience_id"
361-
);
362-
...
350+
const placement = await QubitSDK.getPlacement(
351+
"placement_id",
352+
"LIVE",
353+
"{ \"color\": \"blue\"}",
354+
"campaign_id",
355+
"experience_id"
356+
);
357+
...
358+
}
359+
360+
-------------------------------------------------------
361+
362+
## placementImpression(callbackUrl)
363+
364+
### Description
365+
Sends request to URL described by placement impression callback.
366+
367+
### Parameters
368+
- callbackUrl
369+
- Type: String
370+
- Constraints: Not null
371+
- Description: Impression callback URL.
372+
373+
374+
### Result
375+
None
376+
377+
### Example
378+
async () => {
379+
const placement = await QubitSDK.placementImpression(
380+
"https://some.url.com"
381+
);
382+
...
383+
}
384+
385+
-------------------------------------------------------
386+
387+
## placementClickthrough(callbackUrl)
388+
389+
### Description
390+
Sends request to URL described by placement clickthrough callback.
391+
392+
### Parameters
393+
- callbackUrl
394+
- Type: String
395+
- Constraints: Not null
396+
- Description: Clickthrough callback URL.
397+
398+
399+
### Result
400+
None
401+
402+
### Example
403+
async () => {
404+
const placement = await QubitSDK.placementClickthrough(
405+
"https://some.url.com"
406+
);
407+
...
363408
}
409+
410+

README.md

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ Installation of the QubitSDK, to provide event tracking and lookup. To make use
66

77
### Installation
88

9-
1. `$ npm install qubit-sdk-react-native --save`
10-
or
11-
`$ yarn add qubit-sdk-react-native`
9+
1. `$ npm install qubit-sdk-react-native --save`
10+
or
11+
`$ yarn add qubit-sdk-react-native`
1212

13-
2. Navigate to your `/ios` directory and run `pod install` to ensure the `QubitSDK` CocoaPod is installed. Android should require no further installation.
13+
2. Navigate to your `/ios` directory and run `pod install` to ensure the `QubitSDK` CocoaPod is installed. Android should require no further installation.
1414

1515
Optional - if you are using React Native < 0.60, you must `link` the library.
1616

@@ -54,6 +54,9 @@ and send first event
5454
- [getExperiences](#getexperiences)
5555
- [Parameters](#parameters-3)
5656
- [Examples](#examples-6)
57+
- [getPlacement](#getplacement)
58+
- [Parameters](#parameters-4)
59+
- [Examples](#examples-7)
5760

5861
#### start
5962

@@ -221,45 +224,39 @@ Returns Placement for given parameters.
221224
##### Parameters
222225

223226
- `placementId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Unique ID of the placement.
224-
- `mode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The mode to fetch placements content with, can be one of LIVE/SAMPLE/PREVIEW. Defaults to LIVE.
225-
- `attributes` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** JSON string containing custom attributes to be used to query for the placement. "visitor" attribute will be ignored as it is set by SDK.
227+
- `mode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The mode to fetch placements content with, can be one of LIVE/SAMPLE/PREVIEW. Defaults to LIVE.
228+
- `attributes` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** JSON string containing custom attributes to be used to query for the placement. "visitor" attribute will be ignored as it is set by SDK.
226229
- `campaignId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Optional.
227230
- `experienceId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Optional.
228-
- `placementPromise` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<Placement>** Promise with query result.
229231

230-
231-
##### Example
232+
##### Examples
232233

233234
```javascript
234235
async () => {
235-
const placement = await getPlacement(
236-
"placement_id",
237-
"LIVE",
238-
"{ \"color\": \"blue\"}",
239-
"campaign_id",
240-
"experience_id"
241-
);
242-
...
236+
const placement = await getPlacement(
237+
"placement_id",
238+
"LIVE",
239+
"{ \"color\": \"blue\"}",
240+
"campaign_id",
241+
"experience_id"
242+
);
243+
244+
placement.impression();
245+
...
246+
placement.clickthrough();
247+
...
243248
}
244249

245250
{
246-
"data": {
247-
"placementContent": {
248-
"content": {
249-
"image": "https://image.store.com/images/example.jpeg",
250-
"message": "Hello World",
251-
"url": "https://www.qubit.com"
252-
},
253-
"callbacks": {
254-
"impression": "https://api.qubit.com/placements/callback?data=ggW4eyJtZXRhIjp7ImlkIjo",
255-
"clickthrough": "https://api.qubit.com/placements/callback?data=mQW4eyJtZXRhIjp7Imlkx"
256-
}
257-
}
258-
}
251+
"image": "https://image.store.com/images/example.jpeg",
252+
"message": "Hello World",
253+
"url": "https://www.qubit.com"
254+
"impressionUrl": "https://api.qubit.com/placements/callback?data=ggW4eyJtZXRhIjp7ImlkIjo",
255+
"clickthroughUrl": "https://api.qubit.com/placements/callback?data=mQW4eyJtZXRhIjp7Imlkx"
259256
}
260257
```
261258

262-
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<Placement>** with a map describing Placement object.
259+
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<Placement>** Promise with an object describing Placement object.
263260

264261
### Compatibility
265262

example/App.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class App extends PureComponent {
5151
null
5252
);
5353
console.log(placement);
54+
placement.impression();
5455
};
5556

5657
render() {

0 commit comments

Comments
 (0)