Skip to content

Commit 325c42a

Browse files
authored
Merge pull request #19 from OneSignal/api
409 and 429 errors
2 parents aca317a + c2ca43c commit 325c42a

File tree

98 files changed

+2480
-2499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+2480
-2499
lines changed

README.md

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,13 @@ To install the bindings via [Composer](https://getcomposer.org/), add the follow
2323
}
2424
],
2525
"require": {
26-
"onesignal/onesignal-php-api": "*@dev"
26+
"OneSignal/onesignal-php-api": "*@dev"
2727
}
2828
}
2929
```
3030

3131
Then run `composer install`
3232

33-
### Manual Installation
34-
35-
Download the files and include `autoload.php`:
36-
37-
```php
38-
<?php
39-
require_once('/path/to/OneSignal/vendor/autoload.php');
40-
```
41-
4233

4334
## Usage examples
4435
### Imports
@@ -439,7 +430,8 @@ Class | Method | HTTP request | Description
439430
*DefaultApi* | [**deleteSubscription**](docs/Api/DefaultApi.md#deletesubscription) | **DELETE** /apps/{app_id}/subscriptions/{subscription_id} |
440431
*DefaultApi* | [**deleteUser**](docs/Api/DefaultApi.md#deleteuser) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id} |
441432
*DefaultApi* | [**endLiveActivity**](docs/Api/DefaultApi.md#endliveactivity) | **DELETE** /apps/{app_id}/live_activities/{activity_id}/token/{subscription_id} | Stop Live Activity
442-
*DefaultApi* | [**exportPlayers**](docs/Api/DefaultApi.md#exportplayers) | **POST** /players/csv_export?app_id&#x3D;{app_id} | CSV export
433+
*DefaultApi* | [**exportEvents**](docs/Api/DefaultApi.md#exportevents) | **POST** /notifications/{notification_id}/export_events?app_id&#x3D;{app_id} | Export CSV of Events
434+
*DefaultApi* | [**exportPlayers**](docs/Api/DefaultApi.md#exportplayers) | **POST** /players/csv_export?app_id&#x3D;{app_id} | Export CSV of Players
443435
*DefaultApi* | [**fetchAliases**](docs/Api/DefaultApi.md#fetchaliases) | **GET** /apps/{app_id}/subscriptions/{subscription_id}/user/identity |
444436
*DefaultApi* | [**fetchUser**](docs/Api/DefaultApi.md#fetchuser) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id} |
445437
*DefaultApi* | [**fetchUserIdentity**](docs/Api/DefaultApi.md#fetchuseridentity) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity |
@@ -465,7 +457,6 @@ Class | Method | HTTP request | Description
465457
## Models
466458

467459
- [App](docs/Model/App.md)
468-
- [BadRequestError](docs/Model/BadRequestError.md)
469460
- [BasicNotification](docs/Model/BasicNotification.md)
470461
- [BasicNotificationAllOf](docs/Model/BasicNotificationAllOf.md)
471462
- [BasicNotificationAllOfAndroidBackgroundLayout](docs/Model/BasicNotificationAllOfAndroidBackgroundLayout.md)
@@ -485,13 +476,14 @@ Class | Method | HTTP request | Description
485476
- [DeleteSegmentNotFoundResponse](docs/Model/DeleteSegmentNotFoundResponse.md)
486477
- [DeleteSegmentSuccessResponse](docs/Model/DeleteSegmentSuccessResponse.md)
487478
- [DeliveryData](docs/Model/DeliveryData.md)
479+
- [ExportEventsSuccessResponse](docs/Model/ExportEventsSuccessResponse.md)
488480
- [ExportPlayersRequestBody](docs/Model/ExportPlayersRequestBody.md)
489481
- [ExportPlayersSuccessResponse](docs/Model/ExportPlayersSuccessResponse.md)
490482
- [Filter](docs/Model/Filter.md)
491483
- [FilterExpressions](docs/Model/FilterExpressions.md)
484+
- [GenericError](docs/Model/GenericError.md)
485+
- [GenericErrorErrorsInner](docs/Model/GenericErrorErrorsInner.md)
492486
- [GetNotificationRequestBody](docs/Model/GetNotificationRequestBody.md)
493-
- [IdentifyUserConflictResponse](docs/Model/IdentifyUserConflictResponse.md)
494-
- [IdentifyUserConflictResponseErrorsInner](docs/Model/IdentifyUserConflictResponseErrorsInner.md)
495487
- [InlineResponse200](docs/Model/InlineResponse200.md)
496488
- [InlineResponse2003](docs/Model/InlineResponse2003.md)
497489
- [InlineResponse201](docs/Model/InlineResponse201.md)
@@ -518,6 +510,7 @@ Class | Method | HTTP request | Description
518510
- [PropertiesDeltas](docs/Model/PropertiesDeltas.md)
519511
- [PropertiesObject](docs/Model/PropertiesObject.md)
520512
- [Purchase](docs/Model/Purchase.md)
513+
- [RateLimiterError](docs/Model/RateLimiterError.md)
521514
- [Segment](docs/Model/Segment.md)
522515
- [SegmentNotificationTarget](docs/Model/SegmentNotificationTarget.md)
523516
- [StringMap](docs/Model/StringMap.md)
@@ -558,5 +551,5 @@ requires app_key and which user_key. You can get the value of these keys from yo
558551
559552

560553

561-
- API version: `1.2.1`
562-
- Package version: `2.0.0`
554+
- API version: `1.2.2`
555+
- Package version: `2.0.2`

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "onesignal/onesignal-php-api",
3-
"version": "2.0.0",
3+
"version": "2.0.2",
44
"description": "A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com",
55
"keywords": [
66
"onesignal",

docs/Api/DefaultApi.md

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ Method | HTTP request | Description
1818
[**deleteSubscription()**](DefaultApi.md#deleteSubscription) | **DELETE** /apps/{app_id}/subscriptions/{subscription_id} |
1919
[**deleteUser()**](DefaultApi.md#deleteUser) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id} |
2020
[**endLiveActivity()**](DefaultApi.md#endLiveActivity) | **DELETE** /apps/{app_id}/live_activities/{activity_id}/token/{subscription_id} | Stop Live Activity
21-
[**exportPlayers()**](DefaultApi.md#exportPlayers) | **POST** /players/csv_export?app_id&#x3D;{app_id} | CSV export
21+
[**exportEvents()**](DefaultApi.md#exportEvents) | **POST** /notifications/{notification_id}/export_events?app_id&#x3D;{app_id} | Export CSV of Events
22+
[**exportPlayers()**](DefaultApi.md#exportPlayers) | **POST** /players/csv_export?app_id&#x3D;{app_id} | Export CSV of Players
2223
[**fetchAliases()**](DefaultApi.md#fetchAliases) | **GET** /apps/{app_id}/subscriptions/{subscription_id}/user/identity |
2324
[**fetchUser()**](DefaultApi.md#fetchUser) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id} |
2425
[**fetchUserIdentity()**](DefaultApi.md#fetchUserIdentity) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity |
@@ -818,7 +819,7 @@ void (empty response body)
818819
### HTTP request headers
819820

820821
- **Content-Type**: Not defined
821-
- **Accept**: Not defined
822+
- **Accept**: `application/json`
822823

823824
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
824825
[[Back to Model list]](../../README.md#models)
@@ -877,7 +878,7 @@ No authorization required
877878
### HTTP request headers
878879

879880
- **Content-Type**: Not defined
880-
- **Accept**: Not defined
881+
- **Accept**: `application/json`
881882

882883
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
883884
[[Back to Model list]](../../README.md#models)
@@ -949,13 +950,78 @@ void (empty response body)
949950
[[Back to Model list]](../../README.md#models)
950951
[[Back to README]](../../README.md)
951952

953+
## `exportEvents()`
954+
955+
```php
956+
exportEvents($notification_id, $app_id): \onesignal\client\model\ExportEventsSuccessResponse
957+
```
958+
959+
Export CSV of Events
960+
961+
Generate a compressed CSV report of all of the events data for a notification. This will return a URL immediately upon success but it may take several minutes for the CSV to become available at that URL depending on the volume of data. Only one export can be in-progress per OneSignal account at any given time.
962+
963+
### Example
964+
965+
```php
966+
<?php
967+
require_once(__DIR__ . '/vendor/autoload.php');
968+
969+
970+
// Configure Bearer authorization: app_key
971+
$config = onesignal\client\Configuration::getDefaultConfiguration()
972+
->setAppKeyToken('YOUR_APP_KEY_TOKEN')
973+
->setUserKeyToken('YOUR_USER_KEY_TOKEN');
974+
975+
976+
977+
$apiInstance = new onesignal\client\Api\DefaultApi(
978+
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
979+
// This is optional, `GuzzleHttp\Client` will be used as default.
980+
new GuzzleHttp\Client(),
981+
$config
982+
);
983+
$notification_id = 'notification_id_example'; // string | The ID of the notification to export events from.
984+
$app_id = 'app_id_example'; // string | The ID of the app that the notification belongs to.
985+
986+
try {
987+
$result = $apiInstance->exportEvents($notification_id, $app_id);
988+
print_r($result);
989+
} catch (Exception $e) {
990+
echo 'Exception when calling DefaultApi->exportEvents: ', $e->getMessage(), PHP_EOL;
991+
}
992+
```
993+
994+
### Parameters
995+
996+
Name | Type | Description | Notes
997+
------------- | ------------- | ------------- | -------------
998+
**notification_id** | **string**| The ID of the notification to export events from. |
999+
**app_id** | **string**| The ID of the app that the notification belongs to. |
1000+
1001+
### Return type
1002+
1003+
[**\onesignal\client\model\ExportEventsSuccessResponse**](../Model/ExportEventsSuccessResponse.md)
1004+
1005+
### Authorization
1006+
1007+
[app_key](../../README.md#app_key)
1008+
1009+
### HTTP request headers
1010+
1011+
- **Content-Type**: Not defined
1012+
- **Accept**: `application/json`
1013+
1014+
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
1015+
[[Back to Model list]](../../README.md#models)
1016+
[[Back to README]](../../README.md)
1017+
9521018
## `exportPlayers()`
9531019

9541020
```php
9551021
exportPlayers($app_id, $export_players_request_body): \onesignal\client\model\ExportPlayersSuccessResponse
9561022
```
9571023

958-
CSV export
1024+
Export CSV of Players
9591025

9601026
Generate a compressed CSV export of all of your current user data This method can be used to generate a compressed CSV export of all of your current user data. It is a much faster alternative than retrieving this data using the /players API endpoint. The file will be compressed using GZip. The file may take several minutes to generate depending on the number of users in your app. The URL generated will be available for 3 days and includes random v4 uuid as part of the resource name to be unguessable. &#x1F6A7; 403 Error Responses You can test if it is complete by making a GET request to the csv_file_url value. This file may take time to generate depending on how many device records are being pulled. If the file is not ready, a 403 error will be returned. Otherwise the file itself will be returned. &#x1F6A7; Requires Authentication Key Requires your OneSignal App's REST API Key, available in Keys & IDs. &#x1F6A7; Concurrent Exports Only one concurrent export is allowed per OneSignal account. Please ensure you have successfully downloaded the .csv.gz file before exporting another app. CSV File Format: - Default Columns: | Field | Details | | --- | --- | | id | OneSignal Player Id | | identifier | Push Token | | session_count | Number of times they visited the app or site | language | Device language code | | timezone | Number of seconds away from UTC. Example: -28800 | | game_version | Version of your mobile app gathered from Android Studio versionCode in your App/build.gradle and iOS uses kCFBundleVersionKey in Xcode. | | device_os | Device Operating System Version. Example: 80 = Chrome 80, 9 = Android 9 | | device_type | Device Operating System Type | | device_model | Device Hardware String Code. Example: Mobile Web Subscribers will have `Linux armv` | | ad_id | Based on the Google Advertising Id for Android, identifierForVendor for iOS. OptedOut means user turned off Advertising tracking on the device. | | tags | Current OneSignal Data Tags on the device. | | last_active | Date and time the user last opened the mobile app or visited the site. | | playtime | Total amount of time in seconds the user had the mobile app open. | | amount_spent | Mobile only - amount spent in USD on In-App Purchases. | | created_at | Date and time the device record was created in OneSignal. Mobile - first time they opened the app with OneSignal SDK. Web - first time the user subscribed to the site. | | invalid_identifier | t = unsubscribed, f = subscibed | | badge_count | Current number of badges on the device | - Extra Columns: | Field | Details | | --- | --- | | external_user_id | Your User Id set on the device | | notification_types | Notification types | | location | Location points (Latitude and Longitude) set on the device. | | country | Country code | | rooted | Android device rooted or not | | ip | IP Address of the device if being tracked. See Handling Personal Data. | | web_auth | Web Only authorization key. | | web_p256 | Web Only p256 key. |
9611027

@@ -2334,7 +2400,7 @@ void (empty response body)
23342400
### HTTP request headers
23352401

23362402
- **Content-Type**: `application/json`
2337-
- **Accept**: Not defined
2403+
- **Accept**: `application/json`
23382404

23392405
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
23402406
[[Back to Model list]](../../README.md#models)

docs/Model/BasicNotification.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,11 @@ Name | Type | Description | Notes
104104
**email_body** | **string** | Channel: Email Required unless template_id is set. HTML suported The body of the email you wish to send. Typically, customers include their own HTML templates here. Must include [unsubscribe_url] in an &lt;a&gt; tag somewhere in the email. Note: any malformed HTML content will be sent to users. Please double-check your HTML is valid. | [optional]
105105
**email_from_name** | **string** | Channel: Email The name the email is from. If not specified, will default to \&quot;from name\&quot; set in the OneSignal Dashboard Email Settings. | [optional]
106106
**email_from_address** | **string** | Channel: Email The email address the email is from. If not specified, will default to \&quot;from email\&quot; set in the OneSignal Dashboard Email Settings. | [optional]
107+
**email_preheader** | **string** | Channel: Email The preheader text of the email. Preheader is the preview text displayed immediately after an email subject that provides additional context about the email content. If not specified, will default to null. | [optional]
108+
**include_unsubscribed** | **bool** | Channel: Email Default is &#x60;false&#x60;. This field is used to send transactional notifications. If set to &#x60;true&#x60;, this notification will also be sent to unsubscribed emails. If a &#x60;template_id&#x60; is provided, the &#x60;include_unsubscribed&#x60; value from the template will be inherited. If you are using a third-party ESP, this field requires the ESP&#39;s list of unsubscribed emails to be cleared. | [optional]
107109
**sms_from** | **string** | Channel: SMS Phone Number used to send SMS. Should be a registered Twilio phone number in E.164 format. | [optional]
108110
**sms_media_urls** | **string[]** | Channel: SMS URLs for the media files to be attached to the SMS content. Limit: 10 media urls with a total max. size of 5MBs. | [optional]
109111
**filters** | [**\onesignal\client\model\Filter[]**](Filter.md) | | [optional]
112+
**custom_data** | **object** | Channel: All JSON object that can be used as a source of message personalization data for fields that support tag variable substitution. Push, SMS: Can accept up to 2048 bytes of valid JSON. Email: Can accept up to 10000 bytes of valid JSON. Example: {\&quot;order_id\&quot;: 123, \&quot;currency\&quot;: \&quot;USD\&quot;, \&quot;amount\&quot;: 25} | [optional]
110113

111114
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

docs/Model/BasicNotificationAllOf.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ Name | Type | Description | Notes
9090
**email_body** | **string** | Channel: Email Required unless template_id is set. HTML suported The body of the email you wish to send. Typically, customers include their own HTML templates here. Must include [unsubscribe_url] in an &lt;a&gt; tag somewhere in the email. Note: any malformed HTML content will be sent to users. Please double-check your HTML is valid. | [optional]
9191
**email_from_name** | **string** | Channel: Email The name the email is from. If not specified, will default to \&quot;from name\&quot; set in the OneSignal Dashboard Email Settings. | [optional]
9292
**email_from_address** | **string** | Channel: Email The email address the email is from. If not specified, will default to \&quot;from email\&quot; set in the OneSignal Dashboard Email Settings. | [optional]
93+
**email_preheader** | **string** | Channel: Email The preheader text of the email. Preheader is the preview text displayed immediately after an email subject that provides additional context about the email content. If not specified, will default to null. | [optional]
94+
**include_unsubscribed** | **bool** | Channel: Email Default is &#x60;false&#x60;. This field is used to send transactional notifications. If set to &#x60;true&#x60;, this notification will also be sent to unsubscribed emails. If a &#x60;template_id&#x60; is provided, the &#x60;include_unsubscribed&#x60; value from the template will be inherited. If you are using a third-party ESP, this field requires the ESP&#39;s list of unsubscribed emails to be cleared. | [optional]
9395
**sms_from** | **string** | Channel: SMS Phone Number used to send SMS. Should be a registered Twilio phone number in E.164 format. | [optional]
9496
**sms_media_urls** | **string[]** | Channel: SMS URLs for the media files to be attached to the SMS content. Limit: 10 media urls with a total max. size of 5MBs. | [optional]
9597
**filters** | [**\onesignal\client\model\Filter[]**](Filter.md) | | [optional]
98+
**custom_data** | **object** | Channel: All JSON object that can be used as a source of message personalization data for fields that support tag variable substitution. Push, SMS: Can accept up to 2048 bytes of valid JSON. Email: Can accept up to 10000 bytes of valid JSON. Example: {\&quot;order_id\&quot;: 123, \&quot;currency\&quot;: \&quot;USD\&quot;, \&quot;amount\&quot;: 25} | [optional]
9699

97100
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

docs/Model/DeletePlayerBadRequestResponse.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/Model/DeleteSegmentBadRequestResponse.md

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# # BadRequestError
1+
# # ExportEventsSuccessResponse
22

33
## Properties
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**errors** | **string[]** | | [optional]
7+
**csv_file_url** | **string** | | [optional]
88

99
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

0 commit comments

Comments
 (0)