@onesignal/node-onesignal 5.3.0-beta1 → 5.3.1-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/dist/apis/DefaultApi.js +44 -44
  2. package/package.json +9 -3
  3. package/.github/ISSUE_TEMPLATE/ask-question.yml +0 -25
  4. package/.github/ISSUE_TEMPLATE/bug-report.yml +0 -51
  5. package/.github/ISSUE_TEMPLATE/general-feedback.yml +0 -25
  6. package/.github/pull_request_template.md +0 -44
  7. package/.github/workflows/asana-add-comment.yml +0 -47
  8. package/.github/workflows/asana-create-task.yml +0 -119
  9. package/.github/workflows/asana-update-issue.yml +0 -172
  10. package/.github/workflows/npm_deploy.yml +0 -22
  11. package/.github/workflows/project.yml +0 -17
  12. package/CHANGELOG.md +0 -48
  13. package/DefaultApi.md +0 -3293
  14. package/RELEASE_INSTRUCTIONS.md +0 -2
  15. package/apis/DefaultApi.ts +0 -4673
  16. package/apis/baseapi.ts +0 -37
  17. package/apis/exception.ts +0 -15
  18. package/auth/auth.ts +0 -110
  19. package/configuration.ts +0 -85
  20. package/dist/apis/DefaultApi.js.map +0 -1
  21. package/dist/apis/baseapi.js.map +0 -1
  22. package/dist/apis/exception.js.map +0 -1
  23. package/dist/auth/auth.js.map +0 -1
  24. package/dist/configuration.js.map +0 -1
  25. package/dist/http/http.js.map +0 -1
  26. package/dist/http/isomorphic-fetch.js.map +0 -1
  27. package/dist/index.js.map +0 -1
  28. package/dist/middleware.js.map +0 -1
  29. package/dist/models/ApiKeyToken.js.map +0 -1
  30. package/dist/models/ApiKeyTokensListResponse.js.map +0 -1
  31. package/dist/models/App.js.map +0 -1
  32. package/dist/models/BasicNotification.js.map +0 -1
  33. package/dist/models/BasicNotificationAllOf.js.map +0 -1
  34. package/dist/models/BasicNotificationAllOfAndroidBackgroundLayout.js.map +0 -1
  35. package/dist/models/Button.js.map +0 -1
  36. package/dist/models/CopyTemplateRequest.js.map +0 -1
  37. package/dist/models/CreateApiKeyRequest.js.map +0 -1
  38. package/dist/models/CreateApiKeyResponse.js.map +0 -1
  39. package/dist/models/CreateNotificationSuccessResponse.js.map +0 -1
  40. package/dist/models/CreateSegmentConflictResponse.js.map +0 -1
  41. package/dist/models/CreateSegmentSuccessResponse.js.map +0 -1
  42. package/dist/models/CreateTemplateRequest.js.map +0 -1
  43. package/dist/models/CreateUserConflictResponse.js.map +0 -1
  44. package/dist/models/CreateUserConflictResponseErrorsInner.js.map +0 -1
  45. package/dist/models/CreateUserConflictResponseErrorsItemsMeta.js.map +0 -1
  46. package/dist/models/CustomEvent.js.map +0 -1
  47. package/dist/models/CustomEventsRequest.js.map +0 -1
  48. package/dist/models/DeliveryData.js.map +0 -1
  49. package/dist/models/ExportEventsSuccessResponse.js.map +0 -1
  50. package/dist/models/ExportSubscriptionsRequestBody.js.map +0 -1
  51. package/dist/models/ExportSubscriptionsSuccessResponse.js.map +0 -1
  52. package/dist/models/Filter.js.map +0 -1
  53. package/dist/models/FilterExpression.js.map +0 -1
  54. package/dist/models/GenericError.js.map +0 -1
  55. package/dist/models/GenericSuccessBoolResponse.js.map +0 -1
  56. package/dist/models/GetNotificationHistoryRequestBody.js.map +0 -1
  57. package/dist/models/GetSegmentsSuccessResponse.js.map +0 -1
  58. package/dist/models/LanguageStringMap.js.map +0 -1
  59. package/dist/models/Notification.js.map +0 -1
  60. package/dist/models/NotificationAllOf.js.map +0 -1
  61. package/dist/models/NotificationHistorySuccessResponse.js.map +0 -1
  62. package/dist/models/NotificationSlice.js.map +0 -1
  63. package/dist/models/NotificationTarget.js.map +0 -1
  64. package/dist/models/NotificationWithMeta.js.map +0 -1
  65. package/dist/models/NotificationWithMetaAllOf.js.map +0 -1
  66. package/dist/models/ObjectSerializer.js.map +0 -1
  67. package/dist/models/Operator.js.map +0 -1
  68. package/dist/models/OutcomeData.js.map +0 -1
  69. package/dist/models/OutcomesData.js.map +0 -1
  70. package/dist/models/PlatformDeliveryData.js.map +0 -1
  71. package/dist/models/PlatformDeliveryDataEmailAllOf.js.map +0 -1
  72. package/dist/models/PlatformDeliveryDataSmsAllOf.js.map +0 -1
  73. package/dist/models/PropertiesBody.js.map +0 -1
  74. package/dist/models/PropertiesDeltas.js.map +0 -1
  75. package/dist/models/PropertiesObject.js.map +0 -1
  76. package/dist/models/Purchase.js.map +0 -1
  77. package/dist/models/RateLimitError.js.map +0 -1
  78. package/dist/models/Segment.js.map +0 -1
  79. package/dist/models/SegmentData.js.map +0 -1
  80. package/dist/models/SegmentNotificationTarget.js.map +0 -1
  81. package/dist/models/StartLiveActivityRequest.js.map +0 -1
  82. package/dist/models/StartLiveActivitySuccessResponse.js.map +0 -1
  83. package/dist/models/Subscription.js.map +0 -1
  84. package/dist/models/SubscriptionBody.js.map +0 -1
  85. package/dist/models/SubscriptionNotificationTarget.js.map +0 -1
  86. package/dist/models/TemplateResource.js.map +0 -1
  87. package/dist/models/TemplatesListResponse.js.map +0 -1
  88. package/dist/models/TransferSubscriptionRequestBody.js.map +0 -1
  89. package/dist/models/UpdateApiKeyRequest.js.map +0 -1
  90. package/dist/models/UpdateLiveActivityRequest.js.map +0 -1
  91. package/dist/models/UpdateLiveActivitySuccessResponse.js.map +0 -1
  92. package/dist/models/UpdateTemplateRequest.js.map +0 -1
  93. package/dist/models/UpdateUserRequest.js.map +0 -1
  94. package/dist/models/User.js.map +0 -1
  95. package/dist/models/UserIdentityBody.js.map +0 -1
  96. package/dist/models/WebButton.js.map +0 -1
  97. package/dist/models/all.js.map +0 -1
  98. package/dist/rxjsStub.js.map +0 -1
  99. package/dist/servers.js.map +0 -1
  100. package/dist/types/ObjectParamAPI.js.map +0 -1
  101. package/dist/types/ObservableAPI.js.map +0 -1
  102. package/dist/types/PromiseAPI.js.map +0 -1
  103. package/dist/util.js.map +0 -1
  104. package/http/http.ts +0 -205
  105. package/http/isomorphic-fetch.ts +0 -30
  106. package/index.ts +0 -12
  107. package/middleware.ts +0 -66
  108. package/models/ApiKeyToken.ts +0 -69
  109. package/models/ApiKeyTokensListResponse.ts +0 -32
  110. package/models/App.ts +0 -328
  111. package/models/BasicNotification.ts +0 -1088
  112. package/models/BasicNotificationAllOf.ts +0 -958
  113. package/models/BasicNotificationAllOfAndroidBackgroundLayout.ts +0 -57
  114. package/models/Button.ts +0 -45
  115. package/models/CopyTemplateRequest.ts +0 -34
  116. package/models/CreateApiKeyRequest.ts +0 -48
  117. package/models/CreateApiKeyResponse.ts +0 -38
  118. package/models/CreateNotificationSuccessResponse.ts +0 -48
  119. package/models/CreateSegmentConflictResponse.ts +0 -38
  120. package/models/CreateSegmentSuccessResponse.ts +0 -41
  121. package/models/CreateTemplateRequest.ts +0 -102
  122. package/models/CreateUserConflictResponse.ts +0 -32
  123. package/models/CreateUserConflictResponseErrorsInner.ts +0 -46
  124. package/models/CreateUserConflictResponseErrorsItemsMeta.ts +0 -31
  125. package/models/CustomEvent.ts +0 -74
  126. package/models/CustomEventsRequest.ts +0 -32
  127. package/models/DeliveryData.ts +0 -74
  128. package/models/ExportEventsSuccessResponse.ts +0 -31
  129. package/models/ExportSubscriptionsRequestBody.ts +0 -54
  130. package/models/ExportSubscriptionsSuccessResponse.ts +0 -31
  131. package/models/Filter.ts +0 -107
  132. package/models/FilterExpression.ts +0 -120
  133. package/models/GenericError.ts +0 -45
  134. package/models/GenericSuccessBoolResponse.ts +0 -31
  135. package/models/GetNotificationHistoryRequestBody.ts +0 -54
  136. package/models/GetSegmentsSuccessResponse.ts +0 -65
  137. package/models/LanguageStringMap.ts +0 -454
  138. package/models/Notification.ts +0 -1098
  139. package/models/NotificationAllOf.ts +0 -34
  140. package/models/NotificationHistorySuccessResponse.ts +0 -38
  141. package/models/NotificationSlice.ts +0 -53
  142. package/models/NotificationTarget.ts +0 -156
  143. package/models/NotificationWithMeta.ts +0 -1206
  144. package/models/NotificationWithMetaAllOf.ts +0 -142
  145. package/models/ObjectSerializer.ts +0 -442
  146. package/models/Operator.ts +0 -37
  147. package/models/OutcomeData.ts +0 -48
  148. package/models/OutcomesData.ts +0 -32
  149. package/models/PlatformDeliveryData.ts +0 -86
  150. package/models/PlatformDeliveryDataEmailAllOf.ts +0 -94
  151. package/models/PlatformDeliveryDataSmsAllOf.ts +0 -54
  152. package/models/PropertiesBody.ts +0 -32
  153. package/models/PropertiesDeltas.ts +0 -46
  154. package/models/PropertiesObject.ts +0 -102
  155. package/models/Purchase.ts +0 -61
  156. package/models/RateLimitError.ts +0 -38
  157. package/models/Segment.ts +0 -55
  158. package/models/SegmentData.ts +0 -94
  159. package/models/SegmentNotificationTarget.ts +0 -44
  160. package/models/StartLiveActivityRequest.ts +0 -177
  161. package/models/StartLiveActivitySuccessResponse.ts +0 -31
  162. package/models/Subscription.ts +0 -146
  163. package/models/SubscriptionBody.ts +0 -32
  164. package/models/SubscriptionNotificationTarget.ts +0 -134
  165. package/models/TemplateResource.ts +0 -72
  166. package/models/TemplatesListResponse.ts +0 -32
  167. package/models/TransferSubscriptionRequestBody.ts +0 -31
  168. package/models/UpdateApiKeyRequest.ts +0 -48
  169. package/models/UpdateLiveActivityRequest.ts +0 -109
  170. package/models/UpdateLiveActivitySuccessResponse.ts +0 -31
  171. package/models/UpdateTemplateRequest.ts +0 -92
  172. package/models/UpdateUserRequest.ts +0 -47
  173. package/models/User.ts +0 -47
  174. package/models/UserIdentityBody.ts +0 -31
  175. package/models/WebButton.ts +0 -52
  176. package/models/all.ts +0 -67
  177. package/onesignal-node-onesignal-5.3.0-beta1.tgz +0 -0
  178. package/rxjsStub.ts +0 -27
  179. package/servers.ts +0 -53
  180. package/tsconfig.json +0 -28
  181. package/types/ObjectParamAPI.ts +0 -1270
  182. package/types/ObservableAPI.ts +0 -1201
  183. package/types/PromiseAPI.ts +0 -585
  184. package/util.ts +0 -37
@@ -1,4673 +0,0 @@
1
- // TODO: better import syntax?
2
- import {BaseAPIRequestFactory, RequiredError} from './baseapi';
3
- import {Configuration} from '../configuration';
4
- import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
5
- import * as FormData from "form-data";
6
- import { URLSearchParams } from 'url';
7
- import {ObjectSerializer} from '../models/ObjectSerializer';
8
- import {ApiException} from './exception';
9
- import {canConsumeForm, isCodeInRange} from '../util';
10
- import {SecurityAuthentication} from '../auth/auth';
11
-
12
-
13
- import { ApiKeyTokensListResponse } from '../models/ApiKeyTokensListResponse';
14
- import { App } from '../models/App';
15
- import { CopyTemplateRequest } from '../models/CopyTemplateRequest';
16
- import { CreateApiKeyRequest } from '../models/CreateApiKeyRequest';
17
- import { CreateApiKeyResponse } from '../models/CreateApiKeyResponse';
18
- import { CreateNotificationSuccessResponse } from '../models/CreateNotificationSuccessResponse';
19
- import { CreateSegmentConflictResponse } from '../models/CreateSegmentConflictResponse';
20
- import { CreateSegmentSuccessResponse } from '../models/CreateSegmentSuccessResponse';
21
- import { CreateTemplateRequest } from '../models/CreateTemplateRequest';
22
- import { CreateUserConflictResponse } from '../models/CreateUserConflictResponse';
23
- import { CustomEventsRequest } from '../models/CustomEventsRequest';
24
- import { ExportEventsSuccessResponse } from '../models/ExportEventsSuccessResponse';
25
- import { ExportSubscriptionsRequestBody } from '../models/ExportSubscriptionsRequestBody';
26
- import { ExportSubscriptionsSuccessResponse } from '../models/ExportSubscriptionsSuccessResponse';
27
- import { GenericError } from '../models/GenericError';
28
- import { GenericSuccessBoolResponse } from '../models/GenericSuccessBoolResponse';
29
- import { GetNotificationHistoryRequestBody } from '../models/GetNotificationHistoryRequestBody';
30
- import { GetSegmentsSuccessResponse } from '../models/GetSegmentsSuccessResponse';
31
- import { Notification } from '../models/Notification';
32
- import { NotificationHistorySuccessResponse } from '../models/NotificationHistorySuccessResponse';
33
- import { NotificationSlice } from '../models/NotificationSlice';
34
- import { NotificationWithMeta } from '../models/NotificationWithMeta';
35
- import { OutcomesData } from '../models/OutcomesData';
36
- import { PropertiesBody } from '../models/PropertiesBody';
37
- import { RateLimitError } from '../models/RateLimitError';
38
- import { Segment } from '../models/Segment';
39
- import { StartLiveActivityRequest } from '../models/StartLiveActivityRequest';
40
- import { StartLiveActivitySuccessResponse } from '../models/StartLiveActivitySuccessResponse';
41
- import { SubscriptionBody } from '../models/SubscriptionBody';
42
- import { TemplateResource } from '../models/TemplateResource';
43
- import { TemplatesListResponse } from '../models/TemplatesListResponse';
44
- import { TransferSubscriptionRequestBody } from '../models/TransferSubscriptionRequestBody';
45
- import { UpdateApiKeyRequest } from '../models/UpdateApiKeyRequest';
46
- import { UpdateLiveActivityRequest } from '../models/UpdateLiveActivityRequest';
47
- import { UpdateLiveActivitySuccessResponse } from '../models/UpdateLiveActivitySuccessResponse';
48
- import { UpdateTemplateRequest } from '../models/UpdateTemplateRequest';
49
- import { UpdateUserRequest } from '../models/UpdateUserRequest';
50
- import { User } from '../models/User';
51
- import { UserIdentityBody } from '../models/UserIdentityBody';
52
-
53
- /**
54
- * no description
55
- */
56
- export class DefaultApiRequestFactory extends BaseAPIRequestFactory {
57
-
58
- /**
59
- * Used to stop a scheduled or currently outgoing notification
60
- * Stop a scheduled or currently outgoing notification
61
- * @param appId
62
- * @param notificationId
63
- */
64
- public async cancelNotification(appId: string, notificationId: string, _options?: Configuration): Promise<RequestContext> {
65
- let _config = _options || this.configuration;
66
-
67
- // verify required parameter 'appId' is not null or undefined
68
- if (appId === null || appId === undefined) {
69
- throw new RequiredError("DefaultApi", "cancelNotification", "appId");
70
- }
71
-
72
-
73
- // verify required parameter 'notificationId' is not null or undefined
74
- if (notificationId === null || notificationId === undefined) {
75
- throw new RequiredError("DefaultApi", "cancelNotification", "notificationId");
76
- }
77
-
78
-
79
- // Path Params
80
- const localVarPath = '/notifications/{notification_id}'
81
- .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId)));
82
-
83
- // Make Request Context
84
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
85
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
86
-
87
- // Always add the One Signal telemetry to the request.
88
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
89
-
90
- // Query Params
91
- if (appId !== undefined) {
92
- requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", ""));
93
- }
94
-
95
-
96
- let authMethod: SecurityAuthentication | undefined;
97
- // Apply auth methods
98
- authMethod = _config.authMethods["rest_api_key"]
99
- if (authMethod?.applySecurityAuthentication) {
100
- await authMethod?.applySecurityAuthentication(requestContext);
101
- }
102
-
103
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
104
- if (defaultAuth?.applySecurityAuthentication) {
105
- await defaultAuth?.applySecurityAuthentication(requestContext);
106
- }
107
-
108
- return requestContext;
109
- }
110
-
111
- /**
112
- * Copy a template to a destination app.
113
- * Copy template to another app
114
- * @param templateId
115
- * @param appId
116
- * @param copyTemplateRequest
117
- */
118
- public async copyTemplateToApp(templateId: string, appId: string, copyTemplateRequest: CopyTemplateRequest, _options?: Configuration): Promise<RequestContext> {
119
- let _config = _options || this.configuration;
120
-
121
- // verify required parameter 'templateId' is not null or undefined
122
- if (templateId === null || templateId === undefined) {
123
- throw new RequiredError("DefaultApi", "copyTemplateToApp", "templateId");
124
- }
125
-
126
-
127
- // verify required parameter 'appId' is not null or undefined
128
- if (appId === null || appId === undefined) {
129
- throw new RequiredError("DefaultApi", "copyTemplateToApp", "appId");
130
- }
131
-
132
-
133
- // verify required parameter 'copyTemplateRequest' is not null or undefined
134
- if (copyTemplateRequest === null || copyTemplateRequest === undefined) {
135
- throw new RequiredError("DefaultApi", "copyTemplateToApp", "copyTemplateRequest");
136
- }
137
-
138
-
139
- // Path Params
140
- const localVarPath = '/templates/{template_id}/copy_to_app'
141
- .replace('{' + 'template_id' + '}', encodeURIComponent(String(templateId)));
142
-
143
- // Make Request Context
144
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
145
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
146
-
147
- // Always add the One Signal telemetry to the request.
148
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
149
-
150
- // Query Params
151
- if (appId !== undefined) {
152
- requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", ""));
153
- }
154
-
155
-
156
- // Body Params
157
- const contentType = ObjectSerializer.getPreferredMediaType([
158
- "application/json"
159
- ]);
160
- requestContext.setHeaderParam("Content-Type", contentType);
161
- const serializedBody = ObjectSerializer.stringify(
162
- ObjectSerializer.serialize(copyTemplateRequest, "CopyTemplateRequest", ""),
163
- contentType
164
- );
165
- requestContext.setBody(serializedBody);
166
-
167
- let authMethod: SecurityAuthentication | undefined;
168
- // Apply auth methods
169
- authMethod = _config.authMethods["organization_api_key"]
170
- if (authMethod?.applySecurityAuthentication) {
171
- await authMethod?.applySecurityAuthentication(requestContext);
172
- }
173
-
174
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
175
- if (defaultAuth?.applySecurityAuthentication) {
176
- await defaultAuth?.applySecurityAuthentication(requestContext);
177
- }
178
-
179
- return requestContext;
180
- }
181
-
182
- /**
183
- * Upserts one or more Aliases to an existing User identified by (:alias_label, :alias_id).
184
- * @param appId
185
- * @param aliasLabel
186
- * @param aliasId
187
- * @param userIdentityBody
188
- */
189
- public async createAlias(appId: string, aliasLabel: string, aliasId: string, userIdentityBody: UserIdentityBody, _options?: Configuration): Promise<RequestContext> {
190
- let _config = _options || this.configuration;
191
-
192
- // verify required parameter 'appId' is not null or undefined
193
- if (appId === null || appId === undefined) {
194
- throw new RequiredError("DefaultApi", "createAlias", "appId");
195
- }
196
-
197
-
198
- // verify required parameter 'aliasLabel' is not null or undefined
199
- if (aliasLabel === null || aliasLabel === undefined) {
200
- throw new RequiredError("DefaultApi", "createAlias", "aliasLabel");
201
- }
202
-
203
-
204
- // verify required parameter 'aliasId' is not null or undefined
205
- if (aliasId === null || aliasId === undefined) {
206
- throw new RequiredError("DefaultApi", "createAlias", "aliasId");
207
- }
208
-
209
-
210
- // verify required parameter 'userIdentityBody' is not null or undefined
211
- if (userIdentityBody === null || userIdentityBody === undefined) {
212
- throw new RequiredError("DefaultApi", "createAlias", "userIdentityBody");
213
- }
214
-
215
-
216
- // Path Params
217
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity'
218
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
219
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
220
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)));
221
-
222
- // Make Request Context
223
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
224
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
225
-
226
- // Always add the One Signal telemetry to the request.
227
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
228
-
229
-
230
- // Body Params
231
- const contentType = ObjectSerializer.getPreferredMediaType([
232
- "application/json"
233
- ]);
234
- requestContext.setHeaderParam("Content-Type", contentType);
235
- const serializedBody = ObjectSerializer.stringify(
236
- ObjectSerializer.serialize(userIdentityBody, "UserIdentityBody", ""),
237
- contentType
238
- );
239
- requestContext.setBody(serializedBody);
240
-
241
- let authMethod: SecurityAuthentication | undefined;
242
- // Apply auth methods
243
- authMethod = _config.authMethods["rest_api_key"]
244
- if (authMethod?.applySecurityAuthentication) {
245
- await authMethod?.applySecurityAuthentication(requestContext);
246
- }
247
-
248
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
249
- if (defaultAuth?.applySecurityAuthentication) {
250
- await defaultAuth?.applySecurityAuthentication(requestContext);
251
- }
252
-
253
- return requestContext;
254
- }
255
-
256
- /**
257
- * Upserts one or more Aliases for the User identified by :subscription_id.
258
- * @param appId
259
- * @param subscriptionId
260
- * @param userIdentityBody
261
- */
262
- public async createAliasBySubscription(appId: string, subscriptionId: string, userIdentityBody: UserIdentityBody, _options?: Configuration): Promise<RequestContext> {
263
- let _config = _options || this.configuration;
264
-
265
- // verify required parameter 'appId' is not null or undefined
266
- if (appId === null || appId === undefined) {
267
- throw new RequiredError("DefaultApi", "createAliasBySubscription", "appId");
268
- }
269
-
270
-
271
- // verify required parameter 'subscriptionId' is not null or undefined
272
- if (subscriptionId === null || subscriptionId === undefined) {
273
- throw new RequiredError("DefaultApi", "createAliasBySubscription", "subscriptionId");
274
- }
275
-
276
-
277
- // verify required parameter 'userIdentityBody' is not null or undefined
278
- if (userIdentityBody === null || userIdentityBody === undefined) {
279
- throw new RequiredError("DefaultApi", "createAliasBySubscription", "userIdentityBody");
280
- }
281
-
282
-
283
- // Path Params
284
- const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/user/identity'
285
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
286
- .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId)));
287
-
288
- // Make Request Context
289
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
290
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
291
-
292
- // Always add the One Signal telemetry to the request.
293
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
294
-
295
-
296
- // Body Params
297
- const contentType = ObjectSerializer.getPreferredMediaType([
298
- "application/json"
299
- ]);
300
- requestContext.setHeaderParam("Content-Type", contentType);
301
- const serializedBody = ObjectSerializer.stringify(
302
- ObjectSerializer.serialize(userIdentityBody, "UserIdentityBody", ""),
303
- contentType
304
- );
305
- requestContext.setBody(serializedBody);
306
-
307
- let authMethod: SecurityAuthentication | undefined;
308
- // Apply auth methods
309
- authMethod = _config.authMethods["rest_api_key"]
310
- if (authMethod?.applySecurityAuthentication) {
311
- await authMethod?.applySecurityAuthentication(requestContext);
312
- }
313
-
314
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
315
- if (defaultAuth?.applySecurityAuthentication) {
316
- await defaultAuth?.applySecurityAuthentication(requestContext);
317
- }
318
-
319
- return requestContext;
320
- }
321
-
322
- /**
323
- * Use this API to create a new App API Key (also called a Rich Authentication Token) for a specific OneSignal app. These keys are used to authenticate API requests at the app level and offer enhanced security features, including optional IP allowlisting.
324
- * Create API key
325
- * @param appId
326
- * @param createApiKeyRequest
327
- */
328
- public async createApiKey(appId: string, createApiKeyRequest: CreateApiKeyRequest, _options?: Configuration): Promise<RequestContext> {
329
- let _config = _options || this.configuration;
330
-
331
- // verify required parameter 'appId' is not null or undefined
332
- if (appId === null || appId === undefined) {
333
- throw new RequiredError("DefaultApi", "createApiKey", "appId");
334
- }
335
-
336
-
337
- // verify required parameter 'createApiKeyRequest' is not null or undefined
338
- if (createApiKeyRequest === null || createApiKeyRequest === undefined) {
339
- throw new RequiredError("DefaultApi", "createApiKey", "createApiKeyRequest");
340
- }
341
-
342
-
343
- // Path Params
344
- const localVarPath = '/apps/{app_id}/auth/tokens'
345
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
346
-
347
- // Make Request Context
348
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
349
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
350
-
351
- // Always add the One Signal telemetry to the request.
352
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
353
-
354
-
355
- // Body Params
356
- const contentType = ObjectSerializer.getPreferredMediaType([
357
- "application/json"
358
- ]);
359
- requestContext.setHeaderParam("Content-Type", contentType);
360
- const serializedBody = ObjectSerializer.stringify(
361
- ObjectSerializer.serialize(createApiKeyRequest, "CreateApiKeyRequest", ""),
362
- contentType
363
- );
364
- requestContext.setBody(serializedBody);
365
-
366
- let authMethod: SecurityAuthentication | undefined;
367
- // Apply auth methods
368
- authMethod = _config.authMethods["organization_api_key"]
369
- if (authMethod?.applySecurityAuthentication) {
370
- await authMethod?.applySecurityAuthentication(requestContext);
371
- }
372
-
373
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
374
- if (defaultAuth?.applySecurityAuthentication) {
375
- await defaultAuth?.applySecurityAuthentication(requestContext);
376
- }
377
-
378
- return requestContext;
379
- }
380
-
381
- /**
382
- * Creates a new OneSignal app
383
- * Create an app
384
- * @param app
385
- */
386
- public async createApp(app: App, _options?: Configuration): Promise<RequestContext> {
387
- let _config = _options || this.configuration;
388
-
389
- // verify required parameter 'app' is not null or undefined
390
- if (app === null || app === undefined) {
391
- throw new RequiredError("DefaultApi", "createApp", "app");
392
- }
393
-
394
-
395
- // Path Params
396
- const localVarPath = '/apps';
397
-
398
- // Make Request Context
399
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
400
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
401
-
402
- // Always add the One Signal telemetry to the request.
403
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
404
-
405
-
406
- // Body Params
407
- const contentType = ObjectSerializer.getPreferredMediaType([
408
- "application/json"
409
- ]);
410
- requestContext.setHeaderParam("Content-Type", contentType);
411
- const serializedBody = ObjectSerializer.stringify(
412
- ObjectSerializer.serialize(app, "App", ""),
413
- contentType
414
- );
415
- requestContext.setBody(serializedBody);
416
-
417
- let authMethod: SecurityAuthentication | undefined;
418
- // Apply auth methods
419
- authMethod = _config.authMethods["organization_api_key"]
420
- if (authMethod?.applySecurityAuthentication) {
421
- await authMethod?.applySecurityAuthentication(requestContext);
422
- }
423
-
424
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
425
- if (defaultAuth?.applySecurityAuthentication) {
426
- await defaultAuth?.applySecurityAuthentication(requestContext);
427
- }
428
-
429
- return requestContext;
430
- }
431
-
432
- /**
433
- * The Custom Events API allows you to record user events. Custom events can represent any action users take in your application, such as completing a purchase, viewing content, or achieving milestones.
434
- * Create custom events
435
- * @param appId Your OneSignal App ID in UUID v4 format.
436
- * @param customEventsRequest
437
- */
438
- public async createCustomEvents(appId: string, customEventsRequest: CustomEventsRequest, _options?: Configuration): Promise<RequestContext> {
439
- let _config = _options || this.configuration;
440
-
441
- // verify required parameter 'appId' is not null or undefined
442
- if (appId === null || appId === undefined) {
443
- throw new RequiredError("DefaultApi", "createCustomEvents", "appId");
444
- }
445
-
446
-
447
- // verify required parameter 'customEventsRequest' is not null or undefined
448
- if (customEventsRequest === null || customEventsRequest === undefined) {
449
- throw new RequiredError("DefaultApi", "createCustomEvents", "customEventsRequest");
450
- }
451
-
452
-
453
- // Path Params
454
- const localVarPath = '/apps/{app_id}/integrations/custom_events'
455
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
456
-
457
- // Make Request Context
458
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
459
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
460
-
461
- // Always add the One Signal telemetry to the request.
462
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
463
-
464
-
465
- // Body Params
466
- const contentType = ObjectSerializer.getPreferredMediaType([
467
- "application/json"
468
- ]);
469
- requestContext.setHeaderParam("Content-Type", contentType);
470
- const serializedBody = ObjectSerializer.stringify(
471
- ObjectSerializer.serialize(customEventsRequest, "CustomEventsRequest", ""),
472
- contentType
473
- );
474
- requestContext.setBody(serializedBody);
475
-
476
- let authMethod: SecurityAuthentication | undefined;
477
- // Apply auth methods
478
- authMethod = _config.authMethods["rest_api_key"]
479
- if (authMethod?.applySecurityAuthentication) {
480
- await authMethod?.applySecurityAuthentication(requestContext);
481
- }
482
-
483
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
484
- if (defaultAuth?.applySecurityAuthentication) {
485
- await defaultAuth?.applySecurityAuthentication(requestContext);
486
- }
487
-
488
- return requestContext;
489
- }
490
-
491
- /**
492
- * Sends notifications to your users
493
- * Create notification
494
- * @param notification
495
- */
496
- public async createNotification(notification: Notification, _options?: Configuration): Promise<RequestContext> {
497
- let _config = _options || this.configuration;
498
-
499
- // verify required parameter 'notification' is not null or undefined
500
- if (notification === null || notification === undefined) {
501
- throw new RequiredError("DefaultApi", "createNotification", "notification");
502
- }
503
-
504
-
505
- // Path Params
506
- const localVarPath = '/notifications';
507
-
508
- // Make Request Context
509
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
510
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
511
-
512
- // Always add the One Signal telemetry to the request.
513
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
514
-
515
-
516
- // Body Params
517
- const contentType = ObjectSerializer.getPreferredMediaType([
518
- "application/json"
519
- ]);
520
- requestContext.setHeaderParam("Content-Type", contentType);
521
- const serializedBody = ObjectSerializer.stringify(
522
- ObjectSerializer.serialize(notification, "Notification", ""),
523
- contentType
524
- );
525
- requestContext.setBody(serializedBody);
526
-
527
- let authMethod: SecurityAuthentication | undefined;
528
- // Apply auth methods
529
- authMethod = _config.authMethods["rest_api_key"]
530
- if (authMethod?.applySecurityAuthentication) {
531
- await authMethod?.applySecurityAuthentication(requestContext);
532
- }
533
-
534
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
535
- if (defaultAuth?.applySecurityAuthentication) {
536
- await defaultAuth?.applySecurityAuthentication(requestContext);
537
- }
538
-
539
- return requestContext;
540
- }
541
-
542
- /**
543
- * Create a segment visible and usable in the dashboard and API - Required: OneSignal Paid Plan The Create Segment method is used when you want your server to programmatically create a segment instead of using the OneSignal Dashboard UI. Just like creating Segments from the dashboard you can pass in filters with multiple \"AND\" or \"OR\" operator\'s. &#x1F6A7; Does Not Update Segments This endpoint will only create segments, it does not edit or update currently created Segments. You will need to use the Delete Segment endpoint and re-create it with this endpoint to edit.
544
- * Create Segment
545
- * @param appId The OneSignal App ID for your app. Available in Keys &amp; IDs.
546
- * @param segment
547
- */
548
- public async createSegment(appId: string, segment?: Segment, _options?: Configuration): Promise<RequestContext> {
549
- let _config = _options || this.configuration;
550
-
551
- // verify required parameter 'appId' is not null or undefined
552
- if (appId === null || appId === undefined) {
553
- throw new RequiredError("DefaultApi", "createSegment", "appId");
554
- }
555
-
556
-
557
-
558
- // Path Params
559
- const localVarPath = '/apps/{app_id}/segments'
560
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
561
-
562
- // Make Request Context
563
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
564
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
565
-
566
- // Always add the One Signal telemetry to the request.
567
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
568
-
569
-
570
- // Body Params
571
- const contentType = ObjectSerializer.getPreferredMediaType([
572
- "application/json"
573
- ]);
574
- requestContext.setHeaderParam("Content-Type", contentType);
575
- const serializedBody = ObjectSerializer.stringify(
576
- ObjectSerializer.serialize(segment, "Segment", ""),
577
- contentType
578
- );
579
- requestContext.setBody(serializedBody);
580
-
581
- let authMethod: SecurityAuthentication | undefined;
582
- // Apply auth methods
583
- authMethod = _config.authMethods["rest_api_key"]
584
- if (authMethod?.applySecurityAuthentication) {
585
- await authMethod?.applySecurityAuthentication(requestContext);
586
- }
587
-
588
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
589
- if (defaultAuth?.applySecurityAuthentication) {
590
- await defaultAuth?.applySecurityAuthentication(requestContext);
591
- }
592
-
593
- return requestContext;
594
- }
595
-
596
- /**
597
- * Creates a new Subscription under the User provided. Useful to add email addresses and SMS numbers to the User.
598
- * @param appId
599
- * @param aliasLabel
600
- * @param aliasId
601
- * @param subscriptionBody
602
- */
603
- public async createSubscription(appId: string, aliasLabel: string, aliasId: string, subscriptionBody: SubscriptionBody, _options?: Configuration): Promise<RequestContext> {
604
- let _config = _options || this.configuration;
605
-
606
- // verify required parameter 'appId' is not null or undefined
607
- if (appId === null || appId === undefined) {
608
- throw new RequiredError("DefaultApi", "createSubscription", "appId");
609
- }
610
-
611
-
612
- // verify required parameter 'aliasLabel' is not null or undefined
613
- if (aliasLabel === null || aliasLabel === undefined) {
614
- throw new RequiredError("DefaultApi", "createSubscription", "aliasLabel");
615
- }
616
-
617
-
618
- // verify required parameter 'aliasId' is not null or undefined
619
- if (aliasId === null || aliasId === undefined) {
620
- throw new RequiredError("DefaultApi", "createSubscription", "aliasId");
621
- }
622
-
623
-
624
- // verify required parameter 'subscriptionBody' is not null or undefined
625
- if (subscriptionBody === null || subscriptionBody === undefined) {
626
- throw new RequiredError("DefaultApi", "createSubscription", "subscriptionBody");
627
- }
628
-
629
-
630
- // Path Params
631
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions'
632
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
633
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
634
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)));
635
-
636
- // Make Request Context
637
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
638
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
639
-
640
- // Always add the One Signal telemetry to the request.
641
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
642
-
643
-
644
- // Body Params
645
- const contentType = ObjectSerializer.getPreferredMediaType([
646
- "application/json"
647
- ]);
648
- requestContext.setHeaderParam("Content-Type", contentType);
649
- const serializedBody = ObjectSerializer.stringify(
650
- ObjectSerializer.serialize(subscriptionBody, "SubscriptionBody", ""),
651
- contentType
652
- );
653
- requestContext.setBody(serializedBody);
654
-
655
- let authMethod: SecurityAuthentication | undefined;
656
- // Apply auth methods
657
- authMethod = _config.authMethods["rest_api_key"]
658
- if (authMethod?.applySecurityAuthentication) {
659
- await authMethod?.applySecurityAuthentication(requestContext);
660
- }
661
-
662
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
663
- if (defaultAuth?.applySecurityAuthentication) {
664
- await defaultAuth?.applySecurityAuthentication(requestContext);
665
- }
666
-
667
- return requestContext;
668
- }
669
-
670
- /**
671
- * Create reusable message templates for push, email, and SMS channels.
672
- * Create template
673
- * @param createTemplateRequest
674
- */
675
- public async createTemplate(createTemplateRequest: CreateTemplateRequest, _options?: Configuration): Promise<RequestContext> {
676
- let _config = _options || this.configuration;
677
-
678
- // verify required parameter 'createTemplateRequest' is not null or undefined
679
- if (createTemplateRequest === null || createTemplateRequest === undefined) {
680
- throw new RequiredError("DefaultApi", "createTemplate", "createTemplateRequest");
681
- }
682
-
683
-
684
- // Path Params
685
- const localVarPath = '/templates';
686
-
687
- // Make Request Context
688
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
689
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
690
-
691
- // Always add the One Signal telemetry to the request.
692
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
693
-
694
-
695
- // Body Params
696
- const contentType = ObjectSerializer.getPreferredMediaType([
697
- "application/json"
698
- ]);
699
- requestContext.setHeaderParam("Content-Type", contentType);
700
- const serializedBody = ObjectSerializer.stringify(
701
- ObjectSerializer.serialize(createTemplateRequest, "CreateTemplateRequest", ""),
702
- contentType
703
- );
704
- requestContext.setBody(serializedBody);
705
-
706
- let authMethod: SecurityAuthentication | undefined;
707
- // Apply auth methods
708
- authMethod = _config.authMethods["rest_api_key"]
709
- if (authMethod?.applySecurityAuthentication) {
710
- await authMethod?.applySecurityAuthentication(requestContext);
711
- }
712
-
713
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
714
- if (defaultAuth?.applySecurityAuthentication) {
715
- await defaultAuth?.applySecurityAuthentication(requestContext);
716
- }
717
-
718
- return requestContext;
719
- }
720
-
721
- /**
722
- * Creates a User, optionally Subscriptions owned by the User as well as Aliases. Aliases provided in the payload will be used to look up an existing User.
723
- * @param appId
724
- * @param user
725
- */
726
- public async createUser(appId: string, user: User, _options?: Configuration): Promise<RequestContext> {
727
- let _config = _options || this.configuration;
728
-
729
- // verify required parameter 'appId' is not null or undefined
730
- if (appId === null || appId === undefined) {
731
- throw new RequiredError("DefaultApi", "createUser", "appId");
732
- }
733
-
734
-
735
- // verify required parameter 'user' is not null or undefined
736
- if (user === null || user === undefined) {
737
- throw new RequiredError("DefaultApi", "createUser", "user");
738
- }
739
-
740
-
741
- // Path Params
742
- const localVarPath = '/apps/{app_id}/users'
743
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
744
-
745
- // Make Request Context
746
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
747
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
748
-
749
- // Always add the One Signal telemetry to the request.
750
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
751
-
752
-
753
- // Body Params
754
- const contentType = ObjectSerializer.getPreferredMediaType([
755
- "application/json"
756
- ]);
757
- requestContext.setHeaderParam("Content-Type", contentType);
758
- const serializedBody = ObjectSerializer.stringify(
759
- ObjectSerializer.serialize(user, "User", ""),
760
- contentType
761
- );
762
- requestContext.setBody(serializedBody);
763
-
764
- let authMethod: SecurityAuthentication | undefined;
765
- // Apply auth methods
766
- authMethod = _config.authMethods["rest_api_key"]
767
- if (authMethod?.applySecurityAuthentication) {
768
- await authMethod?.applySecurityAuthentication(requestContext);
769
- }
770
-
771
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
772
- if (defaultAuth?.applySecurityAuthentication) {
773
- await defaultAuth?.applySecurityAuthentication(requestContext);
774
- }
775
-
776
- return requestContext;
777
- }
778
-
779
- /**
780
- * Deletes an alias by alias label
781
- * @param appId
782
- * @param aliasLabel
783
- * @param aliasId
784
- * @param aliasLabelToDelete
785
- */
786
- public async deleteAlias(appId: string, aliasLabel: string, aliasId: string, aliasLabelToDelete: string, _options?: Configuration): Promise<RequestContext> {
787
- let _config = _options || this.configuration;
788
-
789
- // verify required parameter 'appId' is not null or undefined
790
- if (appId === null || appId === undefined) {
791
- throw new RequiredError("DefaultApi", "deleteAlias", "appId");
792
- }
793
-
794
-
795
- // verify required parameter 'aliasLabel' is not null or undefined
796
- if (aliasLabel === null || aliasLabel === undefined) {
797
- throw new RequiredError("DefaultApi", "deleteAlias", "aliasLabel");
798
- }
799
-
800
-
801
- // verify required parameter 'aliasId' is not null or undefined
802
- if (aliasId === null || aliasId === undefined) {
803
- throw new RequiredError("DefaultApi", "deleteAlias", "aliasId");
804
- }
805
-
806
-
807
- // verify required parameter 'aliasLabelToDelete' is not null or undefined
808
- if (aliasLabelToDelete === null || aliasLabelToDelete === undefined) {
809
- throw new RequiredError("DefaultApi", "deleteAlias", "aliasLabelToDelete");
810
- }
811
-
812
-
813
- // Path Params
814
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete}'
815
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
816
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
817
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)))
818
- .replace('{' + 'alias_label_to_delete' + '}', encodeURIComponent(String(aliasLabelToDelete)));
819
-
820
- // Make Request Context
821
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
822
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
823
-
824
- // Always add the One Signal telemetry to the request.
825
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
826
-
827
-
828
- let authMethod: SecurityAuthentication | undefined;
829
- // Apply auth methods
830
- authMethod = _config.authMethods["rest_api_key"]
831
- if (authMethod?.applySecurityAuthentication) {
832
- await authMethod?.applySecurityAuthentication(requestContext);
833
- }
834
-
835
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
836
- if (defaultAuth?.applySecurityAuthentication) {
837
- await defaultAuth?.applySecurityAuthentication(requestContext);
838
- }
839
-
840
- return requestContext;
841
- }
842
-
843
- /**
844
- * Delete a specific Rich Authentication Token (App API Key) for a OneSignal app. Requires your Organization API Key and the token’s unique ID, not the token value itself.
845
- * Delete API key
846
- * @param appId
847
- * @param tokenId
848
- */
849
- public async deleteApiKey(appId: string, tokenId: string, _options?: Configuration): Promise<RequestContext> {
850
- let _config = _options || this.configuration;
851
-
852
- // verify required parameter 'appId' is not null or undefined
853
- if (appId === null || appId === undefined) {
854
- throw new RequiredError("DefaultApi", "deleteApiKey", "appId");
855
- }
856
-
857
-
858
- // verify required parameter 'tokenId' is not null or undefined
859
- if (tokenId === null || tokenId === undefined) {
860
- throw new RequiredError("DefaultApi", "deleteApiKey", "tokenId");
861
- }
862
-
863
-
864
- // Path Params
865
- const localVarPath = '/apps/{app_id}/auth/tokens/{token_id}'
866
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
867
- .replace('{' + 'token_id' + '}', encodeURIComponent(String(tokenId)));
868
-
869
- // Make Request Context
870
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
871
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
872
-
873
- // Always add the One Signal telemetry to the request.
874
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
875
-
876
-
877
- let authMethod: SecurityAuthentication | undefined;
878
- // Apply auth methods
879
- authMethod = _config.authMethods["organization_api_key"]
880
- if (authMethod?.applySecurityAuthentication) {
881
- await authMethod?.applySecurityAuthentication(requestContext);
882
- }
883
-
884
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
885
- if (defaultAuth?.applySecurityAuthentication) {
886
- await defaultAuth?.applySecurityAuthentication(requestContext);
887
- }
888
-
889
- return requestContext;
890
- }
891
-
892
- /**
893
- * Delete a segment (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard.
894
- * Delete Segment
895
- * @param appId The OneSignal App ID for your app. Available in Keys &amp; IDs.
896
- * @param segmentId The segment_id can be found in the URL of the segment when viewing it in the dashboard.
897
- */
898
- public async deleteSegment(appId: string, segmentId: string, _options?: Configuration): Promise<RequestContext> {
899
- let _config = _options || this.configuration;
900
-
901
- // verify required parameter 'appId' is not null or undefined
902
- if (appId === null || appId === undefined) {
903
- throw new RequiredError("DefaultApi", "deleteSegment", "appId");
904
- }
905
-
906
-
907
- // verify required parameter 'segmentId' is not null or undefined
908
- if (segmentId === null || segmentId === undefined) {
909
- throw new RequiredError("DefaultApi", "deleteSegment", "segmentId");
910
- }
911
-
912
-
913
- // Path Params
914
- const localVarPath = '/apps/{app_id}/segments/{segment_id}'
915
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
916
- .replace('{' + 'segment_id' + '}', encodeURIComponent(String(segmentId)));
917
-
918
- // Make Request Context
919
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
920
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
921
-
922
- // Always add the One Signal telemetry to the request.
923
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
924
-
925
-
926
- let authMethod: SecurityAuthentication | undefined;
927
- // Apply auth methods
928
- authMethod = _config.authMethods["rest_api_key"]
929
- if (authMethod?.applySecurityAuthentication) {
930
- await authMethod?.applySecurityAuthentication(requestContext);
931
- }
932
-
933
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
934
- if (defaultAuth?.applySecurityAuthentication) {
935
- await defaultAuth?.applySecurityAuthentication(requestContext);
936
- }
937
-
938
- return requestContext;
939
- }
940
-
941
- /**
942
- * Deletes the Subscription.
943
- * @param appId
944
- * @param subscriptionId
945
- */
946
- public async deleteSubscription(appId: string, subscriptionId: string, _options?: Configuration): Promise<RequestContext> {
947
- let _config = _options || this.configuration;
948
-
949
- // verify required parameter 'appId' is not null or undefined
950
- if (appId === null || appId === undefined) {
951
- throw new RequiredError("DefaultApi", "deleteSubscription", "appId");
952
- }
953
-
954
-
955
- // verify required parameter 'subscriptionId' is not null or undefined
956
- if (subscriptionId === null || subscriptionId === undefined) {
957
- throw new RequiredError("DefaultApi", "deleteSubscription", "subscriptionId");
958
- }
959
-
960
-
961
- // Path Params
962
- const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}'
963
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
964
- .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId)));
965
-
966
- // Make Request Context
967
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
968
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
969
-
970
- // Always add the One Signal telemetry to the request.
971
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
972
-
973
-
974
- let authMethod: SecurityAuthentication | undefined;
975
- // Apply auth methods
976
- authMethod = _config.authMethods["rest_api_key"]
977
- if (authMethod?.applySecurityAuthentication) {
978
- await authMethod?.applySecurityAuthentication(requestContext);
979
- }
980
-
981
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
982
- if (defaultAuth?.applySecurityAuthentication) {
983
- await defaultAuth?.applySecurityAuthentication(requestContext);
984
- }
985
-
986
- return requestContext;
987
- }
988
-
989
- /**
990
- * Delete a template by id.
991
- * Delete template
992
- * @param templateId
993
- * @param appId
994
- */
995
- public async deleteTemplate(templateId: string, appId: string, _options?: Configuration): Promise<RequestContext> {
996
- let _config = _options || this.configuration;
997
-
998
- // verify required parameter 'templateId' is not null or undefined
999
- if (templateId === null || templateId === undefined) {
1000
- throw new RequiredError("DefaultApi", "deleteTemplate", "templateId");
1001
- }
1002
-
1003
-
1004
- // verify required parameter 'appId' is not null or undefined
1005
- if (appId === null || appId === undefined) {
1006
- throw new RequiredError("DefaultApi", "deleteTemplate", "appId");
1007
- }
1008
-
1009
-
1010
- // Path Params
1011
- const localVarPath = '/templates/{template_id}'
1012
- .replace('{' + 'template_id' + '}', encodeURIComponent(String(templateId)));
1013
-
1014
- // Make Request Context
1015
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
1016
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1017
-
1018
- // Always add the One Signal telemetry to the request.
1019
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1020
-
1021
- // Query Params
1022
- if (appId !== undefined) {
1023
- requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", ""));
1024
- }
1025
-
1026
-
1027
- let authMethod: SecurityAuthentication | undefined;
1028
- // Apply auth methods
1029
- authMethod = _config.authMethods["rest_api_key"]
1030
- if (authMethod?.applySecurityAuthentication) {
1031
- await authMethod?.applySecurityAuthentication(requestContext);
1032
- }
1033
-
1034
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1035
- if (defaultAuth?.applySecurityAuthentication) {
1036
- await defaultAuth?.applySecurityAuthentication(requestContext);
1037
- }
1038
-
1039
- return requestContext;
1040
- }
1041
-
1042
- /**
1043
- * Removes the User identified by (:alias_label, :alias_id), and all Subscriptions and Aliases
1044
- * @param appId
1045
- * @param aliasLabel
1046
- * @param aliasId
1047
- */
1048
- public async deleteUser(appId: string, aliasLabel: string, aliasId: string, _options?: Configuration): Promise<RequestContext> {
1049
- let _config = _options || this.configuration;
1050
-
1051
- // verify required parameter 'appId' is not null or undefined
1052
- if (appId === null || appId === undefined) {
1053
- throw new RequiredError("DefaultApi", "deleteUser", "appId");
1054
- }
1055
-
1056
-
1057
- // verify required parameter 'aliasLabel' is not null or undefined
1058
- if (aliasLabel === null || aliasLabel === undefined) {
1059
- throw new RequiredError("DefaultApi", "deleteUser", "aliasLabel");
1060
- }
1061
-
1062
-
1063
- // verify required parameter 'aliasId' is not null or undefined
1064
- if (aliasId === null || aliasId === undefined) {
1065
- throw new RequiredError("DefaultApi", "deleteUser", "aliasId");
1066
- }
1067
-
1068
-
1069
- // Path Params
1070
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'
1071
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1072
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
1073
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)));
1074
-
1075
- // Make Request Context
1076
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
1077
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1078
-
1079
- // Always add the One Signal telemetry to the request.
1080
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1081
-
1082
-
1083
- let authMethod: SecurityAuthentication | undefined;
1084
- // Apply auth methods
1085
- authMethod = _config.authMethods["rest_api_key"]
1086
- if (authMethod?.applySecurityAuthentication) {
1087
- await authMethod?.applySecurityAuthentication(requestContext);
1088
- }
1089
-
1090
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1091
- if (defaultAuth?.applySecurityAuthentication) {
1092
- await defaultAuth?.applySecurityAuthentication(requestContext);
1093
- }
1094
-
1095
- return requestContext;
1096
- }
1097
-
1098
- /**
1099
- * Generate a compressed CSV report of all of the events data for a notification. This will return a URL immediately upon success but it may take several minutes for the CSV to become available at that URL depending on the volume of data. Only one export can be in-progress per OneSignal account at any given time.
1100
- * Export CSV of Events
1101
- * @param notificationId The ID of the notification to export events from.
1102
- * @param appId The ID of the app that the notification belongs to.
1103
- */
1104
- public async exportEvents(notificationId: string, appId: string, _options?: Configuration): Promise<RequestContext> {
1105
- let _config = _options || this.configuration;
1106
-
1107
- // verify required parameter 'notificationId' is not null or undefined
1108
- if (notificationId === null || notificationId === undefined) {
1109
- throw new RequiredError("DefaultApi", "exportEvents", "notificationId");
1110
- }
1111
-
1112
-
1113
- // verify required parameter 'appId' is not null or undefined
1114
- if (appId === null || appId === undefined) {
1115
- throw new RequiredError("DefaultApi", "exportEvents", "appId");
1116
- }
1117
-
1118
-
1119
- // Path Params
1120
- const localVarPath = '/notifications/{notification_id}/export_events?app_id={app_id}'
1121
- .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId)));
1122
-
1123
- // Make Request Context
1124
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
1125
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1126
-
1127
- // Always add the One Signal telemetry to the request.
1128
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1129
-
1130
- // Query Params
1131
- if (appId !== undefined) {
1132
- requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", ""));
1133
- }
1134
-
1135
-
1136
- let authMethod: SecurityAuthentication | undefined;
1137
- // Apply auth methods
1138
- authMethod = _config.authMethods["rest_api_key"]
1139
- if (authMethod?.applySecurityAuthentication) {
1140
- await authMethod?.applySecurityAuthentication(requestContext);
1141
- }
1142
-
1143
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1144
- if (defaultAuth?.applySecurityAuthentication) {
1145
- await defaultAuth?.applySecurityAuthentication(requestContext);
1146
- }
1147
-
1148
- return requestContext;
1149
- }
1150
-
1151
- /**
1152
- * Generate a compressed CSV export of all of your current user data This method can be used to generate a compressed CSV export of all of your current user data. It is a much faster alternative than retrieving this data using the /players API endpoint. The file will be compressed using GZip. The file may take several minutes to generate depending on the number of users in your app. The URL generated will be available for 3 days and includes random v4 uuid as part of the resource name to be unguessable. &#x1F6A7; 403 Error Responses You can test if it is complete by making a GET request to the csv_file_url value. This file may take time to generate depending on how many device records are being pulled. If the file is not ready, a 403 error will be returned. Otherwise the file itself will be returned. &#x1F6A7; Requires Authentication Key Requires your OneSignal App\'s REST API Key, available in Keys & IDs. &#x1F6A7; Concurrent Exports Only one concurrent export is allowed per OneSignal account. Please ensure you have successfully downloaded the .csv.gz file before exporting another app. CSV File Format: - Default Columns: | Field | Details | | --- | --- | | id | OneSignal Player Id | | identifier | Push Token | | session_count | Number of times they visited the app or site | language | Device language code | | timezone | Number of seconds away from UTC. Example: -28800 | | game_version | Version of your mobile app gathered from Android Studio versionCode in your App/build.gradle and iOS uses kCFBundleVersionKey in Xcode. | | device_os | Device Operating System Version. Example: 80 = Chrome 80, 9 = Android 9 | | device_type | Device Operating System Type | | device_model | Device Hardware String Code. Example: Mobile Web Subscribers will have `Linux armv` | | ad_id | Based on the Google Advertising Id for Android, identifierForVendor for iOS. OptedOut means user turned off Advertising tracking on the device. | | tags | Current OneSignal Data Tags on the device. | | last_active | Date and time the user last opened the mobile app or visited the site. | | playtime | Total amount of time in seconds the user had the mobile app open. | | amount_spent | Mobile only - amount spent in USD on In-App Purchases. | | created_at | Date and time the device record was created in OneSignal. Mobile - first time they opened the app with OneSignal SDK. Web - first time the user subscribed to the site. | | invalid_identifier | t = unsubscribed, f = subscibed | | badge_count | Current number of badges on the device | - Extra Columns: | Field | Details | | --- | --- | | external_user_id | Your User Id set on the device | | notification_types | Notification types | | location | Location points (Latitude and Longitude) set on the device. | | country | Country code | | rooted | Android device rooted or not | | ip | IP Address of the device if being tracked. See Handling Personal Data. | | web_auth | Web Only authorization key. | | web_p256 | Web Only p256 key. |
1153
- * Export CSV of Subscriptions
1154
- * @param appId The app ID that you want to export devices from
1155
- * @param exportSubscriptionsRequestBody
1156
- */
1157
- public async exportSubscriptions(appId: string, exportSubscriptionsRequestBody?: ExportSubscriptionsRequestBody, _options?: Configuration): Promise<RequestContext> {
1158
- let _config = _options || this.configuration;
1159
-
1160
- // verify required parameter 'appId' is not null or undefined
1161
- if (appId === null || appId === undefined) {
1162
- throw new RequiredError("DefaultApi", "exportSubscriptions", "appId");
1163
- }
1164
-
1165
-
1166
-
1167
- // Path Params
1168
- const localVarPath = '/players/csv_export?app_id={app_id}'
1169
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
1170
-
1171
- // Make Request Context
1172
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
1173
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1174
-
1175
- // Always add the One Signal telemetry to the request.
1176
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1177
-
1178
-
1179
- // Body Params
1180
- const contentType = ObjectSerializer.getPreferredMediaType([
1181
- "application/json"
1182
- ]);
1183
- requestContext.setHeaderParam("Content-Type", contentType);
1184
- const serializedBody = ObjectSerializer.stringify(
1185
- ObjectSerializer.serialize(exportSubscriptionsRequestBody, "ExportSubscriptionsRequestBody", ""),
1186
- contentType
1187
- );
1188
- requestContext.setBody(serializedBody);
1189
-
1190
- let authMethod: SecurityAuthentication | undefined;
1191
- // Apply auth methods
1192
- authMethod = _config.authMethods["rest_api_key"]
1193
- if (authMethod?.applySecurityAuthentication) {
1194
- await authMethod?.applySecurityAuthentication(requestContext);
1195
- }
1196
-
1197
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1198
- if (defaultAuth?.applySecurityAuthentication) {
1199
- await defaultAuth?.applySecurityAuthentication(requestContext);
1200
- }
1201
-
1202
- return requestContext;
1203
- }
1204
-
1205
- /**
1206
- * Lists all Aliases for the User identified by (:alias_label, :alias_id).
1207
- * @param appId
1208
- * @param aliasLabel
1209
- * @param aliasId
1210
- */
1211
- public async getAliases(appId: string, aliasLabel: string, aliasId: string, _options?: Configuration): Promise<RequestContext> {
1212
- let _config = _options || this.configuration;
1213
-
1214
- // verify required parameter 'appId' is not null or undefined
1215
- if (appId === null || appId === undefined) {
1216
- throw new RequiredError("DefaultApi", "getAliases", "appId");
1217
- }
1218
-
1219
-
1220
- // verify required parameter 'aliasLabel' is not null or undefined
1221
- if (aliasLabel === null || aliasLabel === undefined) {
1222
- throw new RequiredError("DefaultApi", "getAliases", "aliasLabel");
1223
- }
1224
-
1225
-
1226
- // verify required parameter 'aliasId' is not null or undefined
1227
- if (aliasId === null || aliasId === undefined) {
1228
- throw new RequiredError("DefaultApi", "getAliases", "aliasId");
1229
- }
1230
-
1231
-
1232
- // Path Params
1233
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity'
1234
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1235
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
1236
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)));
1237
-
1238
- // Make Request Context
1239
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1240
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1241
-
1242
- // Always add the One Signal telemetry to the request.
1243
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1244
-
1245
-
1246
- let authMethod: SecurityAuthentication | undefined;
1247
- // Apply auth methods
1248
- authMethod = _config.authMethods["rest_api_key"]
1249
- if (authMethod?.applySecurityAuthentication) {
1250
- await authMethod?.applySecurityAuthentication(requestContext);
1251
- }
1252
-
1253
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1254
- if (defaultAuth?.applySecurityAuthentication) {
1255
- await defaultAuth?.applySecurityAuthentication(requestContext);
1256
- }
1257
-
1258
- return requestContext;
1259
- }
1260
-
1261
- /**
1262
- * Lists all Aliases for the User identified by :subscription_id.
1263
- * @param appId
1264
- * @param subscriptionId
1265
- */
1266
- public async getAliasesBySubscription(appId: string, subscriptionId: string, _options?: Configuration): Promise<RequestContext> {
1267
- let _config = _options || this.configuration;
1268
-
1269
- // verify required parameter 'appId' is not null or undefined
1270
- if (appId === null || appId === undefined) {
1271
- throw new RequiredError("DefaultApi", "getAliasesBySubscription", "appId");
1272
- }
1273
-
1274
-
1275
- // verify required parameter 'subscriptionId' is not null or undefined
1276
- if (subscriptionId === null || subscriptionId === undefined) {
1277
- throw new RequiredError("DefaultApi", "getAliasesBySubscription", "subscriptionId");
1278
- }
1279
-
1280
-
1281
- // Path Params
1282
- const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/user/identity'
1283
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1284
- .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId)));
1285
-
1286
- // Make Request Context
1287
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1288
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1289
-
1290
- // Always add the One Signal telemetry to the request.
1291
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1292
-
1293
-
1294
- let authMethod: SecurityAuthentication | undefined;
1295
- // Apply auth methods
1296
- authMethod = _config.authMethods["rest_api_key"]
1297
- if (authMethod?.applySecurityAuthentication) {
1298
- await authMethod?.applySecurityAuthentication(requestContext);
1299
- }
1300
-
1301
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1302
- if (defaultAuth?.applySecurityAuthentication) {
1303
- await defaultAuth?.applySecurityAuthentication(requestContext);
1304
- }
1305
-
1306
- return requestContext;
1307
- }
1308
-
1309
- /**
1310
- * View the details of a single OneSignal app
1311
- * View an app
1312
- * @param appId An app id
1313
- */
1314
- public async getApp(appId: string, _options?: Configuration): Promise<RequestContext> {
1315
- let _config = _options || this.configuration;
1316
-
1317
- // verify required parameter 'appId' is not null or undefined
1318
- if (appId === null || appId === undefined) {
1319
- throw new RequiredError("DefaultApi", "getApp", "appId");
1320
- }
1321
-
1322
-
1323
- // Path Params
1324
- const localVarPath = '/apps/{app_id}'
1325
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
1326
-
1327
- // Make Request Context
1328
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1329
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1330
-
1331
- // Always add the One Signal telemetry to the request.
1332
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1333
-
1334
-
1335
- let authMethod: SecurityAuthentication | undefined;
1336
- // Apply auth methods
1337
- authMethod = _config.authMethods["organization_api_key"]
1338
- if (authMethod?.applySecurityAuthentication) {
1339
- await authMethod?.applySecurityAuthentication(requestContext);
1340
- }
1341
-
1342
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1343
- if (defaultAuth?.applySecurityAuthentication) {
1344
- await defaultAuth?.applySecurityAuthentication(requestContext);
1345
- }
1346
-
1347
- return requestContext;
1348
- }
1349
-
1350
- /**
1351
- * View the details of all of your current OneSignal apps
1352
- * View apps
1353
- */
1354
- public async getApps(_options?: Configuration): Promise<RequestContext> {
1355
- let _config = _options || this.configuration;
1356
-
1357
- // Path Params
1358
- const localVarPath = '/apps';
1359
-
1360
- // Make Request Context
1361
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1362
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1363
-
1364
- // Always add the One Signal telemetry to the request.
1365
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1366
-
1367
-
1368
- let authMethod: SecurityAuthentication | undefined;
1369
- // Apply auth methods
1370
- authMethod = _config.authMethods["organization_api_key"]
1371
- if (authMethod?.applySecurityAuthentication) {
1372
- await authMethod?.applySecurityAuthentication(requestContext);
1373
- }
1374
-
1375
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1376
- if (defaultAuth?.applySecurityAuthentication) {
1377
- await defaultAuth?.applySecurityAuthentication(requestContext);
1378
- }
1379
-
1380
- return requestContext;
1381
- }
1382
-
1383
- /**
1384
- * View the details of a single notification and outcomes associated with it
1385
- * View notification
1386
- * @param appId
1387
- * @param notificationId
1388
- */
1389
- public async getNotification(appId: string, notificationId: string, _options?: Configuration): Promise<RequestContext> {
1390
- let _config = _options || this.configuration;
1391
-
1392
- // verify required parameter 'appId' is not null or undefined
1393
- if (appId === null || appId === undefined) {
1394
- throw new RequiredError("DefaultApi", "getNotification", "appId");
1395
- }
1396
-
1397
-
1398
- // verify required parameter 'notificationId' is not null or undefined
1399
- if (notificationId === null || notificationId === undefined) {
1400
- throw new RequiredError("DefaultApi", "getNotification", "notificationId");
1401
- }
1402
-
1403
-
1404
- // Path Params
1405
- const localVarPath = '/notifications/{notification_id}'
1406
- .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId)));
1407
-
1408
- // Make Request Context
1409
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1410
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1411
-
1412
- // Always add the One Signal telemetry to the request.
1413
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1414
-
1415
- // Query Params
1416
- if (appId !== undefined) {
1417
- requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", ""));
1418
- }
1419
-
1420
-
1421
- let authMethod: SecurityAuthentication | undefined;
1422
- // Apply auth methods
1423
- authMethod = _config.authMethods["rest_api_key"]
1424
- if (authMethod?.applySecurityAuthentication) {
1425
- await authMethod?.applySecurityAuthentication(requestContext);
1426
- }
1427
-
1428
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1429
- if (defaultAuth?.applySecurityAuthentication) {
1430
- await defaultAuth?.applySecurityAuthentication(requestContext);
1431
- }
1432
-
1433
- return requestContext;
1434
- }
1435
-
1436
- /**
1437
- * -> View the devices sent a message - OneSignal Paid Plan Required This method will return all devices that were sent the given notification_id of an Email or Push Notification if used within 7 days of the date sent. After 7 days of the sending date, the message history data will be unavailable. After a successful response is received, the destination url may be polled until the file becomes available. Most exports are done in ~1-3 minutes, so setting a poll interval of 10 seconds should be adequate. For use cases that are not meant to be consumed by a script, an email will be sent to the supplied email address. &#x1F6A7; Requirements A OneSignal Paid Plan. Turn on Send History via OneSignal API in Settings -> Analytics. Cannot get data before this was turned on. Must be called within 7 days after sending the message. Messages targeting under 1000 recipients will not have \"sent\" events recorded, but will show \"clicked\" events. Requires your OneSignal App\'s REST API Key, available in Keys & IDs.
1438
- * Notification History
1439
- * @param notificationId The \&quot;id\&quot; of the message found in the Notification object
1440
- * @param getNotificationHistoryRequestBody
1441
- */
1442
- public async getNotificationHistory(notificationId: string, getNotificationHistoryRequestBody: GetNotificationHistoryRequestBody, _options?: Configuration): Promise<RequestContext> {
1443
- let _config = _options || this.configuration;
1444
-
1445
- // verify required parameter 'notificationId' is not null or undefined
1446
- if (notificationId === null || notificationId === undefined) {
1447
- throw new RequiredError("DefaultApi", "getNotificationHistory", "notificationId");
1448
- }
1449
-
1450
-
1451
- // verify required parameter 'getNotificationHistoryRequestBody' is not null or undefined
1452
- if (getNotificationHistoryRequestBody === null || getNotificationHistoryRequestBody === undefined) {
1453
- throw new RequiredError("DefaultApi", "getNotificationHistory", "getNotificationHistoryRequestBody");
1454
- }
1455
-
1456
-
1457
- // Path Params
1458
- const localVarPath = '/notifications/{notification_id}/history'
1459
- .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId)));
1460
-
1461
- // Make Request Context
1462
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
1463
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1464
-
1465
- // Always add the One Signal telemetry to the request.
1466
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1467
-
1468
-
1469
- // Body Params
1470
- const contentType = ObjectSerializer.getPreferredMediaType([
1471
- "application/json"
1472
- ]);
1473
- requestContext.setHeaderParam("Content-Type", contentType);
1474
- const serializedBody = ObjectSerializer.stringify(
1475
- ObjectSerializer.serialize(getNotificationHistoryRequestBody, "GetNotificationHistoryRequestBody", ""),
1476
- contentType
1477
- );
1478
- requestContext.setBody(serializedBody);
1479
-
1480
- let authMethod: SecurityAuthentication | undefined;
1481
- // Apply auth methods
1482
- authMethod = _config.authMethods["rest_api_key"]
1483
- if (authMethod?.applySecurityAuthentication) {
1484
- await authMethod?.applySecurityAuthentication(requestContext);
1485
- }
1486
-
1487
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1488
- if (defaultAuth?.applySecurityAuthentication) {
1489
- await defaultAuth?.applySecurityAuthentication(requestContext);
1490
- }
1491
-
1492
- return requestContext;
1493
- }
1494
-
1495
- /**
1496
- * View the details of multiple notifications
1497
- * View notifications
1498
- * @param appId The app ID that you want to view notifications from
1499
- * @param limit How many notifications to return. Max is 50. Default is 50.
1500
- * @param offset 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.
1501
- * @param kind Kind of notifications returned: * unset - All notification types (default) * &#x60;0&#x60; - Dashboard only * &#x60;1&#x60; - API only * &#x60;3&#x60; - Automated only
1502
- */
1503
- public async getNotifications(appId: string, limit?: number, offset?: number, kind?: 0 | 1 | 3, _options?: Configuration): Promise<RequestContext> {
1504
- let _config = _options || this.configuration;
1505
-
1506
- // verify required parameter 'appId' is not null or undefined
1507
- if (appId === null || appId === undefined) {
1508
- throw new RequiredError("DefaultApi", "getNotifications", "appId");
1509
- }
1510
-
1511
-
1512
-
1513
-
1514
-
1515
- // Path Params
1516
- const localVarPath = '/notifications';
1517
-
1518
- // Make Request Context
1519
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1520
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1521
-
1522
- // Always add the One Signal telemetry to the request.
1523
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1524
-
1525
- // Query Params
1526
- if (appId !== undefined) {
1527
- requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", ""));
1528
- }
1529
-
1530
- // Query Params
1531
- if (limit !== undefined) {
1532
- requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", ""));
1533
- }
1534
-
1535
- // Query Params
1536
- if (offset !== undefined) {
1537
- requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", ""));
1538
- }
1539
-
1540
- // Query Params
1541
- if (kind !== undefined) {
1542
- requestContext.setQueryParam("kind", ObjectSerializer.serialize(kind, "0 | 1 | 3", ""));
1543
- }
1544
-
1545
-
1546
- let authMethod: SecurityAuthentication | undefined;
1547
- // Apply auth methods
1548
- authMethod = _config.authMethods["rest_api_key"]
1549
- if (authMethod?.applySecurityAuthentication) {
1550
- await authMethod?.applySecurityAuthentication(requestContext);
1551
- }
1552
-
1553
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1554
- if (defaultAuth?.applySecurityAuthentication) {
1555
- await defaultAuth?.applySecurityAuthentication(requestContext);
1556
- }
1557
-
1558
- return requestContext;
1559
- }
1560
-
1561
- /**
1562
- * View the details of all the outcomes associated with your app &#x1F6A7; Requires Authentication Key Requires your OneSignal App\'s REST API Key, available in Keys & IDs. &#x1F6A7; Outcome Data Limitations Outcomes are only accessible for around 30 days before deleted from our servers. You will need to export this data every month if you want to keep it.
1563
- * View Outcomes
1564
- * @param appId The OneSignal App ID for your app. Available in Keys &amp; IDs.
1565
- * @param outcomeNames 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 \&quot;os\&quot; 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
1566
- * @param outcomeNames2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]&#x3D;os__click.count&amp;outcome_names[]&#x3D;Sales, Purchase.count where \&quot;Sales, Purchase\&quot; is the custom outcomes with a comma in the name.
1567
- * @param outcomeTimeRange 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.
1568
- * @param outcomePlatforms Optional Platform id. Refer device\&#39;s platform ids for values. Example: outcome_platform&#x3D;0 for iOS outcome_platform&#x3D;7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted.
1569
- * @param outcomeAttribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution&#x3D;direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted.
1570
- */
1571
- public async getOutcomes(appId: string, outcomeNames: string, outcomeNames2?: string, outcomeTimeRange?: string, outcomePlatforms?: string, outcomeAttribution?: string, _options?: Configuration): Promise<RequestContext> {
1572
- let _config = _options || this.configuration;
1573
-
1574
- // verify required parameter 'appId' is not null or undefined
1575
- if (appId === null || appId === undefined) {
1576
- throw new RequiredError("DefaultApi", "getOutcomes", "appId");
1577
- }
1578
-
1579
-
1580
- // verify required parameter 'outcomeNames' is not null or undefined
1581
- if (outcomeNames === null || outcomeNames === undefined) {
1582
- throw new RequiredError("DefaultApi", "getOutcomes", "outcomeNames");
1583
- }
1584
-
1585
-
1586
-
1587
-
1588
-
1589
-
1590
- // Path Params
1591
- const localVarPath = '/apps/{app_id}/outcomes'
1592
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
1593
-
1594
- // Make Request Context
1595
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1596
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1597
-
1598
- // Always add the One Signal telemetry to the request.
1599
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1600
-
1601
- // Query Params
1602
- if (outcomeNames !== undefined) {
1603
- requestContext.setQueryParam("outcome_names", ObjectSerializer.serialize(outcomeNames, "string", ""));
1604
- }
1605
-
1606
- // Query Params
1607
- if (outcomeNames2 !== undefined) {
1608
- requestContext.setQueryParam("outcome_names[]", ObjectSerializer.serialize(outcomeNames2, "string", ""));
1609
- }
1610
-
1611
- // Query Params
1612
- if (outcomeTimeRange !== undefined) {
1613
- requestContext.setQueryParam("outcome_time_range", ObjectSerializer.serialize(outcomeTimeRange, "string", ""));
1614
- }
1615
-
1616
- // Query Params
1617
- if (outcomePlatforms !== undefined) {
1618
- requestContext.setQueryParam("outcome_platforms", ObjectSerializer.serialize(outcomePlatforms, "string", ""));
1619
- }
1620
-
1621
- // Query Params
1622
- if (outcomeAttribution !== undefined) {
1623
- requestContext.setQueryParam("outcome_attribution", ObjectSerializer.serialize(outcomeAttribution, "string", ""));
1624
- }
1625
-
1626
-
1627
- let authMethod: SecurityAuthentication | undefined;
1628
- // Apply auth methods
1629
- authMethod = _config.authMethods["rest_api_key"]
1630
- if (authMethod?.applySecurityAuthentication) {
1631
- await authMethod?.applySecurityAuthentication(requestContext);
1632
- }
1633
-
1634
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1635
- if (defaultAuth?.applySecurityAuthentication) {
1636
- await defaultAuth?.applySecurityAuthentication(requestContext);
1637
- }
1638
-
1639
- return requestContext;
1640
- }
1641
-
1642
- /**
1643
- * Returns an array of segments from an app.
1644
- * Get Segments
1645
- * @param appId The OneSignal App ID for your app. Available in Keys &amp; IDs.
1646
- * @param offset Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments.
1647
- * @param limit The amount of Segments in the response. Maximum 300.
1648
- */
1649
- public async getSegments(appId: string, offset?: number, limit?: number, _options?: Configuration): Promise<RequestContext> {
1650
- let _config = _options || this.configuration;
1651
-
1652
- // verify required parameter 'appId' is not null or undefined
1653
- if (appId === null || appId === undefined) {
1654
- throw new RequiredError("DefaultApi", "getSegments", "appId");
1655
- }
1656
-
1657
-
1658
-
1659
-
1660
- // Path Params
1661
- const localVarPath = '/apps/{app_id}/segments'
1662
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
1663
-
1664
- // Make Request Context
1665
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1666
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1667
-
1668
- // Always add the One Signal telemetry to the request.
1669
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1670
-
1671
- // Query Params
1672
- if (offset !== undefined) {
1673
- requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", ""));
1674
- }
1675
-
1676
- // Query Params
1677
- if (limit !== undefined) {
1678
- requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", ""));
1679
- }
1680
-
1681
-
1682
- let authMethod: SecurityAuthentication | undefined;
1683
- // Apply auth methods
1684
- authMethod = _config.authMethods["rest_api_key"]
1685
- if (authMethod?.applySecurityAuthentication) {
1686
- await authMethod?.applySecurityAuthentication(requestContext);
1687
- }
1688
-
1689
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1690
- if (defaultAuth?.applySecurityAuthentication) {
1691
- await defaultAuth?.applySecurityAuthentication(requestContext);
1692
- }
1693
-
1694
- return requestContext;
1695
- }
1696
-
1697
- /**
1698
- * Returns the User’s properties, Aliases, and Subscriptions.
1699
- * @param appId
1700
- * @param aliasLabel
1701
- * @param aliasId
1702
- */
1703
- public async getUser(appId: string, aliasLabel: string, aliasId: string, _options?: Configuration): Promise<RequestContext> {
1704
- let _config = _options || this.configuration;
1705
-
1706
- // verify required parameter 'appId' is not null or undefined
1707
- if (appId === null || appId === undefined) {
1708
- throw new RequiredError("DefaultApi", "getUser", "appId");
1709
- }
1710
-
1711
-
1712
- // verify required parameter 'aliasLabel' is not null or undefined
1713
- if (aliasLabel === null || aliasLabel === undefined) {
1714
- throw new RequiredError("DefaultApi", "getUser", "aliasLabel");
1715
- }
1716
-
1717
-
1718
- // verify required parameter 'aliasId' is not null or undefined
1719
- if (aliasId === null || aliasId === undefined) {
1720
- throw new RequiredError("DefaultApi", "getUser", "aliasId");
1721
- }
1722
-
1723
-
1724
- // Path Params
1725
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'
1726
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1727
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
1728
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)));
1729
-
1730
- // Make Request Context
1731
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1732
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1733
-
1734
- // Always add the One Signal telemetry to the request.
1735
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1736
-
1737
-
1738
- let authMethod: SecurityAuthentication | undefined;
1739
- // Apply auth methods
1740
- authMethod = _config.authMethods["rest_api_key"]
1741
- if (authMethod?.applySecurityAuthentication) {
1742
- await authMethod?.applySecurityAuthentication(requestContext);
1743
- }
1744
-
1745
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1746
- if (defaultAuth?.applySecurityAuthentication) {
1747
- await defaultAuth?.applySecurityAuthentication(requestContext);
1748
- }
1749
-
1750
- return requestContext;
1751
- }
1752
-
1753
- /**
1754
- * Rotate a Rich Authentication Token (App API Key) for a OneSignal app. Rotating a key revokes the current token and generates a new one under the same configuration—ideal when a token is lost or compromised but you don’t want to recreate and reconfigure it from scratch.
1755
- * Rotate API key
1756
- * @param appId
1757
- * @param tokenId
1758
- */
1759
- public async rotateApiKey(appId: string, tokenId: string, _options?: Configuration): Promise<RequestContext> {
1760
- let _config = _options || this.configuration;
1761
-
1762
- // verify required parameter 'appId' is not null or undefined
1763
- if (appId === null || appId === undefined) {
1764
- throw new RequiredError("DefaultApi", "rotateApiKey", "appId");
1765
- }
1766
-
1767
-
1768
- // verify required parameter 'tokenId' is not null or undefined
1769
- if (tokenId === null || tokenId === undefined) {
1770
- throw new RequiredError("DefaultApi", "rotateApiKey", "tokenId");
1771
- }
1772
-
1773
-
1774
- // Path Params
1775
- const localVarPath = '/apps/{app_id}/auth/tokens/{token_id}/rotate'
1776
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1777
- .replace('{' + 'token_id' + '}', encodeURIComponent(String(tokenId)));
1778
-
1779
- // Make Request Context
1780
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
1781
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1782
-
1783
- // Always add the One Signal telemetry to the request.
1784
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1785
-
1786
-
1787
- let authMethod: SecurityAuthentication | undefined;
1788
- // Apply auth methods
1789
- authMethod = _config.authMethods["organization_api_key"]
1790
- if (authMethod?.applySecurityAuthentication) {
1791
- await authMethod?.applySecurityAuthentication(requestContext);
1792
- }
1793
-
1794
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1795
- if (defaultAuth?.applySecurityAuthentication) {
1796
- await defaultAuth?.applySecurityAuthentication(requestContext);
1797
- }
1798
-
1799
- return requestContext;
1800
- }
1801
-
1802
- /**
1803
- * Remotely start a Live Activity on iOS devices via OneSignal’s REST API.
1804
- * Start Live Activity
1805
- * @param appId Your OneSignal App ID in UUID v4 format.
1806
- * @param activityType The name of the Live Activity defined in your app. This should match the attributes struct used in your app\&#39;s Live Activity implementation.
1807
- * @param startLiveActivityRequest
1808
- */
1809
- public async startLiveActivity(appId: string, activityType: string, startLiveActivityRequest: StartLiveActivityRequest, _options?: Configuration): Promise<RequestContext> {
1810
- let _config = _options || this.configuration;
1811
-
1812
- // verify required parameter 'appId' is not null or undefined
1813
- if (appId === null || appId === undefined) {
1814
- throw new RequiredError("DefaultApi", "startLiveActivity", "appId");
1815
- }
1816
-
1817
-
1818
- // verify required parameter 'activityType' is not null or undefined
1819
- if (activityType === null || activityType === undefined) {
1820
- throw new RequiredError("DefaultApi", "startLiveActivity", "activityType");
1821
- }
1822
-
1823
-
1824
- // verify required parameter 'startLiveActivityRequest' is not null or undefined
1825
- if (startLiveActivityRequest === null || startLiveActivityRequest === undefined) {
1826
- throw new RequiredError("DefaultApi", "startLiveActivity", "startLiveActivityRequest");
1827
- }
1828
-
1829
-
1830
- // Path Params
1831
- const localVarPath = '/apps/{app_id}/activities/activity/{activity_type}'
1832
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1833
- .replace('{' + 'activity_type' + '}', encodeURIComponent(String(activityType)));
1834
-
1835
- // Make Request Context
1836
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
1837
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1838
-
1839
- // Always add the One Signal telemetry to the request.
1840
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1841
-
1842
-
1843
- // Body Params
1844
- const contentType = ObjectSerializer.getPreferredMediaType([
1845
- "application/json"
1846
- ]);
1847
- requestContext.setHeaderParam("Content-Type", contentType);
1848
- const serializedBody = ObjectSerializer.stringify(
1849
- ObjectSerializer.serialize(startLiveActivityRequest, "StartLiveActivityRequest", ""),
1850
- contentType
1851
- );
1852
- requestContext.setBody(serializedBody);
1853
-
1854
- let authMethod: SecurityAuthentication | undefined;
1855
- // Apply auth methods
1856
- authMethod = _config.authMethods["rest_api_key"]
1857
- if (authMethod?.applySecurityAuthentication) {
1858
- await authMethod?.applySecurityAuthentication(requestContext);
1859
- }
1860
-
1861
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1862
- if (defaultAuth?.applySecurityAuthentication) {
1863
- await defaultAuth?.applySecurityAuthentication(requestContext);
1864
- }
1865
-
1866
- return requestContext;
1867
- }
1868
-
1869
- /**
1870
- * Transfers this Subscription to the User identified by the identity in the payload.
1871
- * @param appId
1872
- * @param subscriptionId
1873
- * @param transferSubscriptionRequestBody
1874
- */
1875
- public async transferSubscription(appId: string, subscriptionId: string, transferSubscriptionRequestBody: TransferSubscriptionRequestBody, _options?: Configuration): Promise<RequestContext> {
1876
- let _config = _options || this.configuration;
1877
-
1878
- // verify required parameter 'appId' is not null or undefined
1879
- if (appId === null || appId === undefined) {
1880
- throw new RequiredError("DefaultApi", "transferSubscription", "appId");
1881
- }
1882
-
1883
-
1884
- // verify required parameter 'subscriptionId' is not null or undefined
1885
- if (subscriptionId === null || subscriptionId === undefined) {
1886
- throw new RequiredError("DefaultApi", "transferSubscription", "subscriptionId");
1887
- }
1888
-
1889
-
1890
- // verify required parameter 'transferSubscriptionRequestBody' is not null or undefined
1891
- if (transferSubscriptionRequestBody === null || transferSubscriptionRequestBody === undefined) {
1892
- throw new RequiredError("DefaultApi", "transferSubscription", "transferSubscriptionRequestBody");
1893
- }
1894
-
1895
-
1896
- // Path Params
1897
- const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/owner'
1898
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1899
- .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId)));
1900
-
1901
- // Make Request Context
1902
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
1903
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1904
-
1905
- // Always add the One Signal telemetry to the request.
1906
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1907
-
1908
-
1909
- // Body Params
1910
- const contentType = ObjectSerializer.getPreferredMediaType([
1911
- "application/json"
1912
- ]);
1913
- requestContext.setHeaderParam("Content-Type", contentType);
1914
- const serializedBody = ObjectSerializer.stringify(
1915
- ObjectSerializer.serialize(transferSubscriptionRequestBody, "TransferSubscriptionRequestBody", ""),
1916
- contentType
1917
- );
1918
- requestContext.setBody(serializedBody);
1919
-
1920
- let authMethod: SecurityAuthentication | undefined;
1921
- // Apply auth methods
1922
- authMethod = _config.authMethods["rest_api_key"]
1923
- if (authMethod?.applySecurityAuthentication) {
1924
- await authMethod?.applySecurityAuthentication(requestContext);
1925
- }
1926
-
1927
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1928
- if (defaultAuth?.applySecurityAuthentication) {
1929
- await defaultAuth?.applySecurityAuthentication(requestContext);
1930
- }
1931
-
1932
- return requestContext;
1933
- }
1934
-
1935
- /**
1936
- * Unsubscribe an email with a token when using your own custom email unsubscribe landing page
1937
- * Unsubscribe with token
1938
- * @param appId The OneSignal App ID for your app. Available in Keys &amp; IDs.
1939
- * @param notificationId The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report.
1940
- * @param token The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email.
1941
- */
1942
- public async unsubscribeEmailWithToken(appId: string, notificationId: string, token: string, _options?: Configuration): Promise<RequestContext> {
1943
- let _config = _options || this.configuration;
1944
-
1945
- // verify required parameter 'appId' is not null or undefined
1946
- if (appId === null || appId === undefined) {
1947
- throw new RequiredError("DefaultApi", "unsubscribeEmailWithToken", "appId");
1948
- }
1949
-
1950
-
1951
- // verify required parameter 'notificationId' is not null or undefined
1952
- if (notificationId === null || notificationId === undefined) {
1953
- throw new RequiredError("DefaultApi", "unsubscribeEmailWithToken", "notificationId");
1954
- }
1955
-
1956
-
1957
- // verify required parameter 'token' is not null or undefined
1958
- if (token === null || token === undefined) {
1959
- throw new RequiredError("DefaultApi", "unsubscribeEmailWithToken", "token");
1960
- }
1961
-
1962
-
1963
- // Path Params
1964
- const localVarPath = '/apps/{app_id}/notifications/{notification_id}/unsubscribe'
1965
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1966
- .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId)));
1967
-
1968
- // Make Request Context
1969
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
1970
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1971
-
1972
- // Always add the One Signal telemetry to the request.
1973
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
1974
-
1975
- // Query Params
1976
- if (token !== undefined) {
1977
- requestContext.setQueryParam("token", ObjectSerializer.serialize(token, "string", ""));
1978
- }
1979
-
1980
-
1981
- let authMethod: SecurityAuthentication | undefined;
1982
- // Apply auth methods
1983
- authMethod = _config.authMethods["rest_api_key"]
1984
- if (authMethod?.applySecurityAuthentication) {
1985
- await authMethod?.applySecurityAuthentication(requestContext);
1986
- }
1987
-
1988
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1989
- if (defaultAuth?.applySecurityAuthentication) {
1990
- await defaultAuth?.applySecurityAuthentication(requestContext);
1991
- }
1992
-
1993
- return requestContext;
1994
- }
1995
-
1996
- /**
1997
- * Update a Rich Authentication Token (App API Key) for a OneSignal app.
1998
- * Update API key
1999
- * @param appId
2000
- * @param tokenId
2001
- * @param updateApiKeyRequest
2002
- */
2003
- public async updateApiKey(appId: string, tokenId: string, updateApiKeyRequest: UpdateApiKeyRequest, _options?: Configuration): Promise<RequestContext> {
2004
- let _config = _options || this.configuration;
2005
-
2006
- // verify required parameter 'appId' is not null or undefined
2007
- if (appId === null || appId === undefined) {
2008
- throw new RequiredError("DefaultApi", "updateApiKey", "appId");
2009
- }
2010
-
2011
-
2012
- // verify required parameter 'tokenId' is not null or undefined
2013
- if (tokenId === null || tokenId === undefined) {
2014
- throw new RequiredError("DefaultApi", "updateApiKey", "tokenId");
2015
- }
2016
-
2017
-
2018
- // verify required parameter 'updateApiKeyRequest' is not null or undefined
2019
- if (updateApiKeyRequest === null || updateApiKeyRequest === undefined) {
2020
- throw new RequiredError("DefaultApi", "updateApiKey", "updateApiKeyRequest");
2021
- }
2022
-
2023
-
2024
- // Path Params
2025
- const localVarPath = '/apps/{app_id}/auth/tokens/{token_id}'
2026
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
2027
- .replace('{' + 'token_id' + '}', encodeURIComponent(String(tokenId)));
2028
-
2029
- // Make Request Context
2030
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
2031
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
2032
-
2033
- // Always add the One Signal telemetry to the request.
2034
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
2035
-
2036
-
2037
- // Body Params
2038
- const contentType = ObjectSerializer.getPreferredMediaType([
2039
- "application/json"
2040
- ]);
2041
- requestContext.setHeaderParam("Content-Type", contentType);
2042
- const serializedBody = ObjectSerializer.stringify(
2043
- ObjectSerializer.serialize(updateApiKeyRequest, "UpdateApiKeyRequest", ""),
2044
- contentType
2045
- );
2046
- requestContext.setBody(serializedBody);
2047
-
2048
- let authMethod: SecurityAuthentication | undefined;
2049
- // Apply auth methods
2050
- authMethod = _config.authMethods["organization_api_key"]
2051
- if (authMethod?.applySecurityAuthentication) {
2052
- await authMethod?.applySecurityAuthentication(requestContext);
2053
- }
2054
-
2055
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
2056
- if (defaultAuth?.applySecurityAuthentication) {
2057
- await defaultAuth?.applySecurityAuthentication(requestContext);
2058
- }
2059
-
2060
- return requestContext;
2061
- }
2062
-
2063
- /**
2064
- * Updates the name or configuration settings of an existing OneSignal app
2065
- * Update an app
2066
- * @param appId An app id
2067
- * @param app
2068
- */
2069
- public async updateApp(appId: string, app: App, _options?: Configuration): Promise<RequestContext> {
2070
- let _config = _options || this.configuration;
2071
-
2072
- // verify required parameter 'appId' is not null or undefined
2073
- if (appId === null || appId === undefined) {
2074
- throw new RequiredError("DefaultApi", "updateApp", "appId");
2075
- }
2076
-
2077
-
2078
- // verify required parameter 'app' is not null or undefined
2079
- if (app === null || app === undefined) {
2080
- throw new RequiredError("DefaultApi", "updateApp", "app");
2081
- }
2082
-
2083
-
2084
- // Path Params
2085
- const localVarPath = '/apps/{app_id}'
2086
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
2087
-
2088
- // Make Request Context
2089
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT);
2090
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
2091
-
2092
- // Always add the One Signal telemetry to the request.
2093
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
2094
-
2095
-
2096
- // Body Params
2097
- const contentType = ObjectSerializer.getPreferredMediaType([
2098
- "application/json"
2099
- ]);
2100
- requestContext.setHeaderParam("Content-Type", contentType);
2101
- const serializedBody = ObjectSerializer.stringify(
2102
- ObjectSerializer.serialize(app, "App", ""),
2103
- contentType
2104
- );
2105
- requestContext.setBody(serializedBody);
2106
-
2107
- let authMethod: SecurityAuthentication | undefined;
2108
- // Apply auth methods
2109
- authMethod = _config.authMethods["organization_api_key"]
2110
- if (authMethod?.applySecurityAuthentication) {
2111
- await authMethod?.applySecurityAuthentication(requestContext);
2112
- }
2113
-
2114
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
2115
- if (defaultAuth?.applySecurityAuthentication) {
2116
- await defaultAuth?.applySecurityAuthentication(requestContext);
2117
- }
2118
-
2119
- return requestContext;
2120
- }
2121
-
2122
- /**
2123
- * Updates a specified live activity.
2124
- * Update a Live Activity via Push
2125
- * @param appId The OneSignal App ID for your app. Available in Keys &amp; IDs.
2126
- * @param activityId Live Activity record ID
2127
- * @param updateLiveActivityRequest
2128
- */
2129
- public async updateLiveActivity(appId: string, activityId: string, updateLiveActivityRequest: UpdateLiveActivityRequest, _options?: Configuration): Promise<RequestContext> {
2130
- let _config = _options || this.configuration;
2131
-
2132
- // verify required parameter 'appId' is not null or undefined
2133
- if (appId === null || appId === undefined) {
2134
- throw new RequiredError("DefaultApi", "updateLiveActivity", "appId");
2135
- }
2136
-
2137
-
2138
- // verify required parameter 'activityId' is not null or undefined
2139
- if (activityId === null || activityId === undefined) {
2140
- throw new RequiredError("DefaultApi", "updateLiveActivity", "activityId");
2141
- }
2142
-
2143
-
2144
- // verify required parameter 'updateLiveActivityRequest' is not null or undefined
2145
- if (updateLiveActivityRequest === null || updateLiveActivityRequest === undefined) {
2146
- throw new RequiredError("DefaultApi", "updateLiveActivity", "updateLiveActivityRequest");
2147
- }
2148
-
2149
-
2150
- // Path Params
2151
- const localVarPath = '/apps/{app_id}/live_activities/{activity_id}/notifications'
2152
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
2153
- .replace('{' + 'activity_id' + '}', encodeURIComponent(String(activityId)));
2154
-
2155
- // Make Request Context
2156
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
2157
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
2158
-
2159
- // Always add the One Signal telemetry to the request.
2160
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
2161
-
2162
-
2163
- // Body Params
2164
- const contentType = ObjectSerializer.getPreferredMediaType([
2165
- "application/json"
2166
- ]);
2167
- requestContext.setHeaderParam("Content-Type", contentType);
2168
- const serializedBody = ObjectSerializer.stringify(
2169
- ObjectSerializer.serialize(updateLiveActivityRequest, "UpdateLiveActivityRequest", ""),
2170
- contentType
2171
- );
2172
- requestContext.setBody(serializedBody);
2173
-
2174
- let authMethod: SecurityAuthentication | undefined;
2175
- // Apply auth methods
2176
- authMethod = _config.authMethods["rest_api_key"]
2177
- if (authMethod?.applySecurityAuthentication) {
2178
- await authMethod?.applySecurityAuthentication(requestContext);
2179
- }
2180
-
2181
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
2182
- if (defaultAuth?.applySecurityAuthentication) {
2183
- await defaultAuth?.applySecurityAuthentication(requestContext);
2184
- }
2185
-
2186
- return requestContext;
2187
- }
2188
-
2189
- /**
2190
- * Updates an existing Subscription’s properties.
2191
- * @param appId
2192
- * @param subscriptionId
2193
- * @param subscriptionBody
2194
- */
2195
- public async updateSubscription(appId: string, subscriptionId: string, subscriptionBody: SubscriptionBody, _options?: Configuration): Promise<RequestContext> {
2196
- let _config = _options || this.configuration;
2197
-
2198
- // verify required parameter 'appId' is not null or undefined
2199
- if (appId === null || appId === undefined) {
2200
- throw new RequiredError("DefaultApi", "updateSubscription", "appId");
2201
- }
2202
-
2203
-
2204
- // verify required parameter 'subscriptionId' is not null or undefined
2205
- if (subscriptionId === null || subscriptionId === undefined) {
2206
- throw new RequiredError("DefaultApi", "updateSubscription", "subscriptionId");
2207
- }
2208
-
2209
-
2210
- // verify required parameter 'subscriptionBody' is not null or undefined
2211
- if (subscriptionBody === null || subscriptionBody === undefined) {
2212
- throw new RequiredError("DefaultApi", "updateSubscription", "subscriptionBody");
2213
- }
2214
-
2215
-
2216
- // Path Params
2217
- const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}'
2218
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
2219
- .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId)));
2220
-
2221
- // Make Request Context
2222
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
2223
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
2224
-
2225
- // Always add the One Signal telemetry to the request.
2226
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
2227
-
2228
-
2229
- // Body Params
2230
- const contentType = ObjectSerializer.getPreferredMediaType([
2231
- "application/json"
2232
- ]);
2233
- requestContext.setHeaderParam("Content-Type", contentType);
2234
- const serializedBody = ObjectSerializer.stringify(
2235
- ObjectSerializer.serialize(subscriptionBody, "SubscriptionBody", ""),
2236
- contentType
2237
- );
2238
- requestContext.setBody(serializedBody);
2239
-
2240
- let authMethod: SecurityAuthentication | undefined;
2241
- // Apply auth methods
2242
- authMethod = _config.authMethods["rest_api_key"]
2243
- if (authMethod?.applySecurityAuthentication) {
2244
- await authMethod?.applySecurityAuthentication(requestContext);
2245
- }
2246
-
2247
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
2248
- if (defaultAuth?.applySecurityAuthentication) {
2249
- await defaultAuth?.applySecurityAuthentication(requestContext);
2250
- }
2251
-
2252
- return requestContext;
2253
- }
2254
-
2255
- /**
2256
- * Update properties on an existing OneSignal subscription using its token.
2257
- * Update subscription by token
2258
- * @param appId Your OneSignal App ID in UUID v4 format.
2259
- * @param tokenType The type of token to use when looking up the subscription. See Subscription Types.
2260
- * @param token The value of the token to lookup by (e.g., email address, phone number).
2261
- * @param subscriptionBody
2262
- */
2263
- public async updateSubscriptionByToken(appId: string, tokenType: string, token: string, subscriptionBody: SubscriptionBody, _options?: Configuration): Promise<RequestContext> {
2264
- let _config = _options || this.configuration;
2265
-
2266
- // verify required parameter 'appId' is not null or undefined
2267
- if (appId === null || appId === undefined) {
2268
- throw new RequiredError("DefaultApi", "updateSubscriptionByToken", "appId");
2269
- }
2270
-
2271
-
2272
- // verify required parameter 'tokenType' is not null or undefined
2273
- if (tokenType === null || tokenType === undefined) {
2274
- throw new RequiredError("DefaultApi", "updateSubscriptionByToken", "tokenType");
2275
- }
2276
-
2277
-
2278
- // verify required parameter 'token' is not null or undefined
2279
- if (token === null || token === undefined) {
2280
- throw new RequiredError("DefaultApi", "updateSubscriptionByToken", "token");
2281
- }
2282
-
2283
-
2284
- // verify required parameter 'subscriptionBody' is not null or undefined
2285
- if (subscriptionBody === null || subscriptionBody === undefined) {
2286
- throw new RequiredError("DefaultApi", "updateSubscriptionByToken", "subscriptionBody");
2287
- }
2288
-
2289
-
2290
- // Path Params
2291
- const localVarPath = '/apps/{app_id}/subscriptions_by_token/{token_type}/{token}'
2292
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
2293
- .replace('{' + 'token_type' + '}', encodeURIComponent(String(tokenType)))
2294
- .replace('{' + 'token' + '}', encodeURIComponent(String(token)));
2295
-
2296
- // Make Request Context
2297
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
2298
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
2299
-
2300
- // Always add the One Signal telemetry to the request.
2301
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
2302
-
2303
-
2304
- // Body Params
2305
- const contentType = ObjectSerializer.getPreferredMediaType([
2306
- "application/json"
2307
- ]);
2308
- requestContext.setHeaderParam("Content-Type", contentType);
2309
- const serializedBody = ObjectSerializer.stringify(
2310
- ObjectSerializer.serialize(subscriptionBody, "SubscriptionBody", ""),
2311
- contentType
2312
- );
2313
- requestContext.setBody(serializedBody);
2314
-
2315
- let authMethod: SecurityAuthentication | undefined;
2316
- // Apply auth methods
2317
- authMethod = _config.authMethods["rest_api_key"]
2318
- if (authMethod?.applySecurityAuthentication) {
2319
- await authMethod?.applySecurityAuthentication(requestContext);
2320
- }
2321
-
2322
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
2323
- if (defaultAuth?.applySecurityAuthentication) {
2324
- await defaultAuth?.applySecurityAuthentication(requestContext);
2325
- }
2326
-
2327
- return requestContext;
2328
- }
2329
-
2330
- /**
2331
- * Update an existing template.
2332
- * Update template
2333
- * @param templateId
2334
- * @param appId
2335
- * @param updateTemplateRequest
2336
- */
2337
- public async updateTemplate(templateId: string, appId: string, updateTemplateRequest: UpdateTemplateRequest, _options?: Configuration): Promise<RequestContext> {
2338
- let _config = _options || this.configuration;
2339
-
2340
- // verify required parameter 'templateId' is not null or undefined
2341
- if (templateId === null || templateId === undefined) {
2342
- throw new RequiredError("DefaultApi", "updateTemplate", "templateId");
2343
- }
2344
-
2345
-
2346
- // verify required parameter 'appId' is not null or undefined
2347
- if (appId === null || appId === undefined) {
2348
- throw new RequiredError("DefaultApi", "updateTemplate", "appId");
2349
- }
2350
-
2351
-
2352
- // verify required parameter 'updateTemplateRequest' is not null or undefined
2353
- if (updateTemplateRequest === null || updateTemplateRequest === undefined) {
2354
- throw new RequiredError("DefaultApi", "updateTemplate", "updateTemplateRequest");
2355
- }
2356
-
2357
-
2358
- // Path Params
2359
- const localVarPath = '/templates/{template_id}'
2360
- .replace('{' + 'template_id' + '}', encodeURIComponent(String(templateId)));
2361
-
2362
- // Make Request Context
2363
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
2364
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
2365
-
2366
- // Always add the One Signal telemetry to the request.
2367
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
2368
-
2369
- // Query Params
2370
- if (appId !== undefined) {
2371
- requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", ""));
2372
- }
2373
-
2374
-
2375
- // Body Params
2376
- const contentType = ObjectSerializer.getPreferredMediaType([
2377
- "application/json"
2378
- ]);
2379
- requestContext.setHeaderParam("Content-Type", contentType);
2380
- const serializedBody = ObjectSerializer.stringify(
2381
- ObjectSerializer.serialize(updateTemplateRequest, "UpdateTemplateRequest", ""),
2382
- contentType
2383
- );
2384
- requestContext.setBody(serializedBody);
2385
-
2386
- let authMethod: SecurityAuthentication | undefined;
2387
- // Apply auth methods
2388
- authMethod = _config.authMethods["rest_api_key"]
2389
- if (authMethod?.applySecurityAuthentication) {
2390
- await authMethod?.applySecurityAuthentication(requestContext);
2391
- }
2392
-
2393
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
2394
- if (defaultAuth?.applySecurityAuthentication) {
2395
- await defaultAuth?.applySecurityAuthentication(requestContext);
2396
- }
2397
-
2398
- return requestContext;
2399
- }
2400
-
2401
- /**
2402
- * Updates an existing User’s properties.
2403
- * @param appId
2404
- * @param aliasLabel
2405
- * @param aliasId
2406
- * @param updateUserRequest
2407
- */
2408
- public async updateUser(appId: string, aliasLabel: string, aliasId: string, updateUserRequest: UpdateUserRequest, _options?: Configuration): Promise<RequestContext> {
2409
- let _config = _options || this.configuration;
2410
-
2411
- // verify required parameter 'appId' is not null or undefined
2412
- if (appId === null || appId === undefined) {
2413
- throw new RequiredError("DefaultApi", "updateUser", "appId");
2414
- }
2415
-
2416
-
2417
- // verify required parameter 'aliasLabel' is not null or undefined
2418
- if (aliasLabel === null || aliasLabel === undefined) {
2419
- throw new RequiredError("DefaultApi", "updateUser", "aliasLabel");
2420
- }
2421
-
2422
-
2423
- // verify required parameter 'aliasId' is not null or undefined
2424
- if (aliasId === null || aliasId === undefined) {
2425
- throw new RequiredError("DefaultApi", "updateUser", "aliasId");
2426
- }
2427
-
2428
-
2429
- // verify required parameter 'updateUserRequest' is not null or undefined
2430
- if (updateUserRequest === null || updateUserRequest === undefined) {
2431
- throw new RequiredError("DefaultApi", "updateUser", "updateUserRequest");
2432
- }
2433
-
2434
-
2435
- // Path Params
2436
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'
2437
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
2438
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
2439
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)));
2440
-
2441
- // Make Request Context
2442
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
2443
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
2444
-
2445
- // Always add the One Signal telemetry to the request.
2446
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
2447
-
2448
-
2449
- // Body Params
2450
- const contentType = ObjectSerializer.getPreferredMediaType([
2451
- "application/json"
2452
- ]);
2453
- requestContext.setHeaderParam("Content-Type", contentType);
2454
- const serializedBody = ObjectSerializer.stringify(
2455
- ObjectSerializer.serialize(updateUserRequest, "UpdateUserRequest", ""),
2456
- contentType
2457
- );
2458
- requestContext.setBody(serializedBody);
2459
-
2460
- let authMethod: SecurityAuthentication | undefined;
2461
- // Apply auth methods
2462
- authMethod = _config.authMethods["rest_api_key"]
2463
- if (authMethod?.applySecurityAuthentication) {
2464
- await authMethod?.applySecurityAuthentication(requestContext);
2465
- }
2466
-
2467
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
2468
- if (defaultAuth?.applySecurityAuthentication) {
2469
- await defaultAuth?.applySecurityAuthentication(requestContext);
2470
- }
2471
-
2472
- return requestContext;
2473
- }
2474
-
2475
- /**
2476
- * View the details of all of your current app API keys (Rich Authentication Token) for a single OneSignal app.
2477
- * View API keys
2478
- * @param appId
2479
- */
2480
- public async viewApiKeys(appId: string, _options?: Configuration): Promise<RequestContext> {
2481
- let _config = _options || this.configuration;
2482
-
2483
- // verify required parameter 'appId' is not null or undefined
2484
- if (appId === null || appId === undefined) {
2485
- throw new RequiredError("DefaultApi", "viewApiKeys", "appId");
2486
- }
2487
-
2488
-
2489
- // Path Params
2490
- const localVarPath = '/apps/{app_id}/auth/tokens'
2491
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
2492
-
2493
- // Make Request Context
2494
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
2495
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
2496
-
2497
- // Always add the One Signal telemetry to the request.
2498
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
2499
-
2500
-
2501
- let authMethod: SecurityAuthentication | undefined;
2502
- // Apply auth methods
2503
- authMethod = _config.authMethods["organization_api_key"]
2504
- if (authMethod?.applySecurityAuthentication) {
2505
- await authMethod?.applySecurityAuthentication(requestContext);
2506
- }
2507
-
2508
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
2509
- if (defaultAuth?.applySecurityAuthentication) {
2510
- await defaultAuth?.applySecurityAuthentication(requestContext);
2511
- }
2512
-
2513
- return requestContext;
2514
- }
2515
-
2516
- /**
2517
- * Fetch a single template by id.
2518
- * View template
2519
- * @param templateId
2520
- * @param appId
2521
- */
2522
- public async viewTemplate(templateId: string, appId: string, _options?: Configuration): Promise<RequestContext> {
2523
- let _config = _options || this.configuration;
2524
-
2525
- // verify required parameter 'templateId' is not null or undefined
2526
- if (templateId === null || templateId === undefined) {
2527
- throw new RequiredError("DefaultApi", "viewTemplate", "templateId");
2528
- }
2529
-
2530
-
2531
- // verify required parameter 'appId' is not null or undefined
2532
- if (appId === null || appId === undefined) {
2533
- throw new RequiredError("DefaultApi", "viewTemplate", "appId");
2534
- }
2535
-
2536
-
2537
- // Path Params
2538
- const localVarPath = '/templates/{template_id}'
2539
- .replace('{' + 'template_id' + '}', encodeURIComponent(String(templateId)));
2540
-
2541
- // Make Request Context
2542
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
2543
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
2544
-
2545
- // Always add the One Signal telemetry to the request.
2546
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
2547
-
2548
- // Query Params
2549
- if (appId !== undefined) {
2550
- requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", ""));
2551
- }
2552
-
2553
-
2554
- let authMethod: SecurityAuthentication | undefined;
2555
- // Apply auth methods
2556
- authMethod = _config.authMethods["rest_api_key"]
2557
- if (authMethod?.applySecurityAuthentication) {
2558
- await authMethod?.applySecurityAuthentication(requestContext);
2559
- }
2560
-
2561
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
2562
- if (defaultAuth?.applySecurityAuthentication) {
2563
- await defaultAuth?.applySecurityAuthentication(requestContext);
2564
- }
2565
-
2566
- return requestContext;
2567
- }
2568
-
2569
- /**
2570
- * List templates for an app.
2571
- * View templates
2572
- * @param appId Your OneSignal App ID in UUID v4 format.
2573
- * @param limit Maximum number of templates. Default and max is 50.
2574
- * @param offset Pagination offset.
2575
- * @param channel Filter by delivery channel.
2576
- */
2577
- public async viewTemplates(appId: string, limit?: number, offset?: number, channel?: 'push' | 'email' | 'sms', _options?: Configuration): Promise<RequestContext> {
2578
- let _config = _options || this.configuration;
2579
-
2580
- // verify required parameter 'appId' is not null or undefined
2581
- if (appId === null || appId === undefined) {
2582
- throw new RequiredError("DefaultApi", "viewTemplates", "appId");
2583
- }
2584
-
2585
-
2586
-
2587
-
2588
-
2589
- // Path Params
2590
- const localVarPath = '/templates';
2591
-
2592
- // Make Request Context
2593
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
2594
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
2595
-
2596
- // Always add the One Signal telemetry to the request.
2597
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.3.0-beta1");
2598
-
2599
- // Query Params
2600
- if (appId !== undefined) {
2601
- requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", ""));
2602
- }
2603
-
2604
- // Query Params
2605
- if (limit !== undefined) {
2606
- requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", ""));
2607
- }
2608
-
2609
- // Query Params
2610
- if (offset !== undefined) {
2611
- requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", ""));
2612
- }
2613
-
2614
- // Query Params
2615
- if (channel !== undefined) {
2616
- requestContext.setQueryParam("channel", ObjectSerializer.serialize(channel, "'push' | 'email' | 'sms'", ""));
2617
- }
2618
-
2619
-
2620
- let authMethod: SecurityAuthentication | undefined;
2621
- // Apply auth methods
2622
- authMethod = _config.authMethods["rest_api_key"]
2623
- if (authMethod?.applySecurityAuthentication) {
2624
- await authMethod?.applySecurityAuthentication(requestContext);
2625
- }
2626
-
2627
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
2628
- if (defaultAuth?.applySecurityAuthentication) {
2629
- await defaultAuth?.applySecurityAuthentication(requestContext);
2630
- }
2631
-
2632
- return requestContext;
2633
- }
2634
-
2635
- }
2636
-
2637
- export class DefaultApiResponseProcessor {
2638
-
2639
- /**
2640
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2641
- * to the expected objects
2642
- *
2643
- * @params response Response returned by the server for a request to cancelNotification
2644
- * @throws ApiException if the response code was not in [200, 299]
2645
- */
2646
- public async cancelNotification(response: ResponseContext): Promise<GenericSuccessBoolResponse > {
2647
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2648
- if (isCodeInRange("200", response.httpStatusCode)) {
2649
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
2650
- ObjectSerializer.parse(await response.body.text(), contentType),
2651
- "GenericSuccessBoolResponse", ""
2652
- ) as GenericSuccessBoolResponse;
2653
- return body;
2654
- }
2655
- if (isCodeInRange("400", response.httpStatusCode)) {
2656
- const body: GenericError = ObjectSerializer.deserialize(
2657
- ObjectSerializer.parse(await response.body.text(), contentType),
2658
- "GenericError", ""
2659
- ) as GenericError;
2660
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2661
- }
2662
- if (isCodeInRange("404", response.httpStatusCode)) {
2663
- const body: GenericError = ObjectSerializer.deserialize(
2664
- ObjectSerializer.parse(await response.body.text(), contentType),
2665
- "GenericError", ""
2666
- ) as GenericError;
2667
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
2668
- }
2669
- if (isCodeInRange("429", response.httpStatusCode)) {
2670
- const body: RateLimitError = ObjectSerializer.deserialize(
2671
- ObjectSerializer.parse(await response.body.text(), contentType),
2672
- "RateLimitError", ""
2673
- ) as RateLimitError;
2674
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2675
- }
2676
-
2677
- // Work around for missing responses in specification, e.g. for petstore.yaml
2678
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2679
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
2680
- ObjectSerializer.parse(await response.body.text(), contentType),
2681
- "GenericSuccessBoolResponse", ""
2682
- ) as GenericSuccessBoolResponse;
2683
- return body;
2684
- }
2685
-
2686
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2687
- }
2688
-
2689
- /**
2690
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2691
- * to the expected objects
2692
- *
2693
- * @params response Response returned by the server for a request to copyTemplateToApp
2694
- * @throws ApiException if the response code was not in [200, 299]
2695
- */
2696
- public async copyTemplateToApp(response: ResponseContext): Promise<TemplateResource > {
2697
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2698
- if (isCodeInRange("200", response.httpStatusCode)) {
2699
- const body: TemplateResource = ObjectSerializer.deserialize(
2700
- ObjectSerializer.parse(await response.body.text(), contentType),
2701
- "TemplateResource", ""
2702
- ) as TemplateResource;
2703
- return body;
2704
- }
2705
- if (isCodeInRange("400", response.httpStatusCode)) {
2706
- const body: GenericError = ObjectSerializer.deserialize(
2707
- ObjectSerializer.parse(await response.body.text(), contentType),
2708
- "GenericError", ""
2709
- ) as GenericError;
2710
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2711
- }
2712
-
2713
- // Work around for missing responses in specification, e.g. for petstore.yaml
2714
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2715
- const body: TemplateResource = ObjectSerializer.deserialize(
2716
- ObjectSerializer.parse(await response.body.text(), contentType),
2717
- "TemplateResource", ""
2718
- ) as TemplateResource;
2719
- return body;
2720
- }
2721
-
2722
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2723
- }
2724
-
2725
- /**
2726
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2727
- * to the expected objects
2728
- *
2729
- * @params response Response returned by the server for a request to createAlias
2730
- * @throws ApiException if the response code was not in [200, 299]
2731
- */
2732
- public async createAlias(response: ResponseContext): Promise<UserIdentityBody > {
2733
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2734
- if (isCodeInRange("200", response.httpStatusCode)) {
2735
- const body: UserIdentityBody = ObjectSerializer.deserialize(
2736
- ObjectSerializer.parse(await response.body.text(), contentType),
2737
- "UserIdentityBody", ""
2738
- ) as UserIdentityBody;
2739
- return body;
2740
- }
2741
- if (isCodeInRange("400", response.httpStatusCode)) {
2742
- const body: GenericError = ObjectSerializer.deserialize(
2743
- ObjectSerializer.parse(await response.body.text(), contentType),
2744
- "GenericError", ""
2745
- ) as GenericError;
2746
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2747
- }
2748
- if (isCodeInRange("404", response.httpStatusCode)) {
2749
- const body: GenericError = ObjectSerializer.deserialize(
2750
- ObjectSerializer.parse(await response.body.text(), contentType),
2751
- "GenericError", ""
2752
- ) as GenericError;
2753
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
2754
- }
2755
- if (isCodeInRange("409", response.httpStatusCode)) {
2756
- const body: GenericError = ObjectSerializer.deserialize(
2757
- ObjectSerializer.parse(await response.body.text(), contentType),
2758
- "GenericError", ""
2759
- ) as GenericError;
2760
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
2761
- }
2762
- if (isCodeInRange("429", response.httpStatusCode)) {
2763
- const body: RateLimitError = ObjectSerializer.deserialize(
2764
- ObjectSerializer.parse(await response.body.text(), contentType),
2765
- "RateLimitError", ""
2766
- ) as RateLimitError;
2767
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2768
- }
2769
-
2770
- // Work around for missing responses in specification, e.g. for petstore.yaml
2771
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2772
- const body: UserIdentityBody = ObjectSerializer.deserialize(
2773
- ObjectSerializer.parse(await response.body.text(), contentType),
2774
- "UserIdentityBody", ""
2775
- ) as UserIdentityBody;
2776
- return body;
2777
- }
2778
-
2779
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2780
- }
2781
-
2782
- /**
2783
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2784
- * to the expected objects
2785
- *
2786
- * @params response Response returned by the server for a request to createAliasBySubscription
2787
- * @throws ApiException if the response code was not in [200, 299]
2788
- */
2789
- public async createAliasBySubscription(response: ResponseContext): Promise<UserIdentityBody > {
2790
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2791
- if (isCodeInRange("200", response.httpStatusCode)) {
2792
- const body: UserIdentityBody = ObjectSerializer.deserialize(
2793
- ObjectSerializer.parse(await response.body.text(), contentType),
2794
- "UserIdentityBody", ""
2795
- ) as UserIdentityBody;
2796
- return body;
2797
- }
2798
- if (isCodeInRange("400", response.httpStatusCode)) {
2799
- const body: GenericError = ObjectSerializer.deserialize(
2800
- ObjectSerializer.parse(await response.body.text(), contentType),
2801
- "GenericError", ""
2802
- ) as GenericError;
2803
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2804
- }
2805
- if (isCodeInRange("404", response.httpStatusCode)) {
2806
- const body: GenericError = ObjectSerializer.deserialize(
2807
- ObjectSerializer.parse(await response.body.text(), contentType),
2808
- "GenericError", ""
2809
- ) as GenericError;
2810
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
2811
- }
2812
- if (isCodeInRange("409", response.httpStatusCode)) {
2813
- const body: GenericError = ObjectSerializer.deserialize(
2814
- ObjectSerializer.parse(await response.body.text(), contentType),
2815
- "GenericError", ""
2816
- ) as GenericError;
2817
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
2818
- }
2819
- if (isCodeInRange("429", response.httpStatusCode)) {
2820
- const body: RateLimitError = ObjectSerializer.deserialize(
2821
- ObjectSerializer.parse(await response.body.text(), contentType),
2822
- "RateLimitError", ""
2823
- ) as RateLimitError;
2824
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2825
- }
2826
-
2827
- // Work around for missing responses in specification, e.g. for petstore.yaml
2828
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2829
- const body: UserIdentityBody = ObjectSerializer.deserialize(
2830
- ObjectSerializer.parse(await response.body.text(), contentType),
2831
- "UserIdentityBody", ""
2832
- ) as UserIdentityBody;
2833
- return body;
2834
- }
2835
-
2836
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2837
- }
2838
-
2839
- /**
2840
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2841
- * to the expected objects
2842
- *
2843
- * @params response Response returned by the server for a request to createApiKey
2844
- * @throws ApiException if the response code was not in [200, 299]
2845
- */
2846
- public async createApiKey(response: ResponseContext): Promise<CreateApiKeyResponse > {
2847
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2848
- if (isCodeInRange("200", response.httpStatusCode)) {
2849
- const body: CreateApiKeyResponse = ObjectSerializer.deserialize(
2850
- ObjectSerializer.parse(await response.body.text(), contentType),
2851
- "CreateApiKeyResponse", ""
2852
- ) as CreateApiKeyResponse;
2853
- return body;
2854
- }
2855
- if (isCodeInRange("400", response.httpStatusCode)) {
2856
- const body: GenericError = ObjectSerializer.deserialize(
2857
- ObjectSerializer.parse(await response.body.text(), contentType),
2858
- "GenericError", ""
2859
- ) as GenericError;
2860
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2861
- }
2862
-
2863
- // Work around for missing responses in specification, e.g. for petstore.yaml
2864
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2865
- const body: CreateApiKeyResponse = ObjectSerializer.deserialize(
2866
- ObjectSerializer.parse(await response.body.text(), contentType),
2867
- "CreateApiKeyResponse", ""
2868
- ) as CreateApiKeyResponse;
2869
- return body;
2870
- }
2871
-
2872
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2873
- }
2874
-
2875
- /**
2876
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2877
- * to the expected objects
2878
- *
2879
- * @params response Response returned by the server for a request to createApp
2880
- * @throws ApiException if the response code was not in [200, 299]
2881
- */
2882
- public async createApp(response: ResponseContext): Promise<App > {
2883
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2884
- if (isCodeInRange("200", response.httpStatusCode)) {
2885
- const body: App = ObjectSerializer.deserialize(
2886
- ObjectSerializer.parse(await response.body.text(), contentType),
2887
- "App", ""
2888
- ) as App;
2889
- return body;
2890
- }
2891
- if (isCodeInRange("400", response.httpStatusCode)) {
2892
- const body: GenericError = ObjectSerializer.deserialize(
2893
- ObjectSerializer.parse(await response.body.text(), contentType),
2894
- "GenericError", ""
2895
- ) as GenericError;
2896
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2897
- }
2898
- if (isCodeInRange("429", response.httpStatusCode)) {
2899
- const body: RateLimitError = ObjectSerializer.deserialize(
2900
- ObjectSerializer.parse(await response.body.text(), contentType),
2901
- "RateLimitError", ""
2902
- ) as RateLimitError;
2903
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2904
- }
2905
-
2906
- // Work around for missing responses in specification, e.g. for petstore.yaml
2907
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2908
- const body: App = ObjectSerializer.deserialize(
2909
- ObjectSerializer.parse(await response.body.text(), contentType),
2910
- "App", ""
2911
- ) as App;
2912
- return body;
2913
- }
2914
-
2915
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2916
- }
2917
-
2918
- /**
2919
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2920
- * to the expected objects
2921
- *
2922
- * @params response Response returned by the server for a request to createCustomEvents
2923
- * @throws ApiException if the response code was not in [200, 299]
2924
- */
2925
- public async createCustomEvents(response: ResponseContext): Promise<object > {
2926
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2927
- if (isCodeInRange("200", response.httpStatusCode)) {
2928
- const body: object = ObjectSerializer.deserialize(
2929
- ObjectSerializer.parse(await response.body.text(), contentType),
2930
- "object", ""
2931
- ) as object;
2932
- return body;
2933
- }
2934
- if (isCodeInRange("400", response.httpStatusCode)) {
2935
- const body: GenericError = ObjectSerializer.deserialize(
2936
- ObjectSerializer.parse(await response.body.text(), contentType),
2937
- "GenericError", ""
2938
- ) as GenericError;
2939
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2940
- }
2941
- if (isCodeInRange("401", response.httpStatusCode)) {
2942
- const body: GenericError = ObjectSerializer.deserialize(
2943
- ObjectSerializer.parse(await response.body.text(), contentType),
2944
- "GenericError", ""
2945
- ) as GenericError;
2946
- throw new ApiException<GenericError>(401, "Unauthorized", body, response.headers);
2947
- }
2948
- if (isCodeInRange("429", response.httpStatusCode)) {
2949
- const body: RateLimitError = ObjectSerializer.deserialize(
2950
- ObjectSerializer.parse(await response.body.text(), contentType),
2951
- "RateLimitError", ""
2952
- ) as RateLimitError;
2953
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2954
- }
2955
-
2956
- // Work around for missing responses in specification, e.g. for petstore.yaml
2957
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2958
- const body: object = ObjectSerializer.deserialize(
2959
- ObjectSerializer.parse(await response.body.text(), contentType),
2960
- "object", ""
2961
- ) as object;
2962
- return body;
2963
- }
2964
-
2965
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2966
- }
2967
-
2968
- /**
2969
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2970
- * to the expected objects
2971
- *
2972
- * @params response Response returned by the server for a request to createNotification
2973
- * @throws ApiException if the response code was not in [200, 299]
2974
- */
2975
- public async createNotification(response: ResponseContext): Promise<CreateNotificationSuccessResponse > {
2976
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2977
- if (isCodeInRange("200", response.httpStatusCode)) {
2978
- const body: CreateNotificationSuccessResponse = ObjectSerializer.deserialize(
2979
- ObjectSerializer.parse(await response.body.text(), contentType),
2980
- "CreateNotificationSuccessResponse", ""
2981
- ) as CreateNotificationSuccessResponse;
2982
- return body;
2983
- }
2984
- if (isCodeInRange("400", response.httpStatusCode)) {
2985
- const body: GenericError = ObjectSerializer.deserialize(
2986
- ObjectSerializer.parse(await response.body.text(), contentType),
2987
- "GenericError", ""
2988
- ) as GenericError;
2989
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2990
- }
2991
- if (isCodeInRange("429", response.httpStatusCode)) {
2992
- const body: RateLimitError = ObjectSerializer.deserialize(
2993
- ObjectSerializer.parse(await response.body.text(), contentType),
2994
- "RateLimitError", ""
2995
- ) as RateLimitError;
2996
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2997
- }
2998
-
2999
- // Work around for missing responses in specification, e.g. for petstore.yaml
3000
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3001
- const body: CreateNotificationSuccessResponse = ObjectSerializer.deserialize(
3002
- ObjectSerializer.parse(await response.body.text(), contentType),
3003
- "CreateNotificationSuccessResponse", ""
3004
- ) as CreateNotificationSuccessResponse;
3005
- return body;
3006
- }
3007
-
3008
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3009
- }
3010
-
3011
- /**
3012
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3013
- * to the expected objects
3014
- *
3015
- * @params response Response returned by the server for a request to createSegment
3016
- * @throws ApiException if the response code was not in [200, 299]
3017
- */
3018
- public async createSegment(response: ResponseContext): Promise<CreateSegmentSuccessResponse > {
3019
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3020
- if (isCodeInRange("201", response.httpStatusCode)) {
3021
- const body: CreateSegmentSuccessResponse = ObjectSerializer.deserialize(
3022
- ObjectSerializer.parse(await response.body.text(), contentType),
3023
- "CreateSegmentSuccessResponse", ""
3024
- ) as CreateSegmentSuccessResponse;
3025
- return body;
3026
- }
3027
- if (isCodeInRange("400", response.httpStatusCode)) {
3028
- const body: GenericError = ObjectSerializer.deserialize(
3029
- ObjectSerializer.parse(await response.body.text(), contentType),
3030
- "GenericError", ""
3031
- ) as GenericError;
3032
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3033
- }
3034
- if (isCodeInRange("409", response.httpStatusCode)) {
3035
- const body: CreateSegmentConflictResponse = ObjectSerializer.deserialize(
3036
- ObjectSerializer.parse(await response.body.text(), contentType),
3037
- "CreateSegmentConflictResponse", ""
3038
- ) as CreateSegmentConflictResponse;
3039
- throw new ApiException<CreateSegmentConflictResponse>(409, "Conflict", body, response.headers);
3040
- }
3041
- if (isCodeInRange("429", response.httpStatusCode)) {
3042
- const body: RateLimitError = ObjectSerializer.deserialize(
3043
- ObjectSerializer.parse(await response.body.text(), contentType),
3044
- "RateLimitError", ""
3045
- ) as RateLimitError;
3046
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3047
- }
3048
-
3049
- // Work around for missing responses in specification, e.g. for petstore.yaml
3050
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3051
- const body: CreateSegmentSuccessResponse = ObjectSerializer.deserialize(
3052
- ObjectSerializer.parse(await response.body.text(), contentType),
3053
- "CreateSegmentSuccessResponse", ""
3054
- ) as CreateSegmentSuccessResponse;
3055
- return body;
3056
- }
3057
-
3058
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3059
- }
3060
-
3061
- /**
3062
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3063
- * to the expected objects
3064
- *
3065
- * @params response Response returned by the server for a request to createSubscription
3066
- * @throws ApiException if the response code was not in [200, 299]
3067
- */
3068
- public async createSubscription(response: ResponseContext): Promise<SubscriptionBody > {
3069
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3070
- if (isCodeInRange("201", response.httpStatusCode)) {
3071
- const body: SubscriptionBody = ObjectSerializer.deserialize(
3072
- ObjectSerializer.parse(await response.body.text(), contentType),
3073
- "SubscriptionBody", ""
3074
- ) as SubscriptionBody;
3075
- return body;
3076
- }
3077
- if (isCodeInRange("202", response.httpStatusCode)) {
3078
- const body: SubscriptionBody = ObjectSerializer.deserialize(
3079
- ObjectSerializer.parse(await response.body.text(), contentType),
3080
- "SubscriptionBody", ""
3081
- ) as SubscriptionBody;
3082
- return body;
3083
- }
3084
- if (isCodeInRange("400", response.httpStatusCode)) {
3085
- const body: GenericError = ObjectSerializer.deserialize(
3086
- ObjectSerializer.parse(await response.body.text(), contentType),
3087
- "GenericError", ""
3088
- ) as GenericError;
3089
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3090
- }
3091
- if (isCodeInRange("404", response.httpStatusCode)) {
3092
- const body: GenericError = ObjectSerializer.deserialize(
3093
- ObjectSerializer.parse(await response.body.text(), contentType),
3094
- "GenericError", ""
3095
- ) as GenericError;
3096
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
3097
- }
3098
- if (isCodeInRange("409", response.httpStatusCode)) {
3099
- const body: GenericError = ObjectSerializer.deserialize(
3100
- ObjectSerializer.parse(await response.body.text(), contentType),
3101
- "GenericError", ""
3102
- ) as GenericError;
3103
- throw new ApiException<GenericError>(409, "Operation is not permitted due to user having the maximum number of subscriptions assigned", body, response.headers);
3104
- }
3105
- if (isCodeInRange("429", response.httpStatusCode)) {
3106
- const body: RateLimitError = ObjectSerializer.deserialize(
3107
- ObjectSerializer.parse(await response.body.text(), contentType),
3108
- "RateLimitError", ""
3109
- ) as RateLimitError;
3110
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3111
- }
3112
-
3113
- // Work around for missing responses in specification, e.g. for petstore.yaml
3114
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3115
- const body: SubscriptionBody = ObjectSerializer.deserialize(
3116
- ObjectSerializer.parse(await response.body.text(), contentType),
3117
- "SubscriptionBody", ""
3118
- ) as SubscriptionBody;
3119
- return body;
3120
- }
3121
-
3122
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3123
- }
3124
-
3125
- /**
3126
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3127
- * to the expected objects
3128
- *
3129
- * @params response Response returned by the server for a request to createTemplate
3130
- * @throws ApiException if the response code was not in [200, 299]
3131
- */
3132
- public async createTemplate(response: ResponseContext): Promise<TemplateResource > {
3133
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3134
- if (isCodeInRange("200", response.httpStatusCode)) {
3135
- const body: TemplateResource = ObjectSerializer.deserialize(
3136
- ObjectSerializer.parse(await response.body.text(), contentType),
3137
- "TemplateResource", ""
3138
- ) as TemplateResource;
3139
- return body;
3140
- }
3141
- if (isCodeInRange("400", response.httpStatusCode)) {
3142
- const body: GenericError = ObjectSerializer.deserialize(
3143
- ObjectSerializer.parse(await response.body.text(), contentType),
3144
- "GenericError", ""
3145
- ) as GenericError;
3146
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3147
- }
3148
- if (isCodeInRange("422", response.httpStatusCode)) {
3149
- const body: GenericError = ObjectSerializer.deserialize(
3150
- ObjectSerializer.parse(await response.body.text(), contentType),
3151
- "GenericError", ""
3152
- ) as GenericError;
3153
- throw new ApiException<GenericError>(422, "Unprocessable Entity", body, response.headers);
3154
- }
3155
-
3156
- // Work around for missing responses in specification, e.g. for petstore.yaml
3157
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3158
- const body: TemplateResource = ObjectSerializer.deserialize(
3159
- ObjectSerializer.parse(await response.body.text(), contentType),
3160
- "TemplateResource", ""
3161
- ) as TemplateResource;
3162
- return body;
3163
- }
3164
-
3165
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3166
- }
3167
-
3168
- /**
3169
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3170
- * to the expected objects
3171
- *
3172
- * @params response Response returned by the server for a request to createUser
3173
- * @throws ApiException if the response code was not in [200, 299]
3174
- */
3175
- public async createUser(response: ResponseContext): Promise<User > {
3176
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3177
- if (isCodeInRange("200", response.httpStatusCode)) {
3178
- const body: User = ObjectSerializer.deserialize(
3179
- ObjectSerializer.parse(await response.body.text(), contentType),
3180
- "User", ""
3181
- ) as User;
3182
- return body;
3183
- }
3184
- if (isCodeInRange("201", response.httpStatusCode)) {
3185
- const body: User = ObjectSerializer.deserialize(
3186
- ObjectSerializer.parse(await response.body.text(), contentType),
3187
- "User", ""
3188
- ) as User;
3189
- return body;
3190
- }
3191
- if (isCodeInRange("202", response.httpStatusCode)) {
3192
- const body: User = ObjectSerializer.deserialize(
3193
- ObjectSerializer.parse(await response.body.text(), contentType),
3194
- "User", ""
3195
- ) as User;
3196
- return body;
3197
- }
3198
- if (isCodeInRange("400", response.httpStatusCode)) {
3199
- const body: GenericError = ObjectSerializer.deserialize(
3200
- ObjectSerializer.parse(await response.body.text(), contentType),
3201
- "GenericError", ""
3202
- ) as GenericError;
3203
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3204
- }
3205
- if (isCodeInRange("409", response.httpStatusCode)) {
3206
- const body: CreateUserConflictResponse = ObjectSerializer.deserialize(
3207
- ObjectSerializer.parse(await response.body.text(), contentType),
3208
- "CreateUserConflictResponse", ""
3209
- ) as CreateUserConflictResponse;
3210
- throw new ApiException<CreateUserConflictResponse>(409, "Multiple User Identity Conflict", body, response.headers);
3211
- }
3212
- if (isCodeInRange("429", response.httpStatusCode)) {
3213
- const body: RateLimitError = ObjectSerializer.deserialize(
3214
- ObjectSerializer.parse(await response.body.text(), contentType),
3215
- "RateLimitError", ""
3216
- ) as RateLimitError;
3217
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3218
- }
3219
-
3220
- // Work around for missing responses in specification, e.g. for petstore.yaml
3221
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3222
- const body: User = ObjectSerializer.deserialize(
3223
- ObjectSerializer.parse(await response.body.text(), contentType),
3224
- "User", ""
3225
- ) as User;
3226
- return body;
3227
- }
3228
-
3229
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3230
- }
3231
-
3232
- /**
3233
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3234
- * to the expected objects
3235
- *
3236
- * @params response Response returned by the server for a request to deleteAlias
3237
- * @throws ApiException if the response code was not in [200, 299]
3238
- */
3239
- public async deleteAlias(response: ResponseContext): Promise<UserIdentityBody > {
3240
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3241
- if (isCodeInRange("200", response.httpStatusCode)) {
3242
- const body: UserIdentityBody = ObjectSerializer.deserialize(
3243
- ObjectSerializer.parse(await response.body.text(), contentType),
3244
- "UserIdentityBody", ""
3245
- ) as UserIdentityBody;
3246
- return body;
3247
- }
3248
- if (isCodeInRange("400", response.httpStatusCode)) {
3249
- const body: GenericError = ObjectSerializer.deserialize(
3250
- ObjectSerializer.parse(await response.body.text(), contentType),
3251
- "GenericError", ""
3252
- ) as GenericError;
3253
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3254
- }
3255
- if (isCodeInRange("404", response.httpStatusCode)) {
3256
- const body: GenericError = ObjectSerializer.deserialize(
3257
- ObjectSerializer.parse(await response.body.text(), contentType),
3258
- "GenericError", ""
3259
- ) as GenericError;
3260
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
3261
- }
3262
- if (isCodeInRange("409", response.httpStatusCode)) {
3263
- const body: GenericError = ObjectSerializer.deserialize(
3264
- ObjectSerializer.parse(await response.body.text(), contentType),
3265
- "GenericError", ""
3266
- ) as GenericError;
3267
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
3268
- }
3269
- if (isCodeInRange("429", response.httpStatusCode)) {
3270
- const body: RateLimitError = ObjectSerializer.deserialize(
3271
- ObjectSerializer.parse(await response.body.text(), contentType),
3272
- "RateLimitError", ""
3273
- ) as RateLimitError;
3274
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3275
- }
3276
-
3277
- // Work around for missing responses in specification, e.g. for petstore.yaml
3278
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3279
- const body: UserIdentityBody = ObjectSerializer.deserialize(
3280
- ObjectSerializer.parse(await response.body.text(), contentType),
3281
- "UserIdentityBody", ""
3282
- ) as UserIdentityBody;
3283
- return body;
3284
- }
3285
-
3286
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3287
- }
3288
-
3289
- /**
3290
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3291
- * to the expected objects
3292
- *
3293
- * @params response Response returned by the server for a request to deleteApiKey
3294
- * @throws ApiException if the response code was not in [200, 299]
3295
- */
3296
- public async deleteApiKey(response: ResponseContext): Promise<object > {
3297
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3298
- if (isCodeInRange("200", response.httpStatusCode)) {
3299
- const body: object = ObjectSerializer.deserialize(
3300
- ObjectSerializer.parse(await response.body.text(), contentType),
3301
- "object", ""
3302
- ) as object;
3303
- return body;
3304
- }
3305
- if (isCodeInRange("400", response.httpStatusCode)) {
3306
- const body: GenericError = ObjectSerializer.deserialize(
3307
- ObjectSerializer.parse(await response.body.text(), contentType),
3308
- "GenericError", ""
3309
- ) as GenericError;
3310
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3311
- }
3312
-
3313
- // Work around for missing responses in specification, e.g. for petstore.yaml
3314
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3315
- const body: object = ObjectSerializer.deserialize(
3316
- ObjectSerializer.parse(await response.body.text(), contentType),
3317
- "object", ""
3318
- ) as object;
3319
- return body;
3320
- }
3321
-
3322
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3323
- }
3324
-
3325
- /**
3326
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3327
- * to the expected objects
3328
- *
3329
- * @params response Response returned by the server for a request to deleteSegment
3330
- * @throws ApiException if the response code was not in [200, 299]
3331
- */
3332
- public async deleteSegment(response: ResponseContext): Promise<GenericSuccessBoolResponse > {
3333
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3334
- if (isCodeInRange("200", response.httpStatusCode)) {
3335
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
3336
- ObjectSerializer.parse(await response.body.text(), contentType),
3337
- "GenericSuccessBoolResponse", ""
3338
- ) as GenericSuccessBoolResponse;
3339
- return body;
3340
- }
3341
- if (isCodeInRange("400", response.httpStatusCode)) {
3342
- const body: GenericError = ObjectSerializer.deserialize(
3343
- ObjectSerializer.parse(await response.body.text(), contentType),
3344
- "GenericError", ""
3345
- ) as GenericError;
3346
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3347
- }
3348
- if (isCodeInRange("404", response.httpStatusCode)) {
3349
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
3350
- ObjectSerializer.parse(await response.body.text(), contentType),
3351
- "GenericSuccessBoolResponse", ""
3352
- ) as GenericSuccessBoolResponse;
3353
- throw new ApiException<GenericSuccessBoolResponse>(404, "Not Found", body, response.headers);
3354
- }
3355
- if (isCodeInRange("429", response.httpStatusCode)) {
3356
- const body: RateLimitError = ObjectSerializer.deserialize(
3357
- ObjectSerializer.parse(await response.body.text(), contentType),
3358
- "RateLimitError", ""
3359
- ) as RateLimitError;
3360
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3361
- }
3362
-
3363
- // Work around for missing responses in specification, e.g. for petstore.yaml
3364
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3365
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
3366
- ObjectSerializer.parse(await response.body.text(), contentType),
3367
- "GenericSuccessBoolResponse", ""
3368
- ) as GenericSuccessBoolResponse;
3369
- return body;
3370
- }
3371
-
3372
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3373
- }
3374
-
3375
- /**
3376
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3377
- * to the expected objects
3378
- *
3379
- * @params response Response returned by the server for a request to deleteSubscription
3380
- * @throws ApiException if the response code was not in [200, 299]
3381
- */
3382
- public async deleteSubscription(response: ResponseContext): Promise<void > {
3383
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3384
- if (isCodeInRange("202", response.httpStatusCode)) {
3385
- return;
3386
- }
3387
- if (isCodeInRange("400", response.httpStatusCode)) {
3388
- const body: GenericError = ObjectSerializer.deserialize(
3389
- ObjectSerializer.parse(await response.body.text(), contentType),
3390
- "GenericError", ""
3391
- ) as GenericError;
3392
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3393
- }
3394
- if (isCodeInRange("404", response.httpStatusCode)) {
3395
- const body: GenericError = ObjectSerializer.deserialize(
3396
- ObjectSerializer.parse(await response.body.text(), contentType),
3397
- "GenericError", ""
3398
- ) as GenericError;
3399
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
3400
- }
3401
- if (isCodeInRange("409", response.httpStatusCode)) {
3402
- const body: GenericError = ObjectSerializer.deserialize(
3403
- ObjectSerializer.parse(await response.body.text(), contentType),
3404
- "GenericError", ""
3405
- ) as GenericError;
3406
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
3407
- }
3408
- if (isCodeInRange("429", response.httpStatusCode)) {
3409
- const body: RateLimitError = ObjectSerializer.deserialize(
3410
- ObjectSerializer.parse(await response.body.text(), contentType),
3411
- "RateLimitError", ""
3412
- ) as RateLimitError;
3413
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3414
- }
3415
-
3416
- // Work around for missing responses in specification, e.g. for petstore.yaml
3417
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3418
- const body: void = ObjectSerializer.deserialize(
3419
- ObjectSerializer.parse(await response.body.text(), contentType),
3420
- "void", ""
3421
- ) as void;
3422
- return body;
3423
- }
3424
-
3425
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3426
- }
3427
-
3428
- /**
3429
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3430
- * to the expected objects
3431
- *
3432
- * @params response Response returned by the server for a request to deleteTemplate
3433
- * @throws ApiException if the response code was not in [200, 299]
3434
- */
3435
- public async deleteTemplate(response: ResponseContext): Promise<GenericSuccessBoolResponse > {
3436
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3437
- if (isCodeInRange("200", response.httpStatusCode)) {
3438
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
3439
- ObjectSerializer.parse(await response.body.text(), contentType),
3440
- "GenericSuccessBoolResponse", ""
3441
- ) as GenericSuccessBoolResponse;
3442
- return body;
3443
- }
3444
- if (isCodeInRange("400", response.httpStatusCode)) {
3445
- const body: GenericError = ObjectSerializer.deserialize(
3446
- ObjectSerializer.parse(await response.body.text(), contentType),
3447
- "GenericError", ""
3448
- ) as GenericError;
3449
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3450
- }
3451
- if (isCodeInRange("404", response.httpStatusCode)) {
3452
- const body: GenericError = ObjectSerializer.deserialize(
3453
- ObjectSerializer.parse(await response.body.text(), contentType),
3454
- "GenericError", ""
3455
- ) as GenericError;
3456
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
3457
- }
3458
-
3459
- // Work around for missing responses in specification, e.g. for petstore.yaml
3460
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3461
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
3462
- ObjectSerializer.parse(await response.body.text(), contentType),
3463
- "GenericSuccessBoolResponse", ""
3464
- ) as GenericSuccessBoolResponse;
3465
- return body;
3466
- }
3467
-
3468
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3469
- }
3470
-
3471
- /**
3472
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3473
- * to the expected objects
3474
- *
3475
- * @params response Response returned by the server for a request to deleteUser
3476
- * @throws ApiException if the response code was not in [200, 299]
3477
- */
3478
- public async deleteUser(response: ResponseContext): Promise<void > {
3479
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3480
- if (isCodeInRange("200", response.httpStatusCode)) {
3481
- return;
3482
- }
3483
- if (isCodeInRange("400", response.httpStatusCode)) {
3484
- const body: GenericError = ObjectSerializer.deserialize(
3485
- ObjectSerializer.parse(await response.body.text(), contentType),
3486
- "GenericError", ""
3487
- ) as GenericError;
3488
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3489
- }
3490
- if (isCodeInRange("409", response.httpStatusCode)) {
3491
- const body: GenericError = ObjectSerializer.deserialize(
3492
- ObjectSerializer.parse(await response.body.text(), contentType),
3493
- "GenericError", ""
3494
- ) as GenericError;
3495
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
3496
- }
3497
- if (isCodeInRange("429", response.httpStatusCode)) {
3498
- const body: RateLimitError = ObjectSerializer.deserialize(
3499
- ObjectSerializer.parse(await response.body.text(), contentType),
3500
- "RateLimitError", ""
3501
- ) as RateLimitError;
3502
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3503
- }
3504
-
3505
- // Work around for missing responses in specification, e.g. for petstore.yaml
3506
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3507
- const body: void = ObjectSerializer.deserialize(
3508
- ObjectSerializer.parse(await response.body.text(), contentType),
3509
- "void", ""
3510
- ) as void;
3511
- return body;
3512
- }
3513
-
3514
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3515
- }
3516
-
3517
- /**
3518
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3519
- * to the expected objects
3520
- *
3521
- * @params response Response returned by the server for a request to exportEvents
3522
- * @throws ApiException if the response code was not in [200, 299]
3523
- */
3524
- public async exportEvents(response: ResponseContext): Promise<ExportEventsSuccessResponse > {
3525
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3526
- if (isCodeInRange("200", response.httpStatusCode)) {
3527
- const body: ExportEventsSuccessResponse = ObjectSerializer.deserialize(
3528
- ObjectSerializer.parse(await response.body.text(), contentType),
3529
- "ExportEventsSuccessResponse", ""
3530
- ) as ExportEventsSuccessResponse;
3531
- return body;
3532
- }
3533
- if (isCodeInRange("400", response.httpStatusCode)) {
3534
- const body: GenericError = ObjectSerializer.deserialize(
3535
- ObjectSerializer.parse(await response.body.text(), contentType),
3536
- "GenericError", ""
3537
- ) as GenericError;
3538
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3539
- }
3540
- if (isCodeInRange("404", response.httpStatusCode)) {
3541
- const body: GenericError = ObjectSerializer.deserialize(
3542
- ObjectSerializer.parse(await response.body.text(), contentType),
3543
- "GenericError", ""
3544
- ) as GenericError;
3545
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
3546
- }
3547
- if (isCodeInRange("429", response.httpStatusCode)) {
3548
- const body: RateLimitError = ObjectSerializer.deserialize(
3549
- ObjectSerializer.parse(await response.body.text(), contentType),
3550
- "RateLimitError", ""
3551
- ) as RateLimitError;
3552
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3553
- }
3554
-
3555
- // Work around for missing responses in specification, e.g. for petstore.yaml
3556
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3557
- const body: ExportEventsSuccessResponse = ObjectSerializer.deserialize(
3558
- ObjectSerializer.parse(await response.body.text(), contentType),
3559
- "ExportEventsSuccessResponse", ""
3560
- ) as ExportEventsSuccessResponse;
3561
- return body;
3562
- }
3563
-
3564
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3565
- }
3566
-
3567
- /**
3568
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3569
- * to the expected objects
3570
- *
3571
- * @params response Response returned by the server for a request to exportSubscriptions
3572
- * @throws ApiException if the response code was not in [200, 299]
3573
- */
3574
- public async exportSubscriptions(response: ResponseContext): Promise<ExportSubscriptionsSuccessResponse > {
3575
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3576
- if (isCodeInRange("200", response.httpStatusCode)) {
3577
- const body: ExportSubscriptionsSuccessResponse = ObjectSerializer.deserialize(
3578
- ObjectSerializer.parse(await response.body.text(), contentType),
3579
- "ExportSubscriptionsSuccessResponse", ""
3580
- ) as ExportSubscriptionsSuccessResponse;
3581
- return body;
3582
- }
3583
- if (isCodeInRange("400", response.httpStatusCode)) {
3584
- const body: GenericError = ObjectSerializer.deserialize(
3585
- ObjectSerializer.parse(await response.body.text(), contentType),
3586
- "GenericError", ""
3587
- ) as GenericError;
3588
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3589
- }
3590
- if (isCodeInRange("429", response.httpStatusCode)) {
3591
- const body: RateLimitError = ObjectSerializer.deserialize(
3592
- ObjectSerializer.parse(await response.body.text(), contentType),
3593
- "RateLimitError", ""
3594
- ) as RateLimitError;
3595
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3596
- }
3597
-
3598
- // Work around for missing responses in specification, e.g. for petstore.yaml
3599
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3600
- const body: ExportSubscriptionsSuccessResponse = ObjectSerializer.deserialize(
3601
- ObjectSerializer.parse(await response.body.text(), contentType),
3602
- "ExportSubscriptionsSuccessResponse", ""
3603
- ) as ExportSubscriptionsSuccessResponse;
3604
- return body;
3605
- }
3606
-
3607
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3608
- }
3609
-
3610
- /**
3611
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3612
- * to the expected objects
3613
- *
3614
- * @params response Response returned by the server for a request to getAliases
3615
- * @throws ApiException if the response code was not in [200, 299]
3616
- */
3617
- public async getAliases(response: ResponseContext): Promise<UserIdentityBody > {
3618
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3619
- if (isCodeInRange("200", response.httpStatusCode)) {
3620
- const body: UserIdentityBody = ObjectSerializer.deserialize(
3621
- ObjectSerializer.parse(await response.body.text(), contentType),
3622
- "UserIdentityBody", ""
3623
- ) as UserIdentityBody;
3624
- return body;
3625
- }
3626
- if (isCodeInRange("400", response.httpStatusCode)) {
3627
- const body: GenericError = ObjectSerializer.deserialize(
3628
- ObjectSerializer.parse(await response.body.text(), contentType),
3629
- "GenericError", ""
3630
- ) as GenericError;
3631
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3632
- }
3633
- if (isCodeInRange("404", response.httpStatusCode)) {
3634
- const body: GenericError = ObjectSerializer.deserialize(
3635
- ObjectSerializer.parse(await response.body.text(), contentType),
3636
- "GenericError", ""
3637
- ) as GenericError;
3638
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
3639
- }
3640
- if (isCodeInRange("429", response.httpStatusCode)) {
3641
- const body: RateLimitError = ObjectSerializer.deserialize(
3642
- ObjectSerializer.parse(await response.body.text(), contentType),
3643
- "RateLimitError", ""
3644
- ) as RateLimitError;
3645
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3646
- }
3647
-
3648
- // Work around for missing responses in specification, e.g. for petstore.yaml
3649
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3650
- const body: UserIdentityBody = ObjectSerializer.deserialize(
3651
- ObjectSerializer.parse(await response.body.text(), contentType),
3652
- "UserIdentityBody", ""
3653
- ) as UserIdentityBody;
3654
- return body;
3655
- }
3656
-
3657
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3658
- }
3659
-
3660
- /**
3661
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3662
- * to the expected objects
3663
- *
3664
- * @params response Response returned by the server for a request to getAliasesBySubscription
3665
- * @throws ApiException if the response code was not in [200, 299]
3666
- */
3667
- public async getAliasesBySubscription(response: ResponseContext): Promise<UserIdentityBody > {
3668
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3669
- if (isCodeInRange("200", response.httpStatusCode)) {
3670
- const body: UserIdentityBody = ObjectSerializer.deserialize(
3671
- ObjectSerializer.parse(await response.body.text(), contentType),
3672
- "UserIdentityBody", ""
3673
- ) as UserIdentityBody;
3674
- return body;
3675
- }
3676
- if (isCodeInRange("400", response.httpStatusCode)) {
3677
- const body: GenericError = ObjectSerializer.deserialize(
3678
- ObjectSerializer.parse(await response.body.text(), contentType),
3679
- "GenericError", ""
3680
- ) as GenericError;
3681
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3682
- }
3683
- if (isCodeInRange("404", response.httpStatusCode)) {
3684
- const body: GenericError = ObjectSerializer.deserialize(
3685
- ObjectSerializer.parse(await response.body.text(), contentType),
3686
- "GenericError", ""
3687
- ) as GenericError;
3688
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
3689
- }
3690
-
3691
- // Work around for missing responses in specification, e.g. for petstore.yaml
3692
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3693
- const body: UserIdentityBody = ObjectSerializer.deserialize(
3694
- ObjectSerializer.parse(await response.body.text(), contentType),
3695
- "UserIdentityBody", ""
3696
- ) as UserIdentityBody;
3697
- return body;
3698
- }
3699
-
3700
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3701
- }
3702
-
3703
- /**
3704
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3705
- * to the expected objects
3706
- *
3707
- * @params response Response returned by the server for a request to getApp
3708
- * @throws ApiException if the response code was not in [200, 299]
3709
- */
3710
- public async getApp(response: ResponseContext): Promise<App > {
3711
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3712
- if (isCodeInRange("200", response.httpStatusCode)) {
3713
- const body: App = ObjectSerializer.deserialize(
3714
- ObjectSerializer.parse(await response.body.text(), contentType),
3715
- "App", ""
3716
- ) as App;
3717
- return body;
3718
- }
3719
- if (isCodeInRange("400", response.httpStatusCode)) {
3720
- const body: GenericError = ObjectSerializer.deserialize(
3721
- ObjectSerializer.parse(await response.body.text(), contentType),
3722
- "GenericError", ""
3723
- ) as GenericError;
3724
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3725
- }
3726
- if (isCodeInRange("429", response.httpStatusCode)) {
3727
- const body: RateLimitError = ObjectSerializer.deserialize(
3728
- ObjectSerializer.parse(await response.body.text(), contentType),
3729
- "RateLimitError", ""
3730
- ) as RateLimitError;
3731
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3732
- }
3733
-
3734
- // Work around for missing responses in specification, e.g. for petstore.yaml
3735
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3736
- const body: App = ObjectSerializer.deserialize(
3737
- ObjectSerializer.parse(await response.body.text(), contentType),
3738
- "App", ""
3739
- ) as App;
3740
- return body;
3741
- }
3742
-
3743
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3744
- }
3745
-
3746
- /**
3747
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3748
- * to the expected objects
3749
- *
3750
- * @params response Response returned by the server for a request to getApps
3751
- * @throws ApiException if the response code was not in [200, 299]
3752
- */
3753
- public async getApps(response: ResponseContext): Promise<Array<App> > {
3754
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3755
- if (isCodeInRange("200", response.httpStatusCode)) {
3756
- const body: Array<App> = ObjectSerializer.deserialize(
3757
- ObjectSerializer.parse(await response.body.text(), contentType),
3758
- "Array<App>", ""
3759
- ) as Array<App>;
3760
- return body;
3761
- }
3762
- if (isCodeInRange("400", response.httpStatusCode)) {
3763
- const body: GenericError = ObjectSerializer.deserialize(
3764
- ObjectSerializer.parse(await response.body.text(), contentType),
3765
- "GenericError", ""
3766
- ) as GenericError;
3767
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3768
- }
3769
- if (isCodeInRange("429", response.httpStatusCode)) {
3770
- const body: RateLimitError = ObjectSerializer.deserialize(
3771
- ObjectSerializer.parse(await response.body.text(), contentType),
3772
- "RateLimitError", ""
3773
- ) as RateLimitError;
3774
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3775
- }
3776
-
3777
- // Work around for missing responses in specification, e.g. for petstore.yaml
3778
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3779
- const body: Array<App> = ObjectSerializer.deserialize(
3780
- ObjectSerializer.parse(await response.body.text(), contentType),
3781
- "Array<App>", ""
3782
- ) as Array<App>;
3783
- return body;
3784
- }
3785
-
3786
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3787
- }
3788
-
3789
- /**
3790
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3791
- * to the expected objects
3792
- *
3793
- * @params response Response returned by the server for a request to getNotification
3794
- * @throws ApiException if the response code was not in [200, 299]
3795
- */
3796
- public async getNotification(response: ResponseContext): Promise<NotificationWithMeta > {
3797
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3798
- if (isCodeInRange("200", response.httpStatusCode)) {
3799
- const body: NotificationWithMeta = ObjectSerializer.deserialize(
3800
- ObjectSerializer.parse(await response.body.text(), contentType),
3801
- "NotificationWithMeta", ""
3802
- ) as NotificationWithMeta;
3803
- return body;
3804
- }
3805
- if (isCodeInRange("400", response.httpStatusCode)) {
3806
- const body: GenericError = ObjectSerializer.deserialize(
3807
- ObjectSerializer.parse(await response.body.text(), contentType),
3808
- "GenericError", ""
3809
- ) as GenericError;
3810
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3811
- }
3812
- if (isCodeInRange("404", response.httpStatusCode)) {
3813
- const body: GenericError = ObjectSerializer.deserialize(
3814
- ObjectSerializer.parse(await response.body.text(), contentType),
3815
- "GenericError", ""
3816
- ) as GenericError;
3817
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
3818
- }
3819
- if (isCodeInRange("429", response.httpStatusCode)) {
3820
- const body: RateLimitError = ObjectSerializer.deserialize(
3821
- ObjectSerializer.parse(await response.body.text(), contentType),
3822
- "RateLimitError", ""
3823
- ) as RateLimitError;
3824
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3825
- }
3826
-
3827
- // Work around for missing responses in specification, e.g. for petstore.yaml
3828
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3829
- const body: NotificationWithMeta = ObjectSerializer.deserialize(
3830
- ObjectSerializer.parse(await response.body.text(), contentType),
3831
- "NotificationWithMeta", ""
3832
- ) as NotificationWithMeta;
3833
- return body;
3834
- }
3835
-
3836
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3837
- }
3838
-
3839
- /**
3840
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3841
- * to the expected objects
3842
- *
3843
- * @params response Response returned by the server for a request to getNotificationHistory
3844
- * @throws ApiException if the response code was not in [200, 299]
3845
- */
3846
- public async getNotificationHistory(response: ResponseContext): Promise<NotificationHistorySuccessResponse > {
3847
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3848
- if (isCodeInRange("200", response.httpStatusCode)) {
3849
- const body: NotificationHistorySuccessResponse = ObjectSerializer.deserialize(
3850
- ObjectSerializer.parse(await response.body.text(), contentType),
3851
- "NotificationHistorySuccessResponse", ""
3852
- ) as NotificationHistorySuccessResponse;
3853
- return body;
3854
- }
3855
- if (isCodeInRange("400", response.httpStatusCode)) {
3856
- const body: GenericError = ObjectSerializer.deserialize(
3857
- ObjectSerializer.parse(await response.body.text(), contentType),
3858
- "GenericError", ""
3859
- ) as GenericError;
3860
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3861
- }
3862
- if (isCodeInRange("404", response.httpStatusCode)) {
3863
- const body: GenericError = ObjectSerializer.deserialize(
3864
- ObjectSerializer.parse(await response.body.text(), contentType),
3865
- "GenericError", ""
3866
- ) as GenericError;
3867
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
3868
- }
3869
- if (isCodeInRange("429", response.httpStatusCode)) {
3870
- const body: RateLimitError = ObjectSerializer.deserialize(
3871
- ObjectSerializer.parse(await response.body.text(), contentType),
3872
- "RateLimitError", ""
3873
- ) as RateLimitError;
3874
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3875
- }
3876
-
3877
- // Work around for missing responses in specification, e.g. for petstore.yaml
3878
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3879
- const body: NotificationHistorySuccessResponse = ObjectSerializer.deserialize(
3880
- ObjectSerializer.parse(await response.body.text(), contentType),
3881
- "NotificationHistorySuccessResponse", ""
3882
- ) as NotificationHistorySuccessResponse;
3883
- return body;
3884
- }
3885
-
3886
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3887
- }
3888
-
3889
- /**
3890
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3891
- * to the expected objects
3892
- *
3893
- * @params response Response returned by the server for a request to getNotifications
3894
- * @throws ApiException if the response code was not in [200, 299]
3895
- */
3896
- public async getNotifications(response: ResponseContext): Promise<NotificationSlice > {
3897
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3898
- if (isCodeInRange("200", response.httpStatusCode)) {
3899
- const body: NotificationSlice = ObjectSerializer.deserialize(
3900
- ObjectSerializer.parse(await response.body.text(), contentType),
3901
- "NotificationSlice", ""
3902
- ) as NotificationSlice;
3903
- return body;
3904
- }
3905
- if (isCodeInRange("400", response.httpStatusCode)) {
3906
- const body: GenericError = ObjectSerializer.deserialize(
3907
- ObjectSerializer.parse(await response.body.text(), contentType),
3908
- "GenericError", ""
3909
- ) as GenericError;
3910
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3911
- }
3912
- if (isCodeInRange("429", response.httpStatusCode)) {
3913
- const body: RateLimitError = ObjectSerializer.deserialize(
3914
- ObjectSerializer.parse(await response.body.text(), contentType),
3915
- "RateLimitError", ""
3916
- ) as RateLimitError;
3917
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3918
- }
3919
-
3920
- // Work around for missing responses in specification, e.g. for petstore.yaml
3921
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3922
- const body: NotificationSlice = ObjectSerializer.deserialize(
3923
- ObjectSerializer.parse(await response.body.text(), contentType),
3924
- "NotificationSlice", ""
3925
- ) as NotificationSlice;
3926
- return body;
3927
- }
3928
-
3929
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3930
- }
3931
-
3932
- /**
3933
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3934
- * to the expected objects
3935
- *
3936
- * @params response Response returned by the server for a request to getOutcomes
3937
- * @throws ApiException if the response code was not in [200, 299]
3938
- */
3939
- public async getOutcomes(response: ResponseContext): Promise<OutcomesData > {
3940
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3941
- if (isCodeInRange("200", response.httpStatusCode)) {
3942
- const body: OutcomesData = ObjectSerializer.deserialize(
3943
- ObjectSerializer.parse(await response.body.text(), contentType),
3944
- "OutcomesData", ""
3945
- ) as OutcomesData;
3946
- return body;
3947
- }
3948
- if (isCodeInRange("400", response.httpStatusCode)) {
3949
- const body: GenericError = ObjectSerializer.deserialize(
3950
- ObjectSerializer.parse(await response.body.text(), contentType),
3951
- "GenericError", ""
3952
- ) as GenericError;
3953
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3954
- }
3955
- if (isCodeInRange("429", response.httpStatusCode)) {
3956
- const body: RateLimitError = ObjectSerializer.deserialize(
3957
- ObjectSerializer.parse(await response.body.text(), contentType),
3958
- "RateLimitError", ""
3959
- ) as RateLimitError;
3960
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3961
- }
3962
-
3963
- // Work around for missing responses in specification, e.g. for petstore.yaml
3964
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3965
- const body: OutcomesData = ObjectSerializer.deserialize(
3966
- ObjectSerializer.parse(await response.body.text(), contentType),
3967
- "OutcomesData", ""
3968
- ) as OutcomesData;
3969
- return body;
3970
- }
3971
-
3972
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3973
- }
3974
-
3975
- /**
3976
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3977
- * to the expected objects
3978
- *
3979
- * @params response Response returned by the server for a request to getSegments
3980
- * @throws ApiException if the response code was not in [200, 299]
3981
- */
3982
- public async getSegments(response: ResponseContext): Promise<GetSegmentsSuccessResponse > {
3983
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3984
- if (isCodeInRange("201", response.httpStatusCode)) {
3985
- const body: GetSegmentsSuccessResponse = ObjectSerializer.deserialize(
3986
- ObjectSerializer.parse(await response.body.text(), contentType),
3987
- "GetSegmentsSuccessResponse", ""
3988
- ) as GetSegmentsSuccessResponse;
3989
- return body;
3990
- }
3991
- if (isCodeInRange("400", response.httpStatusCode)) {
3992
- const body: GenericError = ObjectSerializer.deserialize(
3993
- ObjectSerializer.parse(await response.body.text(), contentType),
3994
- "GenericError", ""
3995
- ) as GenericError;
3996
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3997
- }
3998
- if (isCodeInRange("429", response.httpStatusCode)) {
3999
- const body: RateLimitError = ObjectSerializer.deserialize(
4000
- ObjectSerializer.parse(await response.body.text(), contentType),
4001
- "RateLimitError", ""
4002
- ) as RateLimitError;
4003
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
4004
- }
4005
-
4006
- // Work around for missing responses in specification, e.g. for petstore.yaml
4007
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4008
- const body: GetSegmentsSuccessResponse = ObjectSerializer.deserialize(
4009
- ObjectSerializer.parse(await response.body.text(), contentType),
4010
- "GetSegmentsSuccessResponse", ""
4011
- ) as GetSegmentsSuccessResponse;
4012
- return body;
4013
- }
4014
-
4015
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4016
- }
4017
-
4018
- /**
4019
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4020
- * to the expected objects
4021
- *
4022
- * @params response Response returned by the server for a request to getUser
4023
- * @throws ApiException if the response code was not in [200, 299]
4024
- */
4025
- public async getUser(response: ResponseContext): Promise<User > {
4026
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4027
- if (isCodeInRange("200", response.httpStatusCode)) {
4028
- const body: User = ObjectSerializer.deserialize(
4029
- ObjectSerializer.parse(await response.body.text(), contentType),
4030
- "User", ""
4031
- ) as User;
4032
- return body;
4033
- }
4034
- if (isCodeInRange("400", response.httpStatusCode)) {
4035
- const body: GenericError = ObjectSerializer.deserialize(
4036
- ObjectSerializer.parse(await response.body.text(), contentType),
4037
- "GenericError", ""
4038
- ) as GenericError;
4039
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4040
- }
4041
- if (isCodeInRange("404", response.httpStatusCode)) {
4042
- const body: GenericError = ObjectSerializer.deserialize(
4043
- ObjectSerializer.parse(await response.body.text(), contentType),
4044
- "GenericError", ""
4045
- ) as GenericError;
4046
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
4047
- }
4048
- if (isCodeInRange("429", response.httpStatusCode)) {
4049
- const body: RateLimitError = ObjectSerializer.deserialize(
4050
- ObjectSerializer.parse(await response.body.text(), contentType),
4051
- "RateLimitError", ""
4052
- ) as RateLimitError;
4053
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
4054
- }
4055
-
4056
- // Work around for missing responses in specification, e.g. for petstore.yaml
4057
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4058
- const body: User = ObjectSerializer.deserialize(
4059
- ObjectSerializer.parse(await response.body.text(), contentType),
4060
- "User", ""
4061
- ) as User;
4062
- return body;
4063
- }
4064
-
4065
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4066
- }
4067
-
4068
- /**
4069
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4070
- * to the expected objects
4071
- *
4072
- * @params response Response returned by the server for a request to rotateApiKey
4073
- * @throws ApiException if the response code was not in [200, 299]
4074
- */
4075
- public async rotateApiKey(response: ResponseContext): Promise<CreateApiKeyResponse > {
4076
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4077
- if (isCodeInRange("200", response.httpStatusCode)) {
4078
- const body: CreateApiKeyResponse = ObjectSerializer.deserialize(
4079
- ObjectSerializer.parse(await response.body.text(), contentType),
4080
- "CreateApiKeyResponse", ""
4081
- ) as CreateApiKeyResponse;
4082
- return body;
4083
- }
4084
- if (isCodeInRange("400", response.httpStatusCode)) {
4085
- const body: GenericError = ObjectSerializer.deserialize(
4086
- ObjectSerializer.parse(await response.body.text(), contentType),
4087
- "GenericError", ""
4088
- ) as GenericError;
4089
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4090
- }
4091
-
4092
- // Work around for missing responses in specification, e.g. for petstore.yaml
4093
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4094
- const body: CreateApiKeyResponse = ObjectSerializer.deserialize(
4095
- ObjectSerializer.parse(await response.body.text(), contentType),
4096
- "CreateApiKeyResponse", ""
4097
- ) as CreateApiKeyResponse;
4098
- return body;
4099
- }
4100
-
4101
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4102
- }
4103
-
4104
- /**
4105
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4106
- * to the expected objects
4107
- *
4108
- * @params response Response returned by the server for a request to startLiveActivity
4109
- * @throws ApiException if the response code was not in [200, 299]
4110
- */
4111
- public async startLiveActivity(response: ResponseContext): Promise<StartLiveActivitySuccessResponse > {
4112
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4113
- if (isCodeInRange("201", response.httpStatusCode)) {
4114
- const body: StartLiveActivitySuccessResponse = ObjectSerializer.deserialize(
4115
- ObjectSerializer.parse(await response.body.text(), contentType),
4116
- "StartLiveActivitySuccessResponse", ""
4117
- ) as StartLiveActivitySuccessResponse;
4118
- return body;
4119
- }
4120
- if (isCodeInRange("400", response.httpStatusCode)) {
4121
- const body: GenericError = ObjectSerializer.deserialize(
4122
- ObjectSerializer.parse(await response.body.text(), contentType),
4123
- "GenericError", ""
4124
- ) as GenericError;
4125
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4126
- }
4127
- if (isCodeInRange("429", response.httpStatusCode)) {
4128
- const body: RateLimitError = ObjectSerializer.deserialize(
4129
- ObjectSerializer.parse(await response.body.text(), contentType),
4130
- "RateLimitError", ""
4131
- ) as RateLimitError;
4132
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
4133
- }
4134
-
4135
- // Work around for missing responses in specification, e.g. for petstore.yaml
4136
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4137
- const body: StartLiveActivitySuccessResponse = ObjectSerializer.deserialize(
4138
- ObjectSerializer.parse(await response.body.text(), contentType),
4139
- "StartLiveActivitySuccessResponse", ""
4140
- ) as StartLiveActivitySuccessResponse;
4141
- return body;
4142
- }
4143
-
4144
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4145
- }
4146
-
4147
- /**
4148
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4149
- * to the expected objects
4150
- *
4151
- * @params response Response returned by the server for a request to transferSubscription
4152
- * @throws ApiException if the response code was not in [200, 299]
4153
- */
4154
- public async transferSubscription(response: ResponseContext): Promise<UserIdentityBody > {
4155
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4156
- if (isCodeInRange("200", response.httpStatusCode)) {
4157
- const body: UserIdentityBody = ObjectSerializer.deserialize(
4158
- ObjectSerializer.parse(await response.body.text(), contentType),
4159
- "UserIdentityBody", ""
4160
- ) as UserIdentityBody;
4161
- return body;
4162
- }
4163
- if (isCodeInRange("400", response.httpStatusCode)) {
4164
- const body: GenericError = ObjectSerializer.deserialize(
4165
- ObjectSerializer.parse(await response.body.text(), contentType),
4166
- "GenericError", ""
4167
- ) as GenericError;
4168
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4169
- }
4170
- if (isCodeInRange("404", response.httpStatusCode)) {
4171
- const body: GenericError = ObjectSerializer.deserialize(
4172
- ObjectSerializer.parse(await response.body.text(), contentType),
4173
- "GenericError", ""
4174
- ) as GenericError;
4175
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
4176
- }
4177
- if (isCodeInRange("409", response.httpStatusCode)) {
4178
- const body: GenericError = ObjectSerializer.deserialize(
4179
- ObjectSerializer.parse(await response.body.text(), contentType),
4180
- "GenericError", ""
4181
- ) as GenericError;
4182
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
4183
- }
4184
- if (isCodeInRange("429", response.httpStatusCode)) {
4185
- const body: RateLimitError = ObjectSerializer.deserialize(
4186
- ObjectSerializer.parse(await response.body.text(), contentType),
4187
- "RateLimitError", ""
4188
- ) as RateLimitError;
4189
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
4190
- }
4191
-
4192
- // Work around for missing responses in specification, e.g. for petstore.yaml
4193
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4194
- const body: UserIdentityBody = ObjectSerializer.deserialize(
4195
- ObjectSerializer.parse(await response.body.text(), contentType),
4196
- "UserIdentityBody", ""
4197
- ) as UserIdentityBody;
4198
- return body;
4199
- }
4200
-
4201
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4202
- }
4203
-
4204
- /**
4205
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4206
- * to the expected objects
4207
- *
4208
- * @params response Response returned by the server for a request to unsubscribeEmailWithToken
4209
- * @throws ApiException if the response code was not in [200, 299]
4210
- */
4211
- public async unsubscribeEmailWithToken(response: ResponseContext): Promise<GenericSuccessBoolResponse > {
4212
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4213
- if (isCodeInRange("202", response.httpStatusCode)) {
4214
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
4215
- ObjectSerializer.parse(await response.body.text(), contentType),
4216
- "GenericSuccessBoolResponse", ""
4217
- ) as GenericSuccessBoolResponse;
4218
- return body;
4219
- }
4220
- if (isCodeInRange("400", response.httpStatusCode)) {
4221
- const body: GenericError = ObjectSerializer.deserialize(
4222
- ObjectSerializer.parse(await response.body.text(), contentType),
4223
- "GenericError", ""
4224
- ) as GenericError;
4225
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4226
- }
4227
- if (isCodeInRange("429", response.httpStatusCode)) {
4228
- const body: RateLimitError = ObjectSerializer.deserialize(
4229
- ObjectSerializer.parse(await response.body.text(), contentType),
4230
- "RateLimitError", ""
4231
- ) as RateLimitError;
4232
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
4233
- }
4234
-
4235
- // Work around for missing responses in specification, e.g. for petstore.yaml
4236
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4237
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
4238
- ObjectSerializer.parse(await response.body.text(), contentType),
4239
- "GenericSuccessBoolResponse", ""
4240
- ) as GenericSuccessBoolResponse;
4241
- return body;
4242
- }
4243
-
4244
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4245
- }
4246
-
4247
- /**
4248
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4249
- * to the expected objects
4250
- *
4251
- * @params response Response returned by the server for a request to updateApiKey
4252
- * @throws ApiException if the response code was not in [200, 299]
4253
- */
4254
- public async updateApiKey(response: ResponseContext): Promise<object > {
4255
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4256
- if (isCodeInRange("200", response.httpStatusCode)) {
4257
- const body: object = ObjectSerializer.deserialize(
4258
- ObjectSerializer.parse(await response.body.text(), contentType),
4259
- "object", ""
4260
- ) as object;
4261
- return body;
4262
- }
4263
- if (isCodeInRange("400", response.httpStatusCode)) {
4264
- const body: GenericError = ObjectSerializer.deserialize(
4265
- ObjectSerializer.parse(await response.body.text(), contentType),
4266
- "GenericError", ""
4267
- ) as GenericError;
4268
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4269
- }
4270
-
4271
- // Work around for missing responses in specification, e.g. for petstore.yaml
4272
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4273
- const body: object = ObjectSerializer.deserialize(
4274
- ObjectSerializer.parse(await response.body.text(), contentType),
4275
- "object", ""
4276
- ) as object;
4277
- return body;
4278
- }
4279
-
4280
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4281
- }
4282
-
4283
- /**
4284
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4285
- * to the expected objects
4286
- *
4287
- * @params response Response returned by the server for a request to updateApp
4288
- * @throws ApiException if the response code was not in [200, 299]
4289
- */
4290
- public async updateApp(response: ResponseContext): Promise<App > {
4291
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4292
- if (isCodeInRange("200", response.httpStatusCode)) {
4293
- const body: App = ObjectSerializer.deserialize(
4294
- ObjectSerializer.parse(await response.body.text(), contentType),
4295
- "App", ""
4296
- ) as App;
4297
- return body;
4298
- }
4299
- if (isCodeInRange("400", response.httpStatusCode)) {
4300
- const body: GenericError = ObjectSerializer.deserialize(
4301
- ObjectSerializer.parse(await response.body.text(), contentType),
4302
- "GenericError", ""
4303
- ) as GenericError;
4304
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4305
- }
4306
- if (isCodeInRange("429", response.httpStatusCode)) {
4307
- const body: RateLimitError = ObjectSerializer.deserialize(
4308
- ObjectSerializer.parse(await response.body.text(), contentType),
4309
- "RateLimitError", ""
4310
- ) as RateLimitError;
4311
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
4312
- }
4313
-
4314
- // Work around for missing responses in specification, e.g. for petstore.yaml
4315
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4316
- const body: App = ObjectSerializer.deserialize(
4317
- ObjectSerializer.parse(await response.body.text(), contentType),
4318
- "App", ""
4319
- ) as App;
4320
- return body;
4321
- }
4322
-
4323
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4324
- }
4325
-
4326
- /**
4327
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4328
- * to the expected objects
4329
- *
4330
- * @params response Response returned by the server for a request to updateLiveActivity
4331
- * @throws ApiException if the response code was not in [200, 299]
4332
- */
4333
- public async updateLiveActivity(response: ResponseContext): Promise<UpdateLiveActivitySuccessResponse > {
4334
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4335
- if (isCodeInRange("200", response.httpStatusCode)) {
4336
- const body: UpdateLiveActivitySuccessResponse = ObjectSerializer.deserialize(
4337
- ObjectSerializer.parse(await response.body.text(), contentType),
4338
- "UpdateLiveActivitySuccessResponse", ""
4339
- ) as UpdateLiveActivitySuccessResponse;
4340
- return body;
4341
- }
4342
- if (isCodeInRange("400", response.httpStatusCode)) {
4343
- const body: GenericError = ObjectSerializer.deserialize(
4344
- ObjectSerializer.parse(await response.body.text(), contentType),
4345
- "GenericError", ""
4346
- ) as GenericError;
4347
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4348
- }
4349
- if (isCodeInRange("429", response.httpStatusCode)) {
4350
- const body: RateLimitError = ObjectSerializer.deserialize(
4351
- ObjectSerializer.parse(await response.body.text(), contentType),
4352
- "RateLimitError", ""
4353
- ) as RateLimitError;
4354
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
4355
- }
4356
-
4357
- // Work around for missing responses in specification, e.g. for petstore.yaml
4358
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4359
- const body: UpdateLiveActivitySuccessResponse = ObjectSerializer.deserialize(
4360
- ObjectSerializer.parse(await response.body.text(), contentType),
4361
- "UpdateLiveActivitySuccessResponse", ""
4362
- ) as UpdateLiveActivitySuccessResponse;
4363
- return body;
4364
- }
4365
-
4366
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4367
- }
4368
-
4369
- /**
4370
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4371
- * to the expected objects
4372
- *
4373
- * @params response Response returned by the server for a request to updateSubscription
4374
- * @throws ApiException if the response code was not in [200, 299]
4375
- */
4376
- public async updateSubscription(response: ResponseContext): Promise<void > {
4377
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4378
- if (isCodeInRange("200", response.httpStatusCode)) {
4379
- return;
4380
- }
4381
- if (isCodeInRange("400", response.httpStatusCode)) {
4382
- const body: GenericError = ObjectSerializer.deserialize(
4383
- ObjectSerializer.parse(await response.body.text(), contentType),
4384
- "GenericError", ""
4385
- ) as GenericError;
4386
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4387
- }
4388
- if (isCodeInRange("404", response.httpStatusCode)) {
4389
- const body: GenericError = ObjectSerializer.deserialize(
4390
- ObjectSerializer.parse(await response.body.text(), contentType),
4391
- "GenericError", ""
4392
- ) as GenericError;
4393
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
4394
- }
4395
- if (isCodeInRange("409", response.httpStatusCode)) {
4396
- const body: GenericError = ObjectSerializer.deserialize(
4397
- ObjectSerializer.parse(await response.body.text(), contentType),
4398
- "GenericError", ""
4399
- ) as GenericError;
4400
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
4401
- }
4402
- if (isCodeInRange("429", response.httpStatusCode)) {
4403
- const body: RateLimitError = ObjectSerializer.deserialize(
4404
- ObjectSerializer.parse(await response.body.text(), contentType),
4405
- "RateLimitError", ""
4406
- ) as RateLimitError;
4407
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
4408
- }
4409
-
4410
- // Work around for missing responses in specification, e.g. for petstore.yaml
4411
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4412
- const body: void = ObjectSerializer.deserialize(
4413
- ObjectSerializer.parse(await response.body.text(), contentType),
4414
- "void", ""
4415
- ) as void;
4416
- return body;
4417
- }
4418
-
4419
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4420
- }
4421
-
4422
- /**
4423
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4424
- * to the expected objects
4425
- *
4426
- * @params response Response returned by the server for a request to updateSubscriptionByToken
4427
- * @throws ApiException if the response code was not in [200, 299]
4428
- */
4429
- public async updateSubscriptionByToken(response: ResponseContext): Promise<object > {
4430
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4431
- if (isCodeInRange("202", response.httpStatusCode)) {
4432
- const body: object = ObjectSerializer.deserialize(
4433
- ObjectSerializer.parse(await response.body.text(), contentType),
4434
- "object", ""
4435
- ) as object;
4436
- return body;
4437
- }
4438
- if (isCodeInRange("400", response.httpStatusCode)) {
4439
- const body: GenericError = ObjectSerializer.deserialize(
4440
- ObjectSerializer.parse(await response.body.text(), contentType),
4441
- "GenericError", ""
4442
- ) as GenericError;
4443
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4444
- }
4445
- if (isCodeInRange("404", response.httpStatusCode)) {
4446
- const body: GenericError = ObjectSerializer.deserialize(
4447
- ObjectSerializer.parse(await response.body.text(), contentType),
4448
- "GenericError", ""
4449
- ) as GenericError;
4450
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
4451
- }
4452
-
4453
- // Work around for missing responses in specification, e.g. for petstore.yaml
4454
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4455
- const body: object = ObjectSerializer.deserialize(
4456
- ObjectSerializer.parse(await response.body.text(), contentType),
4457
- "object", ""
4458
- ) as object;
4459
- return body;
4460
- }
4461
-
4462
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4463
- }
4464
-
4465
- /**
4466
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4467
- * to the expected objects
4468
- *
4469
- * @params response Response returned by the server for a request to updateTemplate
4470
- * @throws ApiException if the response code was not in [200, 299]
4471
- */
4472
- public async updateTemplate(response: ResponseContext): Promise<TemplateResource > {
4473
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4474
- if (isCodeInRange("200", response.httpStatusCode)) {
4475
- const body: TemplateResource = ObjectSerializer.deserialize(
4476
- ObjectSerializer.parse(await response.body.text(), contentType),
4477
- "TemplateResource", ""
4478
- ) as TemplateResource;
4479
- return body;
4480
- }
4481
- if (isCodeInRange("400", response.httpStatusCode)) {
4482
- const body: GenericError = ObjectSerializer.deserialize(
4483
- ObjectSerializer.parse(await response.body.text(), contentType),
4484
- "GenericError", ""
4485
- ) as GenericError;
4486
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4487
- }
4488
-
4489
- // Work around for missing responses in specification, e.g. for petstore.yaml
4490
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4491
- const body: TemplateResource = ObjectSerializer.deserialize(
4492
- ObjectSerializer.parse(await response.body.text(), contentType),
4493
- "TemplateResource", ""
4494
- ) as TemplateResource;
4495
- return body;
4496
- }
4497
-
4498
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4499
- }
4500
-
4501
- /**
4502
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4503
- * to the expected objects
4504
- *
4505
- * @params response Response returned by the server for a request to updateUser
4506
- * @throws ApiException if the response code was not in [200, 299]
4507
- */
4508
- public async updateUser(response: ResponseContext): Promise<PropertiesBody > {
4509
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4510
- if (isCodeInRange("202", response.httpStatusCode)) {
4511
- const body: PropertiesBody = ObjectSerializer.deserialize(
4512
- ObjectSerializer.parse(await response.body.text(), contentType),
4513
- "PropertiesBody", ""
4514
- ) as PropertiesBody;
4515
- return body;
4516
- }
4517
- if (isCodeInRange("400", response.httpStatusCode)) {
4518
- const body: GenericError = ObjectSerializer.deserialize(
4519
- ObjectSerializer.parse(await response.body.text(), contentType),
4520
- "GenericError", ""
4521
- ) as GenericError;
4522
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4523
- }
4524
- if (isCodeInRange("409", response.httpStatusCode)) {
4525
- const body: GenericError = ObjectSerializer.deserialize(
4526
- ObjectSerializer.parse(await response.body.text(), contentType),
4527
- "GenericError", ""
4528
- ) as GenericError;
4529
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
4530
- }
4531
- if (isCodeInRange("429", response.httpStatusCode)) {
4532
- const body: RateLimitError = ObjectSerializer.deserialize(
4533
- ObjectSerializer.parse(await response.body.text(), contentType),
4534
- "RateLimitError", ""
4535
- ) as RateLimitError;
4536
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
4537
- }
4538
-
4539
- // Work around for missing responses in specification, e.g. for petstore.yaml
4540
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4541
- const body: PropertiesBody = ObjectSerializer.deserialize(
4542
- ObjectSerializer.parse(await response.body.text(), contentType),
4543
- "PropertiesBody", ""
4544
- ) as PropertiesBody;
4545
- return body;
4546
- }
4547
-
4548
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4549
- }
4550
-
4551
- /**
4552
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4553
- * to the expected objects
4554
- *
4555
- * @params response Response returned by the server for a request to viewApiKeys
4556
- * @throws ApiException if the response code was not in [200, 299]
4557
- */
4558
- public async viewApiKeys(response: ResponseContext): Promise<ApiKeyTokensListResponse > {
4559
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4560
- if (isCodeInRange("200", response.httpStatusCode)) {
4561
- const body: ApiKeyTokensListResponse = ObjectSerializer.deserialize(
4562
- ObjectSerializer.parse(await response.body.text(), contentType),
4563
- "ApiKeyTokensListResponse", ""
4564
- ) as ApiKeyTokensListResponse;
4565
- return body;
4566
- }
4567
- if (isCodeInRange("400", response.httpStatusCode)) {
4568
- const body: GenericError = ObjectSerializer.deserialize(
4569
- ObjectSerializer.parse(await response.body.text(), contentType),
4570
- "GenericError", ""
4571
- ) as GenericError;
4572
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4573
- }
4574
-
4575
- // Work around for missing responses in specification, e.g. for petstore.yaml
4576
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4577
- const body: ApiKeyTokensListResponse = ObjectSerializer.deserialize(
4578
- ObjectSerializer.parse(await response.body.text(), contentType),
4579
- "ApiKeyTokensListResponse", ""
4580
- ) as ApiKeyTokensListResponse;
4581
- return body;
4582
- }
4583
-
4584
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4585
- }
4586
-
4587
- /**
4588
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4589
- * to the expected objects
4590
- *
4591
- * @params response Response returned by the server for a request to viewTemplate
4592
- * @throws ApiException if the response code was not in [200, 299]
4593
- */
4594
- public async viewTemplate(response: ResponseContext): Promise<TemplateResource > {
4595
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4596
- if (isCodeInRange("200", response.httpStatusCode)) {
4597
- const body: TemplateResource = ObjectSerializer.deserialize(
4598
- ObjectSerializer.parse(await response.body.text(), contentType),
4599
- "TemplateResource", ""
4600
- ) as TemplateResource;
4601
- return body;
4602
- }
4603
- if (isCodeInRange("400", response.httpStatusCode)) {
4604
- const body: GenericError = ObjectSerializer.deserialize(
4605
- ObjectSerializer.parse(await response.body.text(), contentType),
4606
- "GenericError", ""
4607
- ) as GenericError;
4608
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4609
- }
4610
- if (isCodeInRange("404", response.httpStatusCode)) {
4611
- const body: GenericError = ObjectSerializer.deserialize(
4612
- ObjectSerializer.parse(await response.body.text(), contentType),
4613
- "GenericError", ""
4614
- ) as GenericError;
4615
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
4616
- }
4617
-
4618
- // Work around for missing responses in specification, e.g. for petstore.yaml
4619
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4620
- const body: TemplateResource = ObjectSerializer.deserialize(
4621
- ObjectSerializer.parse(await response.body.text(), contentType),
4622
- "TemplateResource", ""
4623
- ) as TemplateResource;
4624
- return body;
4625
- }
4626
-
4627
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4628
- }
4629
-
4630
- /**
4631
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
4632
- * to the expected objects
4633
- *
4634
- * @params response Response returned by the server for a request to viewTemplates
4635
- * @throws ApiException if the response code was not in [200, 299]
4636
- */
4637
- public async viewTemplates(response: ResponseContext): Promise<TemplatesListResponse > {
4638
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
4639
- if (isCodeInRange("200", response.httpStatusCode)) {
4640
- const body: TemplatesListResponse = ObjectSerializer.deserialize(
4641
- ObjectSerializer.parse(await response.body.text(), contentType),
4642
- "TemplatesListResponse", ""
4643
- ) as TemplatesListResponse;
4644
- return body;
4645
- }
4646
- if (isCodeInRange("400", response.httpStatusCode)) {
4647
- const body: GenericError = ObjectSerializer.deserialize(
4648
- ObjectSerializer.parse(await response.body.text(), contentType),
4649
- "GenericError", ""
4650
- ) as GenericError;
4651
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
4652
- }
4653
- if (isCodeInRange("429", response.httpStatusCode)) {
4654
- const body: RateLimitError = ObjectSerializer.deserialize(
4655
- ObjectSerializer.parse(await response.body.text(), contentType),
4656
- "RateLimitError", ""
4657
- ) as RateLimitError;
4658
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
4659
- }
4660
-
4661
- // Work around for missing responses in specification, e.g. for petstore.yaml
4662
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
4663
- const body: TemplatesListResponse = ObjectSerializer.deserialize(
4664
- ObjectSerializer.parse(await response.body.text(), contentType),
4665
- "TemplatesListResponse", ""
4666
- ) as TemplatesListResponse;
4667
- return body;
4668
- }
4669
-
4670
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
4671
- }
4672
-
4673
- }