@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.
Files changed (208) hide show
  1. package/.github/workflows/Zapier.yml +29 -0
  2. package/.github/workflows/npm_deploy.yml +6 -7
  3. package/CHANGELOG.md +19 -0
  4. package/DefaultApi.md +1365 -164
  5. package/README.md +189 -0
  6. package/apis/DefaultApi.ts +2041 -423
  7. package/dist/apis/DefaultApi.d.ts +48 -0
  8. package/dist/apis/DefaultApi.js +1861 -414
  9. package/dist/apis/DefaultApi.js.map +1 -1
  10. package/dist/auth/auth.d.ts +6 -6
  11. package/dist/auth/auth.js +1 -1
  12. package/dist/http/http.d.ts +2 -2
  13. package/dist/http/http.js +1 -1
  14. package/dist/models/App.d.ts +5 -1
  15. package/dist/models/App.js +24 -0
  16. package/dist/models/App.js.map +1 -1
  17. package/dist/models/BadRequestError.d.ts +17 -0
  18. package/dist/models/BadRequestError.js +22 -0
  19. package/dist/models/BadRequestError.js.map +1 -0
  20. package/dist/models/BasicNotification.d.ts +5 -1
  21. package/dist/models/BasicNotification.js +12 -0
  22. package/dist/models/BasicNotification.js.map +1 -1
  23. package/dist/models/BasicNotificationAllOf.d.ts +1 -1
  24. package/dist/models/BeginLiveActivityRequest.d.ts +18 -0
  25. package/dist/models/BeginLiveActivityRequest.js +28 -0
  26. package/dist/models/BeginLiveActivityRequest.js.map +1 -0
  27. package/dist/models/CreateSubscriptionRequestBody.d.ts +19 -0
  28. package/dist/models/CreateSubscriptionRequestBody.js +28 -0
  29. package/dist/models/CreateSubscriptionRequestBody.js.map +1 -0
  30. package/dist/models/CreateUserConflictResponse.d.ts +18 -0
  31. package/dist/models/CreateUserConflictResponse.js +22 -0
  32. package/dist/models/CreateUserConflictResponse.js.map +1 -0
  33. package/dist/models/CreateUserConflictResponseErrorsInner.d.ts +20 -0
  34. package/dist/models/CreateUserConflictResponseErrorsInner.js +34 -0
  35. package/dist/models/CreateUserConflictResponseErrorsInner.js.map +1 -0
  36. package/dist/models/CreateUserConflictResponseErrorsItemsMeta.d.ts +17 -0
  37. package/dist/models/CreateUserConflictResponseErrorsItemsMeta.js +22 -0
  38. package/dist/models/CreateUserConflictResponseErrorsItemsMeta.js.map +1 -0
  39. package/dist/models/Filter.d.ts +1 -1
  40. package/dist/models/FilterExpressions.d.ts +2 -2
  41. package/dist/models/GetNotificationRequestBody.d.ts +1 -1
  42. package/dist/models/IdentifyUserConflictResponse.d.ts +18 -0
  43. package/dist/models/IdentifyUserConflictResponse.js +22 -0
  44. package/dist/models/IdentifyUserConflictResponse.js.map +1 -0
  45. package/dist/models/IdentifyUserConflictResponseErrorsInner.d.ts +18 -0
  46. package/dist/models/IdentifyUserConflictResponseErrorsInner.js +28 -0
  47. package/dist/models/IdentifyUserConflictResponseErrorsInner.js.map +1 -0
  48. package/dist/models/InlineResponse200.d.ts +19 -0
  49. package/dist/models/InlineResponse200.js +22 -0
  50. package/dist/models/InlineResponse200.js.map +1 -0
  51. package/dist/models/InlineResponse2003.d.ts +17 -0
  52. package/dist/models/InlineResponse2003.js +22 -0
  53. package/dist/models/InlineResponse2003.js.map +1 -0
  54. package/dist/models/InlineResponse201.d.ts +18 -0
  55. package/dist/models/InlineResponse201.js +22 -0
  56. package/dist/models/InlineResponse201.js.map +1 -0
  57. package/dist/models/InlineResponse202.d.ts +18 -0
  58. package/dist/models/InlineResponse202.js +22 -0
  59. package/dist/models/InlineResponse202.js.map +1 -0
  60. package/dist/models/Notification.d.ts +5 -1
  61. package/dist/models/Notification.js +12 -0
  62. package/dist/models/Notification.js.map +1 -1
  63. package/dist/models/NotificationTarget.d.ts +4 -0
  64. package/dist/models/NotificationTarget.js +12 -0
  65. package/dist/models/NotificationTarget.js.map +1 -1
  66. package/dist/models/NotificationWithMeta.d.ts +5 -1
  67. package/dist/models/NotificationWithMeta.js +12 -0
  68. package/dist/models/NotificationWithMeta.js.map +1 -1
  69. package/dist/models/ObjectSerializer.d.ts +25 -5
  70. package/dist/models/ObjectSerializer.js +83 -15
  71. package/dist/models/ObjectSerializer.js.map +1 -1
  72. package/dist/models/Operator.d.ts +1 -1
  73. package/dist/models/OutcomeData.d.ts +1 -1
  74. package/dist/models/Player.d.ts +1 -1
  75. package/dist/models/Player.js +1 -1
  76. package/dist/models/Player.js.map +1 -1
  77. package/dist/models/PlayerNotificationTarget.d.ts +4 -0
  78. package/dist/models/PlayerNotificationTarget.js +12 -0
  79. package/dist/models/PlayerNotificationTarget.js.map +1 -1
  80. package/dist/models/PlayerNotificationTargetIncludeAliases.d.ts +17 -0
  81. package/dist/models/PlayerNotificationTargetIncludeAliases.js +22 -0
  82. package/dist/models/PlayerNotificationTargetIncludeAliases.js.map +1 -0
  83. package/dist/models/PropertiesDeltas.d.ts +21 -0
  84. package/dist/models/PropertiesDeltas.js +40 -0
  85. package/dist/models/PropertiesDeltas.js.map +1 -0
  86. package/dist/models/PropertiesObject.d.ts +30 -0
  87. package/dist/models/PropertiesObject.js +82 -0
  88. package/dist/models/PropertiesObject.js.map +1 -0
  89. package/dist/models/Purchase.d.ts +1 -1
  90. package/dist/models/Purchase.js +1 -1
  91. package/dist/models/SubscriptionObject.d.ts +34 -0
  92. package/dist/models/SubscriptionObject.js +118 -0
  93. package/dist/models/SubscriptionObject.js.map +1 -0
  94. package/dist/models/TransferSubscriptionRequestBody.d.ts +19 -0
  95. package/dist/models/TransferSubscriptionRequestBody.js +22 -0
  96. package/dist/models/TransferSubscriptionRequestBody.js.map +1 -0
  97. package/dist/models/UpdateLiveActivityRequest.d.ts +22 -0
  98. package/dist/models/UpdateLiveActivityRequest.js +40 -0
  99. package/dist/models/UpdateLiveActivityRequest.js.map +1 -0
  100. package/dist/models/UpdateLiveActivitySuccessResponse.d.ts +19 -0
  101. package/dist/models/UpdateLiveActivitySuccessResponse.js +28 -0
  102. package/dist/models/UpdateLiveActivitySuccessResponse.js.map +1 -0
  103. package/dist/models/UpdateSubscriptionRequestBody.d.ts +18 -0
  104. package/dist/models/UpdateSubscriptionRequestBody.js +22 -0
  105. package/dist/models/UpdateSubscriptionRequestBody.js.map +1 -0
  106. package/dist/models/UpdateUserRequest.d.ts +21 -0
  107. package/dist/models/UpdateUserRequest.js +34 -0
  108. package/dist/models/UpdateUserRequest.js.map +1 -0
  109. package/dist/models/User.d.ts +25 -0
  110. package/dist/models/User.js +40 -0
  111. package/dist/models/User.js.map +1 -0
  112. package/dist/models/UserIdentityRequestBody.d.ts +19 -0
  113. package/dist/models/UserIdentityRequestBody.js +22 -0
  114. package/dist/models/UserIdentityRequestBody.js.map +1 -0
  115. package/dist/models/UserIdentityResponse.d.ts +19 -0
  116. package/dist/models/UserIdentityResponse.js +22 -0
  117. package/dist/models/UserIdentityResponse.js.map +1 -0
  118. package/dist/models/UserSubscriptionOptions.d.ts +17 -0
  119. package/dist/models/UserSubscriptionOptions.js +22 -0
  120. package/dist/models/UserSubscriptionOptions.js.map +1 -0
  121. package/dist/models/all.d.ts +25 -5
  122. package/dist/models/all.js +25 -5
  123. package/dist/models/all.js.map +1 -1
  124. package/dist/types/ObjectParamAPI.d.ts +117 -0
  125. package/dist/types/ObjectParamAPI.js +51 -0
  126. package/dist/types/ObjectParamAPI.js.map +1 -1
  127. package/dist/types/ObservableAPI.d.ts +31 -0
  128. package/dist/types/ObservableAPI.js +464 -56
  129. package/dist/types/ObservableAPI.js.map +1 -1
  130. package/dist/types/PromiseAPI.d.ts +31 -0
  131. package/dist/types/PromiseAPI.js +68 -0
  132. package/dist/types/PromiseAPI.js.map +1 -1
  133. package/models/App.ts +41 -1
  134. package/models/BadRequestError.ts +31 -0
  135. package/models/BasicNotification.ts +17 -1
  136. package/models/BasicNotificationAllOf.ts +1 -1
  137. package/models/BasicNotificationAllOfAndroidBackgroundLayout.ts +1 -1
  138. package/models/BeginLiveActivityRequest.ts +38 -0
  139. package/models/Button.ts +1 -1
  140. package/models/CancelNotificationSuccessResponse.ts +1 -1
  141. package/models/CreateNotificationSuccessResponse.ts +1 -1
  142. package/models/CreatePlayerSuccessResponse.ts +1 -1
  143. package/models/CreateSegmentConflictResponse.ts +1 -1
  144. package/models/CreateSegmentSuccessResponse.ts +1 -1
  145. package/models/CreateSubscriptionRequestBody.ts +39 -0
  146. package/models/CreateUserConflictResponse.ts +32 -0
  147. package/models/CreateUserConflictResponseErrorsInner.ts +46 -0
  148. package/models/CreateUserConflictResponseErrorsItemsMeta.ts +31 -0
  149. package/models/DeletePlayerNotFoundResponse.ts +1 -1
  150. package/models/DeletePlayerSuccessResponse.ts +1 -1
  151. package/models/DeleteSegmentNotFoundResponse.ts +1 -1
  152. package/models/DeleteSegmentSuccessResponse.ts +1 -1
  153. package/models/DeliveryData.ts +1 -1
  154. package/models/ExportPlayersRequestBody.ts +1 -1
  155. package/models/ExportPlayersSuccessResponse.ts +1 -1
  156. package/models/Filter.ts +1 -1
  157. package/models/FilterExpressions.ts +1 -1
  158. package/models/GetNotificationRequestBody.ts +1 -1
  159. package/models/IdentifyUserConflictResponse.ts +32 -0
  160. package/models/IdentifyUserConflictResponseErrorsInner.ts +38 -0
  161. package/models/InlineResponse200.ts +31 -0
  162. package/models/InlineResponse2003.ts +31 -0
  163. package/models/InlineResponse201.ts +32 -0
  164. package/models/InlineResponse202.ts +32 -0
  165. package/models/InvalidIdentifierError.ts +1 -1
  166. package/models/Notification.ts +17 -1
  167. package/models/Notification200Errors.ts +1 -1
  168. package/models/NotificationAllOf.ts +1 -1
  169. package/models/NotificationHistorySuccessResponse.ts +1 -1
  170. package/models/NotificationSlice.ts +1 -1
  171. package/models/NotificationTarget.ts +19 -1
  172. package/models/NotificationWithMeta.ts +17 -1
  173. package/models/NotificationWithMetaAllOf.ts +1 -1
  174. package/models/ObjectSerializer.ts +89 -21
  175. package/models/Operator.ts +1 -1
  176. package/models/OutcomeData.ts +1 -1
  177. package/models/OutcomesData.ts +1 -1
  178. package/models/PlatformDeliveryData.ts +1 -1
  179. package/models/PlatformDeliveryDataEmailAllOf.ts +1 -1
  180. package/models/PlatformDeliveryDataSmsAllOf.ts +1 -1
  181. package/models/Player.ts +3 -3
  182. package/models/PlayerNotificationTarget.ts +19 -1
  183. package/models/PlayerNotificationTargetIncludeAliases.ts +31 -0
  184. package/models/PlayerSlice.ts +1 -1
  185. package/models/PropertiesDeltas.ts +53 -0
  186. package/models/PropertiesObject.ts +102 -0
  187. package/models/Purchase.ts +3 -3
  188. package/models/Segment.ts +1 -1
  189. package/models/SegmentNotificationTarget.ts +1 -1
  190. package/models/StringMap.ts +1 -1
  191. package/models/SubscriptionObject.ts +146 -0
  192. package/models/TransferSubscriptionRequestBody.ts +31 -0
  193. package/models/UpdateLiveActivityRequest.ts +62 -0
  194. package/models/UpdateLiveActivitySuccessResponse.ts +39 -0
  195. package/models/UpdatePlayerSuccessResponse.ts +1 -1
  196. package/models/UpdatePlayerTagsRequestBody.ts +1 -1
  197. package/models/UpdatePlayerTagsSuccessResponse.ts +1 -1
  198. package/models/UpdateSubscriptionRequestBody.ts +32 -0
  199. package/models/UpdateUserRequest.ts +47 -0
  200. package/models/User.ts +55 -0
  201. package/models/UserIdentityRequestBody.ts +31 -0
  202. package/models/UserIdentityResponse.ts +31 -0
  203. package/models/UserSubscriptionOptions.ts +31 -0
  204. package/models/all.ts +25 -5
  205. package/package.json +3 -3
  206. package/types/ObjectParamAPI.ts +527 -5
  207. package/types/ObservableAPI.ts +454 -5
  208. 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