Skip to content

Commit 9907ed5

Browse files
[MOB-11346] exposing baseIterableRequest (#489)
* [MOB-11346] exposing baseIterableRequest * Update README.md Co-authored-by: lauren-mulkern <[email protected]> * Update README.md Co-authored-by: lauren-mulkern <[email protected]> * [MOB-11346] adding example for readme --------- Co-authored-by: lauren-mulkern <[email protected]>
1 parent f56fbbb commit 9907ed5

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Iterable's API, see the [API Overview](https://support.iterable.com/hc/articles/
9494

9595
| Method Name | Description |
9696
| --------------------------------------------------------------------------------- | ----------- |
97+
| [`baseIterableRequest`](#baseiterablerequest) | Executes a custom API request to Iterable, using an extended request configuration for validation and optional features. Valid for web API keys and their supported endpoints only. [Learn more](https://support.iterable.com/hc/articles/360043464871-API-Keys#client-side-keys) |
9798
| [`filterHiddenInAppMessages`](#filterhiddeninappmessages) | From an array of passed-in in-app messages, filters out messages that have already been read, messages that should not be displayed, and messages that only contain JSON data. |
9899
| [`filterOnlyReadAndNeverTriggerMessages`](#filteronlyreadandnevertriggermessages) | From an array of passed-in in-app messages, filters out messages that have already been read and messages that should not be displayed. |
99100
| [`getInAppMessages`](#getInAppMessages) | Fetches in-app messages by calling [`GET /api/inApp/getMessages`](https://support.iterable.com/hc/articles/204780579#get-api-inapp-getmessages). |
@@ -127,6 +128,37 @@ Notes:
127128
automatically track `inAppClick` events or handle custom CTAs. This will impact
128129
analytics for all Safari and mobile iOS users.
129130

131+
## `baseIterableRequest`
132+
133+
Executes a custom API request to Iterable, using an extended request configuration for validation and optional features. Valid for web API keys and their supported endpoints only. [Learn more](https://support.iterable.com/hc/articles/360043464871-API-Keys#client-side-keys)
134+
135+
```ts
136+
function baseIterableRequest(
137+
payload: ExtendedRequestConfig
138+
): IterablePromise<T = any>
139+
```
140+
141+
Parameters:
142+
- `payload` - A request config see [`ExtendedRequestConfig`](#ExtendedRequestConfig)
143+
144+
Example:
145+
```ts
146+
baseIterableRequest<IterableResponse>({
147+
method: 'GET',
148+
url: '/embedded-messaging/messages',
149+
params: {
150+
placementIds: [1, 2, 3],
151+
platform: 'Web',
152+
sdkVersion: '1.0.0',
153+
packageName: 'pkgName'
154+
}
155+
});
156+
```
157+
158+
See also:
159+
160+
- [`IterablePromise`](#iterablepromise)
161+
130162
## `filterHiddenInAppMessages`
131163

132164
From an array of passed-in in-app messages, filters out messages that have
@@ -1793,6 +1825,20 @@ type IterableErrorStatus =
17931825
| 'InvalidJwtPayload';
17941826
```
17951827

1828+
## `ExtendedRequestConfig`
1829+
1830+
An extension of the AxiosRequestConfig
1831+
1832+
```ts
1833+
interface ExtendedRequestConfig extends AxiosRequestConfig {
1834+
validation?: {
1835+
data?: AnySchema;
1836+
params?: AnySchema;
1837+
};
1838+
sendBeacon?: boolean;
1839+
}
1840+
```
1841+
17961842
## `IterablePromise`
17971843

17981844
A promise.

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export * from './embedded';
88
export * from './components/card';
99
export * from './components/banner';
1010
export * from './components/notification';
11+
export { baseIterableRequest } from './request';
1112
export { config } from './utils/config';
1213
export { IterableConfig } from './utils/IterableConfig';
1314

0 commit comments

Comments
 (0)