@onesignal/node-onesignal 1.0.0-beta8 → 2.0.0-beta1
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/.github/workflows/Zapier.yml +34 -0
- package/CHANGELOG.md +15 -0
- package/DefaultApi.md +988 -3
- package/README.md +152 -24
- package/apis/DefaultApi.ts +1339 -98
- package/dist/apis/DefaultApi.d.ts +39 -0
- package/dist/apis/DefaultApi.js +1490 -408
- package/dist/apis/DefaultApi.js.map +1 -1
- package/dist/models/BasicNotification.d.ts +4 -0
- package/dist/models/BasicNotification.js +12 -0
- package/dist/models/BasicNotification.js.map +1 -1
- package/dist/models/CreateNotificationSuccessResponse.d.ts +2 -2
- package/dist/models/CreateSubscriptionRequestBody.d.ts +19 -0
- package/dist/models/CreateSubscriptionRequestBody.js +28 -0
- package/dist/models/CreateSubscriptionRequestBody.js.map +1 -0
- package/dist/models/CreateUserConflictResponse.d.ts +18 -0
- package/dist/models/CreateUserConflictResponse.js +22 -0
- package/dist/models/CreateUserConflictResponse.js.map +1 -0
- package/dist/models/CreateUserConflictResponseErrorsInner.d.ts +20 -0
- package/dist/models/CreateUserConflictResponseErrorsInner.js +34 -0
- package/dist/models/CreateUserConflictResponseErrorsInner.js.map +1 -0
- package/dist/models/CreateUserConflictResponseErrorsItemsMeta.d.ts +17 -0
- package/dist/models/CreateUserConflictResponseErrorsItemsMeta.js +22 -0
- package/dist/models/CreateUserConflictResponseErrorsItemsMeta.js.map +1 -0
- package/dist/models/IdentifyUserConflictResponse.d.ts +18 -0
- package/dist/models/IdentifyUserConflictResponse.js +22 -0
- package/dist/models/IdentifyUserConflictResponse.js.map +1 -0
- package/dist/models/IdentifyUserConflictResponseErrorsInner.d.ts +18 -0
- package/dist/models/IdentifyUserConflictResponseErrorsInner.js +28 -0
- package/dist/models/IdentifyUserConflictResponseErrorsInner.js.map +1 -0
- package/dist/models/InlineResponse200.d.ts +19 -0
- package/dist/models/InlineResponse200.js +22 -0
- package/dist/models/InlineResponse200.js.map +1 -0
- package/dist/models/InlineResponse2003.d.ts +17 -0
- package/dist/models/InlineResponse2003.js +22 -0
- package/dist/models/InlineResponse2003.js.map +1 -0
- package/dist/models/InlineResponse201.d.ts +18 -0
- package/dist/models/InlineResponse201.js +22 -0
- package/dist/models/InlineResponse201.js.map +1 -0
- package/dist/models/InlineResponse202.d.ts +18 -0
- package/dist/models/InlineResponse202.js +22 -0
- package/dist/models/InlineResponse202.js.map +1 -0
- package/dist/models/Notification.d.ts +4 -0
- package/dist/models/Notification.js +12 -0
- package/dist/models/Notification.js.map +1 -1
- package/dist/models/NotificationTarget.d.ts +4 -0
- package/dist/models/NotificationTarget.js +12 -0
- package/dist/models/NotificationTarget.js.map +1 -1
- package/dist/models/NotificationWithMeta.d.ts +4 -0
- package/dist/models/NotificationWithMeta.js +12 -0
- package/dist/models/NotificationWithMeta.js.map +1 -1
- package/dist/models/ObjectSerializer.d.ts +21 -0
- package/dist/models/ObjectSerializer.js +69 -0
- package/dist/models/ObjectSerializer.js.map +1 -1
- package/dist/models/Player.d.ts +1 -1
- package/dist/models/Player.js +1 -1
- package/dist/models/Player.js.map +1 -1
- package/dist/models/PlayerNotificationTarget.d.ts +4 -0
- package/dist/models/PlayerNotificationTarget.js +12 -0
- package/dist/models/PlayerNotificationTarget.js.map +1 -1
- package/dist/models/PlayerNotificationTargetIncludeAliases.d.ts +17 -0
- package/dist/models/PlayerNotificationTargetIncludeAliases.js +22 -0
- package/dist/models/PlayerNotificationTargetIncludeAliases.js.map +1 -0
- package/dist/models/PropertiesDeltas.d.ts +20 -0
- package/dist/models/PropertiesDeltas.js +34 -0
- package/dist/models/PropertiesDeltas.js.map +1 -0
- package/dist/models/PropertiesObject.d.ts +30 -0
- package/dist/models/PropertiesObject.js +82 -0
- package/dist/models/PropertiesObject.js.map +1 -0
- package/dist/models/Purchase.d.ts +2 -1
- package/dist/models/Purchase.js +7 -1
- package/dist/models/Purchase.js.map +1 -1
- package/dist/models/SubscriptionObject.d.ts +34 -0
- package/dist/models/SubscriptionObject.js +118 -0
- package/dist/models/SubscriptionObject.js.map +1 -0
- package/dist/models/TransferSubscriptionRequestBody.d.ts +19 -0
- package/dist/models/TransferSubscriptionRequestBody.js +22 -0
- package/dist/models/TransferSubscriptionRequestBody.js.map +1 -0
- package/dist/models/UpdateSubscriptionRequestBody.d.ts +18 -0
- package/dist/models/UpdateSubscriptionRequestBody.js +22 -0
- package/dist/models/UpdateSubscriptionRequestBody.js.map +1 -0
- package/dist/models/UpdateUserRequest.d.ts +21 -0
- package/dist/models/UpdateUserRequest.js +34 -0
- package/dist/models/UpdateUserRequest.js.map +1 -0
- package/dist/models/User.d.ts +25 -0
- package/dist/models/User.js +40 -0
- package/dist/models/User.js.map +1 -0
- package/dist/models/UserIdentityRequestBody.d.ts +19 -0
- package/dist/models/UserIdentityRequestBody.js +22 -0
- package/dist/models/UserIdentityRequestBody.js.map +1 -0
- package/dist/models/UserIdentityResponse.d.ts +19 -0
- package/dist/models/UserIdentityResponse.js +22 -0
- package/dist/models/UserIdentityResponse.js.map +1 -0
- package/dist/models/UserSubscriptionOptions.d.ts +17 -0
- package/dist/models/UserSubscriptionOptions.js +22 -0
- package/dist/models/UserSubscriptionOptions.js.map +1 -0
- package/dist/models/all.d.ts +21 -0
- package/dist/models/all.js +21 -0
- package/dist/models/all.js.map +1 -1
- package/dist/types/ObjectParamAPI.d.ts +95 -0
- package/dist/types/ObjectParamAPI.js +42 -0
- package/dist/types/ObjectParamAPI.js.map +1 -1
- package/dist/types/ObservableAPI.d.ts +25 -0
- package/dist/types/ObservableAPI.js +383 -47
- package/dist/types/ObservableAPI.js.map +1 -1
- package/dist/types/PromiseAPI.d.ts +25 -0
- package/dist/types/PromiseAPI.js +56 -0
- package/dist/types/PromiseAPI.js.map +1 -1
- package/models/App.ts +1 -1
- package/models/BadRequestError.ts +1 -1
- package/models/BasicNotification.ts +17 -1
- package/models/BasicNotificationAllOf.ts +1 -1
- package/models/BasicNotificationAllOfAndroidBackgroundLayout.ts +1 -1
- package/models/BeginLiveActivityRequest.ts +1 -1
- package/models/Button.ts +1 -1
- package/models/CancelNotificationSuccessResponse.ts +1 -1
- package/models/CreateNotificationSuccessResponse.ts +3 -3
- package/models/CreatePlayerSuccessResponse.ts +1 -1
- package/models/CreateSegmentConflictResponse.ts +1 -1
- package/models/CreateSegmentSuccessResponse.ts +1 -1
- package/models/CreateSubscriptionRequestBody.ts +39 -0
- package/models/CreateUserConflictResponse.ts +32 -0
- package/models/CreateUserConflictResponseErrorsInner.ts +46 -0
- package/models/CreateUserConflictResponseErrorsItemsMeta.ts +31 -0
- package/models/DeletePlayerNotFoundResponse.ts +1 -1
- package/models/DeletePlayerSuccessResponse.ts +1 -1
- package/models/DeleteSegmentNotFoundResponse.ts +1 -1
- package/models/DeleteSegmentSuccessResponse.ts +1 -1
- package/models/DeliveryData.ts +1 -1
- package/models/ExportPlayersRequestBody.ts +1 -1
- package/models/ExportPlayersSuccessResponse.ts +1 -1
- package/models/Filter.ts +1 -1
- package/models/FilterExpressions.ts +1 -1
- package/models/GetNotificationRequestBody.ts +1 -1
- package/models/IdentifyUserConflictResponse.ts +32 -0
- package/models/IdentifyUserConflictResponseErrorsInner.ts +38 -0
- package/models/InlineResponse200.ts +31 -0
- package/models/InlineResponse2003.ts +31 -0
- package/models/InlineResponse201.ts +32 -0
- package/models/InlineResponse202.ts +32 -0
- package/models/InvalidIdentifierError.ts +1 -1
- package/models/Notification.ts +17 -1
- package/models/Notification200Errors.ts +1 -1
- package/models/NotificationAllOf.ts +1 -1
- package/models/NotificationHistorySuccessResponse.ts +1 -1
- package/models/NotificationSlice.ts +1 -1
- package/models/NotificationTarget.ts +19 -1
- package/models/NotificationWithMeta.ts +17 -1
- package/models/NotificationWithMetaAllOf.ts +1 -1
- package/models/ObjectSerializer.ts +74 -5
- package/models/Operator.ts +1 -1
- package/models/OutcomeData.ts +1 -1
- package/models/OutcomesData.ts +1 -1
- package/models/PlatformDeliveryData.ts +1 -1
- package/models/PlatformDeliveryDataEmailAllOf.ts +1 -1
- package/models/PlatformDeliveryDataSmsAllOf.ts +1 -1
- package/models/Player.ts +3 -3
- package/models/PlayerNotificationTarget.ts +19 -1
- package/models/PlayerNotificationTargetIncludeAliases.ts +31 -0
- package/models/PlayerSlice.ts +1 -1
- package/models/PropertiesDeltas.ts +46 -0
- package/models/PropertiesObject.ts +102 -0
- package/models/Purchase.ts +10 -3
- package/models/Segment.ts +1 -1
- package/models/SegmentNotificationTarget.ts +1 -1
- package/models/StringMap.ts +1 -1
- package/models/SubscriptionObject.ts +146 -0
- package/models/TransferSubscriptionRequestBody.ts +31 -0
- package/models/UpdateLiveActivityRequest.ts +1 -1
- package/models/UpdateLiveActivitySuccessResponse.ts +1 -1
- package/models/UpdatePlayerSuccessResponse.ts +1 -1
- package/models/UpdatePlayerTagsRequestBody.ts +1 -1
- package/models/UpdatePlayerTagsSuccessResponse.ts +1 -1
- package/models/UpdateSubscriptionRequestBody.ts +32 -0
- package/models/UpdateUserRequest.ts +47 -0
- package/models/User.ts +55 -0
- package/models/UserIdentityRequestBody.ts +31 -0
- package/models/UserIdentityResponse.ts +31 -0
- package/models/UserSubscriptionOptions.ts +31 -0
- package/models/all.ts +21 -0
- package/package.json +2 -2
- package/types/ObjectParamAPI.ts +427 -0
- package/types/ObservableAPI.ts +371 -0
- package/types/PromiseAPI.ts +175 -0
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ const configuration = OneSignal.createConfiguration({
|
|
|
68
68
|
const client = new OneSignal.DefaultApi(configuration);
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
#### Advanced Usage: Creating a brand
|
|
71
|
+
#### Advanced Usage: Creating a brand-new app
|
|
72
72
|
If creating a new app via the client, the response will return the app's API key via the `basic_auth_key` response
|
|
73
73
|
parameter. You can then use this to modify your configuration object and create a new client that will have both user-level and app-level authentication set up.
|
|
74
74
|
|
|
@@ -86,6 +86,8 @@ const client = new OneSignal.DefaultApi(configuration);
|
|
|
86
86
|
---
|
|
87
87
|
## API Reference
|
|
88
88
|
|
|
89
|
+
> See the full list of [API Endpoints](DefaultApi.MD).
|
|
90
|
+
|
|
89
91
|
To make stateful changes requests should take on the following pattern:
|
|
90
92
|
1. create or get an object
|
|
91
93
|
2. make changes to that object
|
|
@@ -96,28 +98,6 @@ Examples of important OneSignal objects include `App`, `Notification`, `Player`,
|
|
|
96
98
|
For example, see the section below on creating an app. First an app object is created via the instantiation of the `App`
|
|
97
99
|
class. Then, the app instance is modified directly. Finally, we use the `client` to create the app via a remote request.
|
|
98
100
|
|
|
99
|
-
| Function | HTTP Request | Description |
|
|
100
|
-
|---------------------------------------------------------|------------------------------------------------|-----------------------------------------------------|
|
|
101
|
-
| [cancelNotification](#canceling-a-notification) | Delete `/notifications/{notification_id}` | Stop a scheduled or currently outgoing notification |
|
|
102
|
-
| [createApp](#creating-an-app) | Post `/apps` | Create an app |
|
|
103
|
-
| [createNotification](#creating-a-notification) | Post `/notifications` | Create notification |
|
|
104
|
-
| [createPlayer](#creating-a-player) | Post `/players` | Add a device |
|
|
105
|
-
| [createSegments](#creating-a-segment) | Post `/apps/{app_id}/segments` | Create Segments |
|
|
106
|
-
| [deletePlayer](#deleting-a-player) | Delete `/players/{player_id}` | Delete a user record |
|
|
107
|
-
| [deleteSegments](#deleting-a-segment) | Delete `/apps/{app_id}/segments/{segment_id}` | Delete Segments |
|
|
108
|
-
| [exportPlayers](#exporting-a-player) | Post `/players/csv_export?app_id={app_id}` | CSV export |
|
|
109
|
-
| [getApp](#getting-an-app) | Get `/apps/{app_id}` | View an app |
|
|
110
|
-
| [getApps](#getting-multiple-apps) | Get `/apps` | View apps |
|
|
111
|
-
| [getNotification](#getting-a-notification) | Get `/notifications/{notification_id}` | View notification |
|
|
112
|
-
| [getNotificationHistory](#getting-notification-history) | Post `/notifications/{notification_id}/history` | Notification History |
|
|
113
|
-
| [getNotifications](#getting-a-notification) | Get `/notifications` | View notifications |
|
|
114
|
-
| [getOutcomes](#getting-outcomes) | Get `/apps/{app_id}/outcomes` | View Outcomes |
|
|
115
|
-
| [getPlayer](#getting-a-player) | Get `/players/{player_id}` | View device |
|
|
116
|
-
| [getPlayers](#getting-players) | Get `/players` | View devices |
|
|
117
|
-
| [updateApp](#getting-an-app) | Put `/apps/{app_id}` | Update an app |
|
|
118
|
-
| [updatePlayer](#updating-a-player) | Put `/players/{player_id}` | Edit device |
|
|
119
|
-
| [updatePlayerTags](#updating-player-tags) | Put `/apps/{app_id}/users/{external_user_id}` | Edit tags with external user id |
|
|
120
|
-
|
|
121
101
|
### Creating an app
|
|
122
102
|
Creates a new OneSignal app.
|
|
123
103
|
|
|
@@ -440,6 +420,154 @@ const subscriptionId = '<subscription_id>'; // player id
|
|
|
440
420
|
await api.endLiveActivity('<app_id>', '<activity_id>', subscriptionId);
|
|
441
421
|
```
|
|
442
422
|
|
|
423
|
+
### Subscription types
|
|
424
|
+
* iOSPush
|
|
425
|
+
* AndroidPush
|
|
426
|
+
* FireOSPush
|
|
427
|
+
* ChromeExtensionPush
|
|
428
|
+
* ChromePush
|
|
429
|
+
* WindowsPush
|
|
430
|
+
* SafariLegacyPush
|
|
431
|
+
* FirefoxPush
|
|
432
|
+
* macOSPush
|
|
433
|
+
* HuaweiPush
|
|
434
|
+
* SafariPush
|
|
435
|
+
* Email
|
|
436
|
+
* SMS
|
|
437
|
+
|
|
438
|
+
## Users
|
|
439
|
+
### Creating a OneSignal User
|
|
440
|
+
```js
|
|
441
|
+
const user = new OneSignal.User();
|
|
442
|
+
|
|
443
|
+
const aliasLabel = '<alias_label>';
|
|
444
|
+
const aliasId = '<alias_id>';
|
|
445
|
+
const subscriptionToken = '<subscription_token>';
|
|
446
|
+
|
|
447
|
+
user.identity = {
|
|
448
|
+
[aliasLabel]: aliasId,
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
user.subscriptions = [
|
|
452
|
+
{
|
|
453
|
+
type: "iOSPush",
|
|
454
|
+
token: subscriptionToken,
|
|
455
|
+
}
|
|
456
|
+
];
|
|
457
|
+
|
|
458
|
+
const createdUser = await api.createUser('<app_id>', user);
|
|
459
|
+
assert(createdUser.identity!['onesignal_id'] != null);
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Getting a user by `onesignal_id`
|
|
463
|
+
```js
|
|
464
|
+
const oneisgnalAliasLabel = "onesignal_id";
|
|
465
|
+
const onesignalAliasId = createdUser.identity!['onesignal_id'];
|
|
466
|
+
|
|
467
|
+
const fetchedUser = await api.fetchUser('<app_id>', oneisgnalAliasLabel, onesignalAliasId);
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### Getting a user by an alias
|
|
471
|
+
```js
|
|
472
|
+
const fetchedUser = await api.fetchUser('<app_id>', alias_label, alias_id);
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
### Updating a user
|
|
476
|
+
```js
|
|
477
|
+
const updateUserRequest: UpdateUserRequest = {
|
|
478
|
+
properties: {
|
|
479
|
+
language: 'fr'
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
const updatedUser = await api.updateUser('<app_id>', aliasLabel, aliasId, updateUserRequest);
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### Deleting a user
|
|
487
|
+
```js
|
|
488
|
+
await api.deleteUser('<app_id>', aliasLabel, aliasId);
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
## Subscriptions
|
|
492
|
+
### Creating a subscription for existing user
|
|
493
|
+
```js
|
|
494
|
+
const createSubscriptionRequestBody: CreateSubscriptionRequestBody = {
|
|
495
|
+
subscription: {
|
|
496
|
+
type: "AndroidPush",
|
|
497
|
+
token: '<subscription_token>',
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
const response = await api.createSubscription('<app_id>', '<alias_label>', '<alias_id>', createSubscriptionRequestBody);
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### Updating a subscription
|
|
505
|
+
```js
|
|
506
|
+
const updateSubscriptionRequestBody: UpdateSubscriptionRequestBody = {
|
|
507
|
+
subscription: {
|
|
508
|
+
type: "iOSPush",
|
|
509
|
+
token: '<new-subscription-token>',
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
await api.updateSubscription('<app_id>', '<existing_subscription_id>', updateSubscriptionRequestBody);
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
### Deleting a subscription
|
|
517
|
+
```js
|
|
518
|
+
await api.deleteSubscription('<app_id>', '<subscription_id>');
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### Transfer subscription ownership
|
|
522
|
+
Transfers the subscription from one user to another.
|
|
523
|
+
```js
|
|
524
|
+
// Setting the user for transfering the subscription to. User is identyfied by an IdentityObject.
|
|
525
|
+
const transferSubscriptionRequestBody: TransferSubscriptionRequestBody = {
|
|
526
|
+
identity: otherUserIdentityObject
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
const transferResponse = await api.transferSubscription('<app_id>', '<subscription_id>', transferSubscriptionRequestBody);
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
## Aliases
|
|
533
|
+
### Fetching aliases for a user
|
|
534
|
+
```js
|
|
535
|
+
const fetchResponse = await api.fetchAliases('<app_id>', '<subscription_id>');
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
### Fetching user identity
|
|
539
|
+
```js
|
|
540
|
+
const fetchResponse = await api.fetchUserIdentity('<app_id>', '<alias_label>', '<alias_id>');
|
|
541
|
+
```
|
|
542
|
+
### Identifying user by alias
|
|
543
|
+
```js
|
|
544
|
+
const userIdentityRequestBody: UserIdentityRequestBody = {
|
|
545
|
+
identity: {
|
|
546
|
+
['<new_alias_label>']: '<new_alias_id>'
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
const identifyResponse = await api.identifyUserByAlias('<app_id>',
|
|
551
|
+
'<existing_alias_label>',
|
|
552
|
+
'<existing_alias_id>',
|
|
553
|
+
userIdentityRequestBody);
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
### Identifying user by subscription id
|
|
557
|
+
```js
|
|
558
|
+
const userIdentityRequestBody: UserIdentityRequestBody = {
|
|
559
|
+
identity: {
|
|
560
|
+
['<new_alias_label>']: '<new_alias_id>'
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
const identifyResponse = await api.identifyUserBySubscriptionId('<app_id>', '<existing_subscription_id>', userIdentityRequestBody);
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### Deleting an alias
|
|
568
|
+
```js
|
|
569
|
+
await api.deleteAlias('<app_id>', '<alias_label>', '<alias_id>', '<alias_label_to_delete>');
|
|
570
|
+
```
|
|
443
571
|
## Author
|
|
444
572
|
|
|
445
573
|
* Website: https://onesignal.com
|
|
@@ -456,6 +584,6 @@ Give a ⭐️ if this project helped you!
|
|
|
456
584
|
|
|
457
585
|
## 📝 License
|
|
458
586
|
|
|
459
|
-
Copyright ©
|
|
587
|
+
Copyright © 2023 [OneSignal](https://github.com/OneSignal).
|
|
460
588
|
|
|
461
589
|
This project is [MIT](https://github.com/OneSignal/node-onesignal/blob/main/LICENSE) licensed.
|