@onesignal/node-onesignal 1.0.0-beta7 → 1.0.0-beta9
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 +29 -0
- package/.github/workflows/npm_deploy.yml +6 -7
- package/CHANGELOG.md +19 -0
- package/DefaultApi.md +1365 -164
- package/README.md +189 -0
- package/apis/DefaultApi.ts +2041 -423
- package/dist/apis/DefaultApi.d.ts +48 -0
- package/dist/apis/DefaultApi.js +1861 -414
- package/dist/apis/DefaultApi.js.map +1 -1
- package/dist/auth/auth.d.ts +6 -6
- package/dist/auth/auth.js +1 -1
- package/dist/http/http.d.ts +2 -2
- package/dist/http/http.js +1 -1
- package/dist/models/App.d.ts +5 -1
- package/dist/models/App.js +24 -0
- package/dist/models/App.js.map +1 -1
- package/dist/models/BadRequestError.d.ts +17 -0
- package/dist/models/BadRequestError.js +22 -0
- package/dist/models/BadRequestError.js.map +1 -0
- package/dist/models/BasicNotification.d.ts +5 -1
- package/dist/models/BasicNotification.js +12 -0
- package/dist/models/BasicNotification.js.map +1 -1
- package/dist/models/BasicNotificationAllOf.d.ts +1 -1
- package/dist/models/BeginLiveActivityRequest.d.ts +18 -0
- package/dist/models/BeginLiveActivityRequest.js +28 -0
- package/dist/models/BeginLiveActivityRequest.js.map +1 -0
- 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/Filter.d.ts +1 -1
- package/dist/models/FilterExpressions.d.ts +2 -2
- package/dist/models/GetNotificationRequestBody.d.ts +1 -1
- 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 +5 -1
- 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 +5 -1
- package/dist/models/NotificationWithMeta.js +12 -0
- package/dist/models/NotificationWithMeta.js.map +1 -1
- package/dist/models/ObjectSerializer.d.ts +25 -5
- package/dist/models/ObjectSerializer.js +83 -15
- package/dist/models/ObjectSerializer.js.map +1 -1
- package/dist/models/Operator.d.ts +1 -1
- package/dist/models/OutcomeData.d.ts +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 +21 -0
- package/dist/models/PropertiesDeltas.js +40 -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 +1 -1
- package/dist/models/Purchase.js +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/UpdateLiveActivityRequest.d.ts +22 -0
- package/dist/models/UpdateLiveActivityRequest.js +40 -0
- package/dist/models/UpdateLiveActivityRequest.js.map +1 -0
- package/dist/models/UpdateLiveActivitySuccessResponse.d.ts +19 -0
- package/dist/models/UpdateLiveActivitySuccessResponse.js +28 -0
- package/dist/models/UpdateLiveActivitySuccessResponse.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 +25 -5
- package/dist/models/all.js +25 -5
- package/dist/models/all.js.map +1 -1
- package/dist/types/ObjectParamAPI.d.ts +117 -0
- package/dist/types/ObjectParamAPI.js +51 -0
- package/dist/types/ObjectParamAPI.js.map +1 -1
- package/dist/types/ObservableAPI.d.ts +31 -0
- package/dist/types/ObservableAPI.js +464 -56
- package/dist/types/ObservableAPI.js.map +1 -1
- package/dist/types/PromiseAPI.d.ts +31 -0
- package/dist/types/PromiseAPI.js +68 -0
- package/dist/types/PromiseAPI.js.map +1 -1
- package/models/App.ts +41 -1
- package/models/BadRequestError.ts +31 -0
- package/models/BasicNotification.ts +17 -1
- package/models/BasicNotificationAllOf.ts +1 -1
- package/models/BasicNotificationAllOfAndroidBackgroundLayout.ts +1 -1
- package/models/BeginLiveActivityRequest.ts +38 -0
- package/models/Button.ts +1 -1
- package/models/CancelNotificationSuccessResponse.ts +1 -1
- package/models/CreateNotificationSuccessResponse.ts +1 -1
- 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 +89 -21
- 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 +53 -0
- package/models/PropertiesObject.ts +102 -0
- package/models/Purchase.ts +3 -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 +62 -0
- package/models/UpdateLiveActivitySuccessResponse.ts +39 -0
- 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 +25 -5
- package/package.json +3 -3
- package/types/ObjectParamAPI.ts +527 -5
- package/types/ObservableAPI.ts +454 -5
- package/types/PromiseAPI.ts +216 -5
package/README.md
CHANGED
|
@@ -399,6 +399,195 @@ Outcome data are accessible for 30 days before being deleted from our servers. Y
|
|
|
399
399
|
const outcomes = await client.getOutcomes(app.id, 'os__click.count,os_session_duration.count,my_outcome.sum');
|
|
400
400
|
```
|
|
401
401
|
|
|
402
|
+
### Begin Live Activity
|
|
403
|
+
Starts a Live Activity event
|
|
404
|
+
```js
|
|
405
|
+
// Create a player first
|
|
406
|
+
const player = new OneSignal.Player();
|
|
407
|
+
player.device_type = 0;
|
|
408
|
+
player.app_id = '<app id>';
|
|
409
|
+
const playerResponse = await api.createPlayer(player);
|
|
410
|
+
|
|
411
|
+
// Prepare a request
|
|
412
|
+
const beginLiveActivityRequest: BeginLiveActivityRequest = {
|
|
413
|
+
push_token: '<push_token>',
|
|
414
|
+
subscription_id: playerResponse.id!,
|
|
415
|
+
};
|
|
416
|
+
const activityId = '<activity_id>'; // any string
|
|
417
|
+
|
|
418
|
+
// Begin activity
|
|
419
|
+
await api.beginLiveActivity('<app_id>', activityId, beginLiveActivityRequest);
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### Update Live Activity
|
|
423
|
+
Updates a Live Activity event
|
|
424
|
+
```js
|
|
425
|
+
const updateLiveActivityRequest: UpdateLiveActivityRequest = {
|
|
426
|
+
event_updates: {
|
|
427
|
+
data: 'test'
|
|
428
|
+
},
|
|
429
|
+
event: "update",
|
|
430
|
+
name: "contents"
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
await api.updateLiveActivity('<app_id>', '<activity_id>', updateLiveActivityRequest);
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### End Live Activity
|
|
437
|
+
Stops a Live Activity event
|
|
438
|
+
```js
|
|
439
|
+
const subscriptionId = '<subscription_id>'; // player id
|
|
440
|
+
await api.endLiveActivity('<app_id>', '<activity_id>', subscriptionId);
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### Subscription types
|
|
444
|
+
* iOSPush
|
|
445
|
+
* AndroidPush
|
|
446
|
+
* FireOSPush
|
|
447
|
+
* ChromeExtensionPush
|
|
448
|
+
* ChromePush
|
|
449
|
+
* WindowsPush
|
|
450
|
+
* SafariLegacyPush
|
|
451
|
+
* FirefoxPush
|
|
452
|
+
* macOSPush
|
|
453
|
+
* HuaweiPush
|
|
454
|
+
* SafariPush
|
|
455
|
+
* Email
|
|
456
|
+
* SMS
|
|
457
|
+
|
|
458
|
+
## Users
|
|
459
|
+
### Creating a OneSignal User
|
|
460
|
+
```js
|
|
461
|
+
const user = new OneSignal.User();
|
|
462
|
+
|
|
463
|
+
const aliasLabel = '<alias_label>';
|
|
464
|
+
const aliasId = '<alias_id>';
|
|
465
|
+
const subscriptionToken = '<subscription_token>';
|
|
466
|
+
|
|
467
|
+
user.identity = {
|
|
468
|
+
[aliasLabel]: aliasId,
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
user.subscriptions = [
|
|
472
|
+
{
|
|
473
|
+
type: "iOSPush",
|
|
474
|
+
token: subscriptionToken,
|
|
475
|
+
}
|
|
476
|
+
];
|
|
477
|
+
|
|
478
|
+
const createdUser = await api.createUser('<app_id>', user);
|
|
479
|
+
assert(createdUser.identity!['onesignal_id'] != null);
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### Getting a user by `onesignal_id`
|
|
483
|
+
```js
|
|
484
|
+
const oneisgnalAliasLabel = "onesignal_id";
|
|
485
|
+
const onesignalAliasId = createdUser.identity!['onesignal_id'];
|
|
486
|
+
|
|
487
|
+
const fetchedUser = await api.fetchUser('<app_id>', oneisgnalAliasLabel, onesignalAliasId);
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### Getting a user by an alias
|
|
491
|
+
```js
|
|
492
|
+
const fetchedUser = await api.fetchUser('<app_id>', alias_label, alias_id);
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Updating a user
|
|
496
|
+
```js
|
|
497
|
+
const updateUserRequest: UpdateUserRequest = {
|
|
498
|
+
properties: {
|
|
499
|
+
language: 'fr'
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
const updatedUser = await api.updateUser('<app_id>', aliasLabel, aliasId, updateUserRequest);
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### Deleting a user
|
|
507
|
+
```js
|
|
508
|
+
await api.deleteUser('<app_id>', aliasLabel, aliasId);
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
## Subscriptions
|
|
512
|
+
### Creating a subscription for existing user
|
|
513
|
+
```js
|
|
514
|
+
const createSubscriptionRequestBody: CreateSubscriptionRequestBody = {
|
|
515
|
+
subscription: {
|
|
516
|
+
type: "AndroidPush",
|
|
517
|
+
token: '<subscription_token>',
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
const response = await api.createSubscription('<app_id>', '<alias_label>', '<alias_id>', createSubscriptionRequestBody);
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### Updating a subscription
|
|
525
|
+
```js
|
|
526
|
+
const updateSubscriptionRequestBody: UpdateSubscriptionRequestBody = {
|
|
527
|
+
subscription: {
|
|
528
|
+
type: "iOSPush",
|
|
529
|
+
token: '<new-subscription-token>',
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
await api.updateSubscription('<app_id>', '<existing_subscription_id>', updateSubscriptionRequestBody);
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### Deleting a subscription
|
|
537
|
+
```js
|
|
538
|
+
await api.deleteSubscription('<app_id>', '<subscription_id>');
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
### Transfer subscription ownership
|
|
542
|
+
Transfers the subscription from one user to another.
|
|
543
|
+
```js
|
|
544
|
+
// Setting the user for transfering the subscription to. User is identyfied by an IdentityObject.
|
|
545
|
+
const transferSubscriptionRequestBody: TransferSubscriptionRequestBody = {
|
|
546
|
+
identity: otherUserIdentityObject
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
const transferResponse = await api.transferSubscription('<app_id>', '<subscription_id>', transferSubscriptionRequestBody);
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
## Aliases
|
|
553
|
+
### Fetching aliases for a user
|
|
554
|
+
```js
|
|
555
|
+
const fetchResponse = await api.fetchAliases('<app_id>', '<subscription_id>');
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### Fetching user identity
|
|
559
|
+
```js
|
|
560
|
+
const fetchResponse = await api.fetchUserIdentity('<app_id>', '<alias_label>', '<alias_id>');
|
|
561
|
+
```
|
|
562
|
+
### Identifying user by alias
|
|
563
|
+
```js
|
|
564
|
+
const userIdentityRequestBody: UserIdentityRequestBody = {
|
|
565
|
+
identity: {
|
|
566
|
+
['<new_alias_label>']: '<new_alias_id>'
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
const identifyResponse = await api.identifyUserByAlias('<app_id>',
|
|
571
|
+
'<existing_alias_label>',
|
|
572
|
+
'<existing_alias_id>',
|
|
573
|
+
userIdentityRequestBody);
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
### Identifying user by subscription id
|
|
577
|
+
```js
|
|
578
|
+
const userIdentityRequestBody: UserIdentityRequestBody = {
|
|
579
|
+
identity: {
|
|
580
|
+
['<new_alias_label>']: '<new_alias_id>'
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
const identifyResponse = await api.identifyUserBySubscriptionId('<app_id>', '<existing_subscription_id>', userIdentityRequestBody);
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
### Deleting an alias
|
|
588
|
+
```js
|
|
589
|
+
await api.deleteAlias('<app_id>', '<alias_label>', '<alias_id>', '<alias_label_to_delete>');
|
|
590
|
+
```
|
|
402
591
|
## Author
|
|
403
592
|
|
|
404
593
|
* Website: https://onesignal.com
|