Skip to content

Commit

Permalink
Merge pull request #29 from OneSignal/api
Browse files Browse the repository at this point in the history
409 and 429 errors
  • Loading branch information
kesheshyan authored Aug 1, 2023
2 parents e2cd095 + 3c04df4 commit 6a970c4
Show file tree
Hide file tree
Showing 181 changed files with 681 additions and 1,891 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ A powerful way to send personalized messages at scale and build effective custom

This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 1.2.1
- Package version: 2.0.0
- API version: 1.2.2
- Package version: 2.0.2
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
For more information, please visit [https://onesignal.com](https://onesignal.com)

Expand All @@ -24,16 +24,16 @@ gem build onesignal.gemspec
Then either install the gem locally:

```shell
gem install ./onesignal-2.0.0.gem
gem install ./onesignal-2.0.2.gem
```

(for development, run `gem install --dev ./onesignal-2.0.0.gem` to install the development dependencies)
(for development, run `gem install --dev ./onesignal-2.0.2.gem` to install the development dependencies)

or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).

Finally add this to the Gemfile:

gem 'onesignal', '~> 2.0.0'
gem 'onesignal', '~> 2.0.2'

### Install from Git

Expand Down Expand Up @@ -97,7 +97,8 @@ Class | Method | HTTP request | Description
*OneSignal::DefaultApi* | [**delete_subscription**](docs/DefaultApi.md#delete_subscription) | **DELETE** /apps/{app_id}/subscriptions/{subscription_id} |
*OneSignal::DefaultApi* | [**delete_user**](docs/DefaultApi.md#delete_user) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id} |
*OneSignal::DefaultApi* | [**end_live_activity**](docs/DefaultApi.md#end_live_activity) | **DELETE** /apps/{app_id}/live_activities/{activity_id}/token/{subscription_id} | Stop Live Activity
*OneSignal::DefaultApi* | [**export_players**](docs/DefaultApi.md#export_players) | **POST** /players/csv_export?app_id={app_id} | CSV export
*OneSignal::DefaultApi* | [**export_events**](docs/DefaultApi.md#export_events) | **POST** /notifications/{notification_id}/export_events?app_id={app_id} | Export CSV of Events
*OneSignal::DefaultApi* | [**export_players**](docs/DefaultApi.md#export_players) | **POST** /players/csv_export?app_id={app_id} | Export CSV of Players
*OneSignal::DefaultApi* | [**fetch_aliases**](docs/DefaultApi.md#fetch_aliases) | **GET** /apps/{app_id}/subscriptions/{subscription_id}/user/identity |
*OneSignal::DefaultApi* | [**fetch_user**](docs/DefaultApi.md#fetch_user) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id} |
*OneSignal::DefaultApi* | [**fetch_user_identity**](docs/DefaultApi.md#fetch_user_identity) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity |
Expand All @@ -124,7 +125,6 @@ Class | Method | HTTP request | Description
## Documentation for Models

- [OneSignal::App](docs/App.md)
- [OneSignal::BadRequestError](docs/BadRequestError.md)
- [OneSignal::BasicNotification](docs/BasicNotification.md)
- [OneSignal::BasicNotificationAllOf](docs/BasicNotificationAllOf.md)
- [OneSignal::BasicNotificationAllOfAndroidBackgroundLayout](docs/BasicNotificationAllOfAndroidBackgroundLayout.md)
Expand All @@ -144,13 +144,14 @@ Class | Method | HTTP request | Description
- [OneSignal::DeleteSegmentNotFoundResponse](docs/DeleteSegmentNotFoundResponse.md)
- [OneSignal::DeleteSegmentSuccessResponse](docs/DeleteSegmentSuccessResponse.md)
- [OneSignal::DeliveryData](docs/DeliveryData.md)
- [OneSignal::ExportEventsSuccessResponse](docs/ExportEventsSuccessResponse.md)
- [OneSignal::ExportPlayersRequestBody](docs/ExportPlayersRequestBody.md)
- [OneSignal::ExportPlayersSuccessResponse](docs/ExportPlayersSuccessResponse.md)
- [OneSignal::Filter](docs/Filter.md)
- [OneSignal::FilterExpressions](docs/FilterExpressions.md)
- [OneSignal::GenericError](docs/GenericError.md)
- [OneSignal::GenericErrorErrorsInner](docs/GenericErrorErrorsInner.md)
- [OneSignal::GetNotificationRequestBody](docs/GetNotificationRequestBody.md)
- [OneSignal::IdentifyUserConflictResponse](docs/IdentifyUserConflictResponse.md)
- [OneSignal::IdentifyUserConflictResponseErrorsInner](docs/IdentifyUserConflictResponseErrorsInner.md)
- [OneSignal::InlineResponse200](docs/InlineResponse200.md)
- [OneSignal::InlineResponse2003](docs/InlineResponse2003.md)
- [OneSignal::InlineResponse201](docs/InlineResponse201.md)
Expand All @@ -177,6 +178,7 @@ Class | Method | HTTP request | Description
- [OneSignal::PropertiesDeltas](docs/PropertiesDeltas.md)
- [OneSignal::PropertiesObject](docs/PropertiesObject.md)
- [OneSignal::Purchase](docs/Purchase.md)
- [OneSignal::RateLimiterError](docs/RateLimiterError.md)
- [OneSignal::Segment](docs/Segment.md)
- [OneSignal::SegmentNotificationTarget](docs/SegmentNotificationTarget.md)
- [OneSignal::StringMap](docs/StringMap.md)
Expand Down
18 changes: 0 additions & 18 deletions docs/BadRequestError.md

This file was deleted.

8 changes: 7 additions & 1 deletion docs/BasicNotification.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@
| **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 <a> tag somewhere in the email. Note: any malformed HTML content will be sent to users. Please double-check your HTML is valid. | [optional] |
| **email_from_name** | **String** | Channel: Email The name the email is from. If not specified, will default to \"from name\" set in the OneSignal Dashboard Email Settings. | [optional] |
| **email_from_address** | **String** | Channel: Email The email address the email is from. If not specified, will default to \"from email\" set in the OneSignal Dashboard Email Settings. | [optional] |
| **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] |
| **include_unsubscribed** | **Boolean** | Channel: Email Default is `false`. This field is used to send transactional notifications. If set to `true`, this notification will also be sent to unsubscribed emails. If a `template_id` is provided, the `include_unsubscribed` value from the template will be inherited. If you are using a third-party ESP, this field requires the ESP's list of unsubscribed emails to be cleared. | [optional] |
| **sms_from** | **String** | Channel: SMS Phone Number used to send SMS. Should be a registered Twilio phone number in E.164 format. | [optional] |
| **sms_media_urls** | **Array<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] |
| **filters** | [**Array<Filter>**](Filter.md) | | [optional] |
| **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: {\"order_id\": 123, \"currency\": \"USD\", \"amount\": 25} | [optional] |

## Example

Expand Down Expand Up @@ -214,9 +217,12 @@ instance = OneSignal::BasicNotification.new(
email_body: null,
email_from_name: null,
email_from_address: null,
email_preheader: null,
include_unsubscribed: null,
sms_from: null,
sms_media_urls: null,
filters: null
filters: null,
custom_data: null
)
```

8 changes: 7 additions & 1 deletion docs/BasicNotificationAllOf.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@
| **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 <a> tag somewhere in the email. Note: any malformed HTML content will be sent to users. Please double-check your HTML is valid. | [optional] |
| **email_from_name** | **String** | Channel: Email The name the email is from. If not specified, will default to \"from name\" set in the OneSignal Dashboard Email Settings. | [optional] |
| **email_from_address** | **String** | Channel: Email The email address the email is from. If not specified, will default to \"from email\" set in the OneSignal Dashboard Email Settings. | [optional] |
| **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] |
| **include_unsubscribed** | **Boolean** | Channel: Email Default is `false`. This field is used to send transactional notifications. If set to `true`, this notification will also be sent to unsubscribed emails. If a `template_id` is provided, the `include_unsubscribed` value from the template will be inherited. If you are using a third-party ESP, this field requires the ESP's list of unsubscribed emails to be cleared. | [optional] |
| **sms_from** | **String** | Channel: SMS Phone Number used to send SMS. Should be a registered Twilio phone number in E.164 format. | [optional] |
| **sms_media_urls** | **Array<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] |
| **filters** | [**Array<Filter>**](Filter.md) | | [optional] |
| **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: {\"order_id\": 123, \"currency\": \"USD\", \"amount\": 25} | [optional] |

## Example

Expand Down Expand Up @@ -186,9 +189,12 @@ instance = OneSignal::BasicNotificationAllOf.new(
email_body: null,
email_from_name: null,
email_from_address: null,
email_preheader: null,
include_unsubscribed: null,
sms_from: null,
sms_media_urls: null,
filters: null
filters: null,
custom_data: null
)
```

18 changes: 0 additions & 18 deletions docs/CreateNotificationBadRequestResponse.md

This file was deleted.

20 changes: 0 additions & 20 deletions docs/CreateSegmentBadRequestResponse.md

This file was deleted.

86 changes: 79 additions & 7 deletions docs/DefaultApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ All URIs are relative to *https://onesignal.com/api/v1*
| [**delete_subscription**](DefaultApi.md#delete_subscription) | **DELETE** /apps/{app_id}/subscriptions/{subscription_id} | |
| [**delete_user**](DefaultApi.md#delete_user) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id} | |
| [**end_live_activity**](DefaultApi.md#end_live_activity) | **DELETE** /apps/{app_id}/live_activities/{activity_id}/token/{subscription_id} | Stop Live Activity |
| [**export_players**](DefaultApi.md#export_players) | **POST** /players/csv_export?app_id={app_id} | CSV export |
| [**export_events**](DefaultApi.md#export_events) | **POST** /notifications/{notification_id}/export_events?app_id={app_id} | Export CSV of Events |
| [**export_players**](DefaultApi.md#export_players) | **POST** /players/csv_export?app_id={app_id} | Export CSV of Players |
| [**fetch_aliases**](DefaultApi.md#fetch_aliases) | **GET** /apps/{app_id}/subscriptions/{subscription_id}/user/identity | |
| [**fetch_user**](DefaultApi.md#fetch_user) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id} | |
| [**fetch_user_identity**](DefaultApi.md#fetch_user_identity) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity | |
Expand Down Expand Up @@ -895,7 +896,7 @@ nil (empty response body)
### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: Not defined
- **Accept**: application/json


## delete_user
Expand Down Expand Up @@ -961,7 +962,7 @@ No authorization required
### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: Not defined
- **Accept**: application/json


## end_live_activity
Expand Down Expand Up @@ -1036,11 +1037,82 @@ nil (empty response body)
- **Accept**: application/json


## export_events

> <ExportEventsSuccessResponse> export_events(notification_id, app_id)
Export CSV of Events

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.

### Examples

```ruby
require 'onesignal'
# setup authorization
OneSignal.configure do |config|
# Configure Bearer authorization: app_key
config.app_key = 'YOUR_BEARER_TOKEN'

end

api_instance = OneSignal::DefaultApi.new
notification_id = 'notification_id_example' # String | The ID of the notification to export events from.
app_id = 'app_id_example' # String | The ID of the app that the notification belongs to.

begin
# Export CSV of Events
result = api_instance.export_events(notification_id, app_id)
p result
rescue OneSignal::ApiError => e
puts "Error when calling DefaultApi->export_events: #{e}"
end
```

#### Using the export_events_with_http_info variant

This returns an Array which contains the response data, status code and headers.

> <Array(<ExportEventsSuccessResponse>, Integer, Hash)> export_events_with_http_info(notification_id, app_id)
```ruby
begin
# Export CSV of Events
data, status_code, headers = api_instance.export_events_with_http_info(notification_id, app_id)
p status_code # => 2xx
p headers # => { ... }
p data # => <ExportEventsSuccessResponse>
rescue OneSignal::ApiError => e
puts "Error when calling DefaultApi->export_events_with_http_info: #{e}"
end
```

### Parameters

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **notification_id** | **String** | The ID of the notification to export events from. | |
| **app_id** | **String** | The ID of the app that the notification belongs to. | |

### Return type

[**ExportEventsSuccessResponse**](ExportEventsSuccessResponse.md)

### Authorization

[app_key](../README.md#app_key)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json


## export_players

> <ExportPlayersSuccessResponse> export_players(app_id, opts)
CSV export
Export CSV of Players

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. |

Expand All @@ -1062,7 +1134,7 @@ opts = {
}

begin
# CSV export
# Export CSV of Players
result = api_instance.export_players(app_id, opts)
p result
rescue OneSignal::ApiError => e
Expand All @@ -1078,7 +1150,7 @@ This returns an Array which contains the response data, status code and headers.
```ruby
begin
# CSV export
# Export CSV of Players
data, status_code, headers = api_instance.export_players_with_http_info(app_id, opts)
p status_code # => 2xx
p headers # => { ... }
Expand Down Expand Up @@ -2562,7 +2634,7 @@ nil (empty response body)
### HTTP request headers

- **Content-Type**: application/json
- **Accept**: Not defined
- **Accept**: application/json


## update_user
Expand Down
18 changes: 0 additions & 18 deletions docs/DeletePlayerBadRequestResponse.md

This file was deleted.

18 changes: 0 additions & 18 deletions docs/DeleteSegmentBadRequestResponse.md

This file was deleted.

18 changes: 18 additions & 0 deletions docs/ExportEventsSuccessResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# OneSignal::ExportEventsSuccessResponse

## Properties

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **csv_file_url** | **String** | | [optional] |

## Example

```ruby
require 'onesignal'

instance = OneSignal::ExportEventsSuccessResponse.new(
csv_file_url: null
)
```

Loading

0 comments on commit 6a970c4

Please sign in to comment.