├── .github ├── ISSUE_TEMPLATE │ ├── ask-question.yml │ ├── bug-report.yml │ └── general-feedback.yml ├── pull_request_template.md └── workflows │ ├── Zapier.yml │ ├── npm_deploy.yml │ └── project.yml ├── .gitignore ├── .npmignore ├── CHANGELOG.md ├── DefaultApi.md ├── LICENSE ├── README.md ├── RELEASE_INSTRUCTIONS.md ├── apis ├── DefaultApi.ts ├── baseapi.ts └── exception.ts ├── auth └── auth.ts ├── configuration.ts ├── http ├── http.ts └── isomorphic-fetch.ts ├── index.ts ├── middleware.ts ├── models ├── App.ts ├── BasicNotification.ts ├── BasicNotificationAllOf.ts ├── BasicNotificationAllOfAndroidBackgroundLayout.ts ├── Button.ts ├── CreateNotificationSuccessResponse.ts ├── CreateSegmentConflictResponse.ts ├── CreateSegmentSuccessResponse.ts ├── CreateUserConflictResponse.ts ├── CreateUserConflictResponseErrorsInner.ts ├── CreateUserConflictResponseErrorsItemsMeta.ts ├── DeliveryData.ts ├── ExportEventsSuccessResponse.ts ├── ExportSubscriptionsRequestBody.ts ├── ExportSubscriptionsSuccessResponse.ts ├── Filter.ts ├── FilterExpression.ts ├── GenericError.ts ├── GenericErrorErrorsInner.ts ├── GenericSuccessBoolResponse.ts ├── GetNotificationHistoryRequestBody.ts ├── GetSegmentsSuccessResponse.ts ├── LanguageStringMap.ts ├── Notification.ts ├── NotificationAllOf.ts ├── NotificationHistorySuccessResponse.ts ├── NotificationSlice.ts ├── NotificationTarget.ts ├── NotificationWithMeta.ts ├── NotificationWithMetaAllOf.ts ├── ObjectSerializer.ts ├── Operator.ts ├── OutcomeData.ts ├── OutcomesData.ts ├── PlatformDeliveryData.ts ├── PlatformDeliveryDataEmailAllOf.ts ├── PlatformDeliveryDataSmsAllOf.ts ├── PropertiesBody.ts ├── PropertiesDeltas.ts ├── PropertiesObject.ts ├── Purchase.ts ├── RateLimitError.ts ├── Segment.ts ├── SegmentData.ts ├── SegmentNotificationTarget.ts ├── Subscription.ts ├── SubscriptionBody.ts ├── SubscriptionNotificationTarget.ts ├── TransferSubscriptionRequestBody.ts ├── UpdateLiveActivityRequest.ts ├── UpdateLiveActivitySuccessResponse.ts ├── UpdateUserRequest.ts ├── User.ts ├── UserIdentityBody.ts ├── WebButton.ts └── all.ts ├── package.json ├── rxjsStub.ts ├── servers.ts ├── tsconfig.json ├── types ├── ObjectParamAPI.ts ├── ObservableAPI.ts └── PromiseAPI.ts ├── util.ts └── yarn.lock /.github/ISSUE_TEMPLATE/ask-question.yml: -------------------------------------------------------------------------------- 1 | name: 🙋‍♂️ Ask a question 2 | description: Tell us what's on your mind 3 | title: "[Question]: " 4 | labels: ["Question"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Having issues integrating this API library? 10 | - type: textarea 11 | id: question 12 | attributes: 13 | label: How can we help? 14 | description: Specific question regarding integrating this API library. 15 | placeholder: How do I...? 16 | validations: 17 | required: true 18 | - type: checkboxes 19 | id: terms 20 | attributes: 21 | label: Code of Conduct 22 | description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/OneSignal/api/blob/main/CONTRIBUTING.md) 23 | options: 24 | - label: I agree to follow this project's Code of Conduct 25 | required: true 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.yml: -------------------------------------------------------------------------------- 1 | name: 🪳 Bug report 2 | description: File a bug report 3 | title: "[Bug]: " 4 | labels: ["Bug"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thanks for taking the time to fill out this bug report! 10 | - type: textarea 11 | id: what-happened 12 | attributes: 13 | label: What happened? 14 | description: Provide a thorough description of whats going on. 15 | placeholder: The latest version of the API library throws an exception when creating a notification targetting all Active Users. 16 | validations: 17 | required: true 18 | - type: textarea 19 | id: reproduction-steps 20 | attributes: 21 | label: Steps to reproduce? 22 | description: Provide as much detail as posible to reproduce the issue. 23 | placeholder: | 24 | 1. Install vX.Y.Z of dependency 25 | 2. Run provided code snippet 26 | 3. Note that the app crashes 27 | render: Markdown 28 | validations: 29 | required: true 30 | - type: textarea 31 | id: what-are-expectations 32 | attributes: 33 | label: What did you expect to happen? 34 | description: Also tell us, what did you expect to happen? 35 | placeholder: I expected the API library to properly deserialize any response returned by OneSignal. 36 | validations: 37 | required: true 38 | - type: textarea 39 | id: logs 40 | attributes: 41 | label: Relevant log output 42 | description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. 43 | render: Shell 44 | - type: checkboxes 45 | id: terms 46 | attributes: 47 | label: Code of Conduct 48 | description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/OneSignal/api/blob/main/CONTRIBUTING.md) 49 | options: 50 | - label: I agree to follow this project's Code of Conduct 51 | required: true 52 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/general-feedback.yml: -------------------------------------------------------------------------------- 1 | name: 📣 General feedback 2 | description: Tell us what's on your mind 3 | title: "[Feedback]: " 4 | labels: ["Feedback"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thanks for sharing your valuable feedback! 10 | - type: textarea 11 | id: feedback 12 | attributes: 13 | label: What's on your mind? 14 | description: Feedback regarding this API library. 15 | placeholder: Share your feedback... 16 | validations: 17 | required: true 18 | - type: checkboxes 19 | id: terms 20 | attributes: 21 | label: Code of Conduct 22 | description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/OneSignal/api/blob/main/CONTRIBUTING.md) 23 | options: 24 | - label: I agree to follow this project's Code of Conduct 25 | required: true 26 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | # READ AND DELETE THIS SECTION BEFORE SUBMITTING PR 3 | * **Fill out each _REQUIRED_ section** 4 | * **Fill out _OPTIONAL_ sections, remove section if it doesn't apply to your PR** 5 | * **Read and fill out each of the checklists below** 6 | * **Remove this section after reading** 7 | 8 | 9 | # Description 10 | ## One Line Summary 11 | **REQUIRED** - Very short description that summaries the changes in this PR. 12 | 13 | ## Details 14 | 15 | ### Motivation 16 | **REQUIRED -** Why is this code change being made? Or what is the goal of this PR? Examples: Fixes a specific bug, provides additional logging to debug future issues, feature to allow X. 17 | 18 | ### Scope 19 | **RECOMMEND - OPTIONAL -** What is intended to be effected. What is known not to change. Example: Notifications are grouped when parameter X is set, not enabled by default. 20 | 21 | ### OPTIONAL - Other 22 | **OPTIONAL -** Feel free to add any other sections or sub-sections that can explain your PR better. 23 | 24 | # Testing 25 | 26 | ## Manual testing 27 | **REQUIRED -** Explain what scenarios were tested and the environment. 28 | 29 | 30 | # Checklist 31 | ## Overview 32 | - [ ] I have filled out all **REQUIRED** sections above 33 | - [ ] PR does one thing 34 | - If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR 35 | - [ ] Any Public API changes are explained in the PR details and conform to existing APIs 36 | 37 | ## Testing 38 | - [ ] I have personally tested this on my device, or explained why that is not possible 39 | 40 | ## Final pass 41 | - [ ] Code is as readable as possible. 42 | - Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code. 43 | - [ ] I have reviewed this PR myself, ensuring it meets each checklist item 44 | - WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this. -------------------------------------------------------------------------------- /.github/workflows/Zapier.yml: -------------------------------------------------------------------------------- 1 | # This is an action to close asana tasks that were generated by Github issues 2 | 3 | name: Zapier web hook 4 | 5 | # Controls when the workflow will run 6 | on: 7 | # Triggers the workflow on push or pull request events but only for the "main" branch 8 | issues: 9 | types: [closed] 10 | 11 | permissions: 12 | issues: read 13 | 14 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 15 | jobs: 16 | # This workflow contains a single job called "build" 17 | build: 18 | # The type of runner that the job will run on 19 | runs-on: ubuntu-latest 20 | 21 | # Steps represent a sequence of tasks that will be executed as part of the job 22 | steps: 23 | # Runs a set of commands using the runners shell 24 | - name: Call Zapier web hook to close Asana task 25 | if: ${{ !github.event.issue.pull_request }} 26 | env: 27 | ISSUE_TITLE: ${{ github.event.issue.title }} 28 | run: | 29 | curl --location --request POST 'https://hooks.zapier.com/hooks/catch/12728683/b7009qc/' \ 30 | --header 'Content-Type: application/json' \ 31 | --header 'Accept: application/json' \ 32 | --data-raw '{ 33 | "task_name" : "$ISSUE_TITLE" 34 | }' -------------------------------------------------------------------------------- /.github/workflows/npm_deploy.yml: -------------------------------------------------------------------------------- 1 | name: NPM Publish 2 | 3 | on: 4 | release: 5 | types: [created] 6 | 7 | jobs: 8 | publish: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v3 12 | - uses: actions/setup-node@v3 13 | with: 14 | node-version: 18 15 | - name: Install Node types 16 | run: npm install @types/node 17 | - name: Run build 18 | run: npm run build 19 | - name: Publish package 20 | uses: JS-DevTools/npm-publish@v1 21 | with: 22 | token: ${{ secrets.NPM }} 23 | -------------------------------------------------------------------------------- /.github/workflows/project.yml: -------------------------------------------------------------------------------- 1 | name: Add issues to project 2 | 3 | on: 4 | issues: 5 | types: 6 | - opened 7 | 8 | jobs: 9 | add-to-project: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Add issue to project 13 | uses: actions/add-to-project@v1.0.2 14 | with: 15 | # SDK Server Project 16 | project-url: https://github.com/orgs/OneSignal/projects/11 17 | github-token: ${{ secrets.GH_PROJECTS_TOKEN }} 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | ## January 2023 5 | ### `1.0.0-beta9` - 09/06/2023 6 | - Added User model endpoints 7 | - Limitations 8 | - Recommend using only in development and staging environments for Alpha releases. 9 | - Aliases will be available in a future release 10 | - Outcomes will be available in a future release 11 | - Users are deleted when the last subscription is removed 12 | - Known issues 13 | - User properties may not update when Subscriptions are transferred 14 | - Identity Verification 15 | - We will be introducing JWT in follow up Alpha or Beta release 16 | - Extra disabled subscriptions are created when switching Users in the SDK. 17 | 18 | ## December 2022 19 | ### `1.0.0-beta8` - 11/14/2022 20 | - Added Live Activity endpoints 21 | - Fixed various bugs 22 | 23 | ## November 2022 24 | ### `1.0.0-beta5` - 11/14/2022 25 | #### Api Changes 26 | - Configuration setup has been simplified and streamlined. Now it looks like this: 27 | ```js 28 | const configuration = OneSignal.createConfiguration({ 29 | userKey: USER_KEY_TOKEN, 30 | appKey: APP_KEY_TOKEN, 31 | }); 32 | ``` 33 | - Player ID is no longer required when creating a player 34 | 35 | #### Fixed 36 | - Bug in the OpenAPI schema not allowing users to use filters when creating a notification. 37 | - Bug in the OpenAPI schema not allowing to set the notification name. 38 | 39 | 40 | ## February 2022 41 | 42 | ### `1.0.0-beta4` - 02/25/2022 43 | #### Added 44 | - .npmignore file 45 | 46 | #### Fixed 47 | - Missing `dist` directory since npm was ignoring it due to lack of .npmignore 48 | 49 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Modified MIT License 2 | 3 | Copyright 2022 OneSignal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | 1. The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | 2. All copies of substantial portions of the Software may only be used in connection 16 | with services provided by OneSignal. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Welcome to @onesignal/node-onesignal 👋

2 |

3 | 4 | Version 5 | 6 | 7 | Documentation 8 | 9 | 10 | Maintenance 11 | 12 | 13 | Twitter: onesignal 14 | 15 |

16 | 17 | > OpenAPI client for node-onesignal 18 | 19 | ### 🏠 [Homepage](https://github.com/OneSignal/node-onesignal#readme) 20 | ### 🖤 [npm](https://www.npmjs.com/package/@onesignal/node-onesignal) 21 | 22 | # Node Client SDK 23 | The OneSignal Node client is a server OneSignal SDK for NodeJS. Integrate OneSignal with your backend events, data, and 24 | more. 25 | 26 | 27 | # Install 28 | 29 | ```sh 30 | # yarn 31 | yarn add @onesignal/node-onesignal 32 | 33 | # npm 34 | npm install @onesignal/node-onesignal --save 35 | ``` 36 | 37 | # Usage 38 | ```js 39 | const OneSignal = require('@onesignal/node-onesignal'); 40 | ``` 41 | ```js 42 | import * as OneSignal from '@onesignal/node-onesignal'; 43 | ``` 44 | 45 | ## Creating a client 46 | ### Configuration 47 | We can configure the client using the `createConfiguration` function. You can find more info on each configuration 48 | parameter [here](https://github.com/OpenAPITools/openapi-generator/pull/10283/files). 49 | 50 | ```js 51 | const configuration = OneSignal.createConfiguration(configParams); 52 | ``` 53 | 54 | ### Initializing the Client 55 | ```js 56 | const client = new OneSignal.DefaultApi(configuration); 57 | ``` 58 | 59 | ### Authentication 60 | You can configure auth parameters passing them like this: 61 | 62 | ```js 63 | const configuration = OneSignal.createConfiguration({ 64 | organizationApiKey: '', // Organization key is only required for creating new apps and other top-level endpoints 65 | restApiKey: '', // App REST API key required for most endpoints 66 | }); 67 | 68 | const client = new OneSignal.DefaultApi(configuration); 69 | ``` 70 | 71 | #### Advanced Usage: Creating a brand-new app 72 | If creating a new app via the client, the response will return the app's API key via the `basic_auth_key` response 73 | parameter. You can then use this to modify your configuration object and create a new client that will have both user-level and app-level authentication set up. 74 | 75 | ```js 76 | const response = await client.createApp(newapp); 77 | 78 | const configuration = OneSignal.createConfiguration({ 79 | organizationApiKey: '', // Organization key is only required for creating new apps and other top-level endpoints 80 | restApiKey: response.basic_auth_key, 81 | }); 82 | 83 | const client = new OneSignal.DefaultApi(configuration); 84 | ``` 85 | 86 | --- 87 | ## API Reference 88 | 89 | > See the full list of [API Endpoints](DefaultApi.MD). 90 | 91 | To make stateful changes requests should take on the following pattern: 92 | 1. create or get an object 93 | 2. make changes to that object 94 | 3. pass the object to the request function to make the changes 95 | 96 | Examples of important OneSignal objects include `App`, `Notification`, `Player`, and `Segment`. 97 | 98 | For example, see the section below on creating an app. First an app object is created via the instantiation of the `App` 99 | class. Then, the app instance is modified directly. Finally, we use the `client` to create the app via a remote request. 100 | 101 | ### Creating an app 102 | Creates a new OneSignal app. 103 | 104 | **Example** 105 | ```js 106 | const app = new OneSignal.App(); 107 | 108 | // configure your application 109 | app.name = 'app_name'; 110 | app.gcm_key = ''; 111 | app.android_gcm_sender_id = ''; 112 | 113 | const response = await client.createApp(app); 114 | ``` 115 | 116 | ### Getting an app 117 | View the details of a single OneSignal app. 118 | 119 | **Example** 120 | ```js 121 | const app = await client.getApp(''); 122 | ``` 123 | 124 | ### Getting multiple apps 125 | View apps. 126 | 127 | **Example** 128 | ```js 129 | const apps = await client.getApps(); 130 | ``` 131 | 132 | ### Updating an app 133 | Updates the name or configuration settings of an existing OneSignal app. 134 | 135 | **Example** 136 | ```js 137 | const app = new OneSignal.App(); 138 | app.name = 'modified_app_name'; 139 | 140 | const udpateAppResponse = await client.updateApp('', app); 141 | ``` 142 | 143 | ### Creating a notification 144 | Sends a notification to your users. 145 | 146 | **Example** 147 | ```js 148 | const notification = new OneSignal.Notification(); 149 | notification.app_id = app.id; 150 | // Name property may be required in some case, for instance when sending an SMS. 151 | notification.name = "test_notification_name"; 152 | notification.contents = { 153 | en: "Gig'em Ags" 154 | } 155 | 156 | // required for Huawei 157 | notification.headings = { 158 | en: "Gig'em Ags" 159 | } 160 | const notification = await client.createNotification(notification); 161 | ``` 162 | ### Creating a notification using Filters 163 | Sends a notification to your users filtered by specific criteria. 164 | 165 | **Example** 166 | ```js 167 | const notification = new OneSignal.Notification(); 168 | notification.app_id = app.id; 169 | 170 | notification.contents = { 171 | en: "Gig'em Ags" 172 | } 173 | 174 | // required for Huawei 175 | notification.headings = { 176 | en: "Gig'em Ags" 177 | } 178 | 179 | // Find all the users that have not spent any amount in USD on IAP. 180 | // https://documentation.onesignal.com/reference/create-notification#send-to-users-based-on-filters 181 | notification.filters = [ 182 | { 183 | field: 'amount_spent', 184 | relation: '=', 185 | value: "0" 186 | }, 187 | ]; 188 | 189 | const notification = await client.createNotification(notification); 190 | ``` 191 | 192 | ### Canceling a notification 193 | Stop a scheduled or currently outgoing notification. 194 | 195 | **Example** 196 | 197 | ```js 198 | const cancelNotificationResponse = await client.cancelNotification('', ''); 199 | ``` 200 | 201 | 202 | ### Getting a notification 203 | View the details of a single notification and outcomes associated with it. 204 | 205 | **Example** 206 | ```js 207 | await client.getNotification('', ''); 208 | ``` 209 | 210 | ### Getting notifications 211 | View the details of multiple notifications. 212 | 213 | | Param | Type | Description | 214 | |--------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 215 | | app_id | string | The OneSignal App ID for your app. Available in Keys & IDs. | 216 | | limit | string | How many notifications to return. Max is 50. Default is 50. | 217 | | offset | number | Page offset. Default is 0. Results are sorted by queued_at in descending order. `queued_at` is a representation of the time that the notification was queued at. | 218 | | kind | number | Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only | 219 | 220 | 221 | **Example** 222 | ```js 223 | const notifications = await client.getNotifications('', '50', 0, 1); 224 | ``` 225 | 226 | ### Getting notification history 227 | View the devices sent a message - **OneSignal Paid Plan Required** 228 | This method will return all devices that were sent the given `notification_id` of an Email or Push Notification if used 229 | within 7 days of the date sent. 230 | 231 | **Example** 232 | ```js 233 | const notificationHistory = await client.getNotificationHistory(''); 234 | ``` 235 | 236 | ### Creating a segment 237 | Create segments visible and usable in the dashboard and API - **Required: OneSignal Paid Plan** 238 | 239 | **Example** 240 | ```js 241 | const segment = new OneSignal.Segment(); 242 | 243 | segment.filters = [ 244 | { field: 'session_count', relation: '>', value: '1' }, 245 | { field: 'tag', key: 'my_tag', relation: 'exists' } 246 | ] 247 | 248 | const segment = await client.createSegments(app.id, segment); 249 | ``` 250 | 251 | ### Deleting a segment 252 | Delete segments (not user devices) - **Required: OneSignal Paid Plan** 253 | You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header 254 | that has admin access on the app. 255 | The `segment_id` can be found in the URL of the segment when viewing it in the dashboard. 256 | 257 | **Example** 258 | ```js 259 | const deleteSegmentsResponse = await client.deleteSegments('', ''); 260 | ``` 261 | 262 | ### Creating a player 263 | Add a device. 264 | 265 | **Example** 266 | ```js 267 | const player = new OneSignal.Player(); 268 | player.device_type = 1; 269 | player.app_id = app_id; 270 | player.identifier = ''; 271 | const player = await client.createPlayer(player); 272 | ``` 273 | 274 | ### Getting a player 275 | View the details of an existing device in one of your OneSignal apps. 276 | The email and the hash is **only required if you have enabled Identity Verification and `device_type` is email**. 277 | 278 | **Example** 279 | ```js 280 | const player = await client.getPlayer('', '', ''); 281 | ``` 282 | 283 | ### Getting players 284 | View the details of multiple devices in one of your OneSignal apps. 285 | 286 | ⚠️ Unavailable for Apps Over 80,000 Users. 287 | 288 | | Param | Type | Description | 289 | |--------|--------|------------------------------------------------------------------| 290 | | app_id | string | The OneSignal App ID for your app. Available in Keys & IDs. | 291 | | limit | string | How many devices to return. Max is 300. Default is 300 | 292 | | offset | number | Result offset. Default is 0. Results are sorted by id; | 293 | 294 | 295 | **Example** 296 | ```js 297 | const players = await client.getPlayers('', '300', 0); 298 | ``` 299 | 300 | ### Exporting a player 301 | Generate a compressed CSV export of all of your current user data. This method can be used to generate a compressed CSV 302 | export of all of your existing user data and is a better alternative to retrieving this data using the /players API endpoint. 303 | 304 | See [full CSV Export Reference](https://documentation.onesignal.com/reference/csv-export) 305 | 306 | **Example** 307 | ```js 308 | const exportPlayerResponse = await client.exportPlayer('', { 309 | extra_fields: ['location', 'external_user_id'], 310 | last_active_since: 1469392779, 311 | segment_name: "Subscribed Users" 312 | }); 313 | ``` 314 | 315 | 316 | ### Updating a player 317 | Update an existing device in one of your OneSignal apps. 318 | 319 | **Example** 320 | ```js 321 | const updatePlayerResponse = await client.updatePlayer('', player); 322 | ``` 323 | 324 | ### Updating player tags 325 | Update an existing device's tags in one of your OneSignal apps using the External User ID. 326 | 327 | ```js 328 | const playerToUpdate = new OneSignal.Player(); 329 | 330 | player.app_id = APP_ID; 331 | player.device_type = 1; 332 | 333 | playerToUpdate.external_user_id = 'your_player_external_id'; // setting the same external_user_id as before 334 | const updatePlayerTagsRequestBody = new OneSignal.UpdatePlayerTagsRequestBody(); 335 | updatePlayerTagsRequestBody.tags = {'typescript_test_tag': 1}; 336 | const updatePlayerResponse = await api.updatePlayerTags(APP_ID, PLAYER_EXTERNAL_USER_ID, updatePlayerTagsRequestBody); 337 | ``` 338 | #### Deleting Tags 339 | To delete a tag, include its key and set its value to blank (""). Omitting a key/value will not delete it. 340 | 341 | For example, if you wanted to delete two existing tags rank and category while simultaneously adding a new tag class, the 342 | tags JSON would look like the following: 343 | 344 | **Example** 345 | ```json 346 | "tags": { 347 | "rank": "", 348 | "category": "", 349 | "class": "my_new_value" 350 | } 351 | ``` 352 | 353 | ### Deleting a player 354 | Deletes a user record. 355 | 356 | **Example** 357 | ```js 358 | const deletePlayerResponse = await client.deletePlayer(app.id, '') 359 | ``` 360 | 361 | ### Getting outcomes 362 | View the details of all the outcomes associated with your app. 363 | 364 | 🚧 **Requires your OneSignal App's REST API Key, available in Keys & IDs** 🚧 365 | 366 | Outcome data are accessible for 30 days before being deleted from our servers. You can export this data monthly if you need it for a more extended period. 367 | 368 | | Param | Type | Description | 369 | |---------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 370 | | app_id | string | The OneSignal App ID for your app. Available in Keys & IDs. | 371 | | outcome_names | string | Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the “os” prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum | 372 | | outcome_names2 | string | If outcome names contain any commas, then please specify only one value at a time. Example: `outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count` where “Sales, Purchase” is the custom outcomes with a comma in the name. | 373 | | outcome_time_range | string | Optional Time range for the returned data. The values can be `1h` (for the last 1 hour data), `1d` (for the last 1 day data), or `1mo` (for the last 1 month data). Default is 1h if the parameter is omitted. | 374 | | outcome_platforms | string | Optional Platform id. Refer device's platform ids for values. **Example:** `outcome_platform=0` for iOS `outcome_platform=7`, `8` for Safari and Firefox Default is data from all platforms if the parameter is omitted. | 375 | | outcome_attribution | string | Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. | 376 | 377 | **Example** 378 | ```js 379 | const outcomes = await client.getOutcomes(app.id, 'os__click.count,os_session_duration.count,my_outcome.sum'); 380 | ``` 381 | 382 | ### Begin Live Activity 383 | Starts a Live Activity event 384 | ```js 385 | // Create a player first 386 | const player = new OneSignal.Player(); 387 | player.device_type = 0; 388 | player.app_id = ''; 389 | const playerResponse = await api.createPlayer(player); 390 | 391 | // Prepare a request 392 | const beginLiveActivityRequest: BeginLiveActivityRequest = { 393 | push_token: '', 394 | subscription_id: playerResponse.id!, 395 | }; 396 | const activityId = ''; // any string 397 | 398 | // Begin activity 399 | await api.beginLiveActivity('', activityId, beginLiveActivityRequest); 400 | ``` 401 | 402 | ### Update Live Activity 403 | Updates a Live Activity event 404 | ```js 405 | const updateLiveActivityRequest: UpdateLiveActivityRequest = { 406 | event_updates: { 407 | data: 'test' 408 | }, 409 | event: "update", 410 | name: "contents" 411 | }; 412 | 413 | await api.updateLiveActivity('', '', updateLiveActivityRequest); 414 | ``` 415 | 416 | ### End Live Activity 417 | Stops a Live Activity event 418 | ```js 419 | const subscriptionId = ''; // player id 420 | await api.endLiveActivity('', '', subscriptionId); 421 | ``` 422 | 423 | ### Subscription types 424 | * iOSPush 425 | * AndroidPush 426 | * FireOSPush 427 | * ChromeExtensionPush 428 | * ChromePush 429 | * WindowsPush 430 | * SafariLegacyPush 431 | * FirefoxPush 432 | * macOSPush 433 | * HuaweiPush 434 | * SafariPush 435 | * Email 436 | * SMS 437 | 438 | ## Users 439 | ### Creating a OneSignal User 440 | ```js 441 | const user = new OneSignal.User(); 442 | 443 | const aliasLabel = ''; 444 | const aliasId = ''; 445 | const subscriptionToken = ''; 446 | 447 | user.identity = { 448 | [aliasLabel]: aliasId, 449 | }; 450 | 451 | user.subscriptions = [ 452 | { 453 | type: "iOSPush", 454 | token: subscriptionToken, 455 | } 456 | ]; 457 | 458 | const createdUser = await api.createUser('', user); 459 | assert(createdUser.identity!['onesignal_id'] != null); 460 | ``` 461 | 462 | ### Getting a user by `onesignal_id` 463 | ```js 464 | const oneisgnalAliasLabel = "onesignal_id"; 465 | const onesignalAliasId = createdUser.identity!['onesignal_id']; 466 | 467 | const fetchedUser = await api.fetchUser('', oneisgnalAliasLabel, onesignalAliasId); 468 | ``` 469 | 470 | ### Getting a user by an alias 471 | ```js 472 | const fetchedUser = await api.fetchUser('', alias_label, alias_id); 473 | ``` 474 | 475 | ### Updating a user 476 | ```js 477 | const updateUserRequest: UpdateUserRequest = { 478 | properties: { 479 | language: 'fr' 480 | } 481 | }; 482 | 483 | const updatedUser = await api.updateUser('', aliasLabel, aliasId, updateUserRequest); 484 | ``` 485 | 486 | ### Deleting a user 487 | ```js 488 | await api.deleteUser('', aliasLabel, aliasId); 489 | ``` 490 | 491 | ## Subscriptions 492 | ### Creating a subscription for existing user 493 | ```js 494 | const createSubscriptionRequestBody: CreateSubscriptionRequestBody = { 495 | subscription: { 496 | type: "AndroidPush", 497 | token: '', 498 | } 499 | }; 500 | 501 | const response = await api.createSubscription('', '', '', createSubscriptionRequestBody); 502 | ``` 503 | 504 | ### Updating a subscription 505 | ```js 506 | const updateSubscriptionRequestBody: UpdateSubscriptionRequestBody = { 507 | subscription: { 508 | type: "iOSPush", 509 | token: '', 510 | } 511 | }; 512 | 513 | await api.updateSubscription('', '', updateSubscriptionRequestBody); 514 | ``` 515 | 516 | ### Deleting a subscription 517 | ```js 518 | await api.deleteSubscription('', ''); 519 | ``` 520 | 521 | ### Transfer subscription ownership 522 | Transfers the subscription from one user to another. 523 | ```js 524 | // Setting the user for transfering the subscription to. User is identyfied by an IdentityObject. 525 | const transferSubscriptionRequestBody: TransferSubscriptionRequestBody = { 526 | identity: otherUserIdentityObject 527 | }; 528 | 529 | const transferResponse = await api.transferSubscription('', '', transferSubscriptionRequestBody); 530 | ``` 531 | 532 | ## Aliases 533 | ### Fetching aliases for a user 534 | ```js 535 | const fetchResponse = await api.fetchAliases('', ''); 536 | ``` 537 | 538 | ### Fetching user identity 539 | ```js 540 | const fetchResponse = await api.fetchUserIdentity('', '', ''); 541 | ``` 542 | ### Identifying user by alias 543 | ```js 544 | const userIdentityRequestBody: UserIdentityRequestBody = { 545 | identity: { 546 | ['']: '' 547 | } 548 | }; 549 | 550 | const identifyResponse = await api.identifyUserByAlias('', 551 | '', 552 | '', 553 | userIdentityRequestBody); 554 | ``` 555 | 556 | ### Identifying user by subscription id 557 | ```js 558 | const userIdentityRequestBody: UserIdentityRequestBody = { 559 | identity: { 560 | ['']: '' 561 | } 562 | }; 563 | 564 | const identifyResponse = await api.identifyUserBySubscriptionId('', '', userIdentityRequestBody); 565 | ``` 566 | 567 | ### Deleting an alias 568 | ```js 569 | await api.deleteAlias('', '', '', ''); 570 | ``` 571 | ## Author 572 | 573 | * Website: https://onesignal.com 574 | * Twitter: [@onesignal](https://twitter.com/onesignal) 575 | * Github: [@OneSignal](https://github.com/OneSignal) 576 | 577 | ## 🤝 Contributing 578 | 579 | Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/OneSignal/node-onesignal/issues). 580 | 581 | ## Show your support 582 | 583 | Give a ⭐️ if this project helped you! 584 | 585 | ## 📝 License 586 | 587 | Copyright © 2023 [OneSignal](https://github.com/OneSignal). 588 | 589 | This project is [MIT](https://github.com/OneSignal/node-onesignal/blob/main/LICENSE) licensed. 590 | -------------------------------------------------------------------------------- /RELEASE_INSTRUCTIONS.md: -------------------------------------------------------------------------------- 1 | ## NodeJS 2 | `npm publish . --access public` -------------------------------------------------------------------------------- /apis/baseapi.ts: -------------------------------------------------------------------------------- 1 | import { Configuration } from '../configuration' 2 | 3 | /** 4 | * 5 | * @export 6 | */ 7 | export const COLLECTION_FORMATS = { 8 | csv: ",", 9 | ssv: " ", 10 | tsv: "\t", 11 | pipes: "|", 12 | }; 13 | 14 | 15 | /** 16 | * 17 | * @export 18 | * @class BaseAPI 19 | */ 20 | export class BaseAPIRequestFactory { 21 | 22 | constructor(protected configuration: Configuration) { 23 | } 24 | }; 25 | 26 | /** 27 | * 28 | * @export 29 | * @class RequiredError 30 | * @extends {Error} 31 | */ 32 | export class RequiredError extends Error { 33 | name: "RequiredError" = "RequiredError"; 34 | constructor(public api: string, public method: string, public field: string) { 35 | super("Required parameter " + field + " was null or undefined when calling " + api + "." + method + "."); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /apis/exception.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Represents an error caused by an api call i.e. it has attributes for a HTTP status code 3 | * and the returned body object. 4 | * 5 | * Example 6 | * API returns a ErrorMessageObject whenever HTTP status code is not in [200, 299] 7 | * => ApiException(404, someErrorMessageObject) 8 | * 9 | */ 10 | export class ApiException extends Error { 11 | public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) { 12 | super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " + 13 | JSON.stringify(headers)) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /auth/auth.ts: -------------------------------------------------------------------------------- 1 | // typings for btoa are incorrect 2 | //@ts-ignore 3 | import * as btoa from "btoa"; 4 | import { RequestContext } from "../http/http"; 5 | 6 | /** 7 | * Interface authentication schemes. 8 | */ 9 | export interface SecurityAuthentication { 10 | /* 11 | * @return returns the name of the security authentication as specified in OAI 12 | */ 13 | getName(): string; 14 | 15 | /** 16 | * Applies the authentication scheme to the request context 17 | * 18 | * @params context the request context which should use this authentication scheme 19 | */ 20 | applySecurityAuthentication(context: RequestContext): void | Promise; 21 | } 22 | 23 | export interface TokenProvider { 24 | getToken(): Promise | string; 25 | } 26 | 27 | /** 28 | * Applies http authentication to the request context. 29 | */ 30 | export class OrganizationApiKeyAuthentication implements SecurityAuthentication { 31 | /** 32 | * Configures the http authentication with the required details. 33 | * 34 | * @param tokenProvider service that can provide the up-to-date token when needed 35 | */ 36 | public constructor(private tokenProvider: TokenProvider) {} 37 | 38 | public getName(): string { 39 | return "organization_api_key"; 40 | } 41 | 42 | public async applySecurityAuthentication(context: RequestContext) { 43 | context.setHeaderParam("Authorization", "Key " + await this.tokenProvider.getToken()); 44 | } 45 | } 46 | 47 | /** 48 | * Applies http authentication to the request context. 49 | */ 50 | export class RestApiKeyAuthentication implements SecurityAuthentication { 51 | /** 52 | * Configures the http authentication with the required details. 53 | * 54 | * @param tokenProvider service that can provide the up-to-date token when needed 55 | */ 56 | public constructor(private tokenProvider: TokenProvider) {} 57 | 58 | public getName(): string { 59 | return "rest_api_key"; 60 | } 61 | 62 | public async applySecurityAuthentication(context: RequestContext) { 63 | context.setHeaderParam("Authorization", "Key " + await this.tokenProvider.getToken()); 64 | } 65 | } 66 | 67 | 68 | export type AuthMethods = { 69 | "default"?: SecurityAuthentication, 70 | "organization_api_key"?: SecurityAuthentication, 71 | "rest_api_key"?: SecurityAuthentication 72 | } 73 | 74 | export type ApiKeyConfiguration = string; 75 | export type HttpBasicConfiguration = { "username": string, "password": string }; 76 | export type HttpBearerConfiguration = { tokenProvider: TokenProvider }; 77 | export type OAuth2Configuration = { accessToken: string }; 78 | 79 | export type AuthMethodsConfiguration = { 80 | "default"?: SecurityAuthentication, 81 | "organization_api_key"?: HttpBearerConfiguration, 82 | "rest_api_key"?: HttpBearerConfiguration 83 | } 84 | 85 | /** 86 | * Creates the authentication methods from a swagger description. 87 | * 88 | */ 89 | export function configureAuthMethods(config: AuthMethodsConfiguration | undefined): AuthMethods { 90 | let authMethods: AuthMethods = {} 91 | 92 | if (!config) { 93 | return authMethods; 94 | } 95 | authMethods["default"] = config["default"] 96 | 97 | if (config["organization_api_key"]) { 98 | authMethods["organization_api_key"] = new OrganizationApiKeyAuthentication( 99 | config["organization_api_key"]["tokenProvider"] 100 | ); 101 | } 102 | 103 | if (config["rest_api_key"]) { 104 | authMethods["rest_api_key"] = new RestApiKeyAuthentication( 105 | config["rest_api_key"]["tokenProvider"] 106 | ); 107 | } 108 | 109 | return authMethods; 110 | } 111 | -------------------------------------------------------------------------------- /configuration.ts: -------------------------------------------------------------------------------- 1 | import { HttpLibrary } from "./http/http"; 2 | import { Middleware, PromiseMiddleware, PromiseMiddlewareWrapper } from "./middleware"; 3 | import { IsomorphicFetchHttpLibrary as DefaultHttpLibrary } from "./http/isomorphic-fetch"; 4 | import { BaseServerConfiguration, server1 } from "./servers"; 5 | import { configureAuthMethods, AuthMethods, AuthMethodsConfiguration } from "./auth/auth"; 6 | 7 | export interface Configuration { 8 | readonly baseServer: BaseServerConfiguration; 9 | readonly httpApi: HttpLibrary; 10 | readonly middleware: Middleware[]; 11 | readonly authMethods: AuthMethods; 12 | } 13 | 14 | 15 | /** 16 | * Interface with which a configuration object can be configured. 17 | */ 18 | export interface ConfigurationParameters { 19 | /** 20 | * Default server to use 21 | */ 22 | baseServer?: BaseServerConfiguration; 23 | /** 24 | * HTTP library to use e.g. IsomorphicFetch 25 | */ 26 | httpApi?: HttpLibrary; 27 | /** 28 | * The middlewares which will be applied to requests and responses 29 | */ 30 | middleware?: Middleware[]; 31 | /** 32 | * Configures all middlewares using the promise api instead of observables (which Middleware uses) 33 | */ 34 | promiseMiddleware?: PromiseMiddleware[]; 35 | /** 36 | * Configuration for the available authentication methods 37 | */ 38 | authMethods?: AuthMethodsConfiguration; 39 | /** 40 | * Faster way to configure authentication methods 41 | */ 42 | organizationApiKey?: string; 43 | restApiKey?: string; 44 | } 45 | 46 | /** 47 | * Configuration factory function 48 | * 49 | * If a property is not included in conf, a default is used: 50 | * - baseServer: server1 51 | * - httpApi: IsomorphicFetchHttpLibrary 52 | * - middleware: [] 53 | * - promiseMiddleware: [] 54 | * - authMethods: {} 55 | * 56 | * @param conf partial configuration 57 | */ 58 | export function createConfiguration(conf: ConfigurationParameters): Configuration { 59 | 60 | const authMethods: AuthMethodsConfiguration = { 61 | 'organization_api_key': { 62 | tokenProvider: { 63 | getToken: () => conf.organizationApiKey || '' 64 | } 65 | }, 66 | 'rest_api_key': { 67 | tokenProvider: { 68 | getToken: () => conf.restApiKey || '' 69 | } 70 | }, 71 | } 72 | 73 | const configuration: Configuration = { 74 | baseServer: conf.baseServer !== undefined ? conf.baseServer : server1, 75 | httpApi: conf.httpApi || new DefaultHttpLibrary(), 76 | middleware: conf.middleware || [], 77 | authMethods: configureAuthMethods(Object.assign(authMethods, conf.authMethods || {})) 78 | }; 79 | if (conf.promiseMiddleware) { 80 | conf.promiseMiddleware.forEach( 81 | m => configuration.middleware.push(new PromiseMiddlewareWrapper(m)) 82 | ); 83 | } 84 | return configuration; 85 | } -------------------------------------------------------------------------------- /http/http.ts: -------------------------------------------------------------------------------- 1 | // TODO: evaluate if we can easily get rid of this library 2 | import * as FormData from "form-data"; 3 | import { Observable, from } from '../rxjsStub'; 4 | 5 | export * from './isomorphic-fetch'; 6 | 7 | /** 8 | * Represents an HTTP method. 9 | */ 10 | export enum HttpMethod { 11 | GET = "GET", 12 | HEAD = "HEAD", 13 | POST = "POST", 14 | PUT = "PUT", 15 | DELETE = "DELETE", 16 | CONNECT = "CONNECT", 17 | OPTIONS = "OPTIONS", 18 | TRACE = "TRACE", 19 | PATCH = "PATCH" 20 | } 21 | 22 | /** 23 | * Represents an HTTP file which will be transferred from or to a server. 24 | */ 25 | export type HttpFile = { 26 | data: Buffer, 27 | name: string 28 | }; 29 | 30 | 31 | export class HttpException extends Error { 32 | public constructor(msg: string) { 33 | super(msg); 34 | } 35 | } 36 | 37 | /** 38 | * Represents the body of an outgoing HTTP request. 39 | */ 40 | export type RequestBody = undefined | string | FormData; 41 | 42 | /** 43 | * Represents an HTTP request context 44 | */ 45 | export class RequestContext { 46 | private headers: { [key: string]: string } = {}; 47 | private body: RequestBody = undefined; 48 | private url: URL; 49 | 50 | /** 51 | * Creates the request context using a http method and request resource url 52 | * 53 | * @param url url of the requested resource 54 | * @param httpMethod http method 55 | */ 56 | public constructor(url: string, private httpMethod: HttpMethod) { 57 | this.url = new URL(url); 58 | } 59 | 60 | /* 61 | * Returns the url set in the constructor including the query string 62 | * 63 | */ 64 | public getUrl(): string { 65 | return this.url.toString(); 66 | } 67 | 68 | /** 69 | * Replaces the url set in the constructor with this url. 70 | * 71 | */ 72 | public setUrl(url: string) { 73 | this.url = new URL(url); 74 | } 75 | 76 | /** 77 | * Sets the body of the http request either as a string or FormData 78 | * 79 | * Note that setting a body on a HTTP GET, HEAD, DELETE, CONNECT or TRACE 80 | * request is discouraged. 81 | * https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#rfc.section.7.3.1 82 | * 83 | * @param body the body of the request 84 | */ 85 | public setBody(body: RequestBody) { 86 | this.body = body; 87 | } 88 | 89 | public getHttpMethod(): HttpMethod { 90 | return this.httpMethod; 91 | } 92 | 93 | public getHeaders(): { [key: string]: string } { 94 | return this.headers; 95 | } 96 | 97 | public getBody(): RequestBody { 98 | return this.body; 99 | } 100 | 101 | public setQueryParam(name: string, value: string) { 102 | this.url.searchParams.set(name, value); 103 | } 104 | 105 | /** 106 | * Sets a cookie with the name and value. NO check for duplicate cookies is performed 107 | * 108 | */ 109 | public addCookie(name: string, value: string): void { 110 | if (!this.headers["Cookie"]) { 111 | this.headers["Cookie"] = ""; 112 | } 113 | this.headers["Cookie"] += name + "=" + value + "; "; 114 | } 115 | 116 | public setHeaderParam(key: string, value: string): void { 117 | this.headers[key] = value; 118 | } 119 | } 120 | 121 | export interface ResponseBody { 122 | text(): Promise; 123 | binary(): Promise; 124 | } 125 | 126 | 127 | /** 128 | * Helper class to generate a `ResponseBody` from binary data 129 | */ 130 | export class SelfDecodingBody implements ResponseBody { 131 | constructor(private dataSource: Promise) {} 132 | 133 | binary(): Promise { 134 | return this.dataSource; 135 | } 136 | 137 | async text(): Promise { 138 | const data: Buffer = await this.dataSource; 139 | return data.toString(); 140 | } 141 | } 142 | 143 | export class ResponseContext { 144 | public constructor( 145 | public httpStatusCode: number, 146 | public headers: { [key: string]: string }, 147 | public body: ResponseBody 148 | ) {} 149 | 150 | /** 151 | * Parse header value in the form `value; param1="value1"` 152 | * 153 | * E.g. for Content-Type or Content-Disposition 154 | * Parameter names are converted to lower case 155 | * The first parameter is returned with the key `""` 156 | */ 157 | public getParsedHeader(headerName: string): { [parameter: string]: string } { 158 | const result: { [parameter: string]: string } = {}; 159 | if (!this.headers[headerName]) { 160 | return result; 161 | } 162 | 163 | const parameters = this.headers[headerName].split(";"); 164 | for (const parameter of parameters) { 165 | let [key, value] = parameter.split("=", 2); 166 | key = key.toLowerCase().trim(); 167 | if (value === undefined) { 168 | result[""] = key; 169 | } else { 170 | value = value.trim(); 171 | if (value.startsWith('"') && value.endsWith('"')) { 172 | value = value.substring(1, value.length - 1); 173 | } 174 | result[key] = value; 175 | } 176 | } 177 | return result; 178 | } 179 | 180 | public async getBodyAsFile(): Promise { 181 | const data = await this.body.binary(); 182 | const fileName = this.getParsedHeader("content-disposition")["filename"] || ""; 183 | return { data, name: fileName }; 184 | } 185 | 186 | public async getBodyAsAny(): Promise { 187 | return this.body as any; 188 | } 189 | } 190 | 191 | export interface HttpLibrary { 192 | send(request: RequestContext): Observable; 193 | } 194 | 195 | export interface PromiseHttpLibrary { 196 | send(request: RequestContext): Promise; 197 | } 198 | 199 | export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLibrary { 200 | return { 201 | send(request: RequestContext): Observable { 202 | return from(promiseHttpLibrary.send(request)); 203 | } 204 | } 205 | } -------------------------------------------------------------------------------- /http/isomorphic-fetch.ts: -------------------------------------------------------------------------------- 1 | import {HttpLibrary, RequestContext, ResponseContext} from './http'; 2 | import { from, Observable } from '../rxjsStub'; 3 | 4 | export class IsomorphicFetchHttpLibrary implements HttpLibrary { 5 | 6 | public send(request: RequestContext): Observable { 7 | let method = request.getHttpMethod().toString(); 8 | let body = request.getBody(); 9 | 10 | const resultPromise = fetch(request.getUrl(), { 11 | method: method, 12 | body: body as any, 13 | headers: request.getHeaders(), 14 | }).then((resp: any) => { 15 | const headers: { [name: string]: string } = {}; 16 | resp.headers.forEach((value: string, name: string) => { 17 | headers[name] = value; 18 | }); 19 | 20 | const body = { 21 | text: () => resp.text(), 22 | binary: () => resp.buffer() 23 | }; 24 | return new ResponseContext(resp.status, headers, body); 25 | }); 26 | 27 | return from>(resultPromise); 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | export * from "./http/http"; 2 | export * from "./auth/auth"; 3 | export * from "./models/all"; 4 | export { createConfiguration } from "./configuration" 5 | export { Configuration } from "./configuration" 6 | export * from "./apis/exception"; 7 | export * from "./servers"; 8 | export { RequiredError } from "./apis/baseapi"; 9 | 10 | export { PromiseMiddleware as Middleware } from './middleware'; 11 | export { PromiseDefaultApi as DefaultApi } from './types/PromiseAPI'; 12 | 13 | -------------------------------------------------------------------------------- /middleware.ts: -------------------------------------------------------------------------------- 1 | import {RequestContext, ResponseContext} from './http/http'; 2 | import { Observable, from } from './rxjsStub'; 3 | 4 | /** 5 | * Defines the contract for a middleware intercepting requests before 6 | * they are sent (but after the RequestContext was created) 7 | * and before the ResponseContext is unwrapped. 8 | * 9 | */ 10 | export interface Middleware { 11 | /** 12 | * Modifies the request before the request is sent. 13 | * 14 | * @param context RequestContext of a request which is about to be sent to the server 15 | * @returns an observable of the updated request context 16 | * 17 | */ 18 | pre(context: RequestContext): Observable; 19 | /** 20 | * Modifies the returned response before it is deserialized. 21 | * 22 | * @param context ResponseContext of a sent request 23 | * @returns an observable of the modified response context 24 | */ 25 | post(context: ResponseContext): Observable; 26 | } 27 | 28 | export class PromiseMiddlewareWrapper implements Middleware { 29 | 30 | public constructor(private middleware: PromiseMiddleware) { 31 | 32 | } 33 | 34 | pre(context: RequestContext): Observable { 35 | return from(this.middleware.pre(context)); 36 | } 37 | 38 | post(context: ResponseContext): Observable { 39 | return from(this.middleware.post(context)); 40 | } 41 | 42 | } 43 | 44 | /** 45 | * Defines the contract for a middleware intercepting requests before 46 | * they are sent (but after the RequestContext was created) 47 | * and before the ResponseContext is unwrapped. 48 | * 49 | */ 50 | export interface PromiseMiddleware { 51 | /** 52 | * Modifies the request before the request is sent. 53 | * 54 | * @param context RequestContext of a request which is about to be sent to the server 55 | * @returns an observable of the updated request context 56 | * 57 | */ 58 | pre(context: RequestContext): Promise; 59 | /** 60 | * Modifies the returned response before it is deserialized. 61 | * 62 | * @param context ResponseContext of a sent request 63 | * @returns an observable of the modified response context 64 | */ 65 | post(context: ResponseContext): Promise; 66 | } 67 | -------------------------------------------------------------------------------- /models/App.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class App { 12 | 'id'?: string; 13 | /** 14 | * The name of your app, as displayed on your apps list on the dashboard. This can be renamed. 15 | */ 16 | 'name'?: string; 17 | 'players'?: number; 18 | 'messageable_players'?: number; 19 | 'updated_at'?: string; 20 | 'created_at'?: string; 21 | /** 22 | * Android: Your Google Project number. Also known as Sender ID. 23 | */ 24 | 'android_gcm_sender_id'?: string; 25 | /** 26 | * Android: Your Google Push Messaging Auth Key 27 | */ 28 | 'gcm_key'?: string; 29 | /** 30 | * Chrome (All Browsers except Safari) (Recommended): The URL to your website. This field is required if you wish to enable web push and specify other web push parameters. 31 | */ 32 | 'chrome_web_origin'?: string; 33 | /** 34 | * Not for web push. Your Google Push Messaging Auth Key if you use Chrome Apps / Extensions. 35 | */ 36 | 'chrome_key'?: string; 37 | /** 38 | * Chrome (All Browsers except Safari): Your default notification icon. Should be 256x256 pixels, min 80x80. 39 | */ 40 | 'chrome_web_default_notification_icon'?: string; 41 | /** 42 | * Chrome (All Browsers except Safari): A subdomain of your choice in order to support Web Push on non-HTTPS websites. This field must be set in order for the chrome_web_gcm_sender_id property to be processed. 43 | */ 44 | 'chrome_web_sub_domain'?: string; 45 | /** 46 | * iOS: Either sandbox or production 47 | */ 48 | 'apns_env'?: AppApnsEnvEnum; 49 | /** 50 | * iOS: Your apple push notification p12 certificate file, converted to a string and Base64 encoded. 51 | */ 52 | 'apns_p12'?: string; 53 | /** 54 | * iOS: Required if using p12 certificate. Password for the apns_p12 file. 55 | */ 56 | 'apns_p12_password'?: string; 57 | 'apns_certificates'?: string; 58 | 'safari_apns_certificates'?: string; 59 | /** 60 | * Safari: Your apple push notification p12 certificate file for Safari Push Notifications, converted to a string and Base64 encoded. 61 | */ 62 | 'safari_apns_p12'?: string; 63 | /** 64 | * Safari: Password for safari_apns_p12 file 65 | */ 66 | 'safari_apns_p12_password'?: string; 67 | /** 68 | * iOS: Required if using p8. Unique identifier for the p8 authentication key. 69 | */ 70 | 'apns_key_id'?: string; 71 | /** 72 | * iOS: Required if using p8. Team ID generated by Apple for your developer account. 73 | */ 74 | 'apns_team_id'?: string; 75 | /** 76 | * iOS: Required if using p8. Bundle ID for your app in the Apple ecosystem. 77 | */ 78 | 'apns_bundle_id'?: string; 79 | /** 80 | * iOS: Required if using p8. Base64 encoded p8 key 81 | */ 82 | 'apns_p8'?: string; 83 | /** 84 | * Safari (Recommended): The hostname to your website including http(s):// 85 | */ 86 | 'safari_site_origin'?: string; 87 | 'safari_push_id'?: string; 88 | 'safari_icon_16_16'?: string; 89 | 'safari_icon_32_32'?: string; 90 | 'safari_icon_64_64'?: string; 91 | 'safari_icon_128_128'?: string; 92 | /** 93 | * Safari: A url for a 256x256 png notification icon. This is the only Safari icon URL you need to provide. 94 | */ 95 | 'safari_icon_256_256'?: string; 96 | /** 97 | * All Browsers (Recommended): The Site Name. Requires both chrome_web_origin and safari_site_origin to be set to add or update it. 98 | */ 99 | 'site_name'?: string; 100 | 'basic_auth_key'?: string; 101 | /** 102 | * The Id of the Organization you would like to add this app to. 103 | */ 104 | 'organization_id'?: string; 105 | /** 106 | * iOS: Notification data (additional data) values will be added to the root of the apns payload when sent to the device. Ignore if you\'re not using any other plugins, or not using OneSignal SDK methods to read the payload. 107 | */ 108 | 'additional_data_is_root_payload'?: boolean; 109 | 110 | static readonly discriminator: string | undefined = undefined; 111 | 112 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 113 | { 114 | "name": "id", 115 | "baseName": "id", 116 | "type": "string", 117 | "format": "" 118 | }, 119 | { 120 | "name": "name", 121 | "baseName": "name", 122 | "type": "string", 123 | "format": "" 124 | }, 125 | { 126 | "name": "players", 127 | "baseName": "players", 128 | "type": "number", 129 | "format": "" 130 | }, 131 | { 132 | "name": "messageable_players", 133 | "baseName": "messageable_players", 134 | "type": "number", 135 | "format": "" 136 | }, 137 | { 138 | "name": "updated_at", 139 | "baseName": "updated_at", 140 | "type": "string", 141 | "format": "date-time" 142 | }, 143 | { 144 | "name": "created_at", 145 | "baseName": "created_at", 146 | "type": "string", 147 | "format": "date-time" 148 | }, 149 | { 150 | "name": "android_gcm_sender_id", 151 | "baseName": "android_gcm_sender_id", 152 | "type": "string", 153 | "format": "" 154 | }, 155 | { 156 | "name": "gcm_key", 157 | "baseName": "gcm_key", 158 | "type": "string", 159 | "format": "" 160 | }, 161 | { 162 | "name": "chrome_web_origin", 163 | "baseName": "chrome_web_origin", 164 | "type": "string", 165 | "format": "" 166 | }, 167 | { 168 | "name": "chrome_key", 169 | "baseName": "chrome_key", 170 | "type": "string", 171 | "format": "" 172 | }, 173 | { 174 | "name": "chrome_web_default_notification_icon", 175 | "baseName": "chrome_web_default_notification_icon", 176 | "type": "string", 177 | "format": "" 178 | }, 179 | { 180 | "name": "chrome_web_sub_domain", 181 | "baseName": "chrome_web_sub_domain", 182 | "type": "string", 183 | "format": "" 184 | }, 185 | { 186 | "name": "apns_env", 187 | "baseName": "apns_env", 188 | "type": "AppApnsEnvEnum", 189 | "format": "" 190 | }, 191 | { 192 | "name": "apns_p12", 193 | "baseName": "apns_p12", 194 | "type": "string", 195 | "format": "" 196 | }, 197 | { 198 | "name": "apns_p12_password", 199 | "baseName": "apns_p12_password", 200 | "type": "string", 201 | "format": "" 202 | }, 203 | { 204 | "name": "apns_certificates", 205 | "baseName": "apns_certificates", 206 | "type": "string", 207 | "format": "" 208 | }, 209 | { 210 | "name": "safari_apns_certificates", 211 | "baseName": "safari_apns_certificates", 212 | "type": "string", 213 | "format": "" 214 | }, 215 | { 216 | "name": "safari_apns_p12", 217 | "baseName": "safari_apns_p12", 218 | "type": "string", 219 | "format": "" 220 | }, 221 | { 222 | "name": "safari_apns_p12_password", 223 | "baseName": "safari_apns_p12_password", 224 | "type": "string", 225 | "format": "" 226 | }, 227 | { 228 | "name": "apns_key_id", 229 | "baseName": "apns_key_id", 230 | "type": "string", 231 | "format": "" 232 | }, 233 | { 234 | "name": "apns_team_id", 235 | "baseName": "apns_team_id", 236 | "type": "string", 237 | "format": "" 238 | }, 239 | { 240 | "name": "apns_bundle_id", 241 | "baseName": "apns_bundle_id", 242 | "type": "string", 243 | "format": "" 244 | }, 245 | { 246 | "name": "apns_p8", 247 | "baseName": "apns_p8", 248 | "type": "string", 249 | "format": "" 250 | }, 251 | { 252 | "name": "safari_site_origin", 253 | "baseName": "safari_site_origin", 254 | "type": "string", 255 | "format": "" 256 | }, 257 | { 258 | "name": "safari_push_id", 259 | "baseName": "safari_push_id", 260 | "type": "string", 261 | "format": "" 262 | }, 263 | { 264 | "name": "safari_icon_16_16", 265 | "baseName": "safari_icon_16_16", 266 | "type": "string", 267 | "format": "" 268 | }, 269 | { 270 | "name": "safari_icon_32_32", 271 | "baseName": "safari_icon_32_32", 272 | "type": "string", 273 | "format": "" 274 | }, 275 | { 276 | "name": "safari_icon_64_64", 277 | "baseName": "safari_icon_64_64", 278 | "type": "string", 279 | "format": "" 280 | }, 281 | { 282 | "name": "safari_icon_128_128", 283 | "baseName": "safari_icon_128_128", 284 | "type": "string", 285 | "format": "" 286 | }, 287 | { 288 | "name": "safari_icon_256_256", 289 | "baseName": "safari_icon_256_256", 290 | "type": "string", 291 | "format": "" 292 | }, 293 | { 294 | "name": "site_name", 295 | "baseName": "site_name", 296 | "type": "string", 297 | "format": "" 298 | }, 299 | { 300 | "name": "basic_auth_key", 301 | "baseName": "basic_auth_key", 302 | "type": "string", 303 | "format": "" 304 | }, 305 | { 306 | "name": "organization_id", 307 | "baseName": "organization_id", 308 | "type": "string", 309 | "format": "" 310 | }, 311 | { 312 | "name": "additional_data_is_root_payload", 313 | "baseName": "additional_data_is_root_payload", 314 | "type": "boolean", 315 | "format": "" 316 | } ]; 317 | 318 | static getAttributeTypeMap() { 319 | return App.attributeTypeMap; 320 | } 321 | 322 | public constructor() { 323 | } 324 | } 325 | 326 | 327 | export type AppApnsEnvEnum = "sandbox" | "production" ; 328 | 329 | -------------------------------------------------------------------------------- /models/BasicNotificationAllOfAndroidBackgroundLayout.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | /** 12 | * Channel: Push Notifications Platform: Android Allowing setting a background image for the notification. This is a JSON object containing the following keys. See our Background Image documentation for image sizes. 13 | */ 14 | export class BasicNotificationAllOfAndroidBackgroundLayout { 15 | /** 16 | * Asset file, android resource name, or URL to remote image. 17 | */ 18 | 'image'?: string; 19 | /** 20 | * Title text color ARGB Hex format. Example(Blue) \"FF0000FF\". 21 | */ 22 | 'headings_color'?: string; 23 | /** 24 | * Body text color ARGB Hex format. Example(Red) \"FFFF0000\". 25 | */ 26 | 'contents_color'?: string; 27 | 28 | static readonly discriminator: string | undefined = undefined; 29 | 30 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 31 | { 32 | "name": "image", 33 | "baseName": "image", 34 | "type": "string", 35 | "format": "" 36 | }, 37 | { 38 | "name": "headings_color", 39 | "baseName": "headings_color", 40 | "type": "string", 41 | "format": "" 42 | }, 43 | { 44 | "name": "contents_color", 45 | "baseName": "contents_color", 46 | "type": "string", 47 | "format": "" 48 | } ]; 49 | 50 | static getAttributeTypeMap() { 51 | return BasicNotificationAllOfAndroidBackgroundLayout.attributeTypeMap; 52 | } 53 | 54 | public constructor() { 55 | } 56 | } 57 | 58 | -------------------------------------------------------------------------------- /models/Button.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class Button { 12 | 'id': string; 13 | 'text'?: string; 14 | 'icon'?: string; 15 | 16 | static readonly discriminator: string | undefined = undefined; 17 | 18 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 19 | { 20 | "name": "id", 21 | "baseName": "id", 22 | "type": "string", 23 | "format": "" 24 | }, 25 | { 26 | "name": "text", 27 | "baseName": "text", 28 | "type": "string", 29 | "format": "" 30 | }, 31 | { 32 | "name": "icon", 33 | "baseName": "icon", 34 | "type": "string", 35 | "format": "" 36 | } ]; 37 | 38 | static getAttributeTypeMap() { 39 | return Button.attributeTypeMap; 40 | } 41 | 42 | public constructor() { 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /models/CreateNotificationSuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class CreateNotificationSuccessResponse { 12 | 'id'?: string; 13 | 'external_id'?: string; 14 | /** 15 | * Errors include the identifiers that are invalid, or that there are no subscribers. 16 | */ 17 | 'errors'?: any; 18 | 19 | static readonly discriminator: string | undefined = undefined; 20 | 21 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 22 | { 23 | "name": "id", 24 | "baseName": "id", 25 | "type": "string", 26 | "format": "" 27 | }, 28 | { 29 | "name": "external_id", 30 | "baseName": "external_id", 31 | "type": "string", 32 | "format": "" 33 | }, 34 | { 35 | "name": "errors", 36 | "baseName": "errors", 37 | "type": "any", 38 | "format": "" 39 | } ]; 40 | 41 | static getAttributeTypeMap() { 42 | return CreateNotificationSuccessResponse.attributeTypeMap; 43 | } 44 | 45 | public constructor() { 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /models/CreateSegmentConflictResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class CreateSegmentConflictResponse { 12 | 'success'?: boolean; 13 | 'errors'?: Array; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "success", 20 | "baseName": "success", 21 | "type": "boolean", 22 | "format": "" 23 | }, 24 | { 25 | "name": "errors", 26 | "baseName": "errors", 27 | "type": "Array", 28 | "format": "" 29 | } ]; 30 | 31 | static getAttributeTypeMap() { 32 | return CreateSegmentConflictResponse.attributeTypeMap; 33 | } 34 | 35 | public constructor() { 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /models/CreateSegmentSuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class CreateSegmentSuccessResponse { 12 | 'success'?: boolean; 13 | /** 14 | * UUID of created segment 15 | */ 16 | 'id'?: string; 17 | 18 | static readonly discriminator: string | undefined = undefined; 19 | 20 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 21 | { 22 | "name": "success", 23 | "baseName": "success", 24 | "type": "boolean", 25 | "format": "" 26 | }, 27 | { 28 | "name": "id", 29 | "baseName": "id", 30 | "type": "string", 31 | "format": "" 32 | } ]; 33 | 34 | static getAttributeTypeMap() { 35 | return CreateSegmentSuccessResponse.attributeTypeMap; 36 | } 37 | 38 | public constructor() { 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /models/CreateUserConflictResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { CreateUserConflictResponseErrorsInner } from './CreateUserConflictResponseErrorsInner'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class CreateUserConflictResponse { 13 | 'errors'?: Array; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "errors", 20 | "baseName": "errors", 21 | "type": "Array", 22 | "format": "" 23 | } ]; 24 | 25 | static getAttributeTypeMap() { 26 | return CreateUserConflictResponse.attributeTypeMap; 27 | } 28 | 29 | public constructor() { 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /models/CreateUserConflictResponseErrorsInner.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { CreateUserConflictResponseErrorsItemsMeta } from './CreateUserConflictResponseErrorsItemsMeta'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class CreateUserConflictResponseErrorsInner { 13 | 'code'?: string; 14 | 'title'?: string; 15 | 'meta'?: CreateUserConflictResponseErrorsItemsMeta; 16 | 17 | static readonly discriminator: string | undefined = undefined; 18 | 19 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 20 | { 21 | "name": "code", 22 | "baseName": "code", 23 | "type": "string", 24 | "format": "" 25 | }, 26 | { 27 | "name": "title", 28 | "baseName": "title", 29 | "type": "string", 30 | "format": "" 31 | }, 32 | { 33 | "name": "meta", 34 | "baseName": "meta", 35 | "type": "CreateUserConflictResponseErrorsItemsMeta", 36 | "format": "" 37 | } ]; 38 | 39 | static getAttributeTypeMap() { 40 | return CreateUserConflictResponseErrorsInner.attributeTypeMap; 41 | } 42 | 43 | public constructor() { 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /models/CreateUserConflictResponseErrorsItemsMeta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class CreateUserConflictResponseErrorsItemsMeta { 12 | 'conflicting_aliases'?: object; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "conflicting_aliases", 19 | "baseName": "conflicting_aliases", 20 | "type": "object", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return CreateUserConflictResponseErrorsItemsMeta.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/DeliveryData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class DeliveryData { 12 | /** 13 | * Number of messages delivered to push servers, mobile carriers, or email service providers. 14 | */ 15 | 'successful'?: number; 16 | /** 17 | * Number of messages sent to unsubscribed devices. 18 | */ 19 | 'failed'?: number; 20 | /** 21 | * Number of errors reported. 22 | */ 23 | 'errored'?: number; 24 | /** 25 | * Number of messages that were clicked. 26 | */ 27 | 'converted'?: number; 28 | /** 29 | * Number of devices that received the message. 30 | */ 31 | 'received'?: number; 32 | 33 | static readonly discriminator: string | undefined = undefined; 34 | 35 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 36 | { 37 | "name": "successful", 38 | "baseName": "successful", 39 | "type": "number", 40 | "format": "" 41 | }, 42 | { 43 | "name": "failed", 44 | "baseName": "failed", 45 | "type": "number", 46 | "format": "" 47 | }, 48 | { 49 | "name": "errored", 50 | "baseName": "errored", 51 | "type": "number", 52 | "format": "" 53 | }, 54 | { 55 | "name": "converted", 56 | "baseName": "converted", 57 | "type": "number", 58 | "format": "" 59 | }, 60 | { 61 | "name": "received", 62 | "baseName": "received", 63 | "type": "number", 64 | "format": "" 65 | } ]; 66 | 67 | static getAttributeTypeMap() { 68 | return DeliveryData.attributeTypeMap; 69 | } 70 | 71 | public constructor() { 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /models/ExportEventsSuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class ExportEventsSuccessResponse { 12 | 'csv_file_url'?: string; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "csv_file_url", 19 | "baseName": "csv_file_url", 20 | "type": "string", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return ExportEventsSuccessResponse.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/ExportSubscriptionsRequestBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class ExportSubscriptionsRequestBody { 12 | /** 13 | * Additional fields that you wish to include. Currently supports location, country, rooted, notification_types, ip, external_user_id, web_auth, and web_p256. 14 | */ 15 | 'extra_fields'?: Array; 16 | /** 17 | * Export all devices with a last_active timestamp greater than this time. Unixtime in seconds. 18 | */ 19 | 'last_active_since'?: string; 20 | /** 21 | * Export all devices belonging to the segment. 22 | */ 23 | 'segment_name'?: string; 24 | 25 | static readonly discriminator: string | undefined = undefined; 26 | 27 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 28 | { 29 | "name": "extra_fields", 30 | "baseName": "extra_fields", 31 | "type": "Array", 32 | "format": "" 33 | }, 34 | { 35 | "name": "last_active_since", 36 | "baseName": "last_active_since", 37 | "type": "string", 38 | "format": "" 39 | }, 40 | { 41 | "name": "segment_name", 42 | "baseName": "segment_name", 43 | "type": "string", 44 | "format": "" 45 | } ]; 46 | 47 | static getAttributeTypeMap() { 48 | return ExportSubscriptionsRequestBody.attributeTypeMap; 49 | } 50 | 51 | public constructor() { 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /models/ExportSubscriptionsSuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class ExportSubscriptionsSuccessResponse { 12 | 'csv_file_url'?: string; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "csv_file_url", 19 | "baseName": "csv_file_url", 20 | "type": "string", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return ExportSubscriptionsSuccessResponse.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/Filter.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class Filter { 12 | /** 13 | * Required. Name of the field to use as the first operand in the filter expression. 14 | */ 15 | 'field'?: string; 16 | /** 17 | * If `field` is `tag`, this field is *required* to specify `key` inside the tags. 18 | */ 19 | 'key'?: string; 20 | /** 21 | * Constant value to use as the second operand in the filter expression. This value is *required* when the relation operator is a binary operator. 22 | */ 23 | 'value'?: string; 24 | /** 25 | * If `field` is session-related, this is *required* to specify the number of hours before or after the user\'s session. 26 | */ 27 | 'hours_ago'?: string; 28 | /** 29 | * If `field` is `location`, this will specify the radius in meters from a provided location point. Use with `lat` and `long`. 30 | */ 31 | 'radius'?: number; 32 | /** 33 | * If `field` is `location`, this is *required* to specify the user\'s latitude. 34 | */ 35 | 'lat'?: number; 36 | /** 37 | * If `field` is `location`, this is *required* to specify the user\'s longitude. 38 | */ 39 | 'long'?: number; 40 | /** 41 | * Required. Operator of a filter expression. 42 | */ 43 | 'relation'?: FilterRelationEnum; 44 | 45 | static readonly discriminator: string | undefined = undefined; 46 | 47 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 48 | { 49 | "name": "field", 50 | "baseName": "field", 51 | "type": "string", 52 | "format": "" 53 | }, 54 | { 55 | "name": "key", 56 | "baseName": "key", 57 | "type": "string", 58 | "format": "" 59 | }, 60 | { 61 | "name": "value", 62 | "baseName": "value", 63 | "type": "string", 64 | "format": "" 65 | }, 66 | { 67 | "name": "hours_ago", 68 | "baseName": "hours_ago", 69 | "type": "string", 70 | "format": "" 71 | }, 72 | { 73 | "name": "radius", 74 | "baseName": "radius", 75 | "type": "number", 76 | "format": "" 77 | }, 78 | { 79 | "name": "lat", 80 | "baseName": "lat", 81 | "type": "number", 82 | "format": "" 83 | }, 84 | { 85 | "name": "long", 86 | "baseName": "long", 87 | "type": "number", 88 | "format": "" 89 | }, 90 | { 91 | "name": "relation", 92 | "baseName": "relation", 93 | "type": "FilterRelationEnum", 94 | "format": "" 95 | } ]; 96 | 97 | static getAttributeTypeMap() { 98 | return Filter.attributeTypeMap; 99 | } 100 | 101 | public constructor() { 102 | } 103 | } 104 | 105 | 106 | export type FilterRelationEnum = ">" | "<" | "=" | "!=" | "exists" | "not_exists" | "time_elapsed_gt" | "time_elapsed_lt" ; 107 | 108 | -------------------------------------------------------------------------------- /models/FilterExpression.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { Filter } from './Filter'; 10 | import { Operator } from './Operator'; 11 | import { HttpFile } from '../http/http'; 12 | 13 | export class FilterExpression { 14 | /** 15 | * Required. Name of the field to use as the first operand in the filter expression. 16 | */ 17 | 'field'?: string; 18 | /** 19 | * If `field` is `tag`, this field is *required* to specify `key` inside the tags. 20 | */ 21 | 'key'?: string; 22 | /** 23 | * Constant value to use as the second operand in the filter expression. This value is *required* when the relation operator is a binary operator. 24 | */ 25 | 'value'?: string; 26 | /** 27 | * If `field` is session-related, this is *required* to specify the number of hours before or after the user\'s session. 28 | */ 29 | 'hours_ago'?: string; 30 | /** 31 | * If `field` is `location`, this will specify the radius in meters from a provided location point. Use with `lat` and `long`. 32 | */ 33 | 'radius'?: number; 34 | /** 35 | * If `field` is `location`, this is *required* to specify the user\'s latitude. 36 | */ 37 | 'lat'?: number; 38 | /** 39 | * If `field` is `location`, this is *required* to specify the user\'s longitude. 40 | */ 41 | 'long'?: number; 42 | /** 43 | * Required. Operator of a filter expression. 44 | */ 45 | 'relation'?: FilterExpressionRelationEnum; 46 | /** 47 | * Strictly, this must be either `\"OR\"`, or `\"AND\"`. It can be used to compose Filters as part of a Filters object. 48 | */ 49 | 'operator'?: FilterExpressionOperatorEnum; 50 | 51 | static readonly discriminator: string | undefined = undefined; 52 | 53 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 54 | { 55 | "name": "field", 56 | "baseName": "field", 57 | "type": "string", 58 | "format": "" 59 | }, 60 | { 61 | "name": "key", 62 | "baseName": "key", 63 | "type": "string", 64 | "format": "" 65 | }, 66 | { 67 | "name": "value", 68 | "baseName": "value", 69 | "type": "string", 70 | "format": "" 71 | }, 72 | { 73 | "name": "hours_ago", 74 | "baseName": "hours_ago", 75 | "type": "string", 76 | "format": "" 77 | }, 78 | { 79 | "name": "radius", 80 | "baseName": "radius", 81 | "type": "number", 82 | "format": "" 83 | }, 84 | { 85 | "name": "lat", 86 | "baseName": "lat", 87 | "type": "number", 88 | "format": "" 89 | }, 90 | { 91 | "name": "long", 92 | "baseName": "long", 93 | "type": "number", 94 | "format": "" 95 | }, 96 | { 97 | "name": "relation", 98 | "baseName": "relation", 99 | "type": "FilterExpressionRelationEnum", 100 | "format": "" 101 | }, 102 | { 103 | "name": "operator", 104 | "baseName": "operator", 105 | "type": "FilterExpressionOperatorEnum", 106 | "format": "" 107 | } ]; 108 | 109 | static getAttributeTypeMap() { 110 | return FilterExpression.attributeTypeMap; 111 | } 112 | 113 | public constructor() { 114 | } 115 | } 116 | 117 | 118 | export type FilterExpressionRelationEnum = ">" | "<" | "=" | "!=" | "exists" | "not_exists" | "time_elapsed_gt" | "time_elapsed_lt" ; 119 | export type FilterExpressionOperatorEnum = "OR" | "AND" ; 120 | 121 | -------------------------------------------------------------------------------- /models/GenericError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class GenericError { 12 | 'errors'?: any; 13 | 'success'?: boolean; 14 | 'reference'?: any; 15 | 16 | static readonly discriminator: string | undefined = undefined; 17 | 18 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 19 | { 20 | "name": "errors", 21 | "baseName": "errors", 22 | "type": "any", 23 | "format": "" 24 | }, 25 | { 26 | "name": "success", 27 | "baseName": "success", 28 | "type": "boolean", 29 | "format": "" 30 | }, 31 | { 32 | "name": "reference", 33 | "baseName": "reference", 34 | "type": "any", 35 | "format": "" 36 | } ]; 37 | 38 | static getAttributeTypeMap() { 39 | return GenericError.attributeTypeMap; 40 | } 41 | 42 | public constructor() { 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /models/GenericErrorErrorsInner.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 1.2.2 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class GenericErrorErrorsInner { 12 | 'code'?: string; 13 | 'title'?: string; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "code", 20 | "baseName": "code", 21 | "type": "string", 22 | "format": "" 23 | }, 24 | { 25 | "name": "title", 26 | "baseName": "title", 27 | "type": "string", 28 | "format": "" 29 | } ]; 30 | 31 | static getAttributeTypeMap() { 32 | return GenericErrorErrorsInner.attributeTypeMap; 33 | } 34 | 35 | public constructor() { 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /models/GenericSuccessBoolResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class GenericSuccessBoolResponse { 12 | 'success'?: boolean; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "success", 19 | "baseName": "success", 20 | "type": "boolean", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return GenericSuccessBoolResponse.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/GetNotificationHistoryRequestBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class GetNotificationHistoryRequestBody { 12 | /** 13 | * -> \"sent\" - All the devices by player_id that were sent the specified notification_id. Notifications targeting under 1000 recipients will not have \"sent\" events recorded, but will show \"clicked\" events. \"clicked\" - All the devices by `player_id` that clicked the specified notification_id. 14 | */ 15 | 'events'?: GetNotificationHistoryRequestBodyEventsEnum; 16 | /** 17 | * The email address you would like the report sent. 18 | */ 19 | 'email'?: string; 20 | 'app_id'?: string; 21 | 22 | static readonly discriminator: string | undefined = undefined; 23 | 24 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 25 | { 26 | "name": "events", 27 | "baseName": "events", 28 | "type": "GetNotificationHistoryRequestBodyEventsEnum", 29 | "format": "" 30 | }, 31 | { 32 | "name": "email", 33 | "baseName": "email", 34 | "type": "string", 35 | "format": "" 36 | }, 37 | { 38 | "name": "app_id", 39 | "baseName": "app_id", 40 | "type": "string", 41 | "format": "" 42 | } ]; 43 | 44 | static getAttributeTypeMap() { 45 | return GetNotificationHistoryRequestBody.attributeTypeMap; 46 | } 47 | 48 | public constructor() { 49 | } 50 | } 51 | 52 | 53 | export type GetNotificationHistoryRequestBodyEventsEnum = "sent" | "clicked" ; 54 | 55 | -------------------------------------------------------------------------------- /models/GetSegmentsSuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { SegmentData } from './SegmentData'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class GetSegmentsSuccessResponse { 13 | /** 14 | * The number of Segments in the response. 15 | */ 16 | 'total_count'?: number; 17 | /** 18 | * Set with the offset query parameter. Default 0. 19 | */ 20 | 'offset'?: number; 21 | /** 22 | * Maximum number of Segments returned. Default 300. 23 | */ 24 | 'limit'?: number; 25 | /** 26 | * An array containing the Segment information. 27 | */ 28 | 'segments'?: Array; 29 | 30 | static readonly discriminator: string | undefined = undefined; 31 | 32 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 33 | { 34 | "name": "total_count", 35 | "baseName": "total_count", 36 | "type": "number", 37 | "format": "" 38 | }, 39 | { 40 | "name": "offset", 41 | "baseName": "offset", 42 | "type": "number", 43 | "format": "" 44 | }, 45 | { 46 | "name": "limit", 47 | "baseName": "limit", 48 | "type": "number", 49 | "format": "" 50 | }, 51 | { 52 | "name": "segments", 53 | "baseName": "segments", 54 | "type": "Array", 55 | "format": "" 56 | } ]; 57 | 58 | static getAttributeTypeMap() { 59 | return GetSegmentsSuccessResponse.attributeTypeMap; 60 | } 61 | 62 | public constructor() { 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /models/LanguageStringMap.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class LanguageStringMap { 12 | /** 13 | * Text in English. Will be used as a fallback 14 | */ 15 | 'en'?: string; 16 | /** 17 | * Text in Arabic. 18 | */ 19 | 'ar'?: string; 20 | /** 21 | * Text in Bosnian. 22 | */ 23 | 'bs'?: string; 24 | /** 25 | * Text in Bulgarian. 26 | */ 27 | 'bg'?: string; 28 | /** 29 | * Text in Catalan. 30 | */ 31 | 'ca'?: string; 32 | /** 33 | * Text in Chinese (Simplified). 34 | */ 35 | 'zh_hans'?: string; 36 | /** 37 | * Text in Chinese (Traditional). 38 | */ 39 | 'zh_hant'?: string; 40 | /** 41 | * Alias for zh-Hans. 42 | */ 43 | 'zh'?: string; 44 | /** 45 | * Text in Croatian. 46 | */ 47 | 'hr'?: string; 48 | /** 49 | * Text in Czech. 50 | */ 51 | 'cs'?: string; 52 | /** 53 | * Text in Danish. 54 | */ 55 | 'da'?: string; 56 | /** 57 | * Text in Dutch. 58 | */ 59 | 'nl'?: string; 60 | /** 61 | * Text in Estonian. 62 | */ 63 | 'et'?: string; 64 | /** 65 | * Text in Finnish. 66 | */ 67 | 'fi'?: string; 68 | /** 69 | * Text in French. 70 | */ 71 | 'fr'?: string; 72 | /** 73 | * Text in Georgian. 74 | */ 75 | 'ka'?: string; 76 | /** 77 | * Text in German. 78 | */ 79 | 'de'?: string; 80 | /** 81 | * Text in Greek. 82 | */ 83 | 'el'?: string; 84 | /** 85 | * Text in Hindi. 86 | */ 87 | 'hi'?: string; 88 | /** 89 | * Text in Hebrew. 90 | */ 91 | 'he'?: string; 92 | /** 93 | * Text in Hungarian. 94 | */ 95 | 'hu'?: string; 96 | /** 97 | * Text in Indonesian. 98 | */ 99 | 'id'?: string; 100 | /** 101 | * Text in Italian. 102 | */ 103 | 'it'?: string; 104 | /** 105 | * Text in Japanese. 106 | */ 107 | 'ja'?: string; 108 | /** 109 | * Text in Korean. 110 | */ 111 | 'ko'?: string; 112 | /** 113 | * Text in Latvian. 114 | */ 115 | 'lv'?: string; 116 | /** 117 | * Text in Lithuanian. 118 | */ 119 | 'lt'?: string; 120 | /** 121 | * Text in Malay. 122 | */ 123 | 'ms'?: string; 124 | /** 125 | * Text in Norwegian. 126 | */ 127 | 'nb'?: string; 128 | /** 129 | * Text in Polish. 130 | */ 131 | 'pl'?: string; 132 | /** 133 | * Text in Persian. 134 | */ 135 | 'fa'?: string; 136 | /** 137 | * Text in Portugese. 138 | */ 139 | 'pt'?: string; 140 | /** 141 | * Text in Punjabi. 142 | */ 143 | 'pa'?: string; 144 | /** 145 | * Text in Romanian. 146 | */ 147 | 'ro'?: string; 148 | /** 149 | * Text in Russian. 150 | */ 151 | 'ru'?: string; 152 | /** 153 | * Text in Serbian. 154 | */ 155 | 'sr'?: string; 156 | /** 157 | * Text in Slovak. 158 | */ 159 | 'sk'?: string; 160 | /** 161 | * Text in Spanish. 162 | */ 163 | 'es'?: string; 164 | /** 165 | * Text in Swedish. 166 | */ 167 | 'sv'?: string; 168 | /** 169 | * Text in Thai. 170 | */ 171 | 'th'?: string; 172 | /** 173 | * Text in Turkish. 174 | */ 175 | 'tr'?: string; 176 | /** 177 | * Text in Ukrainian. 178 | */ 179 | 'uk'?: string; 180 | /** 181 | * Text in Vietnamese. 182 | */ 183 | 'vi'?: string; 184 | 185 | static readonly discriminator: string | undefined = undefined; 186 | 187 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 188 | { 189 | "name": "en", 190 | "baseName": "en", 191 | "type": "string", 192 | "format": "" 193 | }, 194 | { 195 | "name": "ar", 196 | "baseName": "ar", 197 | "type": "string", 198 | "format": "" 199 | }, 200 | { 201 | "name": "bs", 202 | "baseName": "bs", 203 | "type": "string", 204 | "format": "" 205 | }, 206 | { 207 | "name": "bg", 208 | "baseName": "bg", 209 | "type": "string", 210 | "format": "" 211 | }, 212 | { 213 | "name": "ca", 214 | "baseName": "ca", 215 | "type": "string", 216 | "format": "" 217 | }, 218 | { 219 | "name": "zh_hans", 220 | "baseName": "zh-Hans", 221 | "type": "string", 222 | "format": "" 223 | }, 224 | { 225 | "name": "zh_hant", 226 | "baseName": "zh-Hant", 227 | "type": "string", 228 | "format": "" 229 | }, 230 | { 231 | "name": "zh", 232 | "baseName": "zh", 233 | "type": "string", 234 | "format": "" 235 | }, 236 | { 237 | "name": "hr", 238 | "baseName": "hr", 239 | "type": "string", 240 | "format": "" 241 | }, 242 | { 243 | "name": "cs", 244 | "baseName": "cs", 245 | "type": "string", 246 | "format": "" 247 | }, 248 | { 249 | "name": "da", 250 | "baseName": "da", 251 | "type": "string", 252 | "format": "" 253 | }, 254 | { 255 | "name": "nl", 256 | "baseName": "nl", 257 | "type": "string", 258 | "format": "" 259 | }, 260 | { 261 | "name": "et", 262 | "baseName": "et", 263 | "type": "string", 264 | "format": "" 265 | }, 266 | { 267 | "name": "fi", 268 | "baseName": "fi", 269 | "type": "string", 270 | "format": "" 271 | }, 272 | { 273 | "name": "fr", 274 | "baseName": "fr", 275 | "type": "string", 276 | "format": "" 277 | }, 278 | { 279 | "name": "ka", 280 | "baseName": "ka", 281 | "type": "string", 282 | "format": "" 283 | }, 284 | { 285 | "name": "de", 286 | "baseName": "de", 287 | "type": "string", 288 | "format": "" 289 | }, 290 | { 291 | "name": "el", 292 | "baseName": "el", 293 | "type": "string", 294 | "format": "" 295 | }, 296 | { 297 | "name": "hi", 298 | "baseName": "hi", 299 | "type": "string", 300 | "format": "" 301 | }, 302 | { 303 | "name": "he", 304 | "baseName": "he", 305 | "type": "string", 306 | "format": "" 307 | }, 308 | { 309 | "name": "hu", 310 | "baseName": "hu", 311 | "type": "string", 312 | "format": "" 313 | }, 314 | { 315 | "name": "id", 316 | "baseName": "id", 317 | "type": "string", 318 | "format": "" 319 | }, 320 | { 321 | "name": "it", 322 | "baseName": "it", 323 | "type": "string", 324 | "format": "" 325 | }, 326 | { 327 | "name": "ja", 328 | "baseName": "ja", 329 | "type": "string", 330 | "format": "" 331 | }, 332 | { 333 | "name": "ko", 334 | "baseName": "ko", 335 | "type": "string", 336 | "format": "" 337 | }, 338 | { 339 | "name": "lv", 340 | "baseName": "lv", 341 | "type": "string", 342 | "format": "" 343 | }, 344 | { 345 | "name": "lt", 346 | "baseName": "lt", 347 | "type": "string", 348 | "format": "" 349 | }, 350 | { 351 | "name": "ms", 352 | "baseName": "ms", 353 | "type": "string", 354 | "format": "" 355 | }, 356 | { 357 | "name": "nb", 358 | "baseName": "nb", 359 | "type": "string", 360 | "format": "" 361 | }, 362 | { 363 | "name": "pl", 364 | "baseName": "pl", 365 | "type": "string", 366 | "format": "" 367 | }, 368 | { 369 | "name": "fa", 370 | "baseName": "fa", 371 | "type": "string", 372 | "format": "" 373 | }, 374 | { 375 | "name": "pt", 376 | "baseName": "pt", 377 | "type": "string", 378 | "format": "" 379 | }, 380 | { 381 | "name": "pa", 382 | "baseName": "pa", 383 | "type": "string", 384 | "format": "" 385 | }, 386 | { 387 | "name": "ro", 388 | "baseName": "ro", 389 | "type": "string", 390 | "format": "" 391 | }, 392 | { 393 | "name": "ru", 394 | "baseName": "ru", 395 | "type": "string", 396 | "format": "" 397 | }, 398 | { 399 | "name": "sr", 400 | "baseName": "sr", 401 | "type": "string", 402 | "format": "" 403 | }, 404 | { 405 | "name": "sk", 406 | "baseName": "sk", 407 | "type": "string", 408 | "format": "" 409 | }, 410 | { 411 | "name": "es", 412 | "baseName": "es", 413 | "type": "string", 414 | "format": "" 415 | }, 416 | { 417 | "name": "sv", 418 | "baseName": "sv", 419 | "type": "string", 420 | "format": "" 421 | }, 422 | { 423 | "name": "th", 424 | "baseName": "th", 425 | "type": "string", 426 | "format": "" 427 | }, 428 | { 429 | "name": "tr", 430 | "baseName": "tr", 431 | "type": "string", 432 | "format": "" 433 | }, 434 | { 435 | "name": "uk", 436 | "baseName": "uk", 437 | "type": "string", 438 | "format": "" 439 | }, 440 | { 441 | "name": "vi", 442 | "baseName": "vi", 443 | "type": "string", 444 | "format": "" 445 | } ]; 446 | 447 | static getAttributeTypeMap() { 448 | return LanguageStringMap.attributeTypeMap; 449 | } 450 | 451 | public constructor() { 452 | } 453 | } 454 | 455 | -------------------------------------------------------------------------------- /models/NotificationAllOf.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class NotificationAllOf { 12 | /** 13 | * Channel: All Schedule notification for future delivery. API defaults to UTC -1100 Examples: All examples are the exact same date & time. \"Thu Sep 24 2015 14:00:00 GMT-0700 (PDT)\" \"September 24th 2015, 2:00:00 pm UTC-07:00\" \"2015-09-24 14:00:00 GMT-0700\" \"Sept 24 2015 14:00:00 GMT-0700\" \"Thu Sep 24 2015 14:00:00 GMT-0700 (Pacific Daylight Time)\" Note: SMS currently only supports send_after parameter. 14 | */ 15 | 'send_after'?: string; 16 | 17 | static readonly discriminator: string | undefined = undefined; 18 | 19 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 20 | { 21 | "name": "send_after", 22 | "baseName": "send_after", 23 | "type": "string", 24 | "format": "date-time" 25 | } ]; 26 | 27 | static getAttributeTypeMap() { 28 | return NotificationAllOf.attributeTypeMap; 29 | } 30 | 31 | public constructor() { 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /models/NotificationHistorySuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class NotificationHistorySuccessResponse { 12 | 'success'?: boolean; 13 | 'destination_url'?: string; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "success", 20 | "baseName": "success", 21 | "type": "boolean", 22 | "format": "" 23 | }, 24 | { 25 | "name": "destination_url", 26 | "baseName": "destination_url", 27 | "type": "string", 28 | "format": "" 29 | } ]; 30 | 31 | static getAttributeTypeMap() { 32 | return NotificationHistorySuccessResponse.attributeTypeMap; 33 | } 34 | 35 | public constructor() { 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /models/NotificationSlice.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { NotificationWithMeta } from './NotificationWithMeta'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class NotificationSlice { 13 | 'total_count'?: number; 14 | 'offset'?: number; 15 | 'limit'?: number; 16 | 'notifications'?: Array; 17 | 18 | static readonly discriminator: string | undefined = undefined; 19 | 20 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 21 | { 22 | "name": "total_count", 23 | "baseName": "total_count", 24 | "type": "number", 25 | "format": "" 26 | }, 27 | { 28 | "name": "offset", 29 | "baseName": "offset", 30 | "type": "number", 31 | "format": "" 32 | }, 33 | { 34 | "name": "limit", 35 | "baseName": "limit", 36 | "type": "number", 37 | "format": "" 38 | }, 39 | { 40 | "name": "notifications", 41 | "baseName": "notifications", 42 | "type": "Array", 43 | "format": "" 44 | } ]; 45 | 46 | static getAttributeTypeMap() { 47 | return NotificationSlice.attributeTypeMap; 48 | } 49 | 50 | public constructor() { 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /models/NotificationTarget.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { SegmentNotificationTarget } from './SegmentNotificationTarget'; 10 | import { SubscriptionNotificationTarget } from './SubscriptionNotificationTarget'; 11 | import { HttpFile } from '../http/http'; 12 | 13 | export class NotificationTarget { 14 | /** 15 | * The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] 16 | */ 17 | 'included_segments'?: Array; 18 | /** 19 | * Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] 20 | */ 21 | 'excluded_segments'?: Array; 22 | /** 23 | * 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 24 | */ 25 | 'include_subscription_ids'?: Array; 26 | /** 27 | * 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 28 | */ 29 | 'include_email_tokens'?: Array; 30 | /** 31 | * Recommended for Sending SMS - Target specific phone numbers. The phone number should be in the E.164 format. Phone number should be an existing subscriber on OneSignal. Refer our docs to learn how to add phone numbers to OneSignal. Example phone number: +1999999999 Limit of 2,000 entries per REST API call 32 | */ 33 | 'include_phone_numbers'?: Array; 34 | /** 35 | * 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 36 | */ 37 | 'include_ios_tokens'?: Array; 38 | /** 39 | * 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 40 | */ 41 | 'include_wp_wns_uris'?: Array; 42 | /** 43 | * 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 44 | */ 45 | 'include_amazon_reg_ids'?: Array; 46 | /** 47 | * 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 48 | */ 49 | 'include_chrome_reg_ids'?: Array; 50 | /** 51 | * 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 52 | */ 53 | 'include_chrome_web_reg_ids'?: Array; 54 | /** 55 | * 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 56 | */ 57 | 'include_android_reg_ids'?: Array; 58 | /** 59 | * 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. 60 | */ 61 | 'include_aliases'?: { [key: string]: Array; }; 62 | 'target_channel'?: NotificationTargetTargetChannelEnum; 63 | 64 | static readonly discriminator: string | undefined = undefined; 65 | 66 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 67 | { 68 | "name": "included_segments", 69 | "baseName": "included_segments", 70 | "type": "Array", 71 | "format": "" 72 | }, 73 | { 74 | "name": "excluded_segments", 75 | "baseName": "excluded_segments", 76 | "type": "Array", 77 | "format": "" 78 | }, 79 | { 80 | "name": "include_subscription_ids", 81 | "baseName": "include_subscription_ids", 82 | "type": "Array", 83 | "format": "" 84 | }, 85 | { 86 | "name": "include_email_tokens", 87 | "baseName": "include_email_tokens", 88 | "type": "Array", 89 | "format": "" 90 | }, 91 | { 92 | "name": "include_phone_numbers", 93 | "baseName": "include_phone_numbers", 94 | "type": "Array", 95 | "format": "" 96 | }, 97 | { 98 | "name": "include_ios_tokens", 99 | "baseName": "include_ios_tokens", 100 | "type": "Array", 101 | "format": "" 102 | }, 103 | { 104 | "name": "include_wp_wns_uris", 105 | "baseName": "include_wp_wns_uris", 106 | "type": "Array", 107 | "format": "" 108 | }, 109 | { 110 | "name": "include_amazon_reg_ids", 111 | "baseName": "include_amazon_reg_ids", 112 | "type": "Array", 113 | "format": "" 114 | }, 115 | { 116 | "name": "include_chrome_reg_ids", 117 | "baseName": "include_chrome_reg_ids", 118 | "type": "Array", 119 | "format": "" 120 | }, 121 | { 122 | "name": "include_chrome_web_reg_ids", 123 | "baseName": "include_chrome_web_reg_ids", 124 | "type": "Array", 125 | "format": "" 126 | }, 127 | { 128 | "name": "include_android_reg_ids", 129 | "baseName": "include_android_reg_ids", 130 | "type": "Array", 131 | "format": "" 132 | }, 133 | { 134 | "name": "include_aliases", 135 | "baseName": "include_aliases", 136 | "type": "{ [key: string]: Array; }", 137 | "format": "" 138 | }, 139 | { 140 | "name": "target_channel", 141 | "baseName": "target_channel", 142 | "type": "NotificationTargetTargetChannelEnum", 143 | "format": "" 144 | } ]; 145 | 146 | static getAttributeTypeMap() { 147 | return NotificationTarget.attributeTypeMap; 148 | } 149 | 150 | public constructor() { 151 | } 152 | } 153 | 154 | 155 | export type NotificationTargetTargetChannelEnum = "push" | "email" | "sms" ; 156 | 157 | -------------------------------------------------------------------------------- /models/NotificationWithMetaAllOf.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { PlatformDeliveryData } from './PlatformDeliveryData'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class NotificationWithMetaAllOf { 13 | /** 14 | * Number of notifications that have not been sent out yet. This can mean either our system is still processing the notification or you have delayed options set. 15 | */ 16 | 'remaining'?: number; 17 | /** 18 | * Number of notifications that were successfully delivered. 19 | */ 20 | 'successful'?: number; 21 | /** 22 | * Number of notifications that could not be delivered due to those devices being unsubscribed. 23 | */ 24 | 'failed'?: number; 25 | /** 26 | * Number of notifications that could not be delivered due to an error. You can find more information by viewing the notification in the dashboard. 27 | */ 28 | 'errored'?: number; 29 | /** 30 | * Number of users who have clicked / tapped on your notification. 31 | */ 32 | 'converted'?: number; 33 | /** 34 | * Unix timestamp indicating when the notification was created. 35 | */ 36 | 'queued_at'?: number; 37 | /** 38 | * Unix timestamp indicating when notification delivery should begin. 39 | */ 40 | 'send_after'?: number; 41 | /** 42 | * Unix timestamp indicating when notification delivery completed. The delivery duration from start to finish can be calculated with completed_at - send_after. 43 | */ 44 | 'completed_at'?: number; 45 | 'platform_delivery_stats'?: PlatformDeliveryData; 46 | /** 47 | * Confirmed Deliveries number of devices that received the push notification. Paid Feature Only. Free accounts will see 0. 48 | */ 49 | 'received'?: number; 50 | /** 51 | * number of push notifications sent per minute. Paid Feature Only. If throttling is not enabled for the app or the notification, and for free accounts, null is returned. Refer to Throttling for more details. 52 | */ 53 | 'throttle_rate_per_minute'?: number; 54 | 55 | static readonly discriminator: string | undefined = undefined; 56 | 57 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 58 | { 59 | "name": "remaining", 60 | "baseName": "remaining", 61 | "type": "number", 62 | "format": "" 63 | }, 64 | { 65 | "name": "successful", 66 | "baseName": "successful", 67 | "type": "number", 68 | "format": "" 69 | }, 70 | { 71 | "name": "failed", 72 | "baseName": "failed", 73 | "type": "number", 74 | "format": "" 75 | }, 76 | { 77 | "name": "errored", 78 | "baseName": "errored", 79 | "type": "number", 80 | "format": "" 81 | }, 82 | { 83 | "name": "converted", 84 | "baseName": "converted", 85 | "type": "number", 86 | "format": "" 87 | }, 88 | { 89 | "name": "queued_at", 90 | "baseName": "queued_at", 91 | "type": "number", 92 | "format": "int64" 93 | }, 94 | { 95 | "name": "send_after", 96 | "baseName": "send_after", 97 | "type": "number", 98 | "format": "int64" 99 | }, 100 | { 101 | "name": "completed_at", 102 | "baseName": "completed_at", 103 | "type": "number", 104 | "format": "int64" 105 | }, 106 | { 107 | "name": "platform_delivery_stats", 108 | "baseName": "platform_delivery_stats", 109 | "type": "PlatformDeliveryData", 110 | "format": "" 111 | }, 112 | { 113 | "name": "received", 114 | "baseName": "received", 115 | "type": "number", 116 | "format": "" 117 | }, 118 | { 119 | "name": "throttle_rate_per_minute", 120 | "baseName": "throttle_rate_per_minute", 121 | "type": "number", 122 | "format": "" 123 | } ]; 124 | 125 | static getAttributeTypeMap() { 126 | return NotificationWithMetaAllOf.attributeTypeMap; 127 | } 128 | 129 | public constructor() { 130 | } 131 | } 132 | 133 | -------------------------------------------------------------------------------- /models/ObjectSerializer.ts: -------------------------------------------------------------------------------- 1 | export * from './App'; 2 | export * from './BasicNotification'; 3 | export * from './BasicNotificationAllOf'; 4 | export * from './BasicNotificationAllOfAndroidBackgroundLayout'; 5 | export * from './Button'; 6 | export * from './CreateNotificationSuccessResponse'; 7 | export * from './CreateSegmentConflictResponse'; 8 | export * from './CreateSegmentSuccessResponse'; 9 | export * from './CreateUserConflictResponse'; 10 | export * from './CreateUserConflictResponseErrorsInner'; 11 | export * from './CreateUserConflictResponseErrorsItemsMeta'; 12 | export * from './DeliveryData'; 13 | export * from './ExportEventsSuccessResponse'; 14 | export * from './ExportSubscriptionsRequestBody'; 15 | export * from './ExportSubscriptionsSuccessResponse'; 16 | export * from './Filter'; 17 | export * from './FilterExpression'; 18 | export * from './GenericError'; 19 | export * from './GenericSuccessBoolResponse'; 20 | export * from './GetNotificationHistoryRequestBody'; 21 | export * from './GetSegmentsSuccessResponse'; 22 | export * from './LanguageStringMap'; 23 | export * from './Notification'; 24 | export * from './NotificationAllOf'; 25 | export * from './NotificationHistorySuccessResponse'; 26 | export * from './NotificationSlice'; 27 | export * from './NotificationTarget'; 28 | export * from './NotificationWithMeta'; 29 | export * from './NotificationWithMetaAllOf'; 30 | export * from './Operator'; 31 | export * from './OutcomeData'; 32 | export * from './OutcomesData'; 33 | export * from './PlatformDeliveryData'; 34 | export * from './PlatformDeliveryDataEmailAllOf'; 35 | export * from './PlatformDeliveryDataSmsAllOf'; 36 | export * from './PropertiesBody'; 37 | export * from './PropertiesDeltas'; 38 | export * from './PropertiesObject'; 39 | export * from './Purchase'; 40 | export * from './RateLimitError'; 41 | export * from './Segment'; 42 | export * from './SegmentData'; 43 | export * from './SegmentNotificationTarget'; 44 | export * from './Subscription'; 45 | export * from './SubscriptionBody'; 46 | export * from './SubscriptionNotificationTarget'; 47 | export * from './TransferSubscriptionRequestBody'; 48 | export * from './UpdateLiveActivityRequest'; 49 | export * from './UpdateLiveActivitySuccessResponse'; 50 | export * from './UpdateUserRequest'; 51 | export * from './User'; 52 | export * from './UserIdentityBody'; 53 | export * from './WebButton'; 54 | 55 | import { App , AppApnsEnvEnum } from './App'; 56 | import { BasicNotification , BasicNotificationTargetChannelEnum , BasicNotificationAggregationEnum } from './BasicNotification'; 57 | import { BasicNotificationAllOf , BasicNotificationAllOfAggregationEnum } from './BasicNotificationAllOf'; 58 | import { BasicNotificationAllOfAndroidBackgroundLayout } from './BasicNotificationAllOfAndroidBackgroundLayout'; 59 | import { Button } from './Button'; 60 | import { CreateNotificationSuccessResponse } from './CreateNotificationSuccessResponse'; 61 | import { CreateSegmentConflictResponse } from './CreateSegmentConflictResponse'; 62 | import { CreateSegmentSuccessResponse } from './CreateSegmentSuccessResponse'; 63 | import { CreateUserConflictResponse } from './CreateUserConflictResponse'; 64 | import { CreateUserConflictResponseErrorsInner } from './CreateUserConflictResponseErrorsInner'; 65 | import { CreateUserConflictResponseErrorsItemsMeta } from './CreateUserConflictResponseErrorsItemsMeta'; 66 | import { DeliveryData } from './DeliveryData'; 67 | import { ExportEventsSuccessResponse } from './ExportEventsSuccessResponse'; 68 | import { ExportSubscriptionsRequestBody } from './ExportSubscriptionsRequestBody'; 69 | import { ExportSubscriptionsSuccessResponse } from './ExportSubscriptionsSuccessResponse'; 70 | import { Filter , FilterRelationEnum } from './Filter'; 71 | import { FilterExpression , FilterExpressionRelationEnum , FilterExpressionOperatorEnum } from './FilterExpression'; 72 | import { GenericError } from './GenericError'; 73 | import { GenericSuccessBoolResponse } from './GenericSuccessBoolResponse'; 74 | import { GetNotificationHistoryRequestBody, GetNotificationHistoryRequestBodyEventsEnum } from './GetNotificationHistoryRequestBody'; 75 | import { GetSegmentsSuccessResponse } from './GetSegmentsSuccessResponse'; 76 | import { LanguageStringMap } from './LanguageStringMap'; 77 | import { Notification , NotificationTargetChannelEnum , NotificationAggregationEnum } from './Notification'; 78 | import { NotificationAllOf } from './NotificationAllOf'; 79 | import { NotificationHistorySuccessResponse } from './NotificationHistorySuccessResponse'; 80 | import { NotificationSlice } from './NotificationSlice'; 81 | import { NotificationTarget , NotificationTargetTargetChannelEnum } from './NotificationTarget'; 82 | import { NotificationWithMeta , NotificationWithMetaTargetChannelEnum , NotificationWithMetaAggregationEnum } from './NotificationWithMeta'; 83 | import { NotificationWithMetaAllOf } from './NotificationWithMetaAllOf'; 84 | import { Operator, OperatorOperatorEnum } from './Operator'; 85 | import { OutcomeData , OutcomeDataAggregationEnum } from './OutcomeData'; 86 | import { OutcomesData } from './OutcomesData'; 87 | import { PlatformDeliveryData } from './PlatformDeliveryData'; 88 | import { PlatformDeliveryDataEmailAllOf } from './PlatformDeliveryDataEmailAllOf'; 89 | import { PlatformDeliveryDataSmsAllOf } from './PlatformDeliveryDataSmsAllOf'; 90 | import { PropertiesBody } from './PropertiesBody'; 91 | import { PropertiesDeltas } from './PropertiesDeltas'; 92 | import { PropertiesObject } from './PropertiesObject'; 93 | import { Purchase } from './Purchase'; 94 | import { RateLimitError } from './RateLimitError'; 95 | import { Segment } from './Segment'; 96 | import { SegmentData } from './SegmentData'; 97 | import { SegmentNotificationTarget } from './SegmentNotificationTarget'; 98 | import { Subscription , SubscriptionTypeEnum } from './Subscription'; 99 | import { SubscriptionBody } from './SubscriptionBody'; 100 | import { SubscriptionNotificationTarget , SubscriptionNotificationTargetTargetChannelEnum } from './SubscriptionNotificationTarget'; 101 | import { TransferSubscriptionRequestBody } from './TransferSubscriptionRequestBody'; 102 | import { UpdateLiveActivityRequest , UpdateLiveActivityRequestEventEnum } from './UpdateLiveActivityRequest'; 103 | import { UpdateLiveActivitySuccessResponse } from './UpdateLiveActivitySuccessResponse'; 104 | import { UpdateUserRequest } from './UpdateUserRequest'; 105 | import { User } from './User'; 106 | import { UserIdentityBody } from './UserIdentityBody'; 107 | import { WebButton } from './WebButton'; 108 | 109 | /* tslint:disable:no-unused-variable */ 110 | let primitives = [ 111 | "string", 112 | "boolean", 113 | "double", 114 | "integer", 115 | "long", 116 | "float", 117 | "number", 118 | "any" 119 | ]; 120 | 121 | const supportedMediaTypes: { [mediaType: string]: number } = { 122 | "application/json": Infinity, 123 | "application/octet-stream": 0, 124 | "application/x-www-form-urlencoded": 0 125 | } 126 | 127 | 128 | let enumsMap: Set = new Set([ 129 | "AppApnsEnvEnum", 130 | "BasicNotificationTargetChannelEnum", 131 | "BasicNotificationAggregationEnum", 132 | "BasicNotificationAllOfAggregationEnum", 133 | "FilterRelationEnum", 134 | "FilterExpressionRelationEnum", 135 | "FilterExpressionOperatorEnum", 136 | "GetNotificationHistoryRequestBodyEventsEnum", 137 | "NotificationTargetChannelEnum", 138 | "NotificationAggregationEnum", 139 | "NotificationTargetTargetChannelEnum", 140 | "NotificationWithMetaTargetChannelEnum", 141 | "NotificationWithMetaAggregationEnum", 142 | "OperatorOperatorEnum", 143 | "OutcomeDataAggregationEnum", 144 | "SubscriptionTypeEnum", 145 | "SubscriptionNotificationTargetTargetChannelEnum", 146 | "UpdateLiveActivityRequestEventEnum", 147 | ]); 148 | 149 | let typeMap: {[index: string]: any} = { 150 | "App": App, 151 | "BasicNotification": BasicNotification, 152 | "BasicNotificationAllOf": BasicNotificationAllOf, 153 | "BasicNotificationAllOfAndroidBackgroundLayout": BasicNotificationAllOfAndroidBackgroundLayout, 154 | "Button": Button, 155 | "CreateNotificationSuccessResponse": CreateNotificationSuccessResponse, 156 | "CreateSegmentConflictResponse": CreateSegmentConflictResponse, 157 | "CreateSegmentSuccessResponse": CreateSegmentSuccessResponse, 158 | "CreateUserConflictResponse": CreateUserConflictResponse, 159 | "CreateUserConflictResponseErrorsInner": CreateUserConflictResponseErrorsInner, 160 | "CreateUserConflictResponseErrorsItemsMeta": CreateUserConflictResponseErrorsItemsMeta, 161 | "DeliveryData": DeliveryData, 162 | "ExportEventsSuccessResponse": ExportEventsSuccessResponse, 163 | "ExportSubscriptionsRequestBody": ExportSubscriptionsRequestBody, 164 | "ExportSubscriptionsSuccessResponse": ExportSubscriptionsSuccessResponse, 165 | "Filter": Filter, 166 | "FilterExpression": FilterExpression, 167 | "GenericError": GenericError, 168 | "GenericSuccessBoolResponse": GenericSuccessBoolResponse, 169 | "GetNotificationHistoryRequestBody": GetNotificationHistoryRequestBody, 170 | "GetSegmentsSuccessResponse": GetSegmentsSuccessResponse, 171 | "LanguageStringMap": LanguageStringMap, 172 | "Notification": Notification, 173 | "NotificationAllOf": NotificationAllOf, 174 | "NotificationHistorySuccessResponse": NotificationHistorySuccessResponse, 175 | "NotificationSlice": NotificationSlice, 176 | "NotificationTarget": NotificationTarget, 177 | "NotificationWithMeta": NotificationWithMeta, 178 | "NotificationWithMetaAllOf": NotificationWithMetaAllOf, 179 | "Operator": Operator, 180 | "OutcomeData": OutcomeData, 181 | "OutcomesData": OutcomesData, 182 | "PlatformDeliveryData": PlatformDeliveryData, 183 | "PlatformDeliveryDataEmailAllOf": PlatformDeliveryDataEmailAllOf, 184 | "PlatformDeliveryDataSmsAllOf": PlatformDeliveryDataSmsAllOf, 185 | "PropertiesBody": PropertiesBody, 186 | "PropertiesDeltas": PropertiesDeltas, 187 | "PropertiesObject": PropertiesObject, 188 | "Purchase": Purchase, 189 | "RateLimitError": RateLimitError, 190 | "Segment": Segment, 191 | "SegmentData": SegmentData, 192 | "SegmentNotificationTarget": SegmentNotificationTarget, 193 | "Subscription": Subscription, 194 | "SubscriptionBody": SubscriptionBody, 195 | "SubscriptionNotificationTarget": SubscriptionNotificationTarget, 196 | "TransferSubscriptionRequestBody": TransferSubscriptionRequestBody, 197 | "UpdateLiveActivityRequest": UpdateLiveActivityRequest, 198 | "UpdateLiveActivitySuccessResponse": UpdateLiveActivitySuccessResponse, 199 | "UpdateUserRequest": UpdateUserRequest, 200 | "User": User, 201 | "UserIdentityBody": UserIdentityBody, 202 | "WebButton": WebButton, 203 | } 204 | 205 | export class ObjectSerializer { 206 | public static findCorrectType(data: any, expectedType: string) { 207 | if (data == undefined) { 208 | return expectedType; 209 | } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { 210 | return expectedType; 211 | } else if (expectedType === "Date") { 212 | return expectedType; 213 | } else { 214 | if (enumsMap.has(expectedType)) { 215 | return expectedType; 216 | } 217 | 218 | if (!typeMap[expectedType]) { 219 | return expectedType; // w/e we don't know the type 220 | } 221 | 222 | // Check the discriminator 223 | let discriminatorProperty = typeMap[expectedType].discriminator; 224 | if (discriminatorProperty == null) { 225 | return expectedType; // the type does not have a discriminator. use it. 226 | } else { 227 | if (data[discriminatorProperty]) { 228 | var discriminatorType = data[discriminatorProperty]; 229 | if(typeMap[discriminatorType]){ 230 | return discriminatorType; // use the type given in the discriminator 231 | } else { 232 | return expectedType; // discriminator did not map to a type 233 | } 234 | } else { 235 | return expectedType; // discriminator was not present (or an empty string) 236 | } 237 | } 238 | } 239 | } 240 | 241 | public static serialize(data: any, type: string, format: string) { 242 | if (data == undefined) { 243 | return data; 244 | } else if (primitives.indexOf(type.toLowerCase()) !== -1) { 245 | return data; 246 | } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 247 | let subType: string = type.replace("Array<", ""); // Array => Type> 248 | subType = subType.substring(0, subType.length - 1); // Type> => Type 249 | let transformedData: any[] = []; 250 | for (let index in data) { 251 | let date = data[index]; 252 | transformedData.push(ObjectSerializer.serialize(date, subType, format)); 253 | } 254 | return transformedData; 255 | } else if (type === "Date") { 256 | if (format == "date") { 257 | let month = data.getMonth()+1 258 | month = month < 10 ? "0" + month.toString() : month.toString() 259 | let day = data.getDate(); 260 | day = day < 10 ? "0" + day.toString() : day.toString(); 261 | 262 | return data.getFullYear() + "-" + month + "-" + day; 263 | } else { 264 | return data.toISOString(); 265 | } 266 | } else { 267 | if (enumsMap.has(type)) { 268 | return data; 269 | } 270 | if (!typeMap[type]) { // in case we dont know the type 271 | return data; 272 | } 273 | 274 | // Get the actual type of this object 275 | type = this.findCorrectType(data, type); 276 | 277 | // get the map for the correct type. 278 | let attributeTypes = typeMap[type].getAttributeTypeMap(); 279 | let instance: {[index: string]: any} = {}; 280 | for (let index in attributeTypes) { 281 | let attributeType = attributeTypes[index]; 282 | instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); 283 | } 284 | return instance; 285 | } 286 | } 287 | 288 | public static deserialize(data: any, type: string, format: string) { 289 | // polymorphism may change the actual type. 290 | type = ObjectSerializer.findCorrectType(data, type); 291 | if (data == undefined) { 292 | return data; 293 | } else if (primitives.indexOf(type.toLowerCase()) !== -1) { 294 | return data; 295 | } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 296 | let subType: string = type.replace("Array<", ""); // Array => Type> 297 | subType = subType.substring(0, subType.length - 1); // Type> => Type 298 | let transformedData: any[] = []; 299 | for (let index in data) { 300 | let date = data[index]; 301 | transformedData.push(ObjectSerializer.deserialize(date, subType, format)); 302 | } 303 | return transformedData; 304 | } else if (type === "Date") { 305 | return new Date(data); 306 | } else { 307 | if (enumsMap.has(type)) {// is Enum 308 | return data; 309 | } 310 | 311 | if (!typeMap[type]) { // dont know the type 312 | return data; 313 | } 314 | let instance = new typeMap[type](); 315 | let attributeTypes = typeMap[type].getAttributeTypeMap(); 316 | for (let index in attributeTypes) { 317 | let attributeType = attributeTypes[index]; 318 | let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); 319 | if (value !== undefined) { 320 | instance[attributeType.name] = value; 321 | } 322 | } 323 | return instance; 324 | } 325 | } 326 | 327 | 328 | /** 329 | * Normalize media type 330 | * 331 | * We currently do not handle any media types attributes, i.e. anything 332 | * after a semicolon. All content is assumed to be UTF-8 compatible. 333 | */ 334 | public static normalizeMediaType(mediaType: string | undefined): string | undefined { 335 | if (mediaType === undefined) { 336 | return undefined; 337 | } 338 | return mediaType.split(";")[0].trim().toLowerCase(); 339 | } 340 | 341 | /** 342 | * From a list of possible media types, choose the one we can handle best. 343 | * 344 | * The order of the given media types does not have any impact on the choice 345 | * made. 346 | */ 347 | public static getPreferredMediaType(mediaTypes: Array): string { 348 | /** According to OAS 3 we should default to json */ 349 | if (!mediaTypes) { 350 | return "application/json"; 351 | } 352 | 353 | const normalMediaTypes = mediaTypes.map(this.normalizeMediaType); 354 | let selectedMediaType: string | undefined = undefined; 355 | let selectedRank: number = -Infinity; 356 | for (const mediaType of normalMediaTypes) { 357 | if (supportedMediaTypes[mediaType!] > selectedRank) { 358 | selectedMediaType = mediaType; 359 | selectedRank = supportedMediaTypes[mediaType!]; 360 | } 361 | } 362 | 363 | if (selectedMediaType === undefined) { 364 | throw new Error("None of the given media types are supported: " + mediaTypes.join(", ")); 365 | } 366 | 367 | return selectedMediaType!; 368 | } 369 | 370 | /** 371 | * Convert data to a string according the given media type 372 | */ 373 | public static stringify(data: any, mediaType: string): string { 374 | if (mediaType === "application/json") { 375 | return JSON.stringify(data); 376 | } 377 | 378 | throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.stringify."); 379 | } 380 | 381 | /** 382 | * Parse data from a string according to the given media type 383 | */ 384 | public static parse(rawData: string, mediaType: string | undefined) { 385 | if (mediaType === undefined) { 386 | throw new Error("Cannot parse content. No Content-Type defined."); 387 | } 388 | 389 | if (mediaType === "application/json") { 390 | return JSON.parse(rawData); 391 | } 392 | 393 | throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse."); 394 | } 395 | } 396 | -------------------------------------------------------------------------------- /models/Operator.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class Operator { 12 | /** 13 | * Strictly, this must be either `\"OR\"`, or `\"AND\"`. It can be used to compose Filters as part of a Filters object. 14 | */ 15 | 'operator'?: OperatorOperatorEnum; 16 | 17 | static readonly discriminator: string | undefined = undefined; 18 | 19 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 20 | { 21 | "name": "operator", 22 | "baseName": "operator", 23 | "type": "OperatorOperatorEnum", 24 | "format": "" 25 | } ]; 26 | 27 | static getAttributeTypeMap() { 28 | return Operator.attributeTypeMap; 29 | } 30 | 31 | public constructor() { 32 | } 33 | } 34 | 35 | 36 | export type OperatorOperatorEnum = "OR" | "AND" ; 37 | 38 | -------------------------------------------------------------------------------- /models/OutcomeData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class OutcomeData { 12 | 'id': string; 13 | 'value': number; 14 | 'aggregation': OutcomeDataAggregationEnum; 15 | 16 | static readonly discriminator: string | undefined = undefined; 17 | 18 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 19 | { 20 | "name": "id", 21 | "baseName": "id", 22 | "type": "string", 23 | "format": "" 24 | }, 25 | { 26 | "name": "value", 27 | "baseName": "value", 28 | "type": "number", 29 | "format": "" 30 | }, 31 | { 32 | "name": "aggregation", 33 | "baseName": "aggregation", 34 | "type": "OutcomeDataAggregationEnum", 35 | "format": "" 36 | } ]; 37 | 38 | static getAttributeTypeMap() { 39 | return OutcomeData.attributeTypeMap; 40 | } 41 | 42 | public constructor() { 43 | } 44 | } 45 | 46 | 47 | export type OutcomeDataAggregationEnum = "sum" | "count" ; 48 | 49 | -------------------------------------------------------------------------------- /models/OutcomesData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { OutcomeData } from './OutcomeData'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class OutcomesData { 13 | 'outcomes'?: Array; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "outcomes", 20 | "baseName": "outcomes", 21 | "type": "Array", 22 | "format": "" 23 | } ]; 24 | 25 | static getAttributeTypeMap() { 26 | return OutcomesData.attributeTypeMap; 27 | } 28 | 29 | public constructor() { 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /models/PlatformDeliveryData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { DeliveryData } from './DeliveryData'; 10 | import { PlatformDeliveryDataEmailAllOf } from './PlatformDeliveryDataEmailAllOf'; 11 | import { PlatformDeliveryDataSmsAllOf } from './PlatformDeliveryDataSmsAllOf'; 12 | import { HttpFile } from '../http/http'; 13 | 14 | /** 15 | * Hash of delivery statistics broken out by target device platform. 16 | */ 17 | export class PlatformDeliveryData { 18 | 'edge_web_push'?: DeliveryData; 19 | 'chrome_web_push'?: DeliveryData; 20 | 'firefox_web_push'?: DeliveryData; 21 | 'safari_web_push'?: DeliveryData; 22 | 'android'?: DeliveryData; 23 | 'ios'?: DeliveryData; 24 | 'sms'?: DeliveryData & PlatformDeliveryDataSmsAllOf; 25 | 'email'?: DeliveryData & PlatformDeliveryDataEmailAllOf; 26 | 27 | static readonly discriminator: string | undefined = undefined; 28 | 29 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 30 | { 31 | "name": "edge_web_push", 32 | "baseName": "edge_web_push", 33 | "type": "DeliveryData", 34 | "format": "" 35 | }, 36 | { 37 | "name": "chrome_web_push", 38 | "baseName": "chrome_web_push", 39 | "type": "DeliveryData", 40 | "format": "" 41 | }, 42 | { 43 | "name": "firefox_web_push", 44 | "baseName": "firefox_web_push", 45 | "type": "DeliveryData", 46 | "format": "" 47 | }, 48 | { 49 | "name": "safari_web_push", 50 | "baseName": "safari_web_push", 51 | "type": "DeliveryData", 52 | "format": "" 53 | }, 54 | { 55 | "name": "android", 56 | "baseName": "android", 57 | "type": "DeliveryData", 58 | "format": "" 59 | }, 60 | { 61 | "name": "ios", 62 | "baseName": "ios", 63 | "type": "DeliveryData", 64 | "format": "" 65 | }, 66 | { 67 | "name": "sms", 68 | "baseName": "sms", 69 | "type": "DeliveryData & PlatformDeliveryDataSmsAllOf", 70 | "format": "" 71 | }, 72 | { 73 | "name": "email", 74 | "baseName": "email", 75 | "type": "DeliveryData & PlatformDeliveryDataEmailAllOf", 76 | "format": "" 77 | } ]; 78 | 79 | static getAttributeTypeMap() { 80 | return PlatformDeliveryData.attributeTypeMap; 81 | } 82 | 83 | public constructor() { 84 | } 85 | } 86 | 87 | -------------------------------------------------------------------------------- /models/PlatformDeliveryDataEmailAllOf.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class PlatformDeliveryDataEmailAllOf { 12 | /** 13 | * Number of times an email has been opened. 14 | */ 15 | 'opened'?: number; 16 | /** 17 | * Number of unique recipients who have opened your email. 18 | */ 19 | 'unique_opens'?: number; 20 | /** 21 | * Number of clicked links from your email. This can include the recipient clicking email links multiple times. 22 | */ 23 | 'clicks'?: number; 24 | /** 25 | * Number of unique clicks that your recipients have made on links from your email. 26 | */ 27 | 'unique_clicks'?: number; 28 | /** 29 | * Number of recipients who registered as a hard or soft bounce and didn\'t receive your email. 30 | */ 31 | 'bounced'?: number; 32 | /** 33 | * Number of recipients who reported this email as spam. 34 | */ 35 | 'reported_spam'?: number; 36 | /** 37 | * Number of recipients who opted out of your emails using the unsubscribe link in this email. 38 | */ 39 | 'unsubscribed'?: number; 40 | 41 | static readonly discriminator: string | undefined = undefined; 42 | 43 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 44 | { 45 | "name": "opened", 46 | "baseName": "opened", 47 | "type": "number", 48 | "format": "" 49 | }, 50 | { 51 | "name": "unique_opens", 52 | "baseName": "unique_opens", 53 | "type": "number", 54 | "format": "" 55 | }, 56 | { 57 | "name": "clicks", 58 | "baseName": "clicks", 59 | "type": "number", 60 | "format": "" 61 | }, 62 | { 63 | "name": "unique_clicks", 64 | "baseName": "unique_clicks", 65 | "type": "number", 66 | "format": "" 67 | }, 68 | { 69 | "name": "bounced", 70 | "baseName": "bounced", 71 | "type": "number", 72 | "format": "" 73 | }, 74 | { 75 | "name": "reported_spam", 76 | "baseName": "reported_spam", 77 | "type": "number", 78 | "format": "" 79 | }, 80 | { 81 | "name": "unsubscribed", 82 | "baseName": "unsubscribed", 83 | "type": "number", 84 | "format": "" 85 | } ]; 86 | 87 | static getAttributeTypeMap() { 88 | return PlatformDeliveryDataEmailAllOf.attributeTypeMap; 89 | } 90 | 91 | public constructor() { 92 | } 93 | } 94 | 95 | -------------------------------------------------------------------------------- /models/PlatformDeliveryDataSmsAllOf.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class PlatformDeliveryDataSmsAllOf { 12 | /** 13 | * Number of messages reported as delivered successfully by the SMS service provider. 14 | */ 15 | 'provider_successful'?: number; 16 | /** 17 | * Number of recipients who didn\'t receive your message as reported by the SMS service provider. 18 | */ 19 | 'provider_failed'?: number; 20 | /** 21 | * Number of errors reported by the SMS service provider. 22 | */ 23 | 'provider_errored'?: number; 24 | 25 | static readonly discriminator: string | undefined = undefined; 26 | 27 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 28 | { 29 | "name": "provider_successful", 30 | "baseName": "provider_successful", 31 | "type": "number", 32 | "format": "" 33 | }, 34 | { 35 | "name": "provider_failed", 36 | "baseName": "provider_failed", 37 | "type": "number", 38 | "format": "" 39 | }, 40 | { 41 | "name": "provider_errored", 42 | "baseName": "provider_errored", 43 | "type": "number", 44 | "format": "" 45 | } ]; 46 | 47 | static getAttributeTypeMap() { 48 | return PlatformDeliveryDataSmsAllOf.attributeTypeMap; 49 | } 50 | 51 | public constructor() { 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /models/PropertiesBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { PropertiesObject } from './PropertiesObject'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class PropertiesBody { 13 | 'properties'?: PropertiesObject; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "properties", 20 | "baseName": "properties", 21 | "type": "PropertiesObject", 22 | "format": "" 23 | } ]; 24 | 25 | static getAttributeTypeMap() { 26 | return PropertiesBody.attributeTypeMap; 27 | } 28 | 29 | public constructor() { 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /models/PropertiesDeltas.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { Purchase } from './Purchase'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class PropertiesDeltas { 13 | 'session_time'?: number; 14 | 'session_count'?: number; 15 | 'purchases'?: Array; 16 | 17 | static readonly discriminator: string | undefined = undefined; 18 | 19 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 20 | { 21 | "name": "session_time", 22 | "baseName": "session_time", 23 | "type": "number", 24 | "format": "" 25 | }, 26 | { 27 | "name": "session_count", 28 | "baseName": "session_count", 29 | "type": "number", 30 | "format": "" 31 | }, 32 | { 33 | "name": "purchases", 34 | "baseName": "purchases", 35 | "type": "Array", 36 | "format": "" 37 | } ]; 38 | 39 | static getAttributeTypeMap() { 40 | return PropertiesDeltas.attributeTypeMap; 41 | } 42 | 43 | public constructor() { 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /models/PropertiesObject.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { Purchase } from './Purchase'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class PropertiesObject { 13 | 'tags'?: { [key: string]: any; }; 14 | 'language'?: string; 15 | 'timezone_id'?: string; 16 | 'lat'?: number; 17 | 'long'?: number; 18 | 'country'?: string; 19 | 'first_active'?: number; 20 | 'last_active'?: number; 21 | 'amount_spent'?: number; 22 | 'purchases'?: Array; 23 | 'ip'?: string; 24 | 25 | static readonly discriminator: string | undefined = undefined; 26 | 27 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 28 | { 29 | "name": "tags", 30 | "baseName": "tags", 31 | "type": "{ [key: string]: any; }", 32 | "format": "" 33 | }, 34 | { 35 | "name": "language", 36 | "baseName": "language", 37 | "type": "string", 38 | "format": "" 39 | }, 40 | { 41 | "name": "timezone_id", 42 | "baseName": "timezone_id", 43 | "type": "string", 44 | "format": "" 45 | }, 46 | { 47 | "name": "lat", 48 | "baseName": "lat", 49 | "type": "number", 50 | "format": "" 51 | }, 52 | { 53 | "name": "long", 54 | "baseName": "long", 55 | "type": "number", 56 | "format": "" 57 | }, 58 | { 59 | "name": "country", 60 | "baseName": "country", 61 | "type": "string", 62 | "format": "" 63 | }, 64 | { 65 | "name": "first_active", 66 | "baseName": "first_active", 67 | "type": "number", 68 | "format": "" 69 | }, 70 | { 71 | "name": "last_active", 72 | "baseName": "last_active", 73 | "type": "number", 74 | "format": "" 75 | }, 76 | { 77 | "name": "amount_spent", 78 | "baseName": "amount_spent", 79 | "type": "number", 80 | "format": "" 81 | }, 82 | { 83 | "name": "purchases", 84 | "baseName": "purchases", 85 | "type": "Array", 86 | "format": "" 87 | }, 88 | { 89 | "name": "ip", 90 | "baseName": "ip", 91 | "type": "string", 92 | "format": "" 93 | } ]; 94 | 95 | static getAttributeTypeMap() { 96 | return PropertiesObject.attributeTypeMap; 97 | } 98 | 99 | public constructor() { 100 | } 101 | } 102 | 103 | -------------------------------------------------------------------------------- /models/Purchase.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class Purchase { 12 | /** 13 | * The unique identifier of the purchased item. 14 | */ 15 | 'sku': string; 16 | /** 17 | * The amount, in USD, spent purchasing the item. 18 | */ 19 | 'amount': string; 20 | /** 21 | * The 3-letter ISO 4217 currency code. Required for correct storage and conversion of amount. 22 | */ 23 | 'iso': string; 24 | 'count'?: number; 25 | 26 | static readonly discriminator: string | undefined = undefined; 27 | 28 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 29 | { 30 | "name": "sku", 31 | "baseName": "sku", 32 | "type": "string", 33 | "format": "" 34 | }, 35 | { 36 | "name": "amount", 37 | "baseName": "amount", 38 | "type": "string", 39 | "format": "" 40 | }, 41 | { 42 | "name": "iso", 43 | "baseName": "iso", 44 | "type": "string", 45 | "format": "" 46 | }, 47 | { 48 | "name": "count", 49 | "baseName": "count", 50 | "type": "number", 51 | "format": "" 52 | } ]; 53 | 54 | static getAttributeTypeMap() { 55 | return Purchase.attributeTypeMap; 56 | } 57 | 58 | public constructor() { 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /models/RateLimitError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class RateLimitError { 12 | 'errors'?: Array; 13 | 'limit'?: string; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "errors", 20 | "baseName": "errors", 21 | "type": "Array", 22 | "format": "" 23 | }, 24 | { 25 | "name": "limit", 26 | "baseName": "limit", 27 | "type": "string", 28 | "format": "" 29 | } ]; 30 | 31 | static getAttributeTypeMap() { 32 | return RateLimitError.attributeTypeMap; 33 | } 34 | 35 | public constructor() { 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /models/Segment.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { FilterExpression } from './FilterExpression'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class Segment { 13 | /** 14 | * UUID of the segment. If left empty, it will be assigned automaticaly. 15 | */ 16 | 'id'?: string; 17 | /** 18 | * Name of the segment. You\'ll see this name on the Web UI. 19 | */ 20 | 'name': string; 21 | /** 22 | * Filter or operators the segment will have. For a list of available filters with details, please see Send to Users Based on Filters. 23 | */ 24 | 'filters': Array; 25 | 26 | static readonly discriminator: string | undefined = undefined; 27 | 28 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 29 | { 30 | "name": "id", 31 | "baseName": "id", 32 | "type": "string", 33 | "format": "" 34 | }, 35 | { 36 | "name": "name", 37 | "baseName": "name", 38 | "type": "string", 39 | "format": "" 40 | }, 41 | { 42 | "name": "filters", 43 | "baseName": "filters", 44 | "type": "Array", 45 | "format": "" 46 | } ]; 47 | 48 | static getAttributeTypeMap() { 49 | return Segment.attributeTypeMap; 50 | } 51 | 52 | public constructor() { 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /models/SegmentData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class SegmentData { 12 | /** 13 | * The segment ID 14 | */ 15 | 'id'?: string; 16 | /** 17 | * The segment name 18 | */ 19 | 'name'?: string; 20 | /** 21 | * Date segment created 22 | */ 23 | 'created_at'?: string; 24 | /** 25 | * Date segment last updated 26 | */ 27 | 'updated_at'?: string; 28 | /** 29 | * The app id 30 | */ 31 | 'app_id'?: string; 32 | /** 33 | * Is the segment read only? 34 | */ 35 | 'read_only'?: boolean; 36 | /** 37 | * Is the segment active? 38 | */ 39 | 'is_active'?: boolean; 40 | 41 | static readonly discriminator: string | undefined = undefined; 42 | 43 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 44 | { 45 | "name": "id", 46 | "baseName": "id", 47 | "type": "string", 48 | "format": "" 49 | }, 50 | { 51 | "name": "name", 52 | "baseName": "name", 53 | "type": "string", 54 | "format": "" 55 | }, 56 | { 57 | "name": "created_at", 58 | "baseName": "created_at", 59 | "type": "string", 60 | "format": "" 61 | }, 62 | { 63 | "name": "updated_at", 64 | "baseName": "updated_at", 65 | "type": "string", 66 | "format": "" 67 | }, 68 | { 69 | "name": "app_id", 70 | "baseName": "app_id", 71 | "type": "string", 72 | "format": "" 73 | }, 74 | { 75 | "name": "read_only", 76 | "baseName": "read_only", 77 | "type": "boolean", 78 | "format": "" 79 | }, 80 | { 81 | "name": "is_active", 82 | "baseName": "is_active", 83 | "type": "boolean", 84 | "format": "" 85 | } ]; 86 | 87 | static getAttributeTypeMap() { 88 | return SegmentData.attributeTypeMap; 89 | } 90 | 91 | public constructor() { 92 | } 93 | } 94 | 95 | -------------------------------------------------------------------------------- /models/SegmentNotificationTarget.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class SegmentNotificationTarget { 12 | /** 13 | * The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] 14 | */ 15 | 'included_segments'?: Array; 16 | /** 17 | * Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] 18 | */ 19 | 'excluded_segments'?: Array; 20 | 21 | static readonly discriminator: string | undefined = undefined; 22 | 23 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 24 | { 25 | "name": "included_segments", 26 | "baseName": "included_segments", 27 | "type": "Array", 28 | "format": "" 29 | }, 30 | { 31 | "name": "excluded_segments", 32 | "baseName": "excluded_segments", 33 | "type": "Array", 34 | "format": "" 35 | } ]; 36 | 37 | static getAttributeTypeMap() { 38 | return SegmentNotificationTarget.attributeTypeMap; 39 | } 40 | 41 | public constructor() { 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /models/Subscription.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class Subscription { 12 | 'id'?: string; 13 | 'type'?: SubscriptionTypeEnum; 14 | 'token'?: string; 15 | 'enabled'?: boolean; 16 | 'notification_types'?: number; 17 | 'session_time'?: number; 18 | 'session_count'?: number; 19 | 'sdk'?: string; 20 | 'device_model'?: string; 21 | 'device_os'?: string; 22 | 'rooted'?: boolean; 23 | 'test_type'?: number; 24 | 'app_version'?: string; 25 | 'net_type'?: number; 26 | 'carrier'?: string; 27 | 'web_auth'?: string; 28 | 'web_p256'?: string; 29 | 30 | static readonly discriminator: string | undefined = undefined; 31 | 32 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 33 | { 34 | "name": "id", 35 | "baseName": "id", 36 | "type": "string", 37 | "format": "" 38 | }, 39 | { 40 | "name": "type", 41 | "baseName": "type", 42 | "type": "SubscriptionTypeEnum", 43 | "format": "" 44 | }, 45 | { 46 | "name": "token", 47 | "baseName": "token", 48 | "type": "string", 49 | "format": "" 50 | }, 51 | { 52 | "name": "enabled", 53 | "baseName": "enabled", 54 | "type": "boolean", 55 | "format": "" 56 | }, 57 | { 58 | "name": "notification_types", 59 | "baseName": "notification_types", 60 | "type": "number", 61 | "format": "" 62 | }, 63 | { 64 | "name": "session_time", 65 | "baseName": "session_time", 66 | "type": "number", 67 | "format": "" 68 | }, 69 | { 70 | "name": "session_count", 71 | "baseName": "session_count", 72 | "type": "number", 73 | "format": "" 74 | }, 75 | { 76 | "name": "sdk", 77 | "baseName": "sdk", 78 | "type": "string", 79 | "format": "" 80 | }, 81 | { 82 | "name": "device_model", 83 | "baseName": "device_model", 84 | "type": "string", 85 | "format": "" 86 | }, 87 | { 88 | "name": "device_os", 89 | "baseName": "device_os", 90 | "type": "string", 91 | "format": "" 92 | }, 93 | { 94 | "name": "rooted", 95 | "baseName": "rooted", 96 | "type": "boolean", 97 | "format": "" 98 | }, 99 | { 100 | "name": "test_type", 101 | "baseName": "test_type", 102 | "type": "number", 103 | "format": "" 104 | }, 105 | { 106 | "name": "app_version", 107 | "baseName": "app_version", 108 | "type": "string", 109 | "format": "" 110 | }, 111 | { 112 | "name": "net_type", 113 | "baseName": "net_type", 114 | "type": "number", 115 | "format": "" 116 | }, 117 | { 118 | "name": "carrier", 119 | "baseName": "carrier", 120 | "type": "string", 121 | "format": "" 122 | }, 123 | { 124 | "name": "web_auth", 125 | "baseName": "web_auth", 126 | "type": "string", 127 | "format": "" 128 | }, 129 | { 130 | "name": "web_p256", 131 | "baseName": "web_p256", 132 | "type": "string", 133 | "format": "" 134 | } ]; 135 | 136 | static getAttributeTypeMap() { 137 | return Subscription.attributeTypeMap; 138 | } 139 | 140 | public constructor() { 141 | } 142 | } 143 | 144 | 145 | export type SubscriptionTypeEnum = "iOSPush" | "AndroidPush" | "FireOSPush" | "ChromeExtensionPush" | "ChromePush" | "WindowsPush" | "SafariLegacyPush" | "FirefoxPush" | "macOSPush" | "HuaweiPush" | "SafariPush" | "Email" | "SMS" ; 146 | 147 | -------------------------------------------------------------------------------- /models/SubscriptionBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { Subscription } from './Subscription'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class SubscriptionBody { 13 | 'subscription'?: Subscription; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "subscription", 20 | "baseName": "subscription", 21 | "type": "Subscription", 22 | "format": "" 23 | } ]; 24 | 25 | static getAttributeTypeMap() { 26 | return SubscriptionBody.attributeTypeMap; 27 | } 28 | 29 | public constructor() { 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /models/SubscriptionNotificationTarget.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class SubscriptionNotificationTarget { 12 | /** 13 | * 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 14 | */ 15 | 'include_subscription_ids'?: Array; 16 | /** 17 | * 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 18 | */ 19 | 'include_email_tokens'?: Array; 20 | /** 21 | * Recommended for Sending SMS - Target specific phone numbers. The phone number should be in the E.164 format. Phone number should be an existing subscriber on OneSignal. Refer our docs to learn how to add phone numbers to OneSignal. Example phone number: +1999999999 Limit of 2,000 entries per REST API call 22 | */ 23 | 'include_phone_numbers'?: Array; 24 | /** 25 | * 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 26 | */ 27 | 'include_ios_tokens'?: Array; 28 | /** 29 | * 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 30 | */ 31 | 'include_wp_wns_uris'?: Array; 32 | /** 33 | * 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 34 | */ 35 | 'include_amazon_reg_ids'?: Array; 36 | /** 37 | * 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 38 | */ 39 | 'include_chrome_reg_ids'?: Array; 40 | /** 41 | * 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 42 | */ 43 | 'include_chrome_web_reg_ids'?: Array; 44 | /** 45 | * 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 46 | */ 47 | 'include_android_reg_ids'?: Array; 48 | /** 49 | * 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. 50 | */ 51 | 'include_aliases'?: { [key: string]: Array; }; 52 | 'target_channel'?: SubscriptionNotificationTargetTargetChannelEnum; 53 | 54 | static readonly discriminator: string | undefined = undefined; 55 | 56 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 57 | { 58 | "name": "include_subscription_ids", 59 | "baseName": "include_subscription_ids", 60 | "type": "Array", 61 | "format": "" 62 | }, 63 | { 64 | "name": "include_email_tokens", 65 | "baseName": "include_email_tokens", 66 | "type": "Array", 67 | "format": "" 68 | }, 69 | { 70 | "name": "include_phone_numbers", 71 | "baseName": "include_phone_numbers", 72 | "type": "Array", 73 | "format": "" 74 | }, 75 | { 76 | "name": "include_ios_tokens", 77 | "baseName": "include_ios_tokens", 78 | "type": "Array", 79 | "format": "" 80 | }, 81 | { 82 | "name": "include_wp_wns_uris", 83 | "baseName": "include_wp_wns_uris", 84 | "type": "Array", 85 | "format": "" 86 | }, 87 | { 88 | "name": "include_amazon_reg_ids", 89 | "baseName": "include_amazon_reg_ids", 90 | "type": "Array", 91 | "format": "" 92 | }, 93 | { 94 | "name": "include_chrome_reg_ids", 95 | "baseName": "include_chrome_reg_ids", 96 | "type": "Array", 97 | "format": "" 98 | }, 99 | { 100 | "name": "include_chrome_web_reg_ids", 101 | "baseName": "include_chrome_web_reg_ids", 102 | "type": "Array", 103 | "format": "" 104 | }, 105 | { 106 | "name": "include_android_reg_ids", 107 | "baseName": "include_android_reg_ids", 108 | "type": "Array", 109 | "format": "" 110 | }, 111 | { 112 | "name": "include_aliases", 113 | "baseName": "include_aliases", 114 | "type": "{ [key: string]: Array; }", 115 | "format": "" 116 | }, 117 | { 118 | "name": "target_channel", 119 | "baseName": "target_channel", 120 | "type": "SubscriptionNotificationTargetTargetChannelEnum", 121 | "format": "" 122 | } ]; 123 | 124 | static getAttributeTypeMap() { 125 | return SubscriptionNotificationTarget.attributeTypeMap; 126 | } 127 | 128 | public constructor() { 129 | } 130 | } 131 | 132 | 133 | export type SubscriptionNotificationTargetTargetChannelEnum = "push" | "email" | "sms" ; 134 | 135 | -------------------------------------------------------------------------------- /models/TransferSubscriptionRequestBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class TransferSubscriptionRequestBody { 12 | 'identity'?: { [key: string]: string; }; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "identity", 19 | "baseName": "identity", 20 | "type": "{ [key: string]: string; }", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return TransferSubscriptionRequestBody.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/UpdateLiveActivityRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { LanguageStringMap } from './LanguageStringMap'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class UpdateLiveActivityRequest { 13 | /** 14 | * An internal name to assist with your campaign organization. This does not get displayed in the message itself. 15 | */ 16 | 'name': string; 17 | 'event': UpdateLiveActivityRequestEventEnum; 18 | /** 19 | * This must match the ContentState interface you have defined within your Live Activity in your app. 20 | */ 21 | 'event_updates': object; 22 | 'contents'?: LanguageStringMap; 23 | 'headings'?: LanguageStringMap; 24 | /** 25 | * Sound file that is included in your app to play instead of the default device notification sound. Omit to disable vibration and sound for the notification. 26 | */ 27 | 'sound'?: string; 28 | /** 29 | * Accepts Unix timestamp in seconds. When time reaches the configured stale date, the system considers the Live Activity out of date, and the ActivityState of the Live Activity changes to ActivityState.stale. 30 | */ 31 | 'stale_date'?: number; 32 | /** 33 | * Accepts Unix timestamp in seconds; only allowed if event is \"end\" 34 | */ 35 | 'dismissal_date'?: number; 36 | /** 37 | * Delivery priority through the the push provider (APNs). Pass 10 for higher priority notifications, or 5 for lower priority notifications. Lower priority notifications are sent based on the power considerations of the end user\'s device. If not set, defaults to 10. Some providers (APNs) allow for a limited budget of high priority notifications per hour, and if that budget is exceeded, the provider may throttle notification delivery. 38 | */ 39 | 'priority'?: number; 40 | 41 | static readonly discriminator: string | undefined = undefined; 42 | 43 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 44 | { 45 | "name": "name", 46 | "baseName": "name", 47 | "type": "string", 48 | "format": "" 49 | }, 50 | { 51 | "name": "event", 52 | "baseName": "event", 53 | "type": "UpdateLiveActivityRequestEventEnum", 54 | "format": "" 55 | }, 56 | { 57 | "name": "event_updates", 58 | "baseName": "event_updates", 59 | "type": "object", 60 | "format": "" 61 | }, 62 | { 63 | "name": "contents", 64 | "baseName": "contents", 65 | "type": "LanguageStringMap", 66 | "format": "" 67 | }, 68 | { 69 | "name": "headings", 70 | "baseName": "headings", 71 | "type": "LanguageStringMap", 72 | "format": "" 73 | }, 74 | { 75 | "name": "sound", 76 | "baseName": "sound", 77 | "type": "string", 78 | "format": "" 79 | }, 80 | { 81 | "name": "stale_date", 82 | "baseName": "stale_date", 83 | "type": "number", 84 | "format": "" 85 | }, 86 | { 87 | "name": "dismissal_date", 88 | "baseName": "dismissal_date", 89 | "type": "number", 90 | "format": "" 91 | }, 92 | { 93 | "name": "priority", 94 | "baseName": "priority", 95 | "type": "number", 96 | "format": "" 97 | } ]; 98 | 99 | static getAttributeTypeMap() { 100 | return UpdateLiveActivityRequest.attributeTypeMap; 101 | } 102 | 103 | public constructor() { 104 | } 105 | } 106 | 107 | 108 | export type UpdateLiveActivityRequestEventEnum = "update" | "end" ; 109 | 110 | -------------------------------------------------------------------------------- /models/UpdateLiveActivitySuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class UpdateLiveActivitySuccessResponse { 12 | 'id'?: string; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "id", 19 | "baseName": "id", 20 | "type": "string", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return UpdateLiveActivitySuccessResponse.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/UpdateUserRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { PropertiesDeltas } from './PropertiesDeltas'; 10 | import { PropertiesObject } from './PropertiesObject'; 11 | import { HttpFile } from '../http/http'; 12 | 13 | export class UpdateUserRequest { 14 | 'properties'?: PropertiesObject; 15 | 'refresh_device_metadata'?: boolean; 16 | 'deltas'?: PropertiesDeltas; 17 | 18 | static readonly discriminator: string | undefined = undefined; 19 | 20 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 21 | { 22 | "name": "properties", 23 | "baseName": "properties", 24 | "type": "PropertiesObject", 25 | "format": "" 26 | }, 27 | { 28 | "name": "refresh_device_metadata", 29 | "baseName": "refresh_device_metadata", 30 | "type": "boolean", 31 | "format": "" 32 | }, 33 | { 34 | "name": "deltas", 35 | "baseName": "deltas", 36 | "type": "PropertiesDeltas", 37 | "format": "" 38 | } ]; 39 | 40 | static getAttributeTypeMap() { 41 | return UpdateUserRequest.attributeTypeMap; 42 | } 43 | 44 | public constructor() { 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /models/User.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { PropertiesObject } from './PropertiesObject'; 10 | import { Subscription } from './Subscription'; 11 | import { HttpFile } from '../http/http'; 12 | 13 | export class User { 14 | 'properties'?: PropertiesObject; 15 | 'identity'?: { [key: string]: string; }; 16 | 'subscriptions'?: Array; 17 | 18 | static readonly discriminator: string | undefined = undefined; 19 | 20 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 21 | { 22 | "name": "properties", 23 | "baseName": "properties", 24 | "type": "PropertiesObject", 25 | "format": "" 26 | }, 27 | { 28 | "name": "identity", 29 | "baseName": "identity", 30 | "type": "{ [key: string]: string; }", 31 | "format": "" 32 | }, 33 | { 34 | "name": "subscriptions", 35 | "baseName": "subscriptions", 36 | "type": "Array", 37 | "format": "" 38 | } ]; 39 | 40 | static getAttributeTypeMap() { 41 | return User.attributeTypeMap; 42 | } 43 | 44 | public constructor() { 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /models/UserIdentityBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class UserIdentityBody { 12 | 'identity'?: { [key: string]: string; }; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "identity", 19 | "baseName": "identity", 20 | "type": "{ [key: string]: string; }", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return UserIdentityBody.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/WebButton.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.1.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class WebButton { 12 | 'id': string; 13 | 'text'?: string; 14 | 'icon'?: string; 15 | 'url'?: string; 16 | 17 | static readonly discriminator: string | undefined = undefined; 18 | 19 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 20 | { 21 | "name": "id", 22 | "baseName": "id", 23 | "type": "string", 24 | "format": "" 25 | }, 26 | { 27 | "name": "text", 28 | "baseName": "text", 29 | "type": "string", 30 | "format": "" 31 | }, 32 | { 33 | "name": "icon", 34 | "baseName": "icon", 35 | "type": "string", 36 | "format": "" 37 | }, 38 | { 39 | "name": "url", 40 | "baseName": "url", 41 | "type": "string", 42 | "format": "" 43 | } ]; 44 | 45 | static getAttributeTypeMap() { 46 | return WebButton.attributeTypeMap; 47 | } 48 | 49 | public constructor() { 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /models/all.ts: -------------------------------------------------------------------------------- 1 | export * from './App' 2 | export * from './BasicNotification' 3 | export * from './BasicNotificationAllOf' 4 | export * from './BasicNotificationAllOfAndroidBackgroundLayout' 5 | export * from './Button' 6 | export * from './CreateNotificationSuccessResponse' 7 | export * from './CreateSegmentConflictResponse' 8 | export * from './CreateSegmentSuccessResponse' 9 | export * from './CreateUserConflictResponse' 10 | export * from './CreateUserConflictResponseErrorsInner' 11 | export * from './CreateUserConflictResponseErrorsItemsMeta' 12 | export * from './DeliveryData' 13 | export * from './ExportEventsSuccessResponse' 14 | export * from './ExportSubscriptionsRequestBody' 15 | export * from './ExportSubscriptionsSuccessResponse' 16 | export * from './Filter' 17 | export * from './FilterExpression' 18 | export * from './GenericError' 19 | export * from './GenericSuccessBoolResponse' 20 | export * from './GetNotificationHistoryRequestBody' 21 | export * from './GetSegmentsSuccessResponse' 22 | export * from './LanguageStringMap' 23 | export * from './Notification' 24 | export * from './NotificationAllOf' 25 | export * from './NotificationHistorySuccessResponse' 26 | export * from './NotificationSlice' 27 | export * from './NotificationTarget' 28 | export * from './NotificationWithMeta' 29 | export * from './NotificationWithMetaAllOf' 30 | export * from './Operator' 31 | export * from './OutcomeData' 32 | export * from './OutcomesData' 33 | export * from './PlatformDeliveryData' 34 | export * from './PlatformDeliveryDataEmailAllOf' 35 | export * from './PlatformDeliveryDataSmsAllOf' 36 | export * from './PropertiesBody' 37 | export * from './PropertiesDeltas' 38 | export * from './PropertiesObject' 39 | export * from './Purchase' 40 | export * from './RateLimitError' 41 | export * from './Segment' 42 | export * from './SegmentData' 43 | export * from './SegmentNotificationTarget' 44 | export * from './Subscription' 45 | export * from './SubscriptionBody' 46 | export * from './SubscriptionNotificationTarget' 47 | export * from './TransferSubscriptionRequestBody' 48 | export * from './UpdateLiveActivityRequest' 49 | export * from './UpdateLiveActivitySuccessResponse' 50 | export * from './UpdateUserRequest' 51 | export * from './User' 52 | export * from './UserIdentityBody' 53 | export * from './WebButton' 54 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@onesignal/node-onesignal", 3 | "version": "5.1.0-beta1", 4 | "description": "OpenAPI client for @onesignal/node-onesignal", 5 | "author": "OpenAPI-Generator Contributors", 6 | "keywords": [ 7 | "fetch", 8 | "typescript", 9 | "openapi-client", 10 | "openapi-generator" 11 | ], 12 | "license": "MIT", 13 | "main": "./dist/index.js", 14 | "type": "commonjs", 15 | "exports": { 16 | ".": "./dist/index.js" 17 | }, 18 | "typings": "./dist/index.d.ts", 19 | "scripts": { 20 | "build": "tsc", 21 | "prepare": "npm run build" 22 | }, 23 | "dependencies": { 24 | "@types/node": "^22.15.30", 25 | "btoa": "^1.2.1", 26 | "es6-promise": "^4.2.4", 27 | "form-data": "^2.5.0", 28 | "url-parse": "^1.4.3" 29 | }, 30 | "devDependencies": { 31 | "@types/url-parse": "1.4.4", 32 | "typescript": "^4.0" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /rxjsStub.ts: -------------------------------------------------------------------------------- 1 | export class Observable { 2 | constructor(private promise: Promise) {} 3 | 4 | toPromise() { 5 | return this.promise; 6 | } 7 | 8 | pipe(callback: (value: T) => S | Promise): Observable { 9 | return new Observable(this.promise.then(callback)); 10 | } 11 | } 12 | 13 | export function from(promise: Promise) { 14 | return new Observable(promise); 15 | } 16 | 17 | export function of(value: T) { 18 | return new Observable(Promise.resolve(value)); 19 | } 20 | 21 | export function mergeMap(callback: (value: T) => Observable) { 22 | return (value: T) => callback(value).toPromise(); 23 | } 24 | 25 | export function map(callback: any) { 26 | return callback; 27 | } 28 | -------------------------------------------------------------------------------- /servers.ts: -------------------------------------------------------------------------------- 1 | import { RequestContext, HttpMethod } from "./http/http"; 2 | 3 | export interface BaseServerConfiguration { 4 | makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; 5 | } 6 | 7 | /** 8 | * 9 | * Represents the configuration of a server including its 10 | * url template and variable configuration based on the url. 11 | * 12 | */ 13 | export class ServerConfiguration implements BaseServerConfiguration { 14 | public constructor(private url: string, private variableConfiguration: T) {} 15 | 16 | /** 17 | * Sets the value of the variables of this server. 18 | * 19 | * @param variableConfiguration a partial variable configuration for the variables contained in the url 20 | */ 21 | public setVariables(variableConfiguration: Partial) { 22 | Object.assign(this.variableConfiguration, variableConfiguration); 23 | } 24 | 25 | public getConfiguration(): T { 26 | return this.variableConfiguration 27 | } 28 | 29 | private getUrl() { 30 | let replacedUrl = this.url; 31 | for (const key in this.variableConfiguration) { 32 | var re = new RegExp("{" + key + "}","g"); 33 | replacedUrl = replacedUrl.replace(re, this.variableConfiguration[key]); 34 | } 35 | return replacedUrl 36 | } 37 | 38 | /** 39 | * Creates a new request context for this server using the url with variables 40 | * replaced with their respective values and the endpoint of the request appended. 41 | * 42 | * @param endpoint the endpoint to be queried on the server 43 | * @param httpMethod httpMethod to be used 44 | * 45 | */ 46 | public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext { 47 | return new RequestContext(this.getUrl() + endpoint, httpMethod); 48 | } 49 | } 50 | 51 | export const server1 = new ServerConfiguration<{ }>("https://api.onesignal.com", { }) 52 | 53 | export const servers = [server1]; 54 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "strict": true, 4 | /* Basic Options */ 5 | "target": "es5", 6 | "moduleResolution": "node", 7 | "declaration": true, 8 | 9 | /* Additional Checks */ 10 | "noUnusedLocals": false, /* Report errors on unused locals. */ // TODO: reenable (unused imports!) 11 | "noUnusedParameters": false, /* Report errors on unused parameters. */ // TODO: set to true again 12 | "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 13 | "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 14 | 15 | "removeComments": true, 16 | "sourceMap": true, 17 | "outDir": "./dist", 18 | "noLib": false, 19 | "lib": [ "es6" ], 20 | }, 21 | "exclude": [ 22 | "dist", 23 | "node_modules" 24 | ], 25 | "filesGlob": [ 26 | "./**/*.ts", 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /util.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Returns if a specific http code is in a given code range 3 | * where the code range is defined as a combination of digits 4 | * and "X" (the letter X) with a length of 3 5 | * 6 | * @param codeRange string with length 3 consisting of digits and "X" (the letter X) 7 | * @param code the http status code to be checked against the code range 8 | */ 9 | export function isCodeInRange(codeRange: string, code: number): boolean { 10 | // This is how the default value is encoded in OAG 11 | if (codeRange === "0") { 12 | return true; 13 | } 14 | if (codeRange == code.toString()) { 15 | return true; 16 | } else { 17 | const codeString = code.toString(); 18 | if (codeString.length != codeRange.length) { 19 | return false; 20 | } 21 | for (let i = 0; i < codeString.length; i++) { 22 | if (codeRange.charAt(i) != "X" && codeRange.charAt(i) != codeString.charAt(i)) { 23 | return false; 24 | } 25 | } 26 | return true; 27 | } 28 | } 29 | 30 | /** 31 | * Returns if it can consume form 32 | * 33 | * @param consumes array 34 | */ 35 | export function canConsumeForm(contentTypes: string[]): boolean { 36 | return contentTypes.indexOf('multipart/form-data') !== -1 37 | } 38 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@types/node@^22.15.30": 6 | version "22.15.30" 7 | resolved "https://registry.yarnpkg.com/@types/node/-/node-22.15.30.tgz#3a20431783e28dd0b0326f84ab386a2ec81d921d" 8 | integrity sha512-6Q7lr06bEHdlfplU6YRbgG1SFBdlsfNC4/lX+SkhiTs0cpJkOElmWls8PxDFv4yY/xKb8Y6SO0OmSX4wgqTZbA== 9 | dependencies: 10 | undici-types "~6.21.0" 11 | 12 | "@types/url-parse@1.4.4": 13 | version "1.4.4" 14 | resolved "https://registry.yarnpkg.com/@types/url-parse/-/url-parse-1.4.4.tgz#ebeb0ec8b581318739cf73e9f9b186f610764255" 15 | integrity sha512-KtQLad12+4T/NfSxpoDhmr22+fig3T7/08QCgmutYA6QSznSRmEtuL95GrhVV40/0otTEdFc+etRcCTqhh1q5Q== 16 | 17 | asynckit@^0.4.0: 18 | version "0.4.0" 19 | resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" 20 | integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== 21 | 22 | btoa@^1.2.1: 23 | version "1.2.1" 24 | resolved "https://registry.yarnpkg.com/btoa/-/btoa-1.2.1.tgz#01a9909f8b2c93f6bf680ba26131eb30f7fa3d73" 25 | integrity sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g== 26 | 27 | call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: 28 | version "1.0.2" 29 | resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" 30 | integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== 31 | dependencies: 32 | es-errors "^1.3.0" 33 | function-bind "^1.1.2" 34 | 35 | combined-stream@^1.0.8: 36 | version "1.0.8" 37 | resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" 38 | integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== 39 | dependencies: 40 | delayed-stream "~1.0.0" 41 | 42 | delayed-stream@~1.0.0: 43 | version "1.0.0" 44 | resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" 45 | integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== 46 | 47 | dunder-proto@^1.0.1: 48 | version "1.0.1" 49 | resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" 50 | integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== 51 | dependencies: 52 | call-bind-apply-helpers "^1.0.1" 53 | es-errors "^1.3.0" 54 | gopd "^1.2.0" 55 | 56 | es-define-property@^1.0.1: 57 | version "1.0.1" 58 | resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" 59 | integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g== 60 | 61 | es-errors@^1.3.0: 62 | version "1.3.0" 63 | resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" 64 | integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== 65 | 66 | es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: 67 | version "1.1.1" 68 | resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" 69 | integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== 70 | dependencies: 71 | es-errors "^1.3.0" 72 | 73 | es-set-tostringtag@^2.1.0: 74 | version "2.1.0" 75 | resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz#f31dbbe0c183b00a6d26eb6325c810c0fd18bd4d" 76 | integrity sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA== 77 | dependencies: 78 | es-errors "^1.3.0" 79 | get-intrinsic "^1.2.6" 80 | has-tostringtag "^1.0.2" 81 | hasown "^2.0.2" 82 | 83 | es6-promise@^4.2.4: 84 | version "4.2.8" 85 | resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" 86 | integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== 87 | 88 | form-data@^2.5.0: 89 | version "2.5.3" 90 | resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.3.tgz#f9bcf87418ce748513c0c3494bb48ec270c97acc" 91 | integrity sha512-XHIrMD0NpDrNM/Ckf7XJiBbLl57KEhT3+i3yY+eWm+cqYZJQTZrKo8Y8AWKnuV5GT4scfuUGt9LzNoIx3dU1nQ== 92 | dependencies: 93 | asynckit "^0.4.0" 94 | combined-stream "^1.0.8" 95 | es-set-tostringtag "^2.1.0" 96 | mime-types "^2.1.35" 97 | safe-buffer "^5.2.1" 98 | 99 | function-bind@^1.1.2: 100 | version "1.1.2" 101 | resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" 102 | integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== 103 | 104 | get-intrinsic@^1.2.6: 105 | version "1.3.0" 106 | resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" 107 | integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== 108 | dependencies: 109 | call-bind-apply-helpers "^1.0.2" 110 | es-define-property "^1.0.1" 111 | es-errors "^1.3.0" 112 | es-object-atoms "^1.1.1" 113 | function-bind "^1.1.2" 114 | get-proto "^1.0.1" 115 | gopd "^1.2.0" 116 | has-symbols "^1.1.0" 117 | hasown "^2.0.2" 118 | math-intrinsics "^1.1.0" 119 | 120 | get-proto@^1.0.1: 121 | version "1.0.1" 122 | resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" 123 | integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== 124 | dependencies: 125 | dunder-proto "^1.0.1" 126 | es-object-atoms "^1.0.0" 127 | 128 | gopd@^1.2.0: 129 | version "1.2.0" 130 | resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" 131 | integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== 132 | 133 | has-symbols@^1.0.3, has-symbols@^1.1.0: 134 | version "1.1.0" 135 | resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" 136 | integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== 137 | 138 | has-tostringtag@^1.0.2: 139 | version "1.0.2" 140 | resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" 141 | integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== 142 | dependencies: 143 | has-symbols "^1.0.3" 144 | 145 | hasown@^2.0.2: 146 | version "2.0.2" 147 | resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" 148 | integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== 149 | dependencies: 150 | function-bind "^1.1.2" 151 | 152 | math-intrinsics@^1.1.0: 153 | version "1.1.0" 154 | resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" 155 | integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== 156 | 157 | mime-db@1.52.0: 158 | version "1.52.0" 159 | resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" 160 | integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== 161 | 162 | mime-types@^2.1.35: 163 | version "2.1.35" 164 | resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" 165 | integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== 166 | dependencies: 167 | mime-db "1.52.0" 168 | 169 | querystringify@^2.1.1: 170 | version "2.2.0" 171 | resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" 172 | integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== 173 | 174 | requires-port@^1.0.0: 175 | version "1.0.0" 176 | resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" 177 | integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== 178 | 179 | safe-buffer@^5.2.1: 180 | version "5.2.1" 181 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" 182 | integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== 183 | 184 | typescript@^4.0: 185 | version "4.9.5" 186 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" 187 | integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== 188 | 189 | undici-types@~6.21.0: 190 | version "6.21.0" 191 | resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb" 192 | integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ== 193 | 194 | url-parse@^1.4.3: 195 | version "1.5.10" 196 | resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" 197 | integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== 198 | dependencies: 199 | querystringify "^2.1.1" 200 | requires-port "^1.0.0" 201 | --------------------------------------------------------------------------------