@@ -294,6 +294,131 @@ $subscriptionId = "player_id_example";
294294self::$apiInstance->endLiveActivity(APP_ID, $activityId, $subscriptionId);
295295```
296296
297+ ## Users
298+ ### Creating a user
299+ ``` php
300+ // Create user model
301+ $user = new User();
302+ $aliasLabel = '<ALIAS _LABEL >';
303+ $aliasId = '<ALIAS _ID >';
304+ $pushToken = '<DEVICE _PUSH_TOKEN >';
305+
306+ $subscriptionObject = new SubscriptionObject();
307+ $subscriptionObject->setType('iOSPush');
308+ $subscriptionObject->setToken($pushToken);
309+
310+ $user->setIdentity(array($aliasLabel => $aliasId));
311+ $user->setSubscriptions([$subscriptionObject]);
312+
313+ // Send model to API
314+ $createUserResponse = self::$apiInstance->createUser(APP_ID, $user);
315+ ```
316+
317+ ### Fetch user by an alias
318+ ``` php
319+ $fetchUserResponse = self::$apiInstance->fetchUser(APP_ID, $aliasLabel, $aliasId);
320+ ```
321+
322+ ### Update user
323+ ``` php
324+ $updateUserRequest = new UpdateUserRequest(array(
325+ 'properties' => array(
326+ 'language' => 'fr'
327+ ))
328+ );
329+
330+ $updateUserResponse = self::$apiInstance->updateUser(APP_ID, $aliasLabel, $aliasId, $updateUserRequest);
331+ ```
332+
333+ ### Delete user
334+ ``` php
335+ self::$apiInstance->deleteUser(APP_ID, $aliasLabel, $aliasId);
336+ ```
337+
338+ ### Create subscription
339+ ``` php
340+ $createSubscriptionRequestBody = new CreateSubscriptionRequestBody();
341+ $subscriptionObject = new SubscriptionObject();
342+ $subscriptionObject->setType('AndroidPush');
343+ $subscriptionObject->setToken('DEVICE_PUSH_TOKEN');
344+ $createSubscriptionRequestBody->setSubscription($subscriptionObject);
345+
346+ $createSubscriptionResponse =
347+ self::$apiInstance->createSubscription(APP_ID, $aliasLabel, $aliasId, $createSubscriptionRequestBody);
348+ ```
349+
350+ ### Update subscription
351+ ``` php
352+ $updateSubscriptionRequestBody = new UpdateSubscriptionRequestBody();
353+ $subscriptionObject = new SubscriptionObject();
354+ $subscriptionObject->setType('AndroidPush');
355+ $subscriptionObject->setToken('DEVICE_PUSH_TOKEN'
356+ $updateSubscriptionRequestBody->setSubscription($subscriptionObject);
357+
358+ self::$apiInstance->updateSubscription(APP_ID, $subscriptionId, $updateSubscriptionRequestBody);
359+ ```
360+
361+ ### Delete subscription
362+ ``` php
363+ self::$apiInstance->deleteSubscription(APP_ID, '<SUBSCRIPTION _ID >');
364+ ```
365+ ### Delete Alias
366+ ``` php
367+ self::$apiInstance->deleteAlias(APP_ID, '<ALIAS _LABEL >', '<ALIAS _ID >', '<ALIAS _LABEL_TO_DELETE >');
368+ ```
369+
370+ ### Fetch aliases by subscription id
371+ ``` php
372+ $fetchAliasesResponse = self::$apiInstance->fetchAliases(APP_ID, '<SUBSCRIPTION _ID >');
373+ ```
374+
375+ ### Fetch aliases by another alias
376+ ``` php
377+ $fetchAliasesResponse = self::$apiInstance->fetchUserIdentity(APP_ID, '<ALIAS _LABEL >', '<ALIAS _ID >');
378+ ```
379+
380+ ### Identify user by subscription id
381+ ``` php
382+ $userIdentityRequestBody = new UserIdentityRequestBody();
383+
384+ $userIdentityRequestBody->setIdentity(array(
385+ '<NEW _ALIAS_LABEL >' => '<NEW _ALIAS_ID >'
386+ ));
387+
388+ // Act
389+ $fetchAliasesResponse = self::$apiInstance->identifyUserBySubscriptionId(
390+ APP_ID, '<SUBSCRIPTION _ID >', $userIdentityRequestBody);
391+ ```
392+
393+ ### Identify user by another alias
394+ ``` php
395+ $userIdentityRequestBody = new UserIdentityRequestBody();
396+
397+ $userIdentityRequestBody->setIdentity(array(
398+ '<NEW _ALIAS_LABEL >' => '<NEW _ALIAS_ID >'
399+ ));
400+
401+ // Act
402+ $fetchAliasesResponse = self::$apiInstance->identifyUserByAlias(
403+ APP_ID, '<ALIAS _LABEL >', '<ALIAS _ID >', $userIdentityRequestBody);
404+ ```
405+
406+
407+ ### Transfer subscription to another user
408+ ``` php
409+ $transferSubscriptionRequestBody = new TransferSubscriptionRequestBody();
410+ $transferSubscriptionRequestBody->setIdentity(array('<USER _FROM_ALIAS_LABEL >' => '<USER _FROM_ALIAS_ID >'));
411+
412+ // Act
413+ $transferSubscriptionResponse = self::$apiInstance->transferSubscription(
414+ APP_ID, '<USER _TO_SUBSCRIPTION_ID >', $transferSubscriptionRequestBody);
415+ ```
416+
417+ ### Fetch in app messages
418+ ``` php
419+ $getEligibleIamsResponse = self::$apiInstance->getEligibleIams(APP_ID, '<SUBSCRIPTION _ID >');
420+ ```
421+
297422## API Endpoints
298423
299424All URIs are relative to * https://onesignal.com/api/v1 *
@@ -306,22 +431,36 @@ Class | Method | HTTP request | Description
306431* DefaultApi* | [ ** createNotification** ] ( docs/Api/DefaultApi.md#createnotification ) | ** POST** /notifications | Create notification
307432* DefaultApi* | [ ** createPlayer** ] ( docs/Api/DefaultApi.md#createplayer ) | ** POST** /players | Add a device
308433* DefaultApi* | [ ** createSegments** ] ( docs/Api/DefaultApi.md#createsegments ) | ** POST** /apps/{app_id}/segments | Create Segments
434+ * DefaultApi* | [ ** createSubscription** ] ( docs/Api/DefaultApi.md#createsubscription ) | ** POST** /apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions |
435+ * DefaultApi* | [ ** createUser** ] ( docs/Api/DefaultApi.md#createuser ) | ** POST** /apps/{app_id}/users |
436+ * DefaultApi* | [ ** deleteAlias** ] ( docs/Api/DefaultApi.md#deletealias ) | ** DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete} |
309437* DefaultApi* | [ ** deletePlayer** ] ( docs/Api/DefaultApi.md#deleteplayer ) | ** DELETE** /players/{player_id} | Delete a user record
310438* DefaultApi* | [ ** deleteSegments** ] ( docs/Api/DefaultApi.md#deletesegments ) | ** DELETE** /apps/{app_id}/segments/{segment_id} | Delete Segments
439+ * DefaultApi* | [ ** deleteSubscription** ] ( docs/Api/DefaultApi.md#deletesubscription ) | ** DELETE** /apps/{app_id}/subscriptions/{subscription_id} |
440+ * DefaultApi* | [ ** deleteUser** ] ( docs/Api/DefaultApi.md#deleteuser ) | ** DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id} |
311441* DefaultApi* | [ ** endLiveActivity** ] ( docs/Api/DefaultApi.md#endliveactivity ) | ** DELETE** /apps/{app_id}/live_activities/{activity_id}/token/{subscription_id} | Stop Live Activity
312442* DefaultApi* | [ ** exportPlayers** ] ( docs/Api/DefaultApi.md#exportplayers ) | ** POST** /players/csv_export?app_id= ; {app_id} | CSV export
443+ * DefaultApi* | [ ** fetchAliases** ] ( docs/Api/DefaultApi.md#fetchaliases ) | ** GET** /apps/{app_id}/subscriptions/{subscription_id}/user/identity |
444+ * DefaultApi* | [ ** fetchUser** ] ( docs/Api/DefaultApi.md#fetchuser ) | ** GET** /apps/{app_id}/users/by/{alias_label}/{alias_id} |
445+ * DefaultApi* | [ ** fetchUserIdentity** ] ( docs/Api/DefaultApi.md#fetchuseridentity ) | ** GET** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity |
313446* DefaultApi* | [ ** getApp** ] ( docs/Api/DefaultApi.md#getapp ) | ** GET** /apps/{app_id} | View an app
314447* DefaultApi* | [ ** getApps** ] ( docs/Api/DefaultApi.md#getapps ) | ** GET** /apps | View apps
448+ * DefaultApi* | [ ** getEligibleIams** ] ( docs/Api/DefaultApi.md#geteligibleiams ) | ** GET** /apps/{app_id}/subscriptions/{subscription_id}/iams |
315449* DefaultApi* | [ ** getNotification** ] ( docs/Api/DefaultApi.md#getnotification ) | ** GET** /notifications/{notification_id} | View notification
316450* DefaultApi* | [ ** getNotificationHistory** ] ( docs/Api/DefaultApi.md#getnotificationhistory ) | ** POST** /notifications/{notification_id}/history | Notification History
317451* DefaultApi* | [ ** getNotifications** ] ( docs/Api/DefaultApi.md#getnotifications ) | ** GET** /notifications | View notifications
318452* DefaultApi* | [ ** getOutcomes** ] ( docs/Api/DefaultApi.md#getoutcomes ) | ** GET** /apps/{app_id}/outcomes | View Outcomes
319453* DefaultApi* | [ ** getPlayer** ] ( docs/Api/DefaultApi.md#getplayer ) | ** GET** /players/{player_id} | View device
320454* DefaultApi* | [ ** getPlayers** ] ( docs/Api/DefaultApi.md#getplayers ) | ** GET** /players | View devices
455+ * DefaultApi* | [ ** identifyUserByAlias** ] ( docs/Api/DefaultApi.md#identifyuserbyalias ) | ** PATCH** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity |
456+ * DefaultApi* | [ ** identifyUserBySubscriptionId** ] ( docs/Api/DefaultApi.md#identifyuserbysubscriptionid ) | ** PATCH** /apps/{app_id}/subscriptions/{subscription_id}/user/identity |
457+ * DefaultApi* | [ ** transferSubscription** ] ( docs/Api/DefaultApi.md#transfersubscription ) | ** PATCH** /apps/{app_id}/subscriptions/{subscription_id}/owner |
321458* DefaultApi* | [ ** updateApp** ] ( docs/Api/DefaultApi.md#updateapp ) | ** PUT** /apps/{app_id} | Update an app
322459* DefaultApi* | [ ** updateLiveActivity** ] ( docs/Api/DefaultApi.md#updateliveactivity ) | ** POST** /apps/{app_id}/live_activities/{activity_id}/notifications | Update a Live Activity via Push
323460* DefaultApi* | [ ** updatePlayer** ] ( docs/Api/DefaultApi.md#updateplayer ) | ** PUT** /players/{player_id} | Edit device
324461* DefaultApi* | [ ** updatePlayerTags** ] ( docs/Api/DefaultApi.md#updateplayertags ) | ** PUT** /apps/{app_id}/users/{external_user_id} | Edit tags with external user id
462+ * DefaultApi* | [ ** updateSubscription** ] ( docs/Api/DefaultApi.md#updatesubscription ) | ** PATCH** /apps/{app_id}/subscriptions/{subscription_id} |
463+ * DefaultApi* | [ ** updateUser** ] ( docs/Api/DefaultApi.md#updateuser ) | ** PATCH** /apps/{app_id}/users/by/{alias_label}/{alias_id} |
325464
326465## Models
327466
@@ -337,6 +476,10 @@ Class | Method | HTTP request | Description
337476- [ CreatePlayerSuccessResponse] ( docs/Model/CreatePlayerSuccessResponse.md )
338477- [ CreateSegmentConflictResponse] ( docs/Model/CreateSegmentConflictResponse.md )
339478- [ CreateSegmentSuccessResponse] ( docs/Model/CreateSegmentSuccessResponse.md )
479+ - [ CreateSubscriptionRequestBody] ( docs/Model/CreateSubscriptionRequestBody.md )
480+ - [ CreateUserConflictResponse] ( docs/Model/CreateUserConflictResponse.md )
481+ - [ CreateUserConflictResponseErrorsInner] ( docs/Model/CreateUserConflictResponseErrorsInner.md )
482+ - [ CreateUserConflictResponseErrorsItemsMeta] ( docs/Model/CreateUserConflictResponseErrorsItemsMeta.md )
340483- [ DeletePlayerNotFoundResponse] ( docs/Model/DeletePlayerNotFoundResponse.md )
341484- [ DeletePlayerSuccessResponse] ( docs/Model/DeletePlayerSuccessResponse.md )
342485- [ DeleteSegmentNotFoundResponse] ( docs/Model/DeleteSegmentNotFoundResponse.md )
@@ -347,6 +490,12 @@ Class | Method | HTTP request | Description
347490- [ Filter] ( docs/Model/Filter.md )
348491- [ FilterExpressions] ( docs/Model/FilterExpressions.md )
349492- [ GetNotificationRequestBody] ( docs/Model/GetNotificationRequestBody.md )
493+ - [ IdentifyUserConflictResponse] ( docs/Model/IdentifyUserConflictResponse.md )
494+ - [ IdentifyUserConflictResponseErrorsInner] ( docs/Model/IdentifyUserConflictResponseErrorsInner.md )
495+ - [ InlineResponse200] ( docs/Model/InlineResponse200.md )
496+ - [ InlineResponse2003] ( docs/Model/InlineResponse2003.md )
497+ - [ InlineResponse201] ( docs/Model/InlineResponse201.md )
498+ - [ InlineResponse202] ( docs/Model/InlineResponse202.md )
350499- [ InvalidIdentifierError] ( docs/Model/InvalidIdentifierError.md )
351500- [ Notification] ( docs/Model/Notification.md )
352501- [ Notification200Errors] ( docs/Model/Notification200Errors.md )
@@ -364,16 +513,27 @@ Class | Method | HTTP request | Description
364513- [ PlatformDeliveryDataSmsAllOf] ( docs/Model/PlatformDeliveryDataSmsAllOf.md )
365514- [ Player] ( docs/Model/Player.md )
366515- [ PlayerNotificationTarget] ( docs/Model/PlayerNotificationTarget.md )
516+ - [ PlayerNotificationTargetIncludeAliases] ( docs/Model/PlayerNotificationTargetIncludeAliases.md )
367517- [ PlayerSlice] ( docs/Model/PlayerSlice.md )
518+ - [ PropertiesDeltas] ( docs/Model/PropertiesDeltas.md )
519+ - [ PropertiesObject] ( docs/Model/PropertiesObject.md )
368520- [ Purchase] ( docs/Model/Purchase.md )
369521- [ Segment] ( docs/Model/Segment.md )
370522- [ SegmentNotificationTarget] ( docs/Model/SegmentNotificationTarget.md )
371523- [ StringMap] ( docs/Model/StringMap.md )
524+ - [ SubscriptionObject] ( docs/Model/SubscriptionObject.md )
525+ - [ TransferSubscriptionRequestBody] ( docs/Model/TransferSubscriptionRequestBody.md )
372526- [ UpdateLiveActivityRequest] ( docs/Model/UpdateLiveActivityRequest.md )
373527- [ UpdateLiveActivitySuccessResponse] ( docs/Model/UpdateLiveActivitySuccessResponse.md )
374528- [ UpdatePlayerSuccessResponse] ( docs/Model/UpdatePlayerSuccessResponse.md )
375529- [ UpdatePlayerTagsRequestBody] ( docs/Model/UpdatePlayerTagsRequestBody.md )
376530- [ UpdatePlayerTagsSuccessResponse] ( docs/Model/UpdatePlayerTagsSuccessResponse.md )
531+ - [ UpdateSubscriptionRequestBody] ( docs/Model/UpdateSubscriptionRequestBody.md )
532+ - [ UpdateUserRequest] ( docs/Model/UpdateUserRequest.md )
533+ - [ User] ( docs/Model/User.md )
534+ - [ UserIdentityRequestBody] ( docs/Model/UserIdentityRequestBody.md )
535+ - [ UserIdentityResponse] ( docs/Model/UserIdentityResponse.md )
536+ - [ UserSubscriptionOptions] ( docs/Model/UserSubscriptionOptions.md )
377537
378538## Authorization
379539All the OneSignal endpoints require either an * app_key* or * user_key* tokens for authorization. It is recommended to
@@ -398,5 +558,5 @@ requires app_key and which user_key. You can get the value of these keys from yo
398558399559
400560
401- - API version: ` 1.0.2 `
402- - Package version: ` 1 .0.4 `
561+ - API version: ` 1.2.1 `
562+ - Package version: ` 2 .0.0 `
0 commit comments