diff --git a/DefaultApi.md b/DefaultApi.md index 116dd1d..7746cd3 100644 --- a/DefaultApi.md +++ b/DefaultApi.md @@ -1,52 +1,45 @@ # .DefaultApi -All URIs are relative to *https://onesignal.com/api/v1* +All URIs are relative to *https://api.onesignal.com* Method | HTTP request | Description ------------- | ------------- | ------------- -[**beginLiveActivity**](DefaultApi.md#beginLiveActivity) | **POST** /apps/{app_id}/live_activities/{activity_id}/token | Start Live Activity [**cancelNotification**](DefaultApi.md#cancelNotification) | **DELETE** /notifications/{notification_id} | Stop a scheduled or currently outgoing notification +[**createAlias**](DefaultApi.md#createAlias) | **PATCH** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity | +[**createAliasBySubscription**](DefaultApi.md#createAliasBySubscription) | **PATCH** /apps/{app_id}/subscriptions/{subscription_id}/user/identity | [**createApp**](DefaultApi.md#createApp) | **POST** /apps | Create an app [**createNotification**](DefaultApi.md#createNotification) | **POST** /notifications | Create notification -[**createPlayer**](DefaultApi.md#createPlayer) | **POST** /players | Add a device -[**createSegments**](DefaultApi.md#createSegments) | **POST** /apps/{app_id}/segments | Create Segments +[**createSegment**](DefaultApi.md#createSegment) | **POST** /apps/{app_id}/segments | Create Segment [**createSubscription**](DefaultApi.md#createSubscription) | **POST** /apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions | [**createUser**](DefaultApi.md#createUser) | **POST** /apps/{app_id}/users | [**deleteAlias**](DefaultApi.md#deleteAlias) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete} | -[**deletePlayer**](DefaultApi.md#deletePlayer) | **DELETE** /players/{player_id} | Delete a user record -[**deleteSegments**](DefaultApi.md#deleteSegments) | **DELETE** /apps/{app_id}/segments/{segment_id} | Delete Segments +[**deleteSegment**](DefaultApi.md#deleteSegment) | **DELETE** /apps/{app_id}/segments/{segment_id} | Delete Segment [**deleteSubscription**](DefaultApi.md#deleteSubscription) | **DELETE** /apps/{app_id}/subscriptions/{subscription_id} | [**deleteUser**](DefaultApi.md#deleteUser) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id} | -[**endLiveActivity**](DefaultApi.md#endLiveActivity) | **DELETE** /apps/{app_id}/live_activities/{activity_id}/token/{subscription_id} | Stop Live Activity [**exportEvents**](DefaultApi.md#exportEvents) | **POST** /notifications/{notification_id}/export_events?app_id={app_id} | Export CSV of Events -[**exportPlayers**](DefaultApi.md#exportPlayers) | **POST** /players/csv_export?app_id={app_id} | Export CSV of Players -[**fetchAliases**](DefaultApi.md#fetchAliases) | **GET** /apps/{app_id}/subscriptions/{subscription_id}/user/identity | -[**fetchUser**](DefaultApi.md#fetchUser) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id} | -[**fetchUserIdentity**](DefaultApi.md#fetchUserIdentity) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity | +[**exportSubscriptions**](DefaultApi.md#exportSubscriptions) | **POST** /players/csv_export?app_id={app_id} | Export CSV of Subscriptions +[**getAliases**](DefaultApi.md#getAliases) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity | +[**getAliasesBySubscription**](DefaultApi.md#getAliasesBySubscription) | **GET** /apps/{app_id}/subscriptions/{subscription_id}/user/identity | [**getApp**](DefaultApi.md#getApp) | **GET** /apps/{app_id} | View an app [**getApps**](DefaultApi.md#getApps) | **GET** /apps | View apps -[**getEligibleIams**](DefaultApi.md#getEligibleIams) | **GET** /apps/{app_id}/subscriptions/{subscription_id}/iams | [**getNotification**](DefaultApi.md#getNotification) | **GET** /notifications/{notification_id} | View notification [**getNotificationHistory**](DefaultApi.md#getNotificationHistory) | **POST** /notifications/{notification_id}/history | Notification History [**getNotifications**](DefaultApi.md#getNotifications) | **GET** /notifications | View notifications [**getOutcomes**](DefaultApi.md#getOutcomes) | **GET** /apps/{app_id}/outcomes | View Outcomes -[**getPlayer**](DefaultApi.md#getPlayer) | **GET** /players/{player_id} | View device -[**getPlayers**](DefaultApi.md#getPlayers) | **GET** /players | View devices -[**identifyUserByAlias**](DefaultApi.md#identifyUserByAlias) | **PATCH** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity | -[**identifyUserBySubscriptionId**](DefaultApi.md#identifyUserBySubscriptionId) | **PATCH** /apps/{app_id}/subscriptions/{subscription_id}/user/identity | +[**getSegments**](DefaultApi.md#getSegments) | **GET** /apps/{app_id}/segments | Get Segments +[**getUser**](DefaultApi.md#getUser) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id} | [**transferSubscription**](DefaultApi.md#transferSubscription) | **PATCH** /apps/{app_id}/subscriptions/{subscription_id}/owner | +[**unsubscribeEmailWithToken**](DefaultApi.md#unsubscribeEmailWithToken) | **POST** /apps/{app_id}/notifications/{notification_id}/unsubscribe | Unsubscribe with token [**updateApp**](DefaultApi.md#updateApp) | **PUT** /apps/{app_id} | Update an app [**updateLiveActivity**](DefaultApi.md#updateLiveActivity) | **POST** /apps/{app_id}/live_activities/{activity_id}/notifications | Update a Live Activity via Push -[**updatePlayer**](DefaultApi.md#updatePlayer) | **PUT** /players/{player_id} | Edit device -[**updatePlayerTags**](DefaultApi.md#updatePlayerTags) | **PUT** /apps/{app_id}/users/{external_user_id} | Edit tags with external user id [**updateSubscription**](DefaultApi.md#updateSubscription) | **PATCH** /apps/{app_id}/subscriptions/{subscription_id} | [**updateUser**](DefaultApi.md#updateUser) | **PATCH** /apps/{app_id}/users/by/{alias_label}/{alias_id} | -# **beginLiveActivity** -> void beginLiveActivity(beginLiveActivityRequest) +# **cancelNotification** +> GenericSuccessBoolResponse cancelNotification() -Starts a Live Activity +Used to stop a scheduled or currently outgoing notification ### Example @@ -58,19 +51,14 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiBeginLiveActivityRequest = { - // string | The OneSignal App ID for your app. Available in Keys & IDs. +let body:.DefaultApiCancelNotificationRequest = { + // string appId: "app_id_example", - // string | Live Activity record ID - activityId: "activity_id_example", - // BeginLiveActivityRequest - beginLiveActivityRequest: { - push_token: "push_token_example", - subscription_id: "subscription_id_example", - }, + // string + notificationId: "notification_id_example", }; -apiInstance.beginLiveActivity(body).then((data:any) => { +apiInstance.cancelNotification(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -80,38 +68,38 @@ apiInstance.beginLiveActivity(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **beginLiveActivityRequest** | **BeginLiveActivityRequest**| | - **appId** | [**string**] | The OneSignal App ID for your app. Available in Keys & IDs. | defaults to undefined - **activityId** | [**string**] | Live Activity record ID | defaults to undefined + **appId** | [**string**] | | defaults to undefined + **notificationId** | [**string**] | | defaults to undefined ### Return type -**void** +**GenericSuccessBoolResponse** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**204** | OK | - | +**200** | OK | - | **400** | Bad Request | - | +**404** | Not Found | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **cancelNotification** -> CancelNotificationSuccessResponse cancelNotification() +# **createAlias** +> UserIdentityBody createAlias(userIdentityBody) -Used to stop a scheduled or currently outgoing notification +Upserts one or more Aliases to an existing User identified by (:alias_label, :alias_id). ### Example @@ -123,14 +111,22 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiCancelNotificationRequest = { +let body:.DefaultApiCreateAliasRequest = { // string appId: "app_id_example", // string - notificationId: "notification_id_example", + aliasLabel: "alias_label_example", + // string + aliasId: "alias_id_example", + // UserIdentityBody + userIdentityBody: { + identity: { + "key": "key_example", + }, + }, }; -apiInstance.cancelNotification(body).then((data:any) => { +apiInstance.createAlias(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -140,21 +136,23 @@ apiInstance.cancelNotification(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **userIdentityBody** | **UserIdentityBody**| | **appId** | [**string**] | | defaults to undefined - **notificationId** | [**string**] | | defaults to undefined + **aliasLabel** | [**string**] | | defaults to undefined + **aliasId** | [**string**] | | defaults to undefined ### Return type -**CancelNotificationSuccessResponse** +**UserIdentityBody** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/json @@ -163,14 +161,16 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | OK | - | **400** | Bad Request | - | +**404** | Not Found | - | +**409** | Conflict | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **createApp** -> App createApp(app) +# **createAliasBySubscription** +> UserIdentityBody createAliasBySubscription(userIdentityBody) -Creates a new OneSignal app +Upserts one or more Aliases for the User identified by :subscription_id. ### Example @@ -182,34 +182,20 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiCreateAppRequest = { - // App - app: { - name: "name_example", - android_gcm_sender_id: "android_gcm_sender_id_example", - gcm_key: "gcm_key_example", - chrome_web_origin: "chrome_web_origin_example", - chrome_key: "chrome_key_example", - chrome_web_default_notification_icon: "chrome_web_default_notification_icon_example", - chrome_web_sub_domain: "chrome_web_sub_domain_example", - apns_env: "sandbox", - apns_p12: "apns_p12_example", - apns_p12_password: "apns_p12_password_example", - safari_apns_p12: "safari_apns_p12_example", - safari_apns_p12_password: "safari_apns_p12_password_example", - apns_key_id: "apns_key_id_example", - apns_team_id: "apns_team_id_example", - apns_bundle_id: "apns_bundle_id_example", - apns_p8: "apns_p8_example", - safari_site_origin: "safari_site_origin_example", - safari_icon_256_256: "safari_icon_256_256_example", - site_name: "site_name_example", - organization_id: "organization_id_example", - additional_data_is_root_payload: true, +let body:.DefaultApiCreateAliasBySubscriptionRequest = { + // string + appId: "app_id_example", + // string + subscriptionId: "subscription_id_example", + // UserIdentityBody + userIdentityBody: { + identity: { + "key": "key_example", + }, }, }; -apiInstance.createApp(body).then((data:any) => { +apiInstance.createAliasBySubscription(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -219,16 +205,18 @@ apiInstance.createApp(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **app** | **App**| | + **userIdentityBody** | **UserIdentityBody**| | + **appId** | [**string**] | | defaults to undefined + **subscriptionId** | [**string**] | | defaults to undefined ### Return type -**App** +**UserIdentityBody** ### Authorization -[user_key](README.md#user_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -241,14 +229,16 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | OK | - | **400** | Bad Request | - | +**404** | Not Found | - | +**409** | Conflict | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **createNotification** -> CreateNotificationSuccessResponse createNotification(notification) +# **createApp** +> App createApp(app) -Sends notifications to your users +Creates a new OneSignal app ### Example @@ -260,12 +250,34 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiCreateNotificationRequest = { - // Notification - notification: null, +let body:.DefaultApiCreateAppRequest = { + // App + app: { + name: "name_example", + android_gcm_sender_id: "android_gcm_sender_id_example", + gcm_key: "gcm_key_example", + chrome_web_origin: "chrome_web_origin_example", + chrome_key: "chrome_key_example", + chrome_web_default_notification_icon: "chrome_web_default_notification_icon_example", + chrome_web_sub_domain: "chrome_web_sub_domain_example", + apns_env: "sandbox", + apns_p12: "apns_p12_example", + apns_p12_password: "apns_p12_password_example", + safari_apns_p12: "safari_apns_p12_example", + safari_apns_p12_password: "safari_apns_p12_password_example", + apns_key_id: "apns_key_id_example", + apns_team_id: "apns_team_id_example", + apns_bundle_id: "apns_bundle_id_example", + apns_p8: "apns_p8_example", + safari_site_origin: "safari_site_origin_example", + safari_icon_256_256: "safari_icon_256_256_example", + site_name: "site_name_example", + organization_id: "organization_id_example", + additional_data_is_root_payload: true, + }, }; -apiInstance.createNotification(body).then((data:any) => { +apiInstance.createApp(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -275,16 +287,16 @@ apiInstance.createNotification(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **notification** | **Notification**| | + **app** | **App**| | ### Return type -**CreateNotificationSuccessResponse** +**App** ### Authorization -[app_key](README.md#app_key) +[user_auth_key](README.md#user_auth_key) ### HTTP request headers @@ -295,16 +307,16 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | OK, invalid_player_ids, invalid_external_user_ids or No Subscribed Players If a message was successfully created, you will get a 200 response and an id for the notification. If the 200 response contains \"invalid_player_ids\" or \"invalid_external_user_ids\" this will mark devices that exist in the provided app_id but are no longer subscribed. If no id is returned, then a message was not created and the targeted User IDs do not exist under the provided app_id. Any User IDs sent in the request that do not exist under the specified app_id will be ignored. | - | +**200** | OK | - | **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **createPlayer** -> CreatePlayerSuccessResponse createPlayer(player) +# **createNotification** +> CreateNotificationSuccessResponse createNotification(notification) -Register a new device to one of your OneSignal apps 🚧 Don\'t use this This API endpoint is designed to be used from our open source Mobile and Web Push SDKs. It is not designed for developers to use it directly, unless instructed to do so by OneSignal support. If you use this method instead of our SDKs, many OneSignal features such as conversion tracking, timezone tracking, language detection, and rich-push won\'t work out of the box. It will also make it harder to identify possible setup issues. This method is used to register a new device with OneSignal. If a device is already registered with the specified identifier, then this will update the existing device record instead of creating a new one. The returned player is a player / user ID. Use the returned ID to send push notifications to this specific user later, or to include this player when sending to a set of users. 🚧 iOS Must set test_type to 1 when building your iOS app as development. Omit this field in your production app builds. +Sends notifications to your users ### Example @@ -316,38 +328,12 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiCreatePlayerRequest = { - // Player - player: { - app_id: "app_id_example", - device_type: 1, - external_user_id: "external_user_id_example", - external_user_id_auth_hash: "external_user_id_auth_hash_example", - email_auth_hash: "email_auth_hash_example", - identifier: "identifier_example", - language: "language_example", - timezone: 1, - game_version: "game_version_example", - device_model: "device_model_example", - device_os: "device_os_example", - ad_id: "ad_id_example", - sdk: "sdk_example", - session_count: 1, - tags: {}, - amount_spent: 3.14, - created_at: 1, - playtime: 1, - badge_count: 1, - last_active: 1, - notification_types: 1, - test_type: 1, - long: 3.14, - lat: 3.14, - country: "country_example", - }, +let body:.DefaultApiCreateNotificationRequest = { + // Notification + notification: null, }; -apiInstance.createPlayer(body).then((data:any) => { +apiInstance.createNotification(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -357,16 +343,16 @@ apiInstance.createPlayer(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **player** | **Player**| | + **notification** | **Notification**| | ### Return type -**CreatePlayerSuccessResponse** +**CreateNotificationSuccessResponse** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -377,17 +363,16 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | OK | - | +**200** | OK, invalid_aliases, or No Subscribed Players If a message was successfully created, you will get a 200 response and an id for the notification. If the 200 response contains \"invalid_aliases\" this will mark devices that exist in the provided app_id but are no longer subscribed. If no id is returned, then a message was not created and the targeted User IDs do not exist under the provided app_id. Any User IDs sent in the request that do not exist under the specified app_id will be ignored. | - | **400** | Bad Request | - | -**409** | Conflict | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **createSegments** -> CreateSegmentSuccessResponse createSegments() +# **createSegment** +> CreateSegmentSuccessResponse createSegment() -Create segments visible and usable in the dashboard and API - Required: OneSignal Paid Plan The Create Segment method is used when you want your server to programmatically create a segment instead of using the OneSignal Dashboard UI. Just like creating Segments from the dashboard you can pass in filters with multiple \"AND\" or \"OR\" operator\'s. 🚧 Does Not Update Segments This endpoint will only create segments, it does not edit or update currently created Segments. You will need to use the Delete Segments endpoint and re-create it with this endpoint to edit. +Create a segment visible and usable in the dashboard and API - Required: OneSignal Paid Plan The Create Segment method is used when you want your server to programmatically create a segment instead of using the OneSignal Dashboard UI. Just like creating Segments from the dashboard you can pass in filters with multiple \"AND\" or \"OR\" operator\'s. 🚧 Does Not Update Segments This endpoint will only create segments, it does not edit or update currently created Segments. You will need to use the Delete Segment endpoint and re-create it with this endpoint to edit. ### Example @@ -399,7 +384,7 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiCreateSegmentsRequest = { +let body:.DefaultApiCreateSegmentRequest = { // string | The OneSignal App ID for your app. Available in Keys & IDs. appId: "app_id_example", // Segment (optional) @@ -412,7 +397,7 @@ let body:.DefaultApiCreateSegmentsRequest = { }, }; -apiInstance.createSegments(body).then((data:any) => { +apiInstance.createSegment(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -432,7 +417,7 @@ Name | Type | Description | Notes ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -451,7 +436,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) # **createSubscription** -> InlineResponse201 createSubscription(createSubscriptionRequestBody) +> SubscriptionBody createSubscription(subscriptionBody) Creates a new Subscription under the User provided. Useful to add email addresses and SMS numbers to the User. @@ -472,28 +457,27 @@ let body:.DefaultApiCreateSubscriptionRequest = { aliasLabel: "alias_label_example", // string aliasId: "alias_id_example", - // CreateSubscriptionRequestBody - createSubscriptionRequestBody: { + // SubscriptionBody + subscriptionBody: { subscription: { id: "id_example", type: "iOSPush", token: "token_example", enabled: true, - notification_types: 3.14, - session_time: 3.14, - session_count: 3.14, + notification_types: 1, + session_time: 1, + session_count: 1, sdk: "sdk_example", device_model: "device_model_example", device_os: "device_os_example", rooted: true, - test_type: 3.14, + test_type: 1, app_version: "app_version_example", - net_type: 3.14, + net_type: 1, carrier: "carrier_example", web_auth: "web_auth_example", web_p256: "web_p256_example", }, - retain_previous_owner: true, }, }; @@ -507,7 +491,7 @@ apiInstance.createSubscription(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **createSubscriptionRequestBody** | **CreateSubscriptionRequestBody**| | + **subscriptionBody** | **SubscriptionBody**| | **appId** | [**string**] | | defaults to undefined **aliasLabel** | [**string**] | | defaults to undefined **aliasId** | [**string**] | | defaults to undefined @@ -515,11 +499,11 @@ Name | Type | Description | Notes ### Return type -**InlineResponse201** +**SubscriptionBody** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -533,6 +517,7 @@ Name | Type | Description | Notes **201** | CREATED | - | **202** | ACCEPTED | - | **400** | Bad Request | - | +**404** | Not Found | - | **409** | Operation is not permitted due to user having the maximum number of subscriptions assigned | - | **429** | Rate Limit Exceeded | - | @@ -565,44 +550,43 @@ let body:.DefaultApiCreateUserRequest = { lat: 3.14, long: 3.14, country: "country_example", - first_active: 3.14, - last_active: 3.14, + first_active: 1, + last_active: 1, amount_spent: 3.14, purchases: [ { sku: "sku_example", amount: "amount_example", iso: "iso_example", - count: 3.14, + count: 1, }, ], ip: "ip_example", }, - identity: {}, + identity: { + "key": "key_example", + }, subscriptions: [ { id: "id_example", type: "iOSPush", token: "token_example", enabled: true, - notification_types: 3.14, - session_time: 3.14, - session_count: 3.14, + notification_types: 1, + session_time: 1, + session_count: 1, sdk: "sdk_example", device_model: "device_model_example", device_os: "device_os_example", rooted: true, - test_type: 3.14, + test_type: 1, app_version: "app_version_example", - net_type: 3.14, + net_type: 1, carrier: "carrier_example", web_auth: "web_auth_example", web_p256: "web_p256_example", }, ], - subscription_options: { - retain_previous_owner: true, - }, }, }; @@ -626,7 +610,7 @@ Name | Type | Description | Notes ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -647,7 +631,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) # **deleteAlias** -> InlineResponse200 deleteAlias() +> UserIdentityBody deleteAlias() Deletes an alias by alias label @@ -690,71 +674,11 @@ Name | Type | Description | Notes ### Return type -**InlineResponse200** - -### Authorization - -[app_key](README.md#app_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**400** | Bad Request | - | -**409** | Conflict | - | -**429** | Rate Limit Exceeded | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **deletePlayer** -> DeletePlayerSuccessResponse deletePlayer() - -Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app. - -### Example - - -```typescript -import { } from ''; -import * as fs from 'fs'; - -const configuration = .createConfiguration(); -const apiInstance = new .DefaultApi(configuration); - -let body:.DefaultApiDeletePlayerRequest = { - // string | The OneSignal App ID for your app. Available in Keys & IDs. - appId: "app_id_example", - // string | The OneSignal player_id - playerId: "player_id_example", -}; - -apiInstance.deletePlayer(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | [**string**] | The OneSignal App ID for your app. Available in Keys & IDs. | defaults to undefined - **playerId** | [**string**] | The OneSignal player_id | defaults to undefined - - -### Return type - -**DeletePlayerSuccessResponse** +**UserIdentityBody** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -768,14 +692,15 @@ Name | Type | Description | Notes **200** | OK | - | **400** | Bad Request | - | **404** | Not Found | - | +**409** | Conflict | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **deleteSegments** -> DeleteSegmentSuccessResponse deleteSegments() +# **deleteSegment** +> GenericSuccessBoolResponse deleteSegment() -Delete segments (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard. +Delete a segment (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard. ### Example @@ -787,14 +712,14 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiDeleteSegmentsRequest = { +let body:.DefaultApiDeleteSegmentRequest = { // string | The OneSignal App ID for your app. Available in Keys & IDs. appId: "app_id_example", // string | The segment_id can be found in the URL of the segment when viewing it in the dashboard. segmentId: "segment_id_example", }; -apiInstance.deleteSegments(body).then((data:any) => { +apiInstance.deleteSegment(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -810,11 +735,11 @@ Name | Type | Description | Notes ### Return type -**DeleteSegmentSuccessResponse** +**GenericSuccessBoolResponse** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -874,7 +799,7 @@ Name | Type | Description | Notes ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -887,6 +812,7 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **202** | ACCEPTED | - | **400** | Bad Request | - | +**404** | Not Found | - | **409** | Conflict | - | **429** | Rate Limit Exceeded | - | @@ -955,10 +881,10 @@ No authorization required [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **endLiveActivity** -> void endLiveActivity() +# **exportEvents** +> ExportEventsSuccessResponse exportEvents() -Stops a Live Activity +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. ### Example @@ -970,16 +896,14 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiEndLiveActivityRequest = { - // string | The OneSignal App ID for your app. Available in Keys & IDs. +let body:.DefaultApiExportEventsRequest = { + // string | The ID of the notification to export events from. + notificationId: "notification_id_example", + // string | The ID of the app that the notification belongs to. appId: "app_id_example", - // string | Live Activity record ID - activityId: "activity_id_example", - // string | Subscription ID - subscriptionId: "subscription_id_example", }; -apiInstance.endLiveActivity(body).then((data:any) => { +apiInstance.exportEvents(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -989,18 +913,17 @@ apiInstance.endLiveActivity(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **appId** | [**string**] | The OneSignal App ID for your app. Available in Keys & IDs. | defaults to undefined - **activityId** | [**string**] | Live Activity record ID | defaults to undefined - **subscriptionId** | [**string**] | Subscription ID | defaults to undefined + **notificationId** | [**string**] | The ID of the notification to export events from. | defaults to undefined + **appId** | [**string**] | The ID of the app that the notification belongs to. | defaults to undefined ### Return type -**void** +**ExportEventsSuccessResponse** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -1011,16 +934,17 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**204** | OK | - | +**200** | OK | - | **400** | Bad Request | - | +**404** | Not Found | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **exportEvents** -> ExportEventsSuccessResponse exportEvents() +# **exportSubscriptions** +> ExportSubscriptionsSuccessResponse exportSubscriptions() -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. +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. 🚧 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. 🚧 Requires Authentication Key Requires your OneSignal App\'s REST API Key, available in Keys & IDs. 🚧 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. | ### Example @@ -1032,14 +956,20 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiExportEventsRequest = { - // string | The ID of the notification to export events from. - notificationId: "notification_id_example", - // string | The ID of the app that the notification belongs to. +let body:.DefaultApiExportSubscriptionsRequest = { + // string | The app ID that you want to export devices from appId: "app_id_example", + // ExportSubscriptionsRequestBody (optional) + exportSubscriptionsRequestBody: { + extra_fields: [ + "extra_fields_example", + ], + last_active_since: "last_active_since_example", + segment_name: "segment_name_example", + }, }; -apiInstance.exportEvents(body).then((data:any) => { +apiInstance.exportSubscriptions(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -1049,21 +979,21 @@ apiInstance.exportEvents(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **notificationId** | [**string**] | The ID of the notification to export events from. | defaults to undefined - **appId** | [**string**] | The ID of the app that the notification belongs to. | defaults to undefined + **exportSubscriptionsRequestBody** | **ExportSubscriptionsRequestBody**| | + **appId** | [**string**] | The app ID that you want to export devices from | defaults to undefined ### Return type -**ExportEventsSuccessResponse** +**ExportSubscriptionsSuccessResponse** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/json @@ -1072,15 +1002,14 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | OK | - | **400** | Bad Request | - | -**404** | Not Found | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **exportPlayers** -> ExportPlayersSuccessResponse exportPlayers() +# **getAliases** +> UserIdentityBody getAliases() -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. 🚧 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. 🚧 Requires Authentication Key Requires your OneSignal App\'s REST API Key, available in Keys & IDs. 🚧 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. | +Lists all Aliases for the User identified by (:alias_label, :alias_id). ### Example @@ -1092,20 +1021,16 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiExportPlayersRequest = { - // string | The app ID that you want to export devices from +let body:.DefaultApiGetAliasesRequest = { + // string appId: "app_id_example", - // ExportPlayersRequestBody (optional) - exportPlayersRequestBody: { - extra_fields: [ - "extra_fields_example", - ], - last_active_since: "last_active_since_example", - segment_name: "segment_name_example", - }, + // string + aliasLabel: "alias_label_example", + // string + aliasId: "alias_id_example", }; -apiInstance.exportPlayers(body).then((data:any) => { +apiInstance.getAliases(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -1115,21 +1040,22 @@ apiInstance.exportPlayers(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **exportPlayersRequestBody** | **ExportPlayersRequestBody**| | - **appId** | [**string**] | The app ID that you want to export devices from | defaults to undefined + **appId** | [**string**] | | defaults to undefined + **aliasLabel** | [**string**] | | defaults to undefined + **aliasId** | [**string**] | | defaults to undefined ### Return type -**ExportPlayersSuccessResponse** +**UserIdentityBody** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json @@ -1138,12 +1064,13 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | OK | - | **400** | Bad Request | - | +**404** | Not Found | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **fetchAliases** -> UserIdentityResponse fetchAliases() +# **getAliasesBySubscription** +> UserIdentityBody getAliasesBySubscription() Lists all Aliases for the User identified by :subscription_id. @@ -1157,14 +1084,14 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiFetchAliasesRequest = { +let body:.DefaultApiGetAliasesBySubscriptionRequest = { // string appId: "app_id_example", // string subscriptionId: "subscription_id_example", }; -apiInstance.fetchAliases(body).then((data:any) => { +apiInstance.getAliasesBySubscription(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -1180,11 +1107,11 @@ Name | Type | Description | Notes ### Return type -**UserIdentityResponse** +**UserIdentityBody** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -1197,137 +1124,14 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | OK | - | **400** | Bad Request | - | +**404** | Not Found | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **fetchUser** -> User fetchUser() +# **getApp** +> App getApp() -Returns the User’s properties, Aliases, and Subscriptions. - -### Example - - -```typescript -import { } from ''; -import * as fs from 'fs'; - -const configuration = .createConfiguration(); -const apiInstance = new .DefaultApi(configuration); - -let body:.DefaultApiFetchUserRequest = { - // string - appId: "app_id_example", - // string - aliasLabel: "alias_label_example", - // string - aliasId: "alias_id_example", -}; - -apiInstance.fetchUser(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | [**string**] | | defaults to undefined - **aliasLabel** | [**string**] | | defaults to undefined - **aliasId** | [**string**] | | defaults to undefined - - -### Return type - -**User** - -### Authorization - -[app_key](README.md#app_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**400** | Bad Request | - | -**429** | Rate Limit Exceeded | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **fetchUserIdentity** -> InlineResponse200 fetchUserIdentity() - -Lists all Aliases for the User identified by (:alias_label, :alias_id). - -### Example - - -```typescript -import { } from ''; -import * as fs from 'fs'; - -const configuration = .createConfiguration(); -const apiInstance = new .DefaultApi(configuration); - -let body:.DefaultApiFetchUserIdentityRequest = { - // string - appId: "app_id_example", - // string - aliasLabel: "alias_label_example", - // string - aliasId: "alias_id_example", -}; - -apiInstance.fetchUserIdentity(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | [**string**] | | defaults to undefined - **aliasLabel** | [**string**] | | defaults to undefined - **aliasId** | [**string**] | | defaults to undefined - - -### Return type - -**InlineResponse200** - -### Authorization - -[app_key](README.md#app_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**400** | Bad Request | - | -**429** | Rate Limit Exceeded | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getApp** -> App getApp() - -View the details of a single OneSignal app +View the details of a single OneSignal app ### Example @@ -1363,7 +1167,7 @@ Name | Type | Description | Notes ### Authorization -[user_key](README.md#user_key) +[user_auth_key](README.md#user_auth_key) ### HTTP request headers @@ -1413,66 +1217,7 @@ This endpoint does not need any parameter. ### Authorization -[user_key](README.md#user_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**400** | Bad Request | - | -**429** | Rate Limit Exceeded | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getEligibleIams** -> InlineResponse2003 getEligibleIams() - -Manifest of In-App Messages the Subscription is eligible to display by the SDK. - -### Example - - -```typescript -import { } from ''; -import * as fs from 'fs'; - -const configuration = .createConfiguration(); -const apiInstance = new .DefaultApi(configuration); - -let body:.DefaultApiGetEligibleIamsRequest = { - // string - appId: "app_id_example", - // string - subscriptionId: "subscription_id_example", -}; - -apiInstance.getEligibleIams(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | [**string**] | | defaults to undefined - **subscriptionId** | [**string**] | | defaults to undefined - - -### Return type - -**InlineResponse2003** - -### Authorization - -[app_key](README.md#app_key) +[user_auth_key](README.md#user_auth_key) ### HTTP request headers @@ -1531,7 +1276,7 @@ Name | Type | Description | Notes ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -1544,12 +1289,13 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | OK | - | **400** | Bad Request | - | +**404** | Not Found | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) # **getNotificationHistory** -> NotificationHistorySuccessResponse getNotificationHistory(getNotificationRequestBody) +> NotificationHistorySuccessResponse getNotificationHistory(getNotificationHistoryRequestBody) -> View the devices sent a message - OneSignal Paid Plan Required This method will return all devices that were sent the given notification_id of an Email or Push Notification if used within 7 days of the date sent. After 7 days of the sending date, the message history data will be unavailable. After a successful response is received, the destination url may be polled until the file becomes available. Most exports are done in ~1-3 minutes, so setting a poll interval of 10 seconds should be adequate. For use cases that are not meant to be consumed by a script, an email will be sent to the supplied email address. 🚧 Requirements A OneSignal Paid Plan. Turn on Send History via OneSignal API in Settings -> Analytics. Cannot get data before this was turned on. Must be called within 7 days after sending the message. Messages targeting under 1000 recipients will not have \"sent\" events recorded, but will show \"clicked\" events. Requires your OneSignal App\'s REST API Key, available in Keys & IDs. @@ -1566,8 +1312,8 @@ const apiInstance = new .DefaultApi(configuration); let body:.DefaultApiGetNotificationHistoryRequest = { // string | The \"id\" of the message found in the Notification object notificationId: "notification_id_example", - // GetNotificationRequestBody - getNotificationRequestBody: { + // GetNotificationHistoryRequestBody + getNotificationHistoryRequestBody: { events: "sent", email: "email_example", app_id: "app_id_example", @@ -1584,7 +1330,7 @@ apiInstance.getNotificationHistory(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **getNotificationRequestBody** | **GetNotificationRequestBody**| | + **getNotificationHistoryRequestBody** | **GetNotificationHistoryRequestBody**| | **notificationId** | [**string**] | The \"id\" of the message found in the Notification object | defaults to undefined @@ -1594,7 +1340,7 @@ Name | Type | Description | Notes ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -1607,6 +1353,7 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | OK | - | **400** | Bad Request | - | +**404** | Not Found | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) @@ -1659,7 +1406,7 @@ Name | Type | Description | Notes ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -1730,7 +1477,7 @@ Name | Type | Description | Notes ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -1747,10 +1494,10 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **getPlayer** -> Player getPlayer() +# **getSegments** +> GetSegmentsSuccessResponse getSegments() -View the details of an existing device in one of your OneSignal apps +Returns an array of segments from an app. ### Example @@ -1762,78 +1509,16 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiGetPlayerRequest = { - // string | Your app_id for this device - appId: "app_id_example", - // string | Player\'s OneSignal ID - playerId: "player_id_example", - // string | Email - Only required if you have enabled Identity Verification and device_type is email (11). (optional) - emailAuthHash: "email_auth_hash_example", -}; - -apiInstance.getPlayer(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | [**string**] | Your app_id for this device | defaults to undefined - **playerId** | [**string**] | Player\'s OneSignal ID | defaults to undefined - **emailAuthHash** | [**string**] | Email - Only required if you have enabled Identity Verification and device_type is email (11). | (optional) defaults to undefined - - -### Return type - -**Player** - -### Authorization - -[app_key](README.md#app_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**400** | Bad Request | - | -**429** | Rate Limit Exceeded | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getPlayers** -> PlayerSlice getPlayers() - -View the details of multiple devices in one of your OneSignal apps Unavailable for Apps Over 80,000 Users For performance reasons, this method is not available for larger apps. Larger apps should use the CSV export API endpoint, which is much more performant. - -### Example - - -```typescript -import { } from ''; -import * as fs from 'fs'; - -const configuration = .createConfiguration(); -const apiInstance = new .DefaultApi(configuration); - -let body:.DefaultApiGetPlayersRequest = { - // string | The app ID that you want to view players from +let body:.DefaultApiGetSegmentsRequest = { + // string | The OneSignal App ID for your app. Available in Keys & IDs. appId: "app_id_example", - // number | How many devices to return. Max is 300. Default is 300 (optional) - limit: 1, - // number | Result offset. Default is 0. Results are sorted by id; (optional) + // number | Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments. (optional) offset: 1, + // number | The amount of Segments in the response. Maximum 300. (optional) + limit: 1, }; -apiInstance.getPlayers(body).then((data:any) => { +apiInstance.getSegments(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -1843,18 +1528,18 @@ apiInstance.getPlayers(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **appId** | [**string**] | The app ID that you want to view players from | defaults to undefined - **limit** | [**number**] | How many devices to return. Max is 300. Default is 300 | (optional) defaults to undefined - **offset** | [**number**] | Result offset. Default is 0. Results are sorted by id; | (optional) defaults to undefined + **appId** | [**string**] | The OneSignal App ID for your app. Available in Keys & IDs. | defaults to undefined + **offset** | [**number**] | Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments. | (optional) defaults to undefined + **limit** | [**number**] | The amount of Segments in the response. Maximum 300. | (optional) defaults to undefined ### Return type -**PlayerSlice** +**GetSegmentsSuccessResponse** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -1865,16 +1550,16 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | OK | - | +**201** | OK | - | **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **identifyUserByAlias** -> InlineResponse200 identifyUserByAlias(userIdentityRequestBody) +# **getUser** +> User getUser() -Upserts one or more Aliases to an existing User identified by (:alias_label, :alias_id). +Returns the User’s properties, Aliases, and Subscriptions. ### Example @@ -1886,20 +1571,16 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiIdentifyUserByAliasRequest = { +let body:.DefaultApiGetUserRequest = { // string appId: "app_id_example", // string aliasLabel: "alias_label_example", // string aliasId: "alias_id_example", - // UserIdentityRequestBody - userIdentityRequestBody: { - identity: {}, - }, }; -apiInstance.identifyUserByAlias(body).then((data:any) => { +apiInstance.getUser(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -1909,7 +1590,6 @@ apiInstance.identifyUserByAlias(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userIdentityRequestBody** | **UserIdentityRequestBody**| | **appId** | [**string**] | | defaults to undefined **aliasLabel** | [**string**] | | defaults to undefined **aliasId** | [**string**] | | defaults to undefined @@ -1917,15 +1597,15 @@ Name | Type | Description | Notes ### Return type -**InlineResponse200** +**User** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json @@ -1934,15 +1614,15 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | OK | - | **400** | Bad Request | - | -**409** | Conflict | - | +**404** | Not Found | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **identifyUserBySubscriptionId** -> UserIdentityResponse identifyUserBySubscriptionId(userIdentityRequestBody) +# **transferSubscription** +> UserIdentityBody transferSubscription(transferSubscriptionRequestBody) -Upserts one or more Aliases for the User identified by :subscription_id. +Transfers this Subscription to the User identified by the identity in the payload. ### Example @@ -1954,18 +1634,20 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiIdentifyUserBySubscriptionIdRequest = { +let body:.DefaultApiTransferSubscriptionRequest = { // string appId: "app_id_example", // string subscriptionId: "subscription_id_example", - // UserIdentityRequestBody - userIdentityRequestBody: { - identity: {}, + // TransferSubscriptionRequestBody + transferSubscriptionRequestBody: { + identity: { + "key": "key_example", + }, }, }; -apiInstance.identifyUserBySubscriptionId(body).then((data:any) => { +apiInstance.transferSubscription(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -1975,18 +1657,18 @@ apiInstance.identifyUserBySubscriptionId(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **userIdentityRequestBody** | **UserIdentityRequestBody**| | + **transferSubscriptionRequestBody** | **TransferSubscriptionRequestBody**| | **appId** | [**string**] | | defaults to undefined **subscriptionId** | [**string**] | | defaults to undefined ### Return type -**UserIdentityResponse** +**UserIdentityBody** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -1999,15 +1681,16 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | OK | - | **400** | Bad Request | - | +**404** | Not Found | - | **409** | Conflict | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **transferSubscription** -> UserIdentityResponse transferSubscription(transferSubscriptionRequestBody) +# **unsubscribeEmailWithToken** +> GenericSuccessBoolResponse unsubscribeEmailWithToken() -Transfers this Subscription to the User identified by the identity in the payload. +Unsubscribe an email with a token when using your own custom email unsubscribe landing page ### Example @@ -2019,18 +1702,16 @@ import * as fs from 'fs'; const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); -let body:.DefaultApiTransferSubscriptionRequest = { - // string +let body:.DefaultApiUnsubscribeEmailWithTokenRequest = { + // string | The OneSignal App ID for your app. Available in Keys & IDs. appId: "app_id_example", - // string - subscriptionId: "subscription_id_example", - // TransferSubscriptionRequestBody - transferSubscriptionRequestBody: { - identity: {}, - }, + // string | The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report. + notificationId: "notification_id_example", + // string | The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email. + token: "token_example", }; -apiInstance.transferSubscription(body).then((data:any) => { +apiInstance.unsubscribeEmailWithToken(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -2040,31 +1721,30 @@ apiInstance.transferSubscription(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **transferSubscriptionRequestBody** | **TransferSubscriptionRequestBody**| | - **appId** | [**string**] | | defaults to undefined - **subscriptionId** | [**string**] | | defaults to undefined + **appId** | [**string**] | The OneSignal App ID for your app. Available in Keys & IDs. | defaults to undefined + **notificationId** | [**string**] | The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report. | defaults to undefined + **token** | [**string**] | The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email. | defaults to undefined ### Return type -**UserIdentityResponse** +**GenericSuccessBoolResponse** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | OK | - | +**202** | OK | - | **400** | Bad Request | - | -**409** | Conflict | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) @@ -2133,7 +1813,7 @@ Name | Type | Description | Notes ### Authorization -[user_key](README.md#user_key) +[user_auth_key](README.md#user_auth_key) ### HTTP request headers @@ -2172,10 +1852,103 @@ let body:.DefaultApiUpdateLiveActivityRequest = { activityId: "activity_id_example", // UpdateLiveActivityRequest updateLiveActivityRequest: { - name: "headings", + name: "name_example", event: "update", event_updates: {}, - dismiss_at: 3.14, + contents: { + en: "en_example", + ar: "ar_example", + bs: "bs_example", + bg: "bg_example", + ca: "ca_example", + zh_hans: "zh_hans_example", + zh_hant: "zh_hant_example", + zh: "zh_example", + hr: "hr_example", + cs: "cs_example", + da: "da_example", + nl: "nl_example", + et: "et_example", + fi: "fi_example", + fr: "fr_example", + ka: "ka_example", + de: "de_example", + el: "el_example", + hi: "hi_example", + he: "he_example", + hu: "hu_example", + id: "id_example", + it: "it_example", + ja: "ja_example", + ko: "ko_example", + lv: "lv_example", + lt: "lt_example", + ms: "ms_example", + nb: "nb_example", + pl: "pl_example", + fa: "fa_example", + pt: "pt_example", + pa: "pa_example", + ro: "ro_example", + ru: "ru_example", + sr: "sr_example", + sk: "sk_example", + es: "es_example", + sv: "sv_example", + th: "th_example", + tr: "tr_example", + uk: "uk_example", + vi: "vi_example", + }, + headings: { + en: "en_example", + ar: "ar_example", + bs: "bs_example", + bg: "bg_example", + ca: "ca_example", + zh_hans: "zh_hans_example", + zh_hant: "zh_hant_example", + zh: "zh_example", + hr: "hr_example", + cs: "cs_example", + da: "da_example", + nl: "nl_example", + et: "et_example", + fi: "fi_example", + fr: "fr_example", + ka: "ka_example", + de: "de_example", + el: "el_example", + hi: "hi_example", + he: "he_example", + hu: "hu_example", + id: "id_example", + it: "it_example", + ja: "ja_example", + ko: "ko_example", + lv: "lv_example", + lt: "lt_example", + ms: "ms_example", + nb: "nb_example", + pl: "pl_example", + fa: "fa_example", + pt: "pt_example", + pa: "pa_example", + ro: "ro_example", + ru: "ru_example", + sr: "sr_example", + sk: "sk_example", + es: "es_example", + sv: "sv_example", + th: "th_example", + tr: "tr_example", + uk: "uk_example", + vi: "vi_example", + }, + sound: "sound_example", + stale_date: 1, + dismissal_date: 1, + priority: 1, }, }; @@ -2200,92 +1973,7 @@ Name | Type | Description | Notes ### Authorization -[app_key](README.md#app_key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**400** | Bad Request | - | -**429** | Rate Limit Exceeded | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **updatePlayer** -> UpdatePlayerSuccessResponse updatePlayer(player) - -Update an existing device in one of your OneSignal apps - -### Example - - -```typescript -import { } from ''; -import * as fs from 'fs'; - -const configuration = .createConfiguration(); -const apiInstance = new .DefaultApi(configuration); - -let body:.DefaultApiUpdatePlayerRequest = { - // string | Player\'s OneSignal ID - playerId: "player_id_example", - // Player - player: { - app_id: "app_id_example", - device_type: 1, - external_user_id: "external_user_id_example", - external_user_id_auth_hash: "external_user_id_auth_hash_example", - email_auth_hash: "email_auth_hash_example", - identifier: "identifier_example", - language: "language_example", - timezone: 1, - game_version: "game_version_example", - device_model: "device_model_example", - device_os: "device_os_example", - ad_id: "ad_id_example", - sdk: "sdk_example", - session_count: 1, - tags: {}, - amount_spent: 3.14, - created_at: 1, - playtime: 1, - badge_count: 1, - last_active: 1, - notification_types: 1, - test_type: 1, - long: 3.14, - lat: 3.14, - country: "country_example", - }, -}; - -apiInstance.updatePlayer(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **player** | **Player**| | - **playerId** | [**string**] | Player\'s OneSignal ID | defaults to undefined - - -### Return type - -**UpdatePlayerSuccessResponse** - -### Authorization - -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -2298,78 +1986,12 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | OK | - | **400** | Bad Request | - | -**409** | Conflict | - | -**429** | Rate Limit Exceeded | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **updatePlayerTags** -> UpdatePlayerTagsSuccessResponse updatePlayerTags() - -Update an existing device\'s tags in one of your OneSignal apps using the External User ID. Warning - Android SDK Data Synchronization Tags added through the Android SDK tagging methods may not update if using the API to change or update the same tag. For example, if you use SDK method sendTag(\"key\", \"value1\") then update the tag value to \"value2\" with this API endpoint. You will not be able to set the value back to \"value1\" through the SDK, you will need to change it to something different through the SDK to be reset. Recommendations if using this Endpoint on Android Mobile Apps: 1 - Do not use the same tag keys for SDK and API updates 2 - If you want to use the same key for both SDK and API updates, call the SDK getTags method first to update the device\'s tags. This is only applicable on the Android Mobile App SDKs. 📘 Deleting Tags To delete a tag, include its key and set its value to blank. Omitting a key/value will not delete it. For example, if I wanted to delete two existing tags rank and category while simultaneously adding a new tag class, the tags JSON would look like the following: \"tags\": { \"rank\": \"\", \"category\": \"\", \"class\": \"my_new_value\" } - -### Example - - -```typescript -import { } from ''; -import * as fs from 'fs'; - -const configuration = .createConfiguration(); -const apiInstance = new .DefaultApi(configuration); - -let body:.DefaultApiUpdatePlayerTagsRequest = { - // string | The OneSignal App ID the user record is found under. - appId: "app_id_example", - // string | The External User ID mapped to teh device record in OneSignal. Must be actively set on the device to be updated. - externalUserId: "external_user_id_example", - // UpdatePlayerTagsRequestBody (optional) - updatePlayerTagsRequestBody: { - tags: {}, - }, -}; - -apiInstance.updatePlayerTags(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **updatePlayerTagsRequestBody** | **UpdatePlayerTagsRequestBody**| | - **appId** | [**string**] | The OneSignal App ID the user record is found under. | defaults to undefined - **externalUserId** | [**string**] | The External User ID mapped to teh device record in OneSignal. Must be actively set on the device to be updated. | defaults to undefined - - -### Return type - -**UpdatePlayerTagsSuccessResponse** - -### Authorization - -[app_key](README.md#app_key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**400** | Bad Request | - | -**409** | Conflict | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) # **updateSubscription** -> void updateSubscription(updateSubscriptionRequestBody) +> void updateSubscription(subscriptionBody) Updates an existing Subscription’s properties. @@ -2388,23 +2010,23 @@ let body:.DefaultApiUpdateSubscriptionRequest = { appId: "app_id_example", // string subscriptionId: "subscription_id_example", - // UpdateSubscriptionRequestBody - updateSubscriptionRequestBody: { + // SubscriptionBody + subscriptionBody: { subscription: { id: "id_example", type: "iOSPush", token: "token_example", enabled: true, - notification_types: 3.14, - session_time: 3.14, - session_count: 3.14, + notification_types: 1, + session_time: 1, + session_count: 1, sdk: "sdk_example", device_model: "device_model_example", device_os: "device_os_example", rooted: true, - test_type: 3.14, + test_type: 1, app_version: "app_version_example", - net_type: 3.14, + net_type: 1, carrier: "carrier_example", web_auth: "web_auth_example", web_p256: "web_p256_example", @@ -2422,7 +2044,7 @@ apiInstance.updateSubscription(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **updateSubscriptionRequestBody** | **UpdateSubscriptionRequestBody**| | + **subscriptionBody** | **SubscriptionBody**| | **appId** | [**string**] | | defaults to undefined **subscriptionId** | [**string**] | | defaults to undefined @@ -2433,7 +2055,7 @@ Name | Type | Description | Notes ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers @@ -2444,15 +2066,16 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**202** | ACCEPTED | - | +**200** | OK | - | **400** | Bad Request | - | +**404** | Not Found | - | **409** | Conflict | - | **429** | Rate Limit Exceeded | - | [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) # **updateUser** -> InlineResponse202 updateUser(updateUserRequest) +> PropertiesBody updateUser(updateUserRequest) Updates an existing User’s properties. @@ -2482,29 +2105,29 @@ let body:.DefaultApiUpdateUserRequest = { lat: 3.14, long: 3.14, country: "country_example", - first_active: 3.14, - last_active: 3.14, + first_active: 1, + last_active: 1, amount_spent: 3.14, purchases: [ { sku: "sku_example", amount: "amount_example", iso: "iso_example", - count: 3.14, + count: 1, }, ], ip: "ip_example", }, refresh_device_metadata: false, deltas: { - session_time: 3.14, - session_count: 3.14, + session_time: 1, + session_count: 1, purchases: [ { sku: "sku_example", amount: "amount_example", iso: "iso_example", - count: 3.14, + count: 1, }, ], }, @@ -2529,11 +2152,11 @@ Name | Type | Description | Notes ### Return type -**InlineResponse202** +**PropertiesBody** ### Authorization -[app_key](README.md#app_key) +[rest_api_key](README.md#rest_api_key) ### HTTP request headers diff --git a/apis/DefaultApi.ts b/apis/DefaultApi.ts index 7c4a2d5..f9a0082 100644 --- a/apis/DefaultApi.ts +++ b/apis/DefaultApi.ts @@ -11,47 +11,32 @@ import {SecurityAuthentication} from '../auth/auth'; import { App } from '../models/App'; -import { BeginLiveActivityRequest } from '../models/BeginLiveActivityRequest'; -import { CancelNotificationSuccessResponse } from '../models/CancelNotificationSuccessResponse'; import { CreateNotificationSuccessResponse } from '../models/CreateNotificationSuccessResponse'; -import { CreatePlayerSuccessResponse } from '../models/CreatePlayerSuccessResponse'; import { CreateSegmentConflictResponse } from '../models/CreateSegmentConflictResponse'; import { CreateSegmentSuccessResponse } from '../models/CreateSegmentSuccessResponse'; -import { CreateSubscriptionRequestBody } from '../models/CreateSubscriptionRequestBody'; import { CreateUserConflictResponse } from '../models/CreateUserConflictResponse'; -import { DeletePlayerNotFoundResponse } from '../models/DeletePlayerNotFoundResponse'; -import { DeletePlayerSuccessResponse } from '../models/DeletePlayerSuccessResponse'; -import { DeleteSegmentNotFoundResponse } from '../models/DeleteSegmentNotFoundResponse'; -import { DeleteSegmentSuccessResponse } from '../models/DeleteSegmentSuccessResponse'; import { ExportEventsSuccessResponse } from '../models/ExportEventsSuccessResponse'; -import { ExportPlayersRequestBody } from '../models/ExportPlayersRequestBody'; -import { ExportPlayersSuccessResponse } from '../models/ExportPlayersSuccessResponse'; +import { ExportSubscriptionsRequestBody } from '../models/ExportSubscriptionsRequestBody'; +import { ExportSubscriptionsSuccessResponse } from '../models/ExportSubscriptionsSuccessResponse'; import { GenericError } from '../models/GenericError'; -import { GetNotificationRequestBody } from '../models/GetNotificationRequestBody'; -import { InlineResponse200 } from '../models/InlineResponse200'; -import { InlineResponse2003 } from '../models/InlineResponse2003'; -import { InlineResponse201 } from '../models/InlineResponse201'; -import { InlineResponse202 } from '../models/InlineResponse202'; +import { GenericSuccessBoolResponse } from '../models/GenericSuccessBoolResponse'; +import { GetNotificationHistoryRequestBody } from '../models/GetNotificationHistoryRequestBody'; +import { GetSegmentsSuccessResponse } from '../models/GetSegmentsSuccessResponse'; import { Notification } from '../models/Notification'; import { NotificationHistorySuccessResponse } from '../models/NotificationHistorySuccessResponse'; import { NotificationSlice } from '../models/NotificationSlice'; import { NotificationWithMeta } from '../models/NotificationWithMeta'; import { OutcomesData } from '../models/OutcomesData'; -import { Player } from '../models/Player'; -import { PlayerSlice } from '../models/PlayerSlice'; -import { RateLimiterError } from '../models/RateLimiterError'; +import { PropertiesBody } from '../models/PropertiesBody'; +import { RateLimitError } from '../models/RateLimitError'; import { Segment } from '../models/Segment'; +import { SubscriptionBody } from '../models/SubscriptionBody'; import { TransferSubscriptionRequestBody } from '../models/TransferSubscriptionRequestBody'; import { UpdateLiveActivityRequest } from '../models/UpdateLiveActivityRequest'; import { UpdateLiveActivitySuccessResponse } from '../models/UpdateLiveActivitySuccessResponse'; -import { UpdatePlayerSuccessResponse } from '../models/UpdatePlayerSuccessResponse'; -import { UpdatePlayerTagsRequestBody } from '../models/UpdatePlayerTagsRequestBody'; -import { UpdatePlayerTagsSuccessResponse } from '../models/UpdatePlayerTagsSuccessResponse'; -import { UpdateSubscriptionRequestBody } from '../models/UpdateSubscriptionRequestBody'; import { UpdateUserRequest } from '../models/UpdateUserRequest'; import { User } from '../models/User'; -import { UserIdentityRequestBody } from '../models/UserIdentityRequestBody'; -import { UserIdentityResponse } from '../models/UserIdentityResponse'; +import { UserIdentityBody } from '../models/UserIdentityBody'; /** * no description @@ -59,57 +44,46 @@ import { UserIdentityResponse } from '../models/UserIdentityResponse'; export class DefaultApiRequestFactory extends BaseAPIRequestFactory { /** - * Starts a Live Activity - * Start Live Activity - * @param appId The OneSignal App ID for your app. Available in Keys & IDs. - * @param activityId Live Activity record ID - * @param beginLiveActivityRequest + * Used to stop a scheduled or currently outgoing notification + * Stop a scheduled or currently outgoing notification + * @param appId + * @param notificationId */ - public async beginLiveActivity(appId: string, activityId: string, beginLiveActivityRequest: BeginLiveActivityRequest, _options?: Configuration): Promise { + public async cancelNotification(appId: string, notificationId: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'appId' is not null or undefined if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "beginLiveActivity", "appId"); - } - - - // verify required parameter 'activityId' is not null or undefined - if (activityId === null || activityId === undefined) { - throw new RequiredError("DefaultApi", "beginLiveActivity", "activityId"); + throw new RequiredError("DefaultApi", "cancelNotification", "appId"); } - // verify required parameter 'beginLiveActivityRequest' is not null or undefined - if (beginLiveActivityRequest === null || beginLiveActivityRequest === undefined) { - throw new RequiredError("DefaultApi", "beginLiveActivity", "beginLiveActivityRequest"); + // verify required parameter 'notificationId' is not null or undefined + if (notificationId === null || notificationId === undefined) { + throw new RequiredError("DefaultApi", "cancelNotification", "notificationId"); } // Path Params - const localVarPath = '/apps/{app_id}/live_activities/{activity_id}/token' - .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) - .replace('{' + 'activity_id' + '}', encodeURIComponent(String(activityId))); + const localVarPath = '/notifications/{notification_id}' + .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId))); // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + + // Query Params + if (appId !== undefined) { + requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", "")); + } - // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([ - "application/json" - ]); - requestContext.setHeaderParam("Content-Type", contentType); - const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(beginLiveActivityRequest, "BeginLiveActivityRequest", ""), - contentType - ); - requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -123,43 +97,67 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * Used to stop a scheduled or currently outgoing notification - * Stop a scheduled or currently outgoing notification + * Upserts one or more Aliases to an existing User identified by (:alias_label, :alias_id). * @param appId - * @param notificationId + * @param aliasLabel + * @param aliasId + * @param userIdentityBody */ - public async cancelNotification(appId: string, notificationId: string, _options?: Configuration): Promise { + public async createAlias(appId: string, aliasLabel: string, aliasId: string, userIdentityBody: UserIdentityBody, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'appId' is not null or undefined if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "cancelNotification", "appId"); + throw new RequiredError("DefaultApi", "createAlias", "appId"); } - // verify required parameter 'notificationId' is not null or undefined - if (notificationId === null || notificationId === undefined) { - throw new RequiredError("DefaultApi", "cancelNotification", "notificationId"); + // verify required parameter 'aliasLabel' is not null or undefined + if (aliasLabel === null || aliasLabel === undefined) { + throw new RequiredError("DefaultApi", "createAlias", "aliasLabel"); + } + + + // verify required parameter 'aliasId' is not null or undefined + if (aliasId === null || aliasId === undefined) { + throw new RequiredError("DefaultApi", "createAlias", "aliasId"); + } + + + // verify required parameter 'userIdentityBody' is not null or undefined + if (userIdentityBody === null || userIdentityBody === undefined) { + throw new RequiredError("DefaultApi", "createAlias", "userIdentityBody"); } // Path Params - const localVarPath = '/notifications/{notification_id}' - .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId))); + const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity' + .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) + .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel))) + .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId))); // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - // Query Params - if (appId !== undefined) { - requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", "")); - } + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(userIdentityBody, "UserIdentityBody", ""), + contentType + ); + requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -173,26 +171,44 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * Creates a new OneSignal app - * Create an app - * @param app + * Upserts one or more Aliases for the User identified by :subscription_id. + * @param appId + * @param subscriptionId + * @param userIdentityBody */ - public async createApp(app: App, _options?: Configuration): Promise { + public async createAliasBySubscription(appId: string, subscriptionId: string, userIdentityBody: UserIdentityBody, _options?: Configuration): Promise { let _config = _options || this.configuration; - // verify required parameter 'app' is not null or undefined - if (app === null || app === undefined) { - throw new RequiredError("DefaultApi", "createApp", "app"); + // verify required parameter 'appId' is not null or undefined + if (appId === null || appId === undefined) { + throw new RequiredError("DefaultApi", "createAliasBySubscription", "appId"); + } + + + // verify required parameter 'subscriptionId' is not null or undefined + if (subscriptionId === null || subscriptionId === undefined) { + throw new RequiredError("DefaultApi", "createAliasBySubscription", "subscriptionId"); + } + + + // verify required parameter 'userIdentityBody' is not null or undefined + if (userIdentityBody === null || userIdentityBody === undefined) { + throw new RequiredError("DefaultApi", "createAliasBySubscription", "userIdentityBody"); } // Path Params - const localVarPath = '/apps'; + const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/user/identity' + .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) + .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId))); // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ @@ -200,14 +216,14 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(app, "App", ""), + ObjectSerializer.serialize(userIdentityBody, "UserIdentityBody", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["user_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -221,26 +237,29 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * Sends notifications to your users - * Create notification - * @param notification + * Creates a new OneSignal app + * Create an app + * @param app */ - public async createNotification(notification: Notification, _options?: Configuration): Promise { + public async createApp(app: App, _options?: Configuration): Promise { let _config = _options || this.configuration; - // verify required parameter 'notification' is not null or undefined - if (notification === null || notification === undefined) { - throw new RequiredError("DefaultApi", "createNotification", "notification"); + // verify required parameter 'app' is not null or undefined + if (app === null || app === undefined) { + throw new RequiredError("DefaultApi", "createApp", "app"); } // Path Params - const localVarPath = '/notifications'; + const localVarPath = '/apps'; // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ @@ -248,14 +267,14 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(notification, "Notification", ""), + ObjectSerializer.serialize(app, "App", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["user_auth_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -269,26 +288,29 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * Register a new device to one of your OneSignal apps 🚧 Don\'t use this This API endpoint is designed to be used from our open source Mobile and Web Push SDKs. It is not designed for developers to use it directly, unless instructed to do so by OneSignal support. If you use this method instead of our SDKs, many OneSignal features such as conversion tracking, timezone tracking, language detection, and rich-push won\'t work out of the box. It will also make it harder to identify possible setup issues. This method is used to register a new device with OneSignal. If a device is already registered with the specified identifier, then this will update the existing device record instead of creating a new one. The returned player is a player / user ID. Use the returned ID to send push notifications to this specific user later, or to include this player when sending to a set of users. 🚧 iOS Must set test_type to 1 when building your iOS app as development. Omit this field in your production app builds. - * Add a device - * @param player + * Sends notifications to your users + * Create notification + * @param notification */ - public async createPlayer(player: Player, _options?: Configuration): Promise { + public async createNotification(notification: Notification, _options?: Configuration): Promise { let _config = _options || this.configuration; - // verify required parameter 'player' is not null or undefined - if (player === null || player === undefined) { - throw new RequiredError("DefaultApi", "createPlayer", "player"); + // verify required parameter 'notification' is not null or undefined + if (notification === null || notification === undefined) { + throw new RequiredError("DefaultApi", "createNotification", "notification"); } // Path Params - const localVarPath = '/players'; + const localVarPath = '/notifications'; // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ @@ -296,14 +318,14 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(player, "Player", ""), + ObjectSerializer.serialize(notification, "Notification", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -317,17 +339,17 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * Create segments visible and usable in the dashboard and API - Required: OneSignal Paid Plan The Create Segment method is used when you want your server to programmatically create a segment instead of using the OneSignal Dashboard UI. Just like creating Segments from the dashboard you can pass in filters with multiple \"AND\" or \"OR\" operator\'s. 🚧 Does Not Update Segments This endpoint will only create segments, it does not edit or update currently created Segments. You will need to use the Delete Segments endpoint and re-create it with this endpoint to edit. - * Create Segments + * Create a segment visible and usable in the dashboard and API - Required: OneSignal Paid Plan The Create Segment method is used when you want your server to programmatically create a segment instead of using the OneSignal Dashboard UI. Just like creating Segments from the dashboard you can pass in filters with multiple \"AND\" or \"OR\" operator\'s. 🚧 Does Not Update Segments This endpoint will only create segments, it does not edit or update currently created Segments. You will need to use the Delete Segment endpoint and re-create it with this endpoint to edit. + * Create Segment * @param appId The OneSignal App ID for your app. Available in Keys & IDs. * @param segment */ - public async createSegments(appId: string, segment?: Segment, _options?: Configuration): Promise { + public async createSegment(appId: string, segment?: Segment, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'appId' is not null or undefined if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "createSegments", "appId"); + throw new RequiredError("DefaultApi", "createSegment", "appId"); } @@ -340,6 +362,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ @@ -354,7 +379,7 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -372,9 +397,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { * @param appId * @param aliasLabel * @param aliasId - * @param createSubscriptionRequestBody + * @param subscriptionBody */ - public async createSubscription(appId: string, aliasLabel: string, aliasId: string, createSubscriptionRequestBody: CreateSubscriptionRequestBody, _options?: Configuration): Promise { + public async createSubscription(appId: string, aliasLabel: string, aliasId: string, subscriptionBody: SubscriptionBody, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'appId' is not null or undefined @@ -395,9 +420,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } - // verify required parameter 'createSubscriptionRequestBody' is not null or undefined - if (createSubscriptionRequestBody === null || createSubscriptionRequestBody === undefined) { - throw new RequiredError("DefaultApi", "createSubscription", "createSubscriptionRequestBody"); + // verify required parameter 'subscriptionBody' is not null or undefined + if (subscriptionBody === null || subscriptionBody === undefined) { + throw new RequiredError("DefaultApi", "createSubscription", "subscriptionBody"); } @@ -411,6 +436,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ @@ -418,14 +446,14 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(createSubscriptionRequestBody, "CreateSubscriptionRequestBody", ""), + ObjectSerializer.serialize(subscriptionBody, "SubscriptionBody", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -466,6 +494,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ @@ -480,7 +511,7 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -538,60 +569,13 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["app_key"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app. - * Delete a user record - * @param appId The OneSignal App ID for your app. Available in Keys & IDs. - * @param playerId The OneSignal player_id - */ - public async deletePlayer(appId: string, playerId: string, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'appId' is not null or undefined - if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "deletePlayer", "appId"); - } - - - // verify required parameter 'playerId' is not null or undefined - if (playerId === null || playerId === undefined) { - throw new RequiredError("DefaultApi", "deletePlayer", "playerId"); - } - - - // Path Params - const localVarPath = '/players/{player_id}' - .replace('{' + 'player_id' + '}', encodeURIComponent(String(playerId))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (appId !== undefined) { - requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", "")); - } + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -605,23 +589,23 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * Delete segments (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard. - * Delete Segments + * Delete a segment (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard. + * Delete Segment * @param appId The OneSignal App ID for your app. Available in Keys & IDs. * @param segmentId The segment_id can be found in the URL of the segment when viewing it in the dashboard. */ - public async deleteSegments(appId: string, segmentId: string, _options?: Configuration): Promise { + public async deleteSegment(appId: string, segmentId: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'appId' is not null or undefined if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "deleteSegments", "appId"); + throw new RequiredError("DefaultApi", "deleteSegment", "appId"); } // verify required parameter 'segmentId' is not null or undefined if (segmentId === null || segmentId === undefined) { - throw new RequiredError("DefaultApi", "deleteSegments", "segmentId"); + throw new RequiredError("DefaultApi", "deleteSegment", "segmentId"); } @@ -634,10 +618,13 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -679,10 +666,13 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -732,61 +722,10 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Stops a Live Activity - * Stop Live Activity - * @param appId The OneSignal App ID for your app. Available in Keys & IDs. - * @param activityId Live Activity record ID - * @param subscriptionId Subscription ID - */ - public async endLiveActivity(appId: string, activityId: string, subscriptionId: string, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'appId' is not null or undefined - if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "endLiveActivity", "appId"); - } - - - // verify required parameter 'activityId' is not null or undefined - if (activityId === null || activityId === undefined) { - throw new RequiredError("DefaultApi", "endLiveActivity", "activityId"); - } - - - // verify required parameter 'subscriptionId' is not null or undefined - if (subscriptionId === null || subscriptionId === undefined) { - throw new RequiredError("DefaultApi", "endLiveActivity", "subscriptionId"); - } - - - // Path Params - const localVarPath = '/apps/{app_id}/live_activities/{activity_id}/token/{subscription_id}' - .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) - .replace('{' + 'activity_id' + '}', encodeURIComponent(String(activityId))) - .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["app_key"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { @@ -825,6 +764,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Query Params if (appId !== undefined) { requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", "")); @@ -833,7 +775,7 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -848,16 +790,16 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { /** * 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. 🚧 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. 🚧 Requires Authentication Key Requires your OneSignal App\'s REST API Key, available in Keys & IDs. 🚧 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. | - * Export CSV of Players + * Export CSV of Subscriptions * @param appId The app ID that you want to export devices from - * @param exportPlayersRequestBody + * @param exportSubscriptionsRequestBody */ - public async exportPlayers(appId: string, exportPlayersRequestBody?: ExportPlayersRequestBody, _options?: Configuration): Promise { + public async exportSubscriptions(appId: string, exportSubscriptionsRequestBody?: ExportSubscriptionsRequestBody, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'appId' is not null or undefined if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "exportPlayers", "appId"); + throw new RequiredError("DefaultApi", "exportSubscriptions", "appId"); } @@ -870,6 +812,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ @@ -877,14 +822,14 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(exportPlayersRequestBody, "ExportPlayersRequestBody", ""), + ObjectSerializer.serialize(exportSubscriptionsRequestBody, "ExportSubscriptionsRequestBody", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -898,38 +843,49 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * Lists all Aliases for the User identified by :subscription_id. + * Lists all Aliases for the User identified by (:alias_label, :alias_id). * @param appId - * @param subscriptionId + * @param aliasLabel + * @param aliasId */ - public async fetchAliases(appId: string, subscriptionId: string, _options?: Configuration): Promise { + public async getAliases(appId: string, aliasLabel: string, aliasId: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'appId' is not null or undefined if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "fetchAliases", "appId"); + throw new RequiredError("DefaultApi", "getAliases", "appId"); } - // verify required parameter 'subscriptionId' is not null or undefined - if (subscriptionId === null || subscriptionId === undefined) { - throw new RequiredError("DefaultApi", "fetchAliases", "subscriptionId"); + // verify required parameter 'aliasLabel' is not null or undefined + if (aliasLabel === null || aliasLabel === undefined) { + throw new RequiredError("DefaultApi", "getAliases", "aliasLabel"); + } + + + // verify required parameter 'aliasId' is not null or undefined + if (aliasId === null || aliasId === undefined) { + throw new RequiredError("DefaultApi", "getAliases", "aliasId"); } // Path Params - const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/user/identity' + const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) - .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId))); + .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel))) + .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId))); // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -943,99 +899,41 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * Returns the User’s properties, Aliases, and Subscriptions. + * Lists all Aliases for the User identified by :subscription_id. * @param appId - * @param aliasLabel - * @param aliasId + * @param subscriptionId */ - public async fetchUser(appId: string, aliasLabel: string, aliasId: string, _options?: Configuration): Promise { + public async getAliasesBySubscription(appId: string, subscriptionId: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'appId' is not null or undefined if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "fetchUser", "appId"); + throw new RequiredError("DefaultApi", "getAliasesBySubscription", "appId"); } - // verify required parameter 'aliasLabel' is not null or undefined - if (aliasLabel === null || aliasLabel === undefined) { - throw new RequiredError("DefaultApi", "fetchUser", "aliasLabel"); - } - - - // verify required parameter 'aliasId' is not null or undefined - if (aliasId === null || aliasId === undefined) { - throw new RequiredError("DefaultApi", "fetchUser", "aliasId"); + // verify required parameter 'subscriptionId' is not null or undefined + if (subscriptionId === null || subscriptionId === undefined) { + throw new RequiredError("DefaultApi", "getAliasesBySubscription", "subscriptionId"); } // Path Params - const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}' + const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/user/identity' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) - .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel))) - .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId))); + .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId))); // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["app_key"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Lists all Aliases for the User identified by (:alias_label, :alias_id). - * @param appId - * @param aliasLabel - * @param aliasId - */ - public async fetchUserIdentity(appId: string, aliasLabel: string, aliasId: string, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'appId' is not null or undefined - if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "fetchUserIdentity", "appId"); - } - - - // verify required parameter 'aliasLabel' is not null or undefined - if (aliasLabel === null || aliasLabel === undefined) { - throw new RequiredError("DefaultApi", "fetchUserIdentity", "aliasLabel"); - } - - - // verify required parameter 'aliasId' is not null or undefined - if (aliasId === null || aliasId === undefined) { - throw new RequiredError("DefaultApi", "fetchUserIdentity", "aliasId"); - } - - - // Path Params - const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity' - .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) - .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel))) - .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -1070,10 +968,13 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["user_key"] + authMethod = _config.authMethods["user_auth_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -1100,55 +1001,13 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["user_key"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Manifest of In-App Messages the Subscription is eligible to display by the SDK. - * @param appId - * @param subscriptionId - */ - public async getEligibleIams(appId: string, subscriptionId: string, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'appId' is not null or undefined - if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "getEligibleIams", "appId"); - } - - - // verify required parameter 'subscriptionId' is not null or undefined - if (subscriptionId === null || subscriptionId === undefined) { - throw new RequiredError("DefaultApi", "getEligibleIams", "subscriptionId"); - } - - - // Path Params - const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/iams' - .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) - .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["user_auth_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -1190,6 +1049,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Query Params if (appId !== undefined) { requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", "")); @@ -1198,7 +1060,7 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -1215,9 +1077,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { * -> View the devices sent a message - OneSignal Paid Plan Required This method will return all devices that were sent the given notification_id of an Email or Push Notification if used within 7 days of the date sent. After 7 days of the sending date, the message history data will be unavailable. After a successful response is received, the destination url may be polled until the file becomes available. Most exports are done in ~1-3 minutes, so setting a poll interval of 10 seconds should be adequate. For use cases that are not meant to be consumed by a script, an email will be sent to the supplied email address. 🚧 Requirements A OneSignal Paid Plan. Turn on Send History via OneSignal API in Settings -> Analytics. Cannot get data before this was turned on. Must be called within 7 days after sending the message. Messages targeting under 1000 recipients will not have \"sent\" events recorded, but will show \"clicked\" events. Requires your OneSignal App\'s REST API Key, available in Keys & IDs. * Notification History * @param notificationId The \"id\" of the message found in the Notification object - * @param getNotificationRequestBody + * @param getNotificationHistoryRequestBody */ - public async getNotificationHistory(notificationId: string, getNotificationRequestBody: GetNotificationRequestBody, _options?: Configuration): Promise { + public async getNotificationHistory(notificationId: string, getNotificationHistoryRequestBody: GetNotificationHistoryRequestBody, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'notificationId' is not null or undefined @@ -1226,9 +1088,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } - // verify required parameter 'getNotificationRequestBody' is not null or undefined - if (getNotificationRequestBody === null || getNotificationRequestBody === undefined) { - throw new RequiredError("DefaultApi", "getNotificationHistory", "getNotificationRequestBody"); + // verify required parameter 'getNotificationHistoryRequestBody' is not null or undefined + if (getNotificationHistoryRequestBody === null || getNotificationHistoryRequestBody === undefined) { + throw new RequiredError("DefaultApi", "getNotificationHistory", "getNotificationHistoryRequestBody"); } @@ -1240,6 +1102,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ @@ -1247,14 +1112,14 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(getNotificationRequestBody, "GetNotificationRequestBody", ""), + ObjectSerializer.serialize(getNotificationHistoryRequestBody, "GetNotificationHistoryRequestBody", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -1294,6 +1159,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Query Params if (appId !== undefined) { requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", "")); @@ -1317,7 +1185,7 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -1367,6 +1235,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Query Params if (outcomeNames !== undefined) { requestContext.setQueryParam("outcome_names", ObjectSerializer.serialize(outcomeNames, "string", "")); @@ -1395,7 +1266,7 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -1409,90 +1280,37 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * View the details of an existing device in one of your OneSignal apps - * View device - * @param appId Your app_id for this device - * @param playerId Player\'s OneSignal ID - * @param emailAuthHash Email - Only required if you have enabled Identity Verification and device_type is email (11). + * Returns an array of segments from an app. + * Get Segments + * @param appId The OneSignal App ID for your app. Available in Keys & IDs. + * @param offset Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments. + * @param limit The amount of Segments in the response. Maximum 300. */ - public async getPlayer(appId: string, playerId: string, emailAuthHash?: string, _options?: Configuration): Promise { + public async getSegments(appId: string, offset?: number, limit?: number, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'appId' is not null or undefined if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "getPlayer", "appId"); + throw new RequiredError("DefaultApi", "getSegments", "appId"); } - // verify required parameter 'playerId' is not null or undefined - if (playerId === null || playerId === undefined) { - throw new RequiredError("DefaultApi", "getPlayer", "playerId"); - } - // Path Params - const localVarPath = '/players/{player_id}' - .replace('{' + 'player_id' + '}', encodeURIComponent(String(playerId))); + const localVarPath = '/apps/{app_id}/segments' + .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))); // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - // Query Params - if (appId !== undefined) { - requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", "")); - } + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); // Query Params - if (emailAuthHash !== undefined) { - requestContext.setQueryParam("email_auth_hash", ObjectSerializer.serialize(emailAuthHash, "string", "")); - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["app_key"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * View the details of multiple devices in one of your OneSignal apps Unavailable for Apps Over 80,000 Users For performance reasons, this method is not available for larger apps. Larger apps should use the CSV export API endpoint, which is much more performant. - * View devices - * @param appId The app ID that you want to view players from - * @param limit How many devices to return. Max is 300. Default is 300 - * @param offset Result offset. Default is 0. Results are sorted by id; - */ - public async getPlayers(appId: string, limit?: number, offset?: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'appId' is not null or undefined - if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "getPlayers", "appId"); - } - - - - - // Path Params - const localVarPath = '/players'; - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (appId !== undefined) { - requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", "")); + if (offset !== undefined) { + requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", "")); } // Query Params @@ -1500,15 +1318,10 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "")); } - // Query Params - if (offset !== undefined) { - requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", "")); - } - let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -1522,64 +1335,49 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * Upserts one or more Aliases to an existing User identified by (:alias_label, :alias_id). + * Returns the User’s properties, Aliases, and Subscriptions. * @param appId * @param aliasLabel * @param aliasId - * @param userIdentityRequestBody */ - public async identifyUserByAlias(appId: string, aliasLabel: string, aliasId: string, userIdentityRequestBody: UserIdentityRequestBody, _options?: Configuration): Promise { + public async getUser(appId: string, aliasLabel: string, aliasId: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'appId' is not null or undefined if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "identifyUserByAlias", "appId"); + throw new RequiredError("DefaultApi", "getUser", "appId"); } // verify required parameter 'aliasLabel' is not null or undefined if (aliasLabel === null || aliasLabel === undefined) { - throw new RequiredError("DefaultApi", "identifyUserByAlias", "aliasLabel"); + throw new RequiredError("DefaultApi", "getUser", "aliasLabel"); } // verify required parameter 'aliasId' is not null or undefined if (aliasId === null || aliasId === undefined) { - throw new RequiredError("DefaultApi", "identifyUserByAlias", "aliasId"); - } - - - // verify required parameter 'userIdentityRequestBody' is not null or undefined - if (userIdentityRequestBody === null || userIdentityRequestBody === undefined) { - throw new RequiredError("DefaultApi", "identifyUserByAlias", "userIdentityRequestBody"); + throw new RequiredError("DefaultApi", "getUser", "aliasId"); } // Path Params - const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity' + const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel))) .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId))); // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH); + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); - // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([ - "application/json" - ]); - requestContext.setHeaderParam("Content-Type", contentType); - const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(userIdentityRequestBody, "UserIdentityRequestBody", ""), - contentType - ); - requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -1593,34 +1391,34 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * Upserts one or more Aliases for the User identified by :subscription_id. + * Transfers this Subscription to the User identified by the identity in the payload. * @param appId * @param subscriptionId - * @param userIdentityRequestBody + * @param transferSubscriptionRequestBody */ - public async identifyUserBySubscriptionId(appId: string, subscriptionId: string, userIdentityRequestBody: UserIdentityRequestBody, _options?: Configuration): Promise { + public async transferSubscription(appId: string, subscriptionId: string, transferSubscriptionRequestBody: TransferSubscriptionRequestBody, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'appId' is not null or undefined if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "identifyUserBySubscriptionId", "appId"); + throw new RequiredError("DefaultApi", "transferSubscription", "appId"); } // verify required parameter 'subscriptionId' is not null or undefined if (subscriptionId === null || subscriptionId === undefined) { - throw new RequiredError("DefaultApi", "identifyUserBySubscriptionId", "subscriptionId"); + throw new RequiredError("DefaultApi", "transferSubscription", "subscriptionId"); } - // verify required parameter 'userIdentityRequestBody' is not null or undefined - if (userIdentityRequestBody === null || userIdentityRequestBody === undefined) { - throw new RequiredError("DefaultApi", "identifyUserBySubscriptionId", "userIdentityRequestBody"); + // verify required parameter 'transferSubscriptionRequestBody' is not null or undefined + if (transferSubscriptionRequestBody === null || transferSubscriptionRequestBody === undefined) { + throw new RequiredError("DefaultApi", "transferSubscription", "transferSubscriptionRequestBody"); } // Path Params - const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/user/identity' + const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/owner' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId))); @@ -1628,6 +1426,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ @@ -1635,14 +1436,14 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(userIdentityRequestBody, "UserIdentityRequestBody", ""), + ObjectSerializer.serialize(transferSubscriptionRequestBody, "TransferSubscriptionRequestBody", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -1656,56 +1457,54 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * Transfers this Subscription to the User identified by the identity in the payload. - * @param appId - * @param subscriptionId - * @param transferSubscriptionRequestBody + * Unsubscribe an email with a token when using your own custom email unsubscribe landing page + * Unsubscribe with token + * @param appId The OneSignal App ID for your app. Available in Keys & IDs. + * @param notificationId The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report. + * @param token The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email. */ - public async transferSubscription(appId: string, subscriptionId: string, transferSubscriptionRequestBody: TransferSubscriptionRequestBody, _options?: Configuration): Promise { + public async unsubscribeEmailWithToken(appId: string, notificationId: string, token: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'appId' is not null or undefined if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "transferSubscription", "appId"); + throw new RequiredError("DefaultApi", "unsubscribeEmailWithToken", "appId"); } - // verify required parameter 'subscriptionId' is not null or undefined - if (subscriptionId === null || subscriptionId === undefined) { - throw new RequiredError("DefaultApi", "transferSubscription", "subscriptionId"); + // verify required parameter 'notificationId' is not null or undefined + if (notificationId === null || notificationId === undefined) { + throw new RequiredError("DefaultApi", "unsubscribeEmailWithToken", "notificationId"); } - // verify required parameter 'transferSubscriptionRequestBody' is not null or undefined - if (transferSubscriptionRequestBody === null || transferSubscriptionRequestBody === undefined) { - throw new RequiredError("DefaultApi", "transferSubscription", "transferSubscriptionRequestBody"); + // verify required parameter 'token' is not null or undefined + if (token === null || token === undefined) { + throw new RequiredError("DefaultApi", "unsubscribeEmailWithToken", "token"); } // Path Params - const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/owner' + const localVarPath = '/apps/{app_id}/notifications/{notification_id}/unsubscribe' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) - .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId))); + .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId))); // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH); + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + + // Query Params + if (token !== undefined) { + requestContext.setQueryParam("token", ObjectSerializer.serialize(token, "string", "")); + } - // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([ - "application/json" - ]); - requestContext.setHeaderParam("Content-Type", contentType); - const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(transferSubscriptionRequestBody, "TransferSubscriptionRequestBody", ""), - contentType - ); - requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -1747,6 +1546,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ @@ -1761,7 +1563,7 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["user_key"] + authMethod = _config.authMethods["user_auth_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -1811,120 +1613,8 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([ - "application/json" - ]); - requestContext.setHeaderParam("Content-Type", contentType); - const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(updateLiveActivityRequest, "UpdateLiveActivityRequest", ""), - contentType - ); - requestContext.setBody(serializedBody); - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["app_key"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Update an existing device in one of your OneSignal apps - * Edit device - * @param playerId Player\'s OneSignal ID - * @param player - */ - public async updatePlayer(playerId: string, player: Player, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'playerId' is not null or undefined - if (playerId === null || playerId === undefined) { - throw new RequiredError("DefaultApi", "updatePlayer", "playerId"); - } - - - // verify required parameter 'player' is not null or undefined - if (player === null || player === undefined) { - throw new RequiredError("DefaultApi", "updatePlayer", "player"); - } - - - // Path Params - const localVarPath = '/players/{player_id}' - .replace('{' + 'player_id' + '}', encodeURIComponent(String(playerId))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - - // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([ - "application/json" - ]); - requestContext.setHeaderParam("Content-Type", contentType); - const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(player, "Player", ""), - contentType - ); - requestContext.setBody(serializedBody); - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["app_key"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Update an existing device\'s tags in one of your OneSignal apps using the External User ID. Warning - Android SDK Data Synchronization Tags added through the Android SDK tagging methods may not update if using the API to change or update the same tag. For example, if you use SDK method sendTag(\"key\", \"value1\") then update the tag value to \"value2\" with this API endpoint. You will not be able to set the value back to \"value1\" through the SDK, you will need to change it to something different through the SDK to be reset. Recommendations if using this Endpoint on Android Mobile Apps: 1 - Do not use the same tag keys for SDK and API updates 2 - If you want to use the same key for both SDK and API updates, call the SDK getTags method first to update the device\'s tags. This is only applicable on the Android Mobile App SDKs. 📘 Deleting Tags To delete a tag, include its key and set its value to blank. Omitting a key/value will not delete it. For example, if I wanted to delete two existing tags rank and category while simultaneously adding a new tag class, the tags JSON would look like the following: \"tags\": { \"rank\": \"\", \"category\": \"\", \"class\": \"my_new_value\" } - * Edit tags with external user id - * @param appId The OneSignal App ID the user record is found under. - * @param externalUserId The External User ID mapped to teh device record in OneSignal. Must be actively set on the device to be updated. - * @param updatePlayerTagsRequestBody - */ - public async updatePlayerTags(appId: string, externalUserId: string, updatePlayerTagsRequestBody?: UpdatePlayerTagsRequestBody, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'appId' is not null or undefined - if (appId === null || appId === undefined) { - throw new RequiredError("DefaultApi", "updatePlayerTags", "appId"); - } - - - // verify required parameter 'externalUserId' is not null or undefined - if (externalUserId === null || externalUserId === undefined) { - throw new RequiredError("DefaultApi", "updatePlayerTags", "externalUserId"); - } - - - - // Path Params - const localVarPath = '/apps/{app_id}/users/{external_user_id}' - .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) - .replace('{' + 'external_user_id' + '}', encodeURIComponent(String(externalUserId))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); // Body Params @@ -1933,14 +1623,14 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(updatePlayerTagsRequestBody, "UpdatePlayerTagsRequestBody", ""), + ObjectSerializer.serialize(updateLiveActivityRequest, "UpdateLiveActivityRequest", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -1957,9 +1647,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { * Updates an existing Subscription’s properties. * @param appId * @param subscriptionId - * @param updateSubscriptionRequestBody + * @param subscriptionBody */ - public async updateSubscription(appId: string, subscriptionId: string, updateSubscriptionRequestBody: UpdateSubscriptionRequestBody, _options?: Configuration): Promise { + public async updateSubscription(appId: string, subscriptionId: string, subscriptionBody: SubscriptionBody, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'appId' is not null or undefined @@ -1974,9 +1664,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } - // verify required parameter 'updateSubscriptionRequestBody' is not null or undefined - if (updateSubscriptionRequestBody === null || updateSubscriptionRequestBody === undefined) { - throw new RequiredError("DefaultApi", "updateSubscription", "updateSubscriptionRequestBody"); + // verify required parameter 'subscriptionBody' is not null or undefined + if (subscriptionBody === null || subscriptionBody === undefined) { + throw new RequiredError("DefaultApi", "updateSubscription", "subscriptionBody"); } @@ -1989,6 +1679,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ @@ -1996,14 +1689,14 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(updateSubscriptionRequestBody, "UpdateSubscriptionRequestBody", ""), + ObjectSerializer.serialize(subscriptionBody, "SubscriptionBody", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -2060,6 +1753,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Always add the One Signal telemetry to the request. + requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.0.0-alpha-01"); + // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ @@ -2074,7 +1770,7 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { let authMethod: SecurityAuthentication | undefined; // Apply auth methods - authMethod = _config.authMethods["app_key"] + authMethod = _config.authMethods["rest_api_key"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } @@ -2095,13 +1791,17 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to beginLiveActivity + * @params response Response returned by the server for a request to cancelNotification * @throws ApiException if the response code was not in [200, 299] */ - public async beginLiveActivity(response: ResponseContext): Promise { + public async cancelNotification(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("204", response.httpStatusCode)) { - return; + if (isCodeInRange("200", response.httpStatusCode)) { + const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GenericSuccessBoolResponse", "" + ) as GenericSuccessBoolResponse; + return body; } if (isCodeInRange("400", response.httpStatusCode)) { const body: GenericError = ObjectSerializer.deserialize( @@ -2110,20 +1810,27 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: GenericError = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GenericError", "" + ) as GenericError; + throw new ApiException(404, "Not Found", body, response.headers); + } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: void = ObjectSerializer.deserialize( + const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "void", "" - ) as void; + "GenericSuccessBoolResponse", "" + ) as GenericSuccessBoolResponse; return body; } @@ -2134,16 +1841,16 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to cancelNotification + * @params response Response returned by the server for a request to createAlias * @throws ApiException if the response code was not in [200, 299] */ - public async cancelNotification(response: ResponseContext): Promise { + public async createAlias(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: CancelNotificationSuccessResponse = ObjectSerializer.deserialize( + const body: UserIdentityBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "CancelNotificationSuccessResponse", "" - ) as CancelNotificationSuccessResponse; + "UserIdentityBody", "" + ) as UserIdentityBody; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -2153,20 +1860,34 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: GenericError = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GenericError", "" + ) as GenericError; + throw new ApiException(404, "Not Found", body, response.headers); + } + if (isCodeInRange("409", response.httpStatusCode)) { + const body: GenericError = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GenericError", "" + ) as GenericError; + throw new ApiException(409, "Conflict", body, response.headers); + } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: CancelNotificationSuccessResponse = ObjectSerializer.deserialize( + const body: UserIdentityBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "CancelNotificationSuccessResponse", "" - ) as CancelNotificationSuccessResponse; + "UserIdentityBody", "" + ) as UserIdentityBody; return body; } @@ -2177,16 +1898,16 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to createApp + * @params response Response returned by the server for a request to createAliasBySubscription * @throws ApiException if the response code was not in [200, 299] */ - public async createApp(response: ResponseContext): Promise { + public async createAliasBySubscription(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: App = ObjectSerializer.deserialize( + const body: UserIdentityBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "App", "" - ) as App; + "UserIdentityBody", "" + ) as UserIdentityBody; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -2196,20 +1917,34 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: GenericError = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GenericError", "" + ) as GenericError; + throw new ApiException(404, "Not Found", body, response.headers); + } + if (isCodeInRange("409", response.httpStatusCode)) { + const body: GenericError = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GenericError", "" + ) as GenericError; + throw new ApiException(409, "Conflict", body, response.headers); + } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: App = ObjectSerializer.deserialize( + const body: UserIdentityBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "App", "" - ) as App; + "UserIdentityBody", "" + ) as UserIdentityBody; return body; } @@ -2220,16 +1955,16 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to createNotification + * @params response Response returned by the server for a request to createApp * @throws ApiException if the response code was not in [200, 299] */ - public async createNotification(response: ResponseContext): Promise { + public async createApp(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: CreateNotificationSuccessResponse = ObjectSerializer.deserialize( + const body: App = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "CreateNotificationSuccessResponse", "" - ) as CreateNotificationSuccessResponse; + "App", "" + ) as App; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -2240,19 +1975,19 @@ export class DefaultApiResponseProcessor { throw new ApiException(400, "Bad Request", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: CreateNotificationSuccessResponse = ObjectSerializer.deserialize( + const body: App = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "CreateNotificationSuccessResponse", "" - ) as CreateNotificationSuccessResponse; + "App", "" + ) as App; return body; } @@ -2263,16 +1998,16 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to createPlayer + * @params response Response returned by the server for a request to createNotification * @throws ApiException if the response code was not in [200, 299] */ - public async createPlayer(response: ResponseContext): Promise { + public async createNotification(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: CreatePlayerSuccessResponse = ObjectSerializer.deserialize( + const body: CreateNotificationSuccessResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "CreatePlayerSuccessResponse", "" - ) as CreatePlayerSuccessResponse; + "CreateNotificationSuccessResponse", "" + ) as CreateNotificationSuccessResponse; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -2282,27 +2017,20 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } - if (isCodeInRange("409", response.httpStatusCode)) { - const body: GenericError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "GenericError", "" - ) as GenericError; - throw new ApiException(409, "Conflict", body, response.headers); - } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: CreatePlayerSuccessResponse = ObjectSerializer.deserialize( + const body: CreateNotificationSuccessResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "CreatePlayerSuccessResponse", "" - ) as CreatePlayerSuccessResponse; + "CreateNotificationSuccessResponse", "" + ) as CreateNotificationSuccessResponse; return body; } @@ -2313,10 +2041,10 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to createSegments + * @params response Response returned by the server for a request to createSegment * @throws ApiException if the response code was not in [200, 299] */ - public async createSegments(response: ResponseContext): Promise { + public async createSegment(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("201", response.httpStatusCode)) { const body: CreateSegmentSuccessResponse = ObjectSerializer.deserialize( @@ -2340,11 +2068,11 @@ export class DefaultApiResponseProcessor { throw new ApiException(409, "Conflict", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -2366,20 +2094,20 @@ export class DefaultApiResponseProcessor { * @params response Response returned by the server for a request to createSubscription * @throws ApiException if the response code was not in [200, 299] */ - public async createSubscription(response: ResponseContext): Promise { + public async createSubscription(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("201", response.httpStatusCode)) { - const body: InlineResponse201 = ObjectSerializer.deserialize( + const body: SubscriptionBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "InlineResponse201", "" - ) as InlineResponse201; + "SubscriptionBody", "" + ) as SubscriptionBody; return body; } if (isCodeInRange("202", response.httpStatusCode)) { - const body: InlineResponse201 = ObjectSerializer.deserialize( + const body: SubscriptionBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "InlineResponse201", "" - ) as InlineResponse201; + "SubscriptionBody", "" + ) as SubscriptionBody; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -2389,6 +2117,13 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: GenericError = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GenericError", "" + ) as GenericError; + throw new ApiException(404, "Not Found", body, response.headers); + } if (isCodeInRange("409", response.httpStatusCode)) { const body: GenericError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), @@ -2397,19 +2132,19 @@ export class DefaultApiResponseProcessor { throw new ApiException(409, "Operation is not permitted due to user having the maximum number of subscriptions assigned", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: InlineResponse201 = ObjectSerializer.deserialize( + const body: SubscriptionBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "InlineResponse201", "" - ) as InlineResponse201; + "SubscriptionBody", "" + ) as SubscriptionBody; return body; } @@ -2461,11 +2196,11 @@ export class DefaultApiResponseProcessor { throw new ApiException(409, "Multiple User Identity Conflict", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -2487,13 +2222,13 @@ export class DefaultApiResponseProcessor { * @params response Response returned by the server for a request to deleteAlias * @throws ApiException if the response code was not in [200, 299] */ - public async deleteAlias(response: ResponseContext): Promise { + public async deleteAlias(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: InlineResponse200 = ObjectSerializer.deserialize( + const body: UserIdentityBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "InlineResponse200", "" - ) as InlineResponse200; + "UserIdentityBody", "" + ) as UserIdentityBody; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -2503,77 +2238,34 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } - if (isCodeInRange("409", response.httpStatusCode)) { + if (isCodeInRange("404", response.httpStatusCode)) { const body: GenericError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "GenericError", "" ) as GenericError; - throw new ApiException(409, "Conflict", body, response.headers); - } - if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: InlineResponse200 = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "InlineResponse200", "" - ) as InlineResponse200; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to deletePlayer - * @throws ApiException if the response code was not in [200, 299] - */ - public async deletePlayer(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: DeletePlayerSuccessResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "DeletePlayerSuccessResponse", "" - ) as DeletePlayerSuccessResponse; - return body; + throw new ApiException(404, "Not Found", body, response.headers); } - if (isCodeInRange("400", response.httpStatusCode)) { + if (isCodeInRange("409", response.httpStatusCode)) { const body: GenericError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "GenericError", "" ) as GenericError; - throw new ApiException(400, "Bad Request", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: DeletePlayerNotFoundResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "DeletePlayerNotFoundResponse", "" - ) as DeletePlayerNotFoundResponse; - throw new ApiException(404, "Not Found", body, response.headers); + throw new ApiException(409, "Conflict", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: DeletePlayerSuccessResponse = ObjectSerializer.deserialize( + const body: UserIdentityBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "DeletePlayerSuccessResponse", "" - ) as DeletePlayerSuccessResponse; + "UserIdentityBody", "" + ) as UserIdentityBody; return body; } @@ -2584,63 +2276,17 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to deleteSegments + * @params response Response returned by the server for a request to deleteSegment * @throws ApiException if the response code was not in [200, 299] */ - public async deleteSegments(response: ResponseContext): Promise { + public async deleteSegment(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: DeleteSegmentSuccessResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "DeleteSegmentSuccessResponse", "" - ) as DeleteSegmentSuccessResponse; - return body; - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: GenericError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "GenericError", "" - ) as GenericError; - throw new ApiException(400, "Bad Request", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: DeleteSegmentNotFoundResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "DeleteSegmentNotFoundResponse", "" - ) as DeleteSegmentNotFoundResponse; - throw new ApiException(404, "Not Found", body, response.headers); - } - if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: DeleteSegmentSuccessResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "DeleteSegmentSuccessResponse", "" - ) as DeleteSegmentSuccessResponse; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to deleteSubscription - * @throws ApiException if the response code was not in [200, 299] - */ - public async deleteSubscription(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("202", response.httpStatusCode)) { - return; + const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GenericSuccessBoolResponse", "" + ) as GenericSuccessBoolResponse; + return body; } if (isCodeInRange("400", response.httpStatusCode)) { const body: GenericError = ObjectSerializer.deserialize( @@ -2649,27 +2295,27 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } - if (isCodeInRange("409", response.httpStatusCode)) { - const body: GenericError = ObjectSerializer.deserialize( + if (isCodeInRange("404", response.httpStatusCode)) { + const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "GenericError", "" - ) as GenericError; - throw new ApiException(409, "Conflict", body, response.headers); + "GenericSuccessBoolResponse", "" + ) as GenericSuccessBoolResponse; + throw new ApiException(404, "Not Found", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: void = ObjectSerializer.deserialize( + const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "void", "" - ) as void; + "GenericSuccessBoolResponse", "" + ) as GenericSuccessBoolResponse; return body; } @@ -2680,12 +2326,12 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to deleteUser + * @params response Response returned by the server for a request to deleteSubscription * @throws ApiException if the response code was not in [200, 299] */ - public async deleteUser(response: ResponseContext): Promise { + public async deleteSubscription(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { + if (isCodeInRange("202", response.httpStatusCode)) { return; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -2695,6 +2341,13 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: GenericError = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GenericError", "" + ) as GenericError; + throw new ApiException(404, "Not Found", body, response.headers); + } if (isCodeInRange("409", response.httpStatusCode)) { const body: GenericError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), @@ -2703,11 +2356,11 @@ export class DefaultApiResponseProcessor { throw new ApiException(409, "Conflict", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -2726,12 +2379,12 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to endLiveActivity + * @params response Response returned by the server for a request to deleteUser * @throws ApiException if the response code was not in [200, 299] */ - public async endLiveActivity(response: ResponseContext): Promise { + public async deleteUser(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("204", response.httpStatusCode)) { + if (isCodeInRange("200", response.httpStatusCode)) { return; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -2741,12 +2394,19 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } + if (isCodeInRange("409", response.httpStatusCode)) { + const body: GenericError = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GenericError", "" + ) as GenericError; + throw new ApiException(409, "Conflict", body, response.headers); + } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -2792,11 +2452,11 @@ export class DefaultApiResponseProcessor { throw new ApiException(404, "Not Found", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -2815,16 +2475,16 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to exportPlayers + * @params response Response returned by the server for a request to exportSubscriptions * @throws ApiException if the response code was not in [200, 299] */ - public async exportPlayers(response: ResponseContext): Promise { + public async exportSubscriptions(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: ExportPlayersSuccessResponse = ObjectSerializer.deserialize( + const body: ExportSubscriptionsSuccessResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "ExportPlayersSuccessResponse", "" - ) as ExportPlayersSuccessResponse; + "ExportSubscriptionsSuccessResponse", "" + ) as ExportSubscriptionsSuccessResponse; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -2835,19 +2495,19 @@ export class DefaultApiResponseProcessor { throw new ApiException(400, "Bad Request", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: ExportPlayersSuccessResponse = ObjectSerializer.deserialize( + const body: ExportSubscriptionsSuccessResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "ExportPlayersSuccessResponse", "" - ) as ExportPlayersSuccessResponse; + "ExportSubscriptionsSuccessResponse", "" + ) as ExportSubscriptionsSuccessResponse; return body; } @@ -2858,16 +2518,16 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to fetchAliases + * @params response Response returned by the server for a request to getAliases * @throws ApiException if the response code was not in [200, 299] */ - public async fetchAliases(response: ResponseContext): Promise { + public async getAliases(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: UserIdentityResponse = ObjectSerializer.deserialize( + const body: UserIdentityBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "UserIdentityResponse", "" - ) as UserIdentityResponse; + "UserIdentityBody", "" + ) as UserIdentityBody; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -2877,56 +2537,27 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: UserIdentityResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "UserIdentityResponse", "" - ) as UserIdentityResponse; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to fetchUser - * @throws ApiException if the response code was not in [200, 299] - */ - public async fetchUser(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: User = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "User", "" - ) as User; - return body; - } - if (isCodeInRange("400", response.httpStatusCode)) { + if (isCodeInRange("404", response.httpStatusCode)) { const body: GenericError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "GenericError", "" ) as GenericError; - throw new ApiException(400, "Bad Request", body, response.headers); + throw new ApiException(404, "Not Found", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: User = ObjectSerializer.deserialize( + const body: UserIdentityBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "User", "" - ) as User; + "UserIdentityBody", "" + ) as UserIdentityBody; return body; } @@ -2937,16 +2568,16 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to fetchUserIdentity + * @params response Response returned by the server for a request to getAliasesBySubscription * @throws ApiException if the response code was not in [200, 299] */ - public async fetchUserIdentity(response: ResponseContext): Promise { + public async getAliasesBySubscription(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: InlineResponse200 = ObjectSerializer.deserialize( + const body: UserIdentityBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "InlineResponse200", "" - ) as InlineResponse200; + "UserIdentityBody", "" + ) as UserIdentityBody; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -2956,20 +2587,20 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } - if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + if (isCodeInRange("404", response.httpStatusCode)) { + const body: GenericError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "GenericError", "" + ) as GenericError; + throw new ApiException(404, "Not Found", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: InlineResponse200 = ObjectSerializer.deserialize( + const body: UserIdentityBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "InlineResponse200", "" - ) as InlineResponse200; + "UserIdentityBody", "" + ) as UserIdentityBody; return body; } @@ -3000,11 +2631,11 @@ export class DefaultApiResponseProcessor { throw new ApiException(400, "Bad Request", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -3043,11 +2674,11 @@ export class DefaultApiResponseProcessor { throw new ApiException(400, "Bad Request", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -3062,49 +2693,6 @@ export class DefaultApiResponseProcessor { throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getEligibleIams - * @throws ApiException if the response code was not in [200, 299] - */ - public async getEligibleIams(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: InlineResponse2003 = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "InlineResponse2003", "" - ) as InlineResponse2003; - return body; - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: GenericError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "GenericError", "" - ) as GenericError; - throw new ApiException(400, "Bad Request", body, response.headers); - } - if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: InlineResponse2003 = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "InlineResponse2003", "" - ) as InlineResponse2003; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -3128,12 +2716,19 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: GenericError = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GenericError", "" + ) as GenericError; + throw new ApiException(404, "Not Found", body, response.headers); + } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -3171,12 +2766,19 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: GenericError = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GenericError", "" + ) as GenericError; + throw new ApiException(404, "Not Found", body, response.headers); + } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -3215,11 +2817,11 @@ export class DefaultApiResponseProcessor { throw new ApiException(400, "Bad Request", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -3258,11 +2860,11 @@ export class DefaultApiResponseProcessor { throw new ApiException(400, "Bad Request", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -3281,59 +2883,16 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to getPlayer - * @throws ApiException if the response code was not in [200, 299] - */ - public async getPlayer(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: Player = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "Player", "" - ) as Player; - return body; - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: GenericError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "GenericError", "" - ) as GenericError; - throw new ApiException(400, "Bad Request", body, response.headers); - } - if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: Player = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "Player", "" - ) as Player; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getPlayers + * @params response Response returned by the server for a request to getSegments * @throws ApiException if the response code was not in [200, 299] */ - public async getPlayers(response: ResponseContext): Promise { + public async getSegments(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: PlayerSlice = ObjectSerializer.deserialize( + if (isCodeInRange("201", response.httpStatusCode)) { + const body: GetSegmentsSuccessResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "PlayerSlice", "" - ) as PlayerSlice; + "GetSegmentsSuccessResponse", "" + ) as GetSegmentsSuccessResponse; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -3344,19 +2903,19 @@ export class DefaultApiResponseProcessor { throw new ApiException(400, "Bad Request", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: PlayerSlice = ObjectSerializer.deserialize( + const body: GetSegmentsSuccessResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "PlayerSlice", "" - ) as PlayerSlice; + "GetSegmentsSuccessResponse", "" + ) as GetSegmentsSuccessResponse; return body; } @@ -3367,16 +2926,16 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to identifyUserByAlias + * @params response Response returned by the server for a request to getUser * @throws ApiException if the response code was not in [200, 299] */ - public async identifyUserByAlias(response: ResponseContext): Promise { + public async getUser(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: InlineResponse200 = ObjectSerializer.deserialize( + const body: User = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "InlineResponse200", "" - ) as InlineResponse200; + "User", "" + ) as User; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -3386,27 +2945,27 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } - if (isCodeInRange("409", response.httpStatusCode)) { + if (isCodeInRange("404", response.httpStatusCode)) { const body: GenericError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "GenericError", "" ) as GenericError; - throw new ApiException(409, "Conflict", body, response.headers); + throw new ApiException(404, "Not Found", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: InlineResponse200 = ObjectSerializer.deserialize( + const body: User = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "InlineResponse200", "" - ) as InlineResponse200; + "User", "" + ) as User; return body; } @@ -3417,16 +2976,16 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to identifyUserBySubscriptionId + * @params response Response returned by the server for a request to transferSubscription * @throws ApiException if the response code was not in [200, 299] */ - public async identifyUserBySubscriptionId(response: ResponseContext): Promise { + public async transferSubscription(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: UserIdentityResponse = ObjectSerializer.deserialize( + const body: UserIdentityBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "UserIdentityResponse", "" - ) as UserIdentityResponse; + "UserIdentityBody", "" + ) as UserIdentityBody; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -3436,6 +2995,13 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: GenericError = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GenericError", "" + ) as GenericError; + throw new ApiException(404, "Not Found", body, response.headers); + } if (isCodeInRange("409", response.httpStatusCode)) { const body: GenericError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), @@ -3444,19 +3010,19 @@ export class DefaultApiResponseProcessor { throw new ApiException(409, "Conflict", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: UserIdentityResponse = ObjectSerializer.deserialize( + const body: UserIdentityBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "UserIdentityResponse", "" - ) as UserIdentityResponse; + "UserIdentityBody", "" + ) as UserIdentityBody; return body; } @@ -3467,16 +3033,16 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to transferSubscription + * @params response Response returned by the server for a request to unsubscribeEmailWithToken * @throws ApiException if the response code was not in [200, 299] */ - public async transferSubscription(response: ResponseContext): Promise { + public async unsubscribeEmailWithToken(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: UserIdentityResponse = ObjectSerializer.deserialize( + if (isCodeInRange("202", response.httpStatusCode)) { + const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "UserIdentityResponse", "" - ) as UserIdentityResponse; + "GenericSuccessBoolResponse", "" + ) as GenericSuccessBoolResponse; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -3486,27 +3052,20 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } - if (isCodeInRange("409", response.httpStatusCode)) { - const body: GenericError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "GenericError", "" - ) as GenericError; - throw new ApiException(409, "Conflict", body, response.headers); - } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: UserIdentityResponse = ObjectSerializer.deserialize( + const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "UserIdentityResponse", "" - ) as UserIdentityResponse; + "GenericSuccessBoolResponse", "" + ) as GenericSuccessBoolResponse; return body; } @@ -3537,11 +3096,11 @@ export class DefaultApiResponseProcessor { throw new ApiException(400, "Bad Request", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -3580,11 +3139,11 @@ export class DefaultApiResponseProcessor { throw new ApiException(400, "Bad Request", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -3603,67 +3162,13 @@ export class DefaultApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to updatePlayer - * @throws ApiException if the response code was not in [200, 299] - */ - public async updatePlayer(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: UpdatePlayerSuccessResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "UpdatePlayerSuccessResponse", "" - ) as UpdatePlayerSuccessResponse; - return body; - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: GenericError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "GenericError", "" - ) as GenericError; - throw new ApiException(400, "Bad Request", body, response.headers); - } - if (isCodeInRange("409", response.httpStatusCode)) { - const body: GenericError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "GenericError", "" - ) as GenericError; - throw new ApiException(409, "Conflict", body, response.headers); - } - if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: UpdatePlayerSuccessResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "UpdatePlayerSuccessResponse", "" - ) as UpdatePlayerSuccessResponse; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to updatePlayerTags + * @params response Response returned by the server for a request to updateSubscription * @throws ApiException if the response code was not in [200, 299] */ - public async updatePlayerTags(response: ResponseContext): Promise { + public async updateSubscription(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: UpdatePlayerTagsSuccessResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "UpdatePlayerTagsSuccessResponse", "" - ) as UpdatePlayerTagsSuccessResponse; - return body; + return; } if (isCodeInRange("400", response.httpStatusCode)) { const body: GenericError = ObjectSerializer.deserialize( @@ -3672,51 +3177,12 @@ export class DefaultApiResponseProcessor { ) as GenericError; throw new ApiException(400, "Bad Request", body, response.headers); } - if (isCodeInRange("409", response.httpStatusCode)) { - const body: GenericError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "GenericError", "" - ) as GenericError; - throw new ApiException(409, "Conflict", body, response.headers); - } - if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: UpdatePlayerTagsSuccessResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "UpdatePlayerTagsSuccessResponse", "" - ) as UpdatePlayerTagsSuccessResponse; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to updateSubscription - * @throws ApiException if the response code was not in [200, 299] - */ - public async updateSubscription(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("202", response.httpStatusCode)) { - return; - } - if (isCodeInRange("400", response.httpStatusCode)) { + if (isCodeInRange("404", response.httpStatusCode)) { const body: GenericError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "GenericError", "" ) as GenericError; - throw new ApiException(400, "Bad Request", body, response.headers); + throw new ApiException(404, "Not Found", body, response.headers); } if (isCodeInRange("409", response.httpStatusCode)) { const body: GenericError = ObjectSerializer.deserialize( @@ -3726,11 +3192,11 @@ export class DefaultApiResponseProcessor { throw new ApiException(409, "Conflict", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -3752,13 +3218,13 @@ export class DefaultApiResponseProcessor { * @params response Response returned by the server for a request to updateUser * @throws ApiException if the response code was not in [200, 299] */ - public async updateUser(response: ResponseContext): Promise { + public async updateUser(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("202", response.httpStatusCode)) { - const body: InlineResponse202 = ObjectSerializer.deserialize( + const body: PropertiesBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "InlineResponse202", "" - ) as InlineResponse202; + "PropertiesBody", "" + ) as PropertiesBody; return body; } if (isCodeInRange("400", response.httpStatusCode)) { @@ -3776,19 +3242,19 @@ export class DefaultApiResponseProcessor { throw new ApiException(409, "Conflict", body, response.headers); } if (isCodeInRange("429", response.httpStatusCode)) { - const body: RateLimiterError = ObjectSerializer.deserialize( + const body: RateLimitError = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "RateLimiterError", "" - ) as RateLimiterError; - throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); + "RateLimitError", "" + ) as RateLimitError; + throw new ApiException(429, "Rate Limit Exceeded", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: InlineResponse202 = ObjectSerializer.deserialize( + const body: PropertiesBody = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "InlineResponse202", "" - ) as InlineResponse202; + "PropertiesBody", "" + ) as PropertiesBody; return body; } diff --git a/auth/auth.ts b/auth/auth.ts index 123ac46..e33ebb7 100644 --- a/auth/auth.ts +++ b/auth/auth.ts @@ -27,7 +27,7 @@ export interface TokenProvider { /** * Applies http authentication to the request context. */ -export class AppKeyAuthentication implements SecurityAuthentication { +export class RestApiKeyAuthentication implements SecurityAuthentication { /** * Configures the http authentication with the required details. * @@ -36,7 +36,7 @@ export class AppKeyAuthentication implements SecurityAuthentication { public constructor(private tokenProvider: TokenProvider) {} public getName(): string { - return "app_key"; + return "rest_api_key"; } public async applySecurityAuthentication(context: RequestContext) { @@ -47,7 +47,7 @@ export class AppKeyAuthentication implements SecurityAuthentication { /** * Applies http authentication to the request context. */ -export class UserKeyAuthentication implements SecurityAuthentication { +export class UserAuthKeyAuthentication implements SecurityAuthentication { /** * Configures the http authentication with the required details. * @@ -56,7 +56,7 @@ export class UserKeyAuthentication implements SecurityAuthentication { public constructor(private tokenProvider: TokenProvider) {} public getName(): string { - return "user_key"; + return "user_auth_key"; } public async applySecurityAuthentication(context: RequestContext) { @@ -67,8 +67,8 @@ export class UserKeyAuthentication implements SecurityAuthentication { export type AuthMethods = { "default"?: SecurityAuthentication, - "app_key"?: SecurityAuthentication, - "user_key"?: SecurityAuthentication + "rest_api_key"?: SecurityAuthentication, + "user_auth_key"?: SecurityAuthentication } export type ApiKeyConfiguration = string; @@ -78,8 +78,8 @@ export type OAuth2Configuration = { accessToken: string }; export type AuthMethodsConfiguration = { "default"?: SecurityAuthentication, - "app_key"?: HttpBearerConfiguration, - "user_key"?: HttpBearerConfiguration + "rest_api_key"?: HttpBearerConfiguration, + "user_auth_key"?: HttpBearerConfiguration } /** @@ -94,15 +94,15 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine } authMethods["default"] = config["default"] - if (config["app_key"]) { - authMethods["app_key"] = new AppKeyAuthentication( - config["app_key"]["tokenProvider"] + if (config["rest_api_key"]) { + authMethods["rest_api_key"] = new RestApiKeyAuthentication( + config["rest_api_key"]["tokenProvider"] ); } - if (config["user_key"]) { - authMethods["user_key"] = new UserKeyAuthentication( - config["user_key"]["tokenProvider"] + if (config["user_auth_key"]) { + authMethods["user_auth_key"] = new UserAuthKeyAuthentication( + config["user_auth_key"]["tokenProvider"] ); } diff --git a/configuration.ts b/configuration.ts index 5d13d34..9f80eb5 100644 --- a/configuration.ts +++ b/configuration.ts @@ -39,8 +39,8 @@ export interface ConfigurationParameters { /** * Faster way to configure authentication methods */ - appKey?: string; - userKey?: string; + restApiKey?: string; + userAuthKey?: string; } /** @@ -58,14 +58,14 @@ export interface ConfigurationParameters { export function createConfiguration(conf: ConfigurationParameters): Configuration { const authMethods: AuthMethodsConfiguration = { - 'app_key': { + 'rest_api_key': { tokenProvider: { - getToken: () => conf.appKey || '' + getToken: () => conf.restApiKey || '' } }, - 'user_key': { + 'user_auth_key': { tokenProvider: { - getToken: () => conf.userKey || '' + getToken: () => conf.userAuthKey || '' } }, } diff --git a/models/App.ts b/models/App.ts index 860e493..a37786d 100644 --- a/models/App.ts +++ b/models/App.ts @@ -2,7 +2,7 @@ * OneSignal * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com * - * API Version: 1.2.2 + * API Version: 5.0.0-alpha-01 * Contact: devrel@onesignal.com */ diff --git a/models/BasicNotification.ts b/models/BasicNotification.ts index f46b10c..c4e0e4c 100644 --- a/models/BasicNotification.ts +++ b/models/BasicNotification.ts @@ -2,17 +2,17 @@ * OneSignal * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com * - * API Version: 1.2.2 + * API Version: 5.0.0-alpha-01 * Contact: devrel@onesignal.com */ import { BasicNotificationAllOf } from './BasicNotificationAllOf'; import { BasicNotificationAllOfAndroidBackgroundLayout } from './BasicNotificationAllOfAndroidBackgroundLayout'; import { Button } from './Button'; -import { Filter } from './Filter'; +import { FilterExpression } from './FilterExpression'; +import { LanguageStringMap } from './LanguageStringMap'; import { NotificationTarget } from './NotificationTarget'; -import { PlayerNotificationTargetIncludeAliases } from './PlayerNotificationTargetIncludeAliases'; -import { StringMap } from './StringMap'; +import { WebButton } from './WebButton'; import { HttpFile } from '../http/http'; export class BasicNotification { @@ -25,13 +25,9 @@ export class BasicNotification { */ 'excluded_segments'?: Array; /** - * Specific playerids to send your notification to. _Does not require API Auth Key. Do not combine with other targeting parameters. Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call + * Specific subscription ids to send your notification to. _Does not require API Auth Key._ Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call */ - 'include_player_ids'?: Array; - /** - * Target specific devices by custom user IDs assigned via API. Not compatible with any other targeting parameters Example: [\"custom-id-assigned-by-api\"] REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call. Note: If targeting push, email, or sms subscribers with same ids, use with channel_for_external_user_ids to indicate you are sending a push or email or sms. - */ - 'include_external_user_ids'?: Array; + 'include_subscription_ids'?: Array; /** * Recommended for Sending Emails - Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts Limit of 2,000 entries per REST API call */ @@ -41,30 +37,33 @@ export class BasicNotification { */ 'include_phone_numbers'?: Array; /** - * Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using iOS device tokens. Warning: Only works with Production tokens. All non-alphanumeric characters must be removed from each token. If a token does not correspond to an existing user, a new user will be created. Example: ce777617da7f548fe7a9ab6febb56cf39fba6d38203... Limit of 2,000 entries per REST API call + * Not Recommended: Please consider using include_subscription_ids or include_aliases instead. Target using iOS device tokens. Warning: Only works with Production tokens. All non-alphanumeric characters must be removed from each token. If a token does not correspond to an existing user, a new user will be created. Example: ce777617da7f548fe7a9ab6febb56cf39fba6d38203... Limit of 2,000 entries per REST API call */ 'include_ios_tokens'?: Array; /** - * Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Windows URIs. If a token does not correspond to an existing user, a new user will be created. Example: http://s.notify.live.net/u/1/bn1/HmQAAACPaLDr-... Limit of 2,000 entries per REST API call + * Not Recommended: Please consider using include_subscription_ids or include_aliases instead. Target using Windows URIs. If a token does not correspond to an existing user, a new user will be created. Example: http://s.notify.live.net/u/1/bn1/HmQAAACPaLDr-... Limit of 2,000 entries per REST API call */ 'include_wp_wns_uris'?: Array; /** - * Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Amazon ADM registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: amzn1.adm-registration.v1.XpvSSUk0Rc3hTVVV... Limit of 2,000 entries per REST API call + * Not Recommended: Please consider using include_subscription_ids or include_aliases instead. Target using Amazon ADM registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: amzn1.adm-registration.v1.XpvSSUk0Rc3hTVVV... Limit of 2,000 entries per REST API call */ 'include_amazon_reg_ids'?: Array; /** - * Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome App registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call + * Not Recommended: Please consider using include_subscription_ids or include_aliases instead. Target using Chrome App registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call */ 'include_chrome_reg_ids'?: Array; /** - * Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome Web Push registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call + * Not Recommended: Please consider using include_subscription_ids or include_aliases instead. Target using Chrome Web Push registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call */ 'include_chrome_web_reg_ids'?: Array; /** - * Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Android device registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call + * Not Recommended: Please consider using include_subscription_ids or include_aliases instead. Target using Android device registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call */ 'include_android_reg_ids'?: Array; - 'include_aliases'?: PlayerNotificationTargetIncludeAliases; + /** + * Target specific users by aliases assigned via API. An alias can be an external_id, onesignal_id, or a custom alias. Accepts an object where keys are alias labels and values are arrays of alias IDs to include Example usage: { \"external_id\": [\"exId1\", \"extId2\"], \"internal_label\": [\"id1\", \"id2\"] } Not compatible with any other targeting parameters. REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call Note: If targeting push, email, or sms subscribers with same ids, use with target_channel to indicate you are sending a push or email or sms. + */ + 'include_aliases'?: { [key: string]: Array; }; 'target_channel'?: BasicNotificationTargetChannelEnum; 'id'?: string; 'value'?: number; @@ -114,10 +113,6 @@ export class BasicNotification { */ 'is_chrome'?: boolean; /** - * Indicates if the message type when targeting with include_external_user_ids for cases where an email, sms, and/or push subscribers have the same external user id. Example: Use the string \"push\" to indicate you are sending a push notification or the string \"email\"for sending emails or \"sms\"for sending SMS. - */ - 'channel_for_external_user_ids'?: string; - /** * Required: Your OneSignal Application ID, which can be found in Keys & IDs. It is a UUID and looks similar to 8250eaf6-1a58-489e-b136-7c74a864b434. */ 'app_id': string; @@ -125,9 +120,9 @@ export class BasicNotification { * Correlation and idempotency key. A request received with this parameter will first look for another notification with the same external_id. If one exists, a notification will not be sent, and result of the previous operation will instead be returned. Therefore, if you plan on using this feature, it\'s important to use a good source of randomness to generate the UUID passed here. This key is only idempotent for 30 days. After 30 days, the notification could be removed from our system and a notification with the same external_id will be sent again. See Idempotent Notification Requests for more details writeOnly: true */ 'external_id'?: string; - 'contents'?: StringMap; - 'headings'?: StringMap; - 'subtitle'?: StringMap; + 'contents'?: LanguageStringMap; + 'headings'?: LanguageStringMap; + 'subtitle'?: LanguageStringMap; /** * Channel: Push Notifications Platform: Huawei A custom map of data that is passed back to your app. Same as using Additional Data within the dashboard. Can use up to 2048 bytes of data. Example: {\"abc\": 123, \"foo\": \"bar\", \"event_performed\": true, \"amount\": 12.1} */ @@ -195,7 +190,7 @@ export class BasicNotification { /** * Channel: Push Notifications Platform: Chrome 48+ Add action buttons to the notification. The id field is required. Example: [{\"id\": \"like-button\", \"text\": \"Like\", \"icon\": \"http://i.imgur.com/N8SN8ZS.png\", \"url\": \"https://yoursite.com\"}, {\"id\": \"read-more-button\", \"text\": \"Read more\", \"icon\": \"http://i.imgur.com/MIxJp1L.png\", \"url\": \"https://yoursite.com\"}] */ - 'web_buttons'?: Array