@onesignal/node-onesignal 5.8.0 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/apis/DefaultApi.d.ts +1 -1
- package/dist/apis/DefaultApi.js +224 -45
- package/dist/apis/exception.d.ts +1 -0
- package/dist/apis/exception.js +43 -0
- package/dist/errors.d.ts +8 -0
- package/dist/errors.js +11 -0
- package/dist/helpers.d.ts +16 -0
- package/dist/helpers.js +87 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/models/NotificationSlice.d.ts +2 -0
- package/dist/models/NotificationSlice.js +12 -0
- package/dist/types/ObjectParamAPI.d.ts +1 -0
- package/dist/types/ObjectParamAPI.js +1 -1
- package/dist/types/ObservableAPI.d.ts +1 -1
- package/dist/types/ObservableAPI.js +2 -2
- package/dist/types/PromiseAPI.d.ts +5 -1
- package/dist/types/PromiseAPI.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,6 +62,15 @@ const response = await client.createNotification(notification);
|
|
|
62
62
|
console.log('Notification ID:', response.id);
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
+
## Send with idempotent retries
|
|
66
|
+
|
|
67
|
+
`createNotificationWithRetry` generates a UUIDv4 `idempotency_key` when absent (a caller-provided key is respected), retries 429 / 503 / transport errors with the **same** key (honoring `Retry-After`, exponential backoff otherwise; `maxRetries` / `baseDelayMs` configurable via the options object), fails fast on other errors, and reports via `wasReplayed` whether the server answered from a previously completed request (`Idempotent-Replayed` response header). It is a `DefaultApi` method, so the call mirrors `createNotification`:
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
const result = await client.createNotificationWithRetry(notification);
|
|
71
|
+
console.log('Notification ID:', result.response.id, 'replayed:', result.wasReplayed);
|
|
72
|
+
```
|
|
73
|
+
|
|
65
74
|
## Send a push notification by External ID
|
|
66
75
|
|
|
67
76
|
Target specific users with the alias label `external_id` (snake_case). This is different from the notification-level `external_id` field, which is only for [idempotent requests](https://documentation.onesignal.com/docs/idempotent-notification-requests).
|
|
@@ -63,7 +63,7 @@ export declare class DefaultApiRequestFactory extends BaseAPIRequestFactory {
|
|
|
63
63
|
getApps(_options?: Configuration): Promise<RequestContext>;
|
|
64
64
|
getNotification(appId: string, notificationId: string, _options?: Configuration): Promise<RequestContext>;
|
|
65
65
|
getNotificationHistory(notificationId: string, getNotificationHistoryRequestBody: GetNotificationHistoryRequestBody, _options?: Configuration): Promise<RequestContext>;
|
|
66
|
-
getNotifications(appId: string, limit?: number, offset?: number, kind?: 0 | 1 | 3, _options?: Configuration): Promise<RequestContext>;
|
|
66
|
+
getNotifications(appId: string, limit?: number, offset?: number, kind?: 0 | 1 | 3, timeOffset?: string, _options?: Configuration): Promise<RequestContext>;
|
|
67
67
|
getOutcomes(appId: string, outcomeNames: string, outcomeNames2?: string, outcomeTimeRange?: string, outcomePlatforms?: string, outcomeAttribution?: string, _options?: Configuration): Promise<RequestContext>;
|
|
68
68
|
getSegments(appId: string, offset?: number, limit?: number, _options?: Configuration): Promise<RequestContext>;
|
|
69
69
|
getUser(appId: string, aliasLabel: string, aliasId: string, _options?: Configuration): Promise<RequestContext>;
|