@onesignal/node-onesignal 5.2.1-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 (198) hide show
  1. package/dist/apis/DefaultApi.d.ts +40 -0
  2. package/dist/apis/DefaultApi.js +1363 -100
  3. package/dist/models/ApiKeyToken.d.ts +23 -0
  4. package/dist/models/ApiKeyToken.js +52 -0
  5. package/dist/models/ApiKeyTokensListResponse.d.ts +18 -0
  6. package/dist/models/ApiKeyTokensListResponse.js +22 -0
  7. package/dist/models/CopyTemplateRequest.d.ts +17 -0
  8. package/dist/models/CopyTemplateRequest.js +22 -0
  9. package/dist/models/CreateApiKeyRequest.d.ts +20 -0
  10. package/dist/models/CreateApiKeyRequest.js +34 -0
  11. package/dist/models/CreateApiKeyResponse.d.ts +18 -0
  12. package/dist/models/CreateApiKeyResponse.js +28 -0
  13. package/dist/models/CreateTemplateRequest.d.ts +25 -0
  14. package/dist/models/CreateTemplateRequest.js +64 -0
  15. package/dist/models/CustomEvent.d.ts +23 -0
  16. package/dist/models/CustomEvent.js +46 -0
  17. package/dist/models/CustomEventsRequest.d.ts +18 -0
  18. package/dist/models/CustomEventsRequest.js +22 -0
  19. package/dist/models/NotificationWithMeta.d.ts +1 -0
  20. package/dist/models/NotificationWithMeta.js +6 -0
  21. package/dist/models/NotificationWithMetaAllOf.d.ts +1 -0
  22. package/dist/models/NotificationWithMetaAllOf.js +6 -0
  23. package/dist/models/ObjectSerializer.d.ts +14 -0
  24. package/dist/models/ObjectSerializer.js +47 -0
  25. package/dist/models/StartLiveActivityRequest.d.ts +37 -0
  26. package/dist/models/StartLiveActivityRequest.js +112 -0
  27. package/dist/models/StartLiveActivitySuccessResponse.d.ts +17 -0
  28. package/dist/models/StartLiveActivitySuccessResponse.js +22 -0
  29. package/dist/models/TemplateResource.d.ts +25 -0
  30. package/dist/models/TemplateResource.js +52 -0
  31. package/dist/models/TemplatesListResponse.d.ts +18 -0
  32. package/dist/models/TemplatesListResponse.js +22 -0
  33. package/dist/models/UpdateApiKeyRequest.d.ts +20 -0
  34. package/dist/models/UpdateApiKeyRequest.js +34 -0
  35. package/dist/models/UpdateTemplateRequest.d.ts +24 -0
  36. package/dist/models/UpdateTemplateRequest.js +58 -0
  37. package/dist/models/all.d.ts +14 -0
  38. package/dist/models/all.js +14 -0
  39. package/dist/types/ObjectParamAPI.d.ts +88 -0
  40. package/dist/types/ObjectParamAPI.js +42 -0
  41. package/dist/types/ObservableAPI.d.ts +26 -0
  42. package/dist/types/ObservableAPI.js +422 -86
  43. package/dist/types/PromiseAPI.d.ts +26 -0
  44. package/dist/types/PromiseAPI.js +56 -0
  45. package/package.json +9 -3
  46. package/.github/ISSUE_TEMPLATE/ask-question.yml +0 -25
  47. package/.github/ISSUE_TEMPLATE/bug-report.yml +0 -51
  48. package/.github/ISSUE_TEMPLATE/general-feedback.yml +0 -25
  49. package/.github/pull_request_template.md +0 -44
  50. package/.github/workflows/asana-add-comment.yml +0 -47
  51. package/.github/workflows/asana-create-task.yml +0 -119
  52. package/.github/workflows/asana-update-issue.yml +0 -172
  53. package/.github/workflows/npm_deploy.yml +0 -22
  54. package/.github/workflows/project.yml +0 -17
  55. package/CHANGELOG.md +0 -48
  56. package/DefaultApi.md +0 -2177
  57. package/RELEASE_INSTRUCTIONS.md +0 -2
  58. package/apis/DefaultApi.ts +0 -3270
  59. package/apis/baseapi.ts +0 -37
  60. package/apis/exception.ts +0 -15
  61. package/auth/auth.ts +0 -110
  62. package/configuration.ts +0 -85
  63. package/dist/apis/DefaultApi.js.map +0 -1
  64. package/dist/apis/baseapi.js.map +0 -1
  65. package/dist/apis/exception.js.map +0 -1
  66. package/dist/auth/auth.js.map +0 -1
  67. package/dist/configuration.js.map +0 -1
  68. package/dist/http/http.js.map +0 -1
  69. package/dist/http/isomorphic-fetch.js.map +0 -1
  70. package/dist/index.js.map +0 -1
  71. package/dist/middleware.js.map +0 -1
  72. package/dist/models/App.js.map +0 -1
  73. package/dist/models/BasicNotification.js.map +0 -1
  74. package/dist/models/BasicNotificationAllOf.js.map +0 -1
  75. package/dist/models/BasicNotificationAllOfAndroidBackgroundLayout.js.map +0 -1
  76. package/dist/models/Button.js.map +0 -1
  77. package/dist/models/CreateNotificationSuccessResponse.js.map +0 -1
  78. package/dist/models/CreateSegmentConflictResponse.js.map +0 -1
  79. package/dist/models/CreateSegmentSuccessResponse.js.map +0 -1
  80. package/dist/models/CreateUserConflictResponse.js.map +0 -1
  81. package/dist/models/CreateUserConflictResponseErrorsInner.js.map +0 -1
  82. package/dist/models/CreateUserConflictResponseErrorsItemsMeta.js.map +0 -1
  83. package/dist/models/DeliveryData.js.map +0 -1
  84. package/dist/models/ExportEventsSuccessResponse.js.map +0 -1
  85. package/dist/models/ExportSubscriptionsRequestBody.js.map +0 -1
  86. package/dist/models/ExportSubscriptionsSuccessResponse.js.map +0 -1
  87. package/dist/models/Filter.js.map +0 -1
  88. package/dist/models/FilterExpression.js.map +0 -1
  89. package/dist/models/GenericError.js.map +0 -1
  90. package/dist/models/GenericSuccessBoolResponse.js.map +0 -1
  91. package/dist/models/GetNotificationHistoryRequestBody.js.map +0 -1
  92. package/dist/models/GetSegmentsSuccessResponse.js.map +0 -1
  93. package/dist/models/LanguageStringMap.js.map +0 -1
  94. package/dist/models/Notification.js.map +0 -1
  95. package/dist/models/NotificationAllOf.js.map +0 -1
  96. package/dist/models/NotificationHistorySuccessResponse.js.map +0 -1
  97. package/dist/models/NotificationSlice.js.map +0 -1
  98. package/dist/models/NotificationTarget.js.map +0 -1
  99. package/dist/models/NotificationWithMeta.js.map +0 -1
  100. package/dist/models/NotificationWithMetaAllOf.js.map +0 -1
  101. package/dist/models/ObjectSerializer.js.map +0 -1
  102. package/dist/models/Operator.js.map +0 -1
  103. package/dist/models/OutcomeData.js.map +0 -1
  104. package/dist/models/OutcomesData.js.map +0 -1
  105. package/dist/models/PlatformDeliveryData.js.map +0 -1
  106. package/dist/models/PlatformDeliveryDataEmailAllOf.js.map +0 -1
  107. package/dist/models/PlatformDeliveryDataSmsAllOf.js.map +0 -1
  108. package/dist/models/PropertiesBody.js.map +0 -1
  109. package/dist/models/PropertiesDeltas.js.map +0 -1
  110. package/dist/models/PropertiesObject.js.map +0 -1
  111. package/dist/models/Purchase.js.map +0 -1
  112. package/dist/models/RateLimitError.js.map +0 -1
  113. package/dist/models/Segment.js.map +0 -1
  114. package/dist/models/SegmentData.js.map +0 -1
  115. package/dist/models/SegmentNotificationTarget.js.map +0 -1
  116. package/dist/models/Subscription.js.map +0 -1
  117. package/dist/models/SubscriptionBody.js.map +0 -1
  118. package/dist/models/SubscriptionNotificationTarget.js.map +0 -1
  119. package/dist/models/TransferSubscriptionRequestBody.js.map +0 -1
  120. package/dist/models/UpdateLiveActivityRequest.js.map +0 -1
  121. package/dist/models/UpdateLiveActivitySuccessResponse.js.map +0 -1
  122. package/dist/models/UpdateUserRequest.js.map +0 -1
  123. package/dist/models/User.js.map +0 -1
  124. package/dist/models/UserIdentityBody.js.map +0 -1
  125. package/dist/models/WebButton.js.map +0 -1
  126. package/dist/models/all.js.map +0 -1
  127. package/dist/rxjsStub.js.map +0 -1
  128. package/dist/servers.js.map +0 -1
  129. package/dist/types/ObjectParamAPI.js.map +0 -1
  130. package/dist/types/ObservableAPI.js.map +0 -1
  131. package/dist/types/PromiseAPI.js.map +0 -1
  132. package/dist/util.js.map +0 -1
  133. package/http/http.ts +0 -205
  134. package/http/isomorphic-fetch.ts +0 -30
  135. package/index.ts +0 -12
  136. package/middleware.ts +0 -66
  137. package/models/App.ts +0 -328
  138. package/models/BasicNotification.ts +0 -1088
  139. package/models/BasicNotificationAllOf.ts +0 -958
  140. package/models/BasicNotificationAllOfAndroidBackgroundLayout.ts +0 -57
  141. package/models/Button.ts +0 -45
  142. package/models/CreateNotificationSuccessResponse.ts +0 -48
  143. package/models/CreateSegmentConflictResponse.ts +0 -38
  144. package/models/CreateSegmentSuccessResponse.ts +0 -41
  145. package/models/CreateUserConflictResponse.ts +0 -32
  146. package/models/CreateUserConflictResponseErrorsInner.ts +0 -46
  147. package/models/CreateUserConflictResponseErrorsItemsMeta.ts +0 -31
  148. package/models/DeliveryData.ts +0 -74
  149. package/models/ExportEventsSuccessResponse.ts +0 -31
  150. package/models/ExportSubscriptionsRequestBody.ts +0 -54
  151. package/models/ExportSubscriptionsSuccessResponse.ts +0 -31
  152. package/models/Filter.ts +0 -107
  153. package/models/FilterExpression.ts +0 -120
  154. package/models/GenericError.ts +0 -45
  155. package/models/GenericSuccessBoolResponse.ts +0 -31
  156. package/models/GetNotificationHistoryRequestBody.ts +0 -54
  157. package/models/GetSegmentsSuccessResponse.ts +0 -65
  158. package/models/LanguageStringMap.ts +0 -454
  159. package/models/Notification.ts +0 -1098
  160. package/models/NotificationAllOf.ts +0 -34
  161. package/models/NotificationHistorySuccessResponse.ts +0 -38
  162. package/models/NotificationSlice.ts +0 -53
  163. package/models/NotificationTarget.ts +0 -156
  164. package/models/NotificationWithMeta.ts +0 -1196
  165. package/models/NotificationWithMetaAllOf.ts +0 -132
  166. package/models/ObjectSerializer.ts +0 -395
  167. package/models/Operator.ts +0 -37
  168. package/models/OutcomeData.ts +0 -48
  169. package/models/OutcomesData.ts +0 -32
  170. package/models/PlatformDeliveryData.ts +0 -86
  171. package/models/PlatformDeliveryDataEmailAllOf.ts +0 -94
  172. package/models/PlatformDeliveryDataSmsAllOf.ts +0 -54
  173. package/models/PropertiesBody.ts +0 -32
  174. package/models/PropertiesDeltas.ts +0 -46
  175. package/models/PropertiesObject.ts +0 -102
  176. package/models/Purchase.ts +0 -61
  177. package/models/RateLimitError.ts +0 -38
  178. package/models/Segment.ts +0 -55
  179. package/models/SegmentData.ts +0 -94
  180. package/models/SegmentNotificationTarget.ts +0 -44
  181. package/models/Subscription.ts +0 -146
  182. package/models/SubscriptionBody.ts +0 -32
  183. package/models/SubscriptionNotificationTarget.ts +0 -134
  184. package/models/TransferSubscriptionRequestBody.ts +0 -31
  185. package/models/UpdateLiveActivityRequest.ts +0 -109
  186. package/models/UpdateLiveActivitySuccessResponse.ts +0 -31
  187. package/models/UpdateUserRequest.ts +0 -47
  188. package/models/User.ts +0 -47
  189. package/models/UserIdentityBody.ts +0 -31
  190. package/models/WebButton.ts +0 -52
  191. package/models/all.ts +0 -53
  192. package/rxjsStub.ts +0 -27
  193. package/servers.ts +0 -53
  194. package/tsconfig.json +0 -28
  195. package/types/ObjectParamAPI.ts +0 -884
  196. package/types/ObservableAPI.ts +0 -831
  197. package/types/PromiseAPI.ts +0 -411
  198. package/util.ts +0 -37
@@ -1,3270 +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 { App } from '../models/App';
14
- import { CreateNotificationSuccessResponse } from '../models/CreateNotificationSuccessResponse';
15
- import { CreateSegmentConflictResponse } from '../models/CreateSegmentConflictResponse';
16
- import { CreateSegmentSuccessResponse } from '../models/CreateSegmentSuccessResponse';
17
- import { CreateUserConflictResponse } from '../models/CreateUserConflictResponse';
18
- import { ExportEventsSuccessResponse } from '../models/ExportEventsSuccessResponse';
19
- import { ExportSubscriptionsRequestBody } from '../models/ExportSubscriptionsRequestBody';
20
- import { ExportSubscriptionsSuccessResponse } from '../models/ExportSubscriptionsSuccessResponse';
21
- import { GenericError } from '../models/GenericError';
22
- import { GenericSuccessBoolResponse } from '../models/GenericSuccessBoolResponse';
23
- import { GetNotificationHistoryRequestBody } from '../models/GetNotificationHistoryRequestBody';
24
- import { GetSegmentsSuccessResponse } from '../models/GetSegmentsSuccessResponse';
25
- import { Notification } from '../models/Notification';
26
- import { NotificationHistorySuccessResponse } from '../models/NotificationHistorySuccessResponse';
27
- import { NotificationSlice } from '../models/NotificationSlice';
28
- import { NotificationWithMeta } from '../models/NotificationWithMeta';
29
- import { OutcomesData } from '../models/OutcomesData';
30
- import { PropertiesBody } from '../models/PropertiesBody';
31
- import { RateLimitError } from '../models/RateLimitError';
32
- import { Segment } from '../models/Segment';
33
- import { SubscriptionBody } from '../models/SubscriptionBody';
34
- import { TransferSubscriptionRequestBody } from '../models/TransferSubscriptionRequestBody';
35
- import { UpdateLiveActivityRequest } from '../models/UpdateLiveActivityRequest';
36
- import { UpdateLiveActivitySuccessResponse } from '../models/UpdateLiveActivitySuccessResponse';
37
- import { UpdateUserRequest } from '../models/UpdateUserRequest';
38
- import { User } from '../models/User';
39
- import { UserIdentityBody } from '../models/UserIdentityBody';
40
-
41
- /**
42
- * no description
43
- */
44
- export class DefaultApiRequestFactory extends BaseAPIRequestFactory {
45
-
46
- /**
47
- * Used to stop a scheduled or currently outgoing notification
48
- * Stop a scheduled or currently outgoing notification
49
- * @param appId
50
- * @param notificationId
51
- */
52
- public async cancelNotification(appId: string, notificationId: string, _options?: Configuration): Promise<RequestContext> {
53
- let _config = _options || this.configuration;
54
-
55
- // verify required parameter 'appId' is not null or undefined
56
- if (appId === null || appId === undefined) {
57
- throw new RequiredError("DefaultApi", "cancelNotification", "appId");
58
- }
59
-
60
-
61
- // verify required parameter 'notificationId' is not null or undefined
62
- if (notificationId === null || notificationId === undefined) {
63
- throw new RequiredError("DefaultApi", "cancelNotification", "notificationId");
64
- }
65
-
66
-
67
- // Path Params
68
- const localVarPath = '/notifications/{notification_id}'
69
- .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId)));
70
-
71
- // Make Request Context
72
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
73
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
74
-
75
- // Always add the One Signal telemetry to the request.
76
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
77
-
78
- // Query Params
79
- if (appId !== undefined) {
80
- requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", ""));
81
- }
82
-
83
-
84
- let authMethod: SecurityAuthentication | undefined;
85
- // Apply auth methods
86
- authMethod = _config.authMethods["rest_api_key"]
87
- if (authMethod?.applySecurityAuthentication) {
88
- await authMethod?.applySecurityAuthentication(requestContext);
89
- }
90
-
91
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
92
- if (defaultAuth?.applySecurityAuthentication) {
93
- await defaultAuth?.applySecurityAuthentication(requestContext);
94
- }
95
-
96
- return requestContext;
97
- }
98
-
99
- /**
100
- * Upserts one or more Aliases to an existing User identified by (:alias_label, :alias_id).
101
- * @param appId
102
- * @param aliasLabel
103
- * @param aliasId
104
- * @param userIdentityBody
105
- */
106
- public async createAlias(appId: string, aliasLabel: string, aliasId: string, userIdentityBody: UserIdentityBody, _options?: Configuration): Promise<RequestContext> {
107
- let _config = _options || this.configuration;
108
-
109
- // verify required parameter 'appId' is not null or undefined
110
- if (appId === null || appId === undefined) {
111
- throw new RequiredError("DefaultApi", "createAlias", "appId");
112
- }
113
-
114
-
115
- // verify required parameter 'aliasLabel' is not null or undefined
116
- if (aliasLabel === null || aliasLabel === undefined) {
117
- throw new RequiredError("DefaultApi", "createAlias", "aliasLabel");
118
- }
119
-
120
-
121
- // verify required parameter 'aliasId' is not null or undefined
122
- if (aliasId === null || aliasId === undefined) {
123
- throw new RequiredError("DefaultApi", "createAlias", "aliasId");
124
- }
125
-
126
-
127
- // verify required parameter 'userIdentityBody' is not null or undefined
128
- if (userIdentityBody === null || userIdentityBody === undefined) {
129
- throw new RequiredError("DefaultApi", "createAlias", "userIdentityBody");
130
- }
131
-
132
-
133
- // Path Params
134
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity'
135
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
136
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
137
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)));
138
-
139
- // Make Request Context
140
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
141
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
142
-
143
- // Always add the One Signal telemetry to the request.
144
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
145
-
146
-
147
- // Body Params
148
- const contentType = ObjectSerializer.getPreferredMediaType([
149
- "application/json"
150
- ]);
151
- requestContext.setHeaderParam("Content-Type", contentType);
152
- const serializedBody = ObjectSerializer.stringify(
153
- ObjectSerializer.serialize(userIdentityBody, "UserIdentityBody", ""),
154
- contentType
155
- );
156
- requestContext.setBody(serializedBody);
157
-
158
- let authMethod: SecurityAuthentication | undefined;
159
- // Apply auth methods
160
- authMethod = _config.authMethods["rest_api_key"]
161
- if (authMethod?.applySecurityAuthentication) {
162
- await authMethod?.applySecurityAuthentication(requestContext);
163
- }
164
-
165
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
166
- if (defaultAuth?.applySecurityAuthentication) {
167
- await defaultAuth?.applySecurityAuthentication(requestContext);
168
- }
169
-
170
- return requestContext;
171
- }
172
-
173
- /**
174
- * Upserts one or more Aliases for the User identified by :subscription_id.
175
- * @param appId
176
- * @param subscriptionId
177
- * @param userIdentityBody
178
- */
179
- public async createAliasBySubscription(appId: string, subscriptionId: string, userIdentityBody: UserIdentityBody, _options?: Configuration): Promise<RequestContext> {
180
- let _config = _options || this.configuration;
181
-
182
- // verify required parameter 'appId' is not null or undefined
183
- if (appId === null || appId === undefined) {
184
- throw new RequiredError("DefaultApi", "createAliasBySubscription", "appId");
185
- }
186
-
187
-
188
- // verify required parameter 'subscriptionId' is not null or undefined
189
- if (subscriptionId === null || subscriptionId === undefined) {
190
- throw new RequiredError("DefaultApi", "createAliasBySubscription", "subscriptionId");
191
- }
192
-
193
-
194
- // verify required parameter 'userIdentityBody' is not null or undefined
195
- if (userIdentityBody === null || userIdentityBody === undefined) {
196
- throw new RequiredError("DefaultApi", "createAliasBySubscription", "userIdentityBody");
197
- }
198
-
199
-
200
- // Path Params
201
- const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/user/identity'
202
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
203
- .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId)));
204
-
205
- // Make Request Context
206
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
207
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
208
-
209
- // Always add the One Signal telemetry to the request.
210
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
211
-
212
-
213
- // Body Params
214
- const contentType = ObjectSerializer.getPreferredMediaType([
215
- "application/json"
216
- ]);
217
- requestContext.setHeaderParam("Content-Type", contentType);
218
- const serializedBody = ObjectSerializer.stringify(
219
- ObjectSerializer.serialize(userIdentityBody, "UserIdentityBody", ""),
220
- contentType
221
- );
222
- requestContext.setBody(serializedBody);
223
-
224
- let authMethod: SecurityAuthentication | undefined;
225
- // Apply auth methods
226
- authMethod = _config.authMethods["rest_api_key"]
227
- if (authMethod?.applySecurityAuthentication) {
228
- await authMethod?.applySecurityAuthentication(requestContext);
229
- }
230
-
231
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
232
- if (defaultAuth?.applySecurityAuthentication) {
233
- await defaultAuth?.applySecurityAuthentication(requestContext);
234
- }
235
-
236
- return requestContext;
237
- }
238
-
239
- /**
240
- * Creates a new OneSignal app
241
- * Create an app
242
- * @param app
243
- */
244
- public async createApp(app: App, _options?: Configuration): Promise<RequestContext> {
245
- let _config = _options || this.configuration;
246
-
247
- // verify required parameter 'app' is not null or undefined
248
- if (app === null || app === undefined) {
249
- throw new RequiredError("DefaultApi", "createApp", "app");
250
- }
251
-
252
-
253
- // Path Params
254
- const localVarPath = '/apps';
255
-
256
- // Make Request Context
257
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
258
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
259
-
260
- // Always add the One Signal telemetry to the request.
261
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
262
-
263
-
264
- // Body Params
265
- const contentType = ObjectSerializer.getPreferredMediaType([
266
- "application/json"
267
- ]);
268
- requestContext.setHeaderParam("Content-Type", contentType);
269
- const serializedBody = ObjectSerializer.stringify(
270
- ObjectSerializer.serialize(app, "App", ""),
271
- contentType
272
- );
273
- requestContext.setBody(serializedBody);
274
-
275
- let authMethod: SecurityAuthentication | undefined;
276
- // Apply auth methods
277
- authMethod = _config.authMethods["organization_api_key"]
278
- if (authMethod?.applySecurityAuthentication) {
279
- await authMethod?.applySecurityAuthentication(requestContext);
280
- }
281
-
282
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
283
- if (defaultAuth?.applySecurityAuthentication) {
284
- await defaultAuth?.applySecurityAuthentication(requestContext);
285
- }
286
-
287
- return requestContext;
288
- }
289
-
290
- /**
291
- * Sends notifications to your users
292
- * Create notification
293
- * @param notification
294
- */
295
- public async createNotification(notification: Notification, _options?: Configuration): Promise<RequestContext> {
296
- let _config = _options || this.configuration;
297
-
298
- // verify required parameter 'notification' is not null or undefined
299
- if (notification === null || notification === undefined) {
300
- throw new RequiredError("DefaultApi", "createNotification", "notification");
301
- }
302
-
303
-
304
- // Path Params
305
- const localVarPath = '/notifications';
306
-
307
- // Make Request Context
308
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
309
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
310
-
311
- // Always add the One Signal telemetry to the request.
312
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
313
-
314
-
315
- // Body Params
316
- const contentType = ObjectSerializer.getPreferredMediaType([
317
- "application/json"
318
- ]);
319
- requestContext.setHeaderParam("Content-Type", contentType);
320
- const serializedBody = ObjectSerializer.stringify(
321
- ObjectSerializer.serialize(notification, "Notification", ""),
322
- contentType
323
- );
324
- requestContext.setBody(serializedBody);
325
-
326
- let authMethod: SecurityAuthentication | undefined;
327
- // Apply auth methods
328
- authMethod = _config.authMethods["rest_api_key"]
329
- if (authMethod?.applySecurityAuthentication) {
330
- await authMethod?.applySecurityAuthentication(requestContext);
331
- }
332
-
333
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
334
- if (defaultAuth?.applySecurityAuthentication) {
335
- await defaultAuth?.applySecurityAuthentication(requestContext);
336
- }
337
-
338
- return requestContext;
339
- }
340
-
341
- /**
342
- * 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.
343
- * Create Segment
344
- * @param appId The OneSignal App ID for your app. Available in Keys &amp; IDs.
345
- * @param segment
346
- */
347
- public async createSegment(appId: string, segment?: Segment, _options?: Configuration): Promise<RequestContext> {
348
- let _config = _options || this.configuration;
349
-
350
- // verify required parameter 'appId' is not null or undefined
351
- if (appId === null || appId === undefined) {
352
- throw new RequiredError("DefaultApi", "createSegment", "appId");
353
- }
354
-
355
-
356
-
357
- // Path Params
358
- const localVarPath = '/apps/{app_id}/segments'
359
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
360
-
361
- // Make Request Context
362
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
363
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
364
-
365
- // Always add the One Signal telemetry to the request.
366
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
367
-
368
-
369
- // Body Params
370
- const contentType = ObjectSerializer.getPreferredMediaType([
371
- "application/json"
372
- ]);
373
- requestContext.setHeaderParam("Content-Type", contentType);
374
- const serializedBody = ObjectSerializer.stringify(
375
- ObjectSerializer.serialize(segment, "Segment", ""),
376
- contentType
377
- );
378
- requestContext.setBody(serializedBody);
379
-
380
- let authMethod: SecurityAuthentication | undefined;
381
- // Apply auth methods
382
- authMethod = _config.authMethods["rest_api_key"]
383
- if (authMethod?.applySecurityAuthentication) {
384
- await authMethod?.applySecurityAuthentication(requestContext);
385
- }
386
-
387
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
388
- if (defaultAuth?.applySecurityAuthentication) {
389
- await defaultAuth?.applySecurityAuthentication(requestContext);
390
- }
391
-
392
- return requestContext;
393
- }
394
-
395
- /**
396
- * Creates a new Subscription under the User provided. Useful to add email addresses and SMS numbers to the User.
397
- * @param appId
398
- * @param aliasLabel
399
- * @param aliasId
400
- * @param subscriptionBody
401
- */
402
- public async createSubscription(appId: string, aliasLabel: string, aliasId: string, subscriptionBody: SubscriptionBody, _options?: Configuration): Promise<RequestContext> {
403
- let _config = _options || this.configuration;
404
-
405
- // verify required parameter 'appId' is not null or undefined
406
- if (appId === null || appId === undefined) {
407
- throw new RequiredError("DefaultApi", "createSubscription", "appId");
408
- }
409
-
410
-
411
- // verify required parameter 'aliasLabel' is not null or undefined
412
- if (aliasLabel === null || aliasLabel === undefined) {
413
- throw new RequiredError("DefaultApi", "createSubscription", "aliasLabel");
414
- }
415
-
416
-
417
- // verify required parameter 'aliasId' is not null or undefined
418
- if (aliasId === null || aliasId === undefined) {
419
- throw new RequiredError("DefaultApi", "createSubscription", "aliasId");
420
- }
421
-
422
-
423
- // verify required parameter 'subscriptionBody' is not null or undefined
424
- if (subscriptionBody === null || subscriptionBody === undefined) {
425
- throw new RequiredError("DefaultApi", "createSubscription", "subscriptionBody");
426
- }
427
-
428
-
429
- // Path Params
430
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions'
431
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
432
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
433
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)));
434
-
435
- // Make Request Context
436
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
437
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
438
-
439
- // Always add the One Signal telemetry to the request.
440
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
441
-
442
-
443
- // Body Params
444
- const contentType = ObjectSerializer.getPreferredMediaType([
445
- "application/json"
446
- ]);
447
- requestContext.setHeaderParam("Content-Type", contentType);
448
- const serializedBody = ObjectSerializer.stringify(
449
- ObjectSerializer.serialize(subscriptionBody, "SubscriptionBody", ""),
450
- contentType
451
- );
452
- requestContext.setBody(serializedBody);
453
-
454
- let authMethod: SecurityAuthentication | undefined;
455
- // Apply auth methods
456
- authMethod = _config.authMethods["rest_api_key"]
457
- if (authMethod?.applySecurityAuthentication) {
458
- await authMethod?.applySecurityAuthentication(requestContext);
459
- }
460
-
461
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
462
- if (defaultAuth?.applySecurityAuthentication) {
463
- await defaultAuth?.applySecurityAuthentication(requestContext);
464
- }
465
-
466
- return requestContext;
467
- }
468
-
469
- /**
470
- * 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.
471
- * @param appId
472
- * @param user
473
- */
474
- public async createUser(appId: string, user: User, _options?: Configuration): Promise<RequestContext> {
475
- let _config = _options || this.configuration;
476
-
477
- // verify required parameter 'appId' is not null or undefined
478
- if (appId === null || appId === undefined) {
479
- throw new RequiredError("DefaultApi", "createUser", "appId");
480
- }
481
-
482
-
483
- // verify required parameter 'user' is not null or undefined
484
- if (user === null || user === undefined) {
485
- throw new RequiredError("DefaultApi", "createUser", "user");
486
- }
487
-
488
-
489
- // Path Params
490
- const localVarPath = '/apps/{app_id}/users'
491
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
492
-
493
- // Make Request Context
494
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
495
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
496
-
497
- // Always add the One Signal telemetry to the request.
498
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
499
-
500
-
501
- // Body Params
502
- const contentType = ObjectSerializer.getPreferredMediaType([
503
- "application/json"
504
- ]);
505
- requestContext.setHeaderParam("Content-Type", contentType);
506
- const serializedBody = ObjectSerializer.stringify(
507
- ObjectSerializer.serialize(user, "User", ""),
508
- contentType
509
- );
510
- requestContext.setBody(serializedBody);
511
-
512
- let authMethod: SecurityAuthentication | undefined;
513
- // Apply auth methods
514
- authMethod = _config.authMethods["rest_api_key"]
515
- if (authMethod?.applySecurityAuthentication) {
516
- await authMethod?.applySecurityAuthentication(requestContext);
517
- }
518
-
519
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
520
- if (defaultAuth?.applySecurityAuthentication) {
521
- await defaultAuth?.applySecurityAuthentication(requestContext);
522
- }
523
-
524
- return requestContext;
525
- }
526
-
527
- /**
528
- * Deletes an alias by alias label
529
- * @param appId
530
- * @param aliasLabel
531
- * @param aliasId
532
- * @param aliasLabelToDelete
533
- */
534
- public async deleteAlias(appId: string, aliasLabel: string, aliasId: string, aliasLabelToDelete: string, _options?: Configuration): Promise<RequestContext> {
535
- let _config = _options || this.configuration;
536
-
537
- // verify required parameter 'appId' is not null or undefined
538
- if (appId === null || appId === undefined) {
539
- throw new RequiredError("DefaultApi", "deleteAlias", "appId");
540
- }
541
-
542
-
543
- // verify required parameter 'aliasLabel' is not null or undefined
544
- if (aliasLabel === null || aliasLabel === undefined) {
545
- throw new RequiredError("DefaultApi", "deleteAlias", "aliasLabel");
546
- }
547
-
548
-
549
- // verify required parameter 'aliasId' is not null or undefined
550
- if (aliasId === null || aliasId === undefined) {
551
- throw new RequiredError("DefaultApi", "deleteAlias", "aliasId");
552
- }
553
-
554
-
555
- // verify required parameter 'aliasLabelToDelete' is not null or undefined
556
- if (aliasLabelToDelete === null || aliasLabelToDelete === undefined) {
557
- throw new RequiredError("DefaultApi", "deleteAlias", "aliasLabelToDelete");
558
- }
559
-
560
-
561
- // Path Params
562
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete}'
563
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
564
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
565
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)))
566
- .replace('{' + 'alias_label_to_delete' + '}', encodeURIComponent(String(aliasLabelToDelete)));
567
-
568
- // Make Request Context
569
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
570
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
571
-
572
- // Always add the One Signal telemetry to the request.
573
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
574
-
575
-
576
- let authMethod: SecurityAuthentication | undefined;
577
- // Apply auth methods
578
- authMethod = _config.authMethods["rest_api_key"]
579
- if (authMethod?.applySecurityAuthentication) {
580
- await authMethod?.applySecurityAuthentication(requestContext);
581
- }
582
-
583
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
584
- if (defaultAuth?.applySecurityAuthentication) {
585
- await defaultAuth?.applySecurityAuthentication(requestContext);
586
- }
587
-
588
- return requestContext;
589
- }
590
-
591
- /**
592
- * 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.
593
- * Delete Segment
594
- * @param appId The OneSignal App ID for your app. Available in Keys &amp; IDs.
595
- * @param segmentId The segment_id can be found in the URL of the segment when viewing it in the dashboard.
596
- */
597
- public async deleteSegment(appId: string, segmentId: string, _options?: Configuration): Promise<RequestContext> {
598
- let _config = _options || this.configuration;
599
-
600
- // verify required parameter 'appId' is not null or undefined
601
- if (appId === null || appId === undefined) {
602
- throw new RequiredError("DefaultApi", "deleteSegment", "appId");
603
- }
604
-
605
-
606
- // verify required parameter 'segmentId' is not null or undefined
607
- if (segmentId === null || segmentId === undefined) {
608
- throw new RequiredError("DefaultApi", "deleteSegment", "segmentId");
609
- }
610
-
611
-
612
- // Path Params
613
- const localVarPath = '/apps/{app_id}/segments/{segment_id}'
614
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
615
- .replace('{' + 'segment_id' + '}', encodeURIComponent(String(segmentId)));
616
-
617
- // Make Request Context
618
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
619
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
620
-
621
- // Always add the One Signal telemetry to the request.
622
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
623
-
624
-
625
- let authMethod: SecurityAuthentication | undefined;
626
- // Apply auth methods
627
- authMethod = _config.authMethods["rest_api_key"]
628
- if (authMethod?.applySecurityAuthentication) {
629
- await authMethod?.applySecurityAuthentication(requestContext);
630
- }
631
-
632
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
633
- if (defaultAuth?.applySecurityAuthentication) {
634
- await defaultAuth?.applySecurityAuthentication(requestContext);
635
- }
636
-
637
- return requestContext;
638
- }
639
-
640
- /**
641
- * Deletes the Subscription.
642
- * @param appId
643
- * @param subscriptionId
644
- */
645
- public async deleteSubscription(appId: string, subscriptionId: string, _options?: Configuration): Promise<RequestContext> {
646
- let _config = _options || this.configuration;
647
-
648
- // verify required parameter 'appId' is not null or undefined
649
- if (appId === null || appId === undefined) {
650
- throw new RequiredError("DefaultApi", "deleteSubscription", "appId");
651
- }
652
-
653
-
654
- // verify required parameter 'subscriptionId' is not null or undefined
655
- if (subscriptionId === null || subscriptionId === undefined) {
656
- throw new RequiredError("DefaultApi", "deleteSubscription", "subscriptionId");
657
- }
658
-
659
-
660
- // Path Params
661
- const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}'
662
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
663
- .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId)));
664
-
665
- // Make Request Context
666
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
667
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
668
-
669
- // Always add the One Signal telemetry to the request.
670
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
671
-
672
-
673
- let authMethod: SecurityAuthentication | undefined;
674
- // Apply auth methods
675
- authMethod = _config.authMethods["rest_api_key"]
676
- if (authMethod?.applySecurityAuthentication) {
677
- await authMethod?.applySecurityAuthentication(requestContext);
678
- }
679
-
680
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
681
- if (defaultAuth?.applySecurityAuthentication) {
682
- await defaultAuth?.applySecurityAuthentication(requestContext);
683
- }
684
-
685
- return requestContext;
686
- }
687
-
688
- /**
689
- * Removes the User identified by (:alias_label, :alias_id), and all Subscriptions and Aliases
690
- * @param appId
691
- * @param aliasLabel
692
- * @param aliasId
693
- */
694
- public async deleteUser(appId: string, aliasLabel: string, aliasId: string, _options?: Configuration): Promise<RequestContext> {
695
- let _config = _options || this.configuration;
696
-
697
- // verify required parameter 'appId' is not null or undefined
698
- if (appId === null || appId === undefined) {
699
- throw new RequiredError("DefaultApi", "deleteUser", "appId");
700
- }
701
-
702
-
703
- // verify required parameter 'aliasLabel' is not null or undefined
704
- if (aliasLabel === null || aliasLabel === undefined) {
705
- throw new RequiredError("DefaultApi", "deleteUser", "aliasLabel");
706
- }
707
-
708
-
709
- // verify required parameter 'aliasId' is not null or undefined
710
- if (aliasId === null || aliasId === undefined) {
711
- throw new RequiredError("DefaultApi", "deleteUser", "aliasId");
712
- }
713
-
714
-
715
- // Path Params
716
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'
717
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
718
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
719
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)));
720
-
721
- // Make Request Context
722
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
723
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
724
-
725
- // Always add the One Signal telemetry to the request.
726
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
727
-
728
-
729
- let authMethod: SecurityAuthentication | undefined;
730
- // Apply auth methods
731
- authMethod = _config.authMethods["rest_api_key"]
732
- if (authMethod?.applySecurityAuthentication) {
733
- await authMethod?.applySecurityAuthentication(requestContext);
734
- }
735
-
736
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
737
- if (defaultAuth?.applySecurityAuthentication) {
738
- await defaultAuth?.applySecurityAuthentication(requestContext);
739
- }
740
-
741
- return requestContext;
742
- }
743
-
744
- /**
745
- * 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.
746
- * Export CSV of Events
747
- * @param notificationId The ID of the notification to export events from.
748
- * @param appId The ID of the app that the notification belongs to.
749
- */
750
- public async exportEvents(notificationId: string, appId: string, _options?: Configuration): Promise<RequestContext> {
751
- let _config = _options || this.configuration;
752
-
753
- // verify required parameter 'notificationId' is not null or undefined
754
- if (notificationId === null || notificationId === undefined) {
755
- throw new RequiredError("DefaultApi", "exportEvents", "notificationId");
756
- }
757
-
758
-
759
- // verify required parameter 'appId' is not null or undefined
760
- if (appId === null || appId === undefined) {
761
- throw new RequiredError("DefaultApi", "exportEvents", "appId");
762
- }
763
-
764
-
765
- // Path Params
766
- const localVarPath = '/notifications/{notification_id}/export_events?app_id={app_id}'
767
- .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId)));
768
-
769
- // Make Request Context
770
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
771
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
772
-
773
- // Always add the One Signal telemetry to the request.
774
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
775
-
776
- // Query Params
777
- if (appId !== undefined) {
778
- requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", ""));
779
- }
780
-
781
-
782
- let authMethod: SecurityAuthentication | undefined;
783
- // Apply auth methods
784
- authMethod = _config.authMethods["rest_api_key"]
785
- if (authMethod?.applySecurityAuthentication) {
786
- await authMethod?.applySecurityAuthentication(requestContext);
787
- }
788
-
789
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
790
- if (defaultAuth?.applySecurityAuthentication) {
791
- await defaultAuth?.applySecurityAuthentication(requestContext);
792
- }
793
-
794
- return requestContext;
795
- }
796
-
797
- /**
798
- * 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. |
799
- * Export CSV of Subscriptions
800
- * @param appId The app ID that you want to export devices from
801
- * @param exportSubscriptionsRequestBody
802
- */
803
- public async exportSubscriptions(appId: string, exportSubscriptionsRequestBody?: ExportSubscriptionsRequestBody, _options?: Configuration): Promise<RequestContext> {
804
- let _config = _options || this.configuration;
805
-
806
- // verify required parameter 'appId' is not null or undefined
807
- if (appId === null || appId === undefined) {
808
- throw new RequiredError("DefaultApi", "exportSubscriptions", "appId");
809
- }
810
-
811
-
812
-
813
- // Path Params
814
- const localVarPath = '/players/csv_export?app_id={app_id}'
815
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
816
-
817
- // Make Request Context
818
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
819
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
820
-
821
- // Always add the One Signal telemetry to the request.
822
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
823
-
824
-
825
- // Body Params
826
- const contentType = ObjectSerializer.getPreferredMediaType([
827
- "application/json"
828
- ]);
829
- requestContext.setHeaderParam("Content-Type", contentType);
830
- const serializedBody = ObjectSerializer.stringify(
831
- ObjectSerializer.serialize(exportSubscriptionsRequestBody, "ExportSubscriptionsRequestBody", ""),
832
- contentType
833
- );
834
- requestContext.setBody(serializedBody);
835
-
836
- let authMethod: SecurityAuthentication | undefined;
837
- // Apply auth methods
838
- authMethod = _config.authMethods["rest_api_key"]
839
- if (authMethod?.applySecurityAuthentication) {
840
- await authMethod?.applySecurityAuthentication(requestContext);
841
- }
842
-
843
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
844
- if (defaultAuth?.applySecurityAuthentication) {
845
- await defaultAuth?.applySecurityAuthentication(requestContext);
846
- }
847
-
848
- return requestContext;
849
- }
850
-
851
- /**
852
- * Lists all Aliases for the User identified by (:alias_label, :alias_id).
853
- * @param appId
854
- * @param aliasLabel
855
- * @param aliasId
856
- */
857
- public async getAliases(appId: string, aliasLabel: string, aliasId: string, _options?: Configuration): Promise<RequestContext> {
858
- let _config = _options || this.configuration;
859
-
860
- // verify required parameter 'appId' is not null or undefined
861
- if (appId === null || appId === undefined) {
862
- throw new RequiredError("DefaultApi", "getAliases", "appId");
863
- }
864
-
865
-
866
- // verify required parameter 'aliasLabel' is not null or undefined
867
- if (aliasLabel === null || aliasLabel === undefined) {
868
- throw new RequiredError("DefaultApi", "getAliases", "aliasLabel");
869
- }
870
-
871
-
872
- // verify required parameter 'aliasId' is not null or undefined
873
- if (aliasId === null || aliasId === undefined) {
874
- throw new RequiredError("DefaultApi", "getAliases", "aliasId");
875
- }
876
-
877
-
878
- // Path Params
879
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity'
880
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
881
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
882
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)));
883
-
884
- // Make Request Context
885
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
886
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
887
-
888
- // Always add the One Signal telemetry to the request.
889
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
890
-
891
-
892
- let authMethod: SecurityAuthentication | undefined;
893
- // Apply auth methods
894
- authMethod = _config.authMethods["rest_api_key"]
895
- if (authMethod?.applySecurityAuthentication) {
896
- await authMethod?.applySecurityAuthentication(requestContext);
897
- }
898
-
899
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
900
- if (defaultAuth?.applySecurityAuthentication) {
901
- await defaultAuth?.applySecurityAuthentication(requestContext);
902
- }
903
-
904
- return requestContext;
905
- }
906
-
907
- /**
908
- * Lists all Aliases for the User identified by :subscription_id.
909
- * @param appId
910
- * @param subscriptionId
911
- */
912
- public async getAliasesBySubscription(appId: string, subscriptionId: string, _options?: Configuration): Promise<RequestContext> {
913
- let _config = _options || this.configuration;
914
-
915
- // verify required parameter 'appId' is not null or undefined
916
- if (appId === null || appId === undefined) {
917
- throw new RequiredError("DefaultApi", "getAliasesBySubscription", "appId");
918
- }
919
-
920
-
921
- // verify required parameter 'subscriptionId' is not null or undefined
922
- if (subscriptionId === null || subscriptionId === undefined) {
923
- throw new RequiredError("DefaultApi", "getAliasesBySubscription", "subscriptionId");
924
- }
925
-
926
-
927
- // Path Params
928
- const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/user/identity'
929
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
930
- .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId)));
931
-
932
- // Make Request Context
933
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
934
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
935
-
936
- // Always add the One Signal telemetry to the request.
937
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
938
-
939
-
940
- let authMethod: SecurityAuthentication | undefined;
941
- // Apply auth methods
942
- authMethod = _config.authMethods["rest_api_key"]
943
- if (authMethod?.applySecurityAuthentication) {
944
- await authMethod?.applySecurityAuthentication(requestContext);
945
- }
946
-
947
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
948
- if (defaultAuth?.applySecurityAuthentication) {
949
- await defaultAuth?.applySecurityAuthentication(requestContext);
950
- }
951
-
952
- return requestContext;
953
- }
954
-
955
- /**
956
- * View the details of a single OneSignal app
957
- * View an app
958
- * @param appId An app id
959
- */
960
- public async getApp(appId: string, _options?: Configuration): Promise<RequestContext> {
961
- let _config = _options || this.configuration;
962
-
963
- // verify required parameter 'appId' is not null or undefined
964
- if (appId === null || appId === undefined) {
965
- throw new RequiredError("DefaultApi", "getApp", "appId");
966
- }
967
-
968
-
969
- // Path Params
970
- const localVarPath = '/apps/{app_id}'
971
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
972
-
973
- // Make Request Context
974
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
975
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
976
-
977
- // Always add the One Signal telemetry to the request.
978
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
979
-
980
-
981
- let authMethod: SecurityAuthentication | undefined;
982
- // Apply auth methods
983
- authMethod = _config.authMethods["organization_api_key"]
984
- if (authMethod?.applySecurityAuthentication) {
985
- await authMethod?.applySecurityAuthentication(requestContext);
986
- }
987
-
988
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
989
- if (defaultAuth?.applySecurityAuthentication) {
990
- await defaultAuth?.applySecurityAuthentication(requestContext);
991
- }
992
-
993
- return requestContext;
994
- }
995
-
996
- /**
997
- * View the details of all of your current OneSignal apps
998
- * View apps
999
- */
1000
- public async getApps(_options?: Configuration): Promise<RequestContext> {
1001
- let _config = _options || this.configuration;
1002
-
1003
- // Path Params
1004
- const localVarPath = '/apps';
1005
-
1006
- // Make Request Context
1007
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1008
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1009
-
1010
- // Always add the One Signal telemetry to the request.
1011
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
1012
-
1013
-
1014
- let authMethod: SecurityAuthentication | undefined;
1015
- // Apply auth methods
1016
- authMethod = _config.authMethods["organization_api_key"]
1017
- if (authMethod?.applySecurityAuthentication) {
1018
- await authMethod?.applySecurityAuthentication(requestContext);
1019
- }
1020
-
1021
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1022
- if (defaultAuth?.applySecurityAuthentication) {
1023
- await defaultAuth?.applySecurityAuthentication(requestContext);
1024
- }
1025
-
1026
- return requestContext;
1027
- }
1028
-
1029
- /**
1030
- * View the details of a single notification and outcomes associated with it
1031
- * View notification
1032
- * @param appId
1033
- * @param notificationId
1034
- */
1035
- public async getNotification(appId: string, notificationId: string, _options?: Configuration): Promise<RequestContext> {
1036
- let _config = _options || this.configuration;
1037
-
1038
- // verify required parameter 'appId' is not null or undefined
1039
- if (appId === null || appId === undefined) {
1040
- throw new RequiredError("DefaultApi", "getNotification", "appId");
1041
- }
1042
-
1043
-
1044
- // verify required parameter 'notificationId' is not null or undefined
1045
- if (notificationId === null || notificationId === undefined) {
1046
- throw new RequiredError("DefaultApi", "getNotification", "notificationId");
1047
- }
1048
-
1049
-
1050
- // Path Params
1051
- const localVarPath = '/notifications/{notification_id}'
1052
- .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId)));
1053
-
1054
- // Make Request Context
1055
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1056
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1057
-
1058
- // Always add the One Signal telemetry to the request.
1059
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
1060
-
1061
- // Query Params
1062
- if (appId !== undefined) {
1063
- requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", ""));
1064
- }
1065
-
1066
-
1067
- let authMethod: SecurityAuthentication | undefined;
1068
- // Apply auth methods
1069
- authMethod = _config.authMethods["rest_api_key"]
1070
- if (authMethod?.applySecurityAuthentication) {
1071
- await authMethod?.applySecurityAuthentication(requestContext);
1072
- }
1073
-
1074
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1075
- if (defaultAuth?.applySecurityAuthentication) {
1076
- await defaultAuth?.applySecurityAuthentication(requestContext);
1077
- }
1078
-
1079
- return requestContext;
1080
- }
1081
-
1082
- /**
1083
- * -> 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.
1084
- * Notification History
1085
- * @param notificationId The \&quot;id\&quot; of the message found in the Notification object
1086
- * @param getNotificationHistoryRequestBody
1087
- */
1088
- public async getNotificationHistory(notificationId: string, getNotificationHistoryRequestBody: GetNotificationHistoryRequestBody, _options?: Configuration): Promise<RequestContext> {
1089
- let _config = _options || this.configuration;
1090
-
1091
- // verify required parameter 'notificationId' is not null or undefined
1092
- if (notificationId === null || notificationId === undefined) {
1093
- throw new RequiredError("DefaultApi", "getNotificationHistory", "notificationId");
1094
- }
1095
-
1096
-
1097
- // verify required parameter 'getNotificationHistoryRequestBody' is not null or undefined
1098
- if (getNotificationHistoryRequestBody === null || getNotificationHistoryRequestBody === undefined) {
1099
- throw new RequiredError("DefaultApi", "getNotificationHistory", "getNotificationHistoryRequestBody");
1100
- }
1101
-
1102
-
1103
- // Path Params
1104
- const localVarPath = '/notifications/{notification_id}/history'
1105
- .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId)));
1106
-
1107
- // Make Request Context
1108
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
1109
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1110
-
1111
- // Always add the One Signal telemetry to the request.
1112
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
1113
-
1114
-
1115
- // Body Params
1116
- const contentType = ObjectSerializer.getPreferredMediaType([
1117
- "application/json"
1118
- ]);
1119
- requestContext.setHeaderParam("Content-Type", contentType);
1120
- const serializedBody = ObjectSerializer.stringify(
1121
- ObjectSerializer.serialize(getNotificationHistoryRequestBody, "GetNotificationHistoryRequestBody", ""),
1122
- contentType
1123
- );
1124
- requestContext.setBody(serializedBody);
1125
-
1126
- let authMethod: SecurityAuthentication | undefined;
1127
- // Apply auth methods
1128
- authMethod = _config.authMethods["rest_api_key"]
1129
- if (authMethod?.applySecurityAuthentication) {
1130
- await authMethod?.applySecurityAuthentication(requestContext);
1131
- }
1132
-
1133
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1134
- if (defaultAuth?.applySecurityAuthentication) {
1135
- await defaultAuth?.applySecurityAuthentication(requestContext);
1136
- }
1137
-
1138
- return requestContext;
1139
- }
1140
-
1141
- /**
1142
- * View the details of multiple notifications
1143
- * View notifications
1144
- * @param appId The app ID that you want to view notifications from
1145
- * @param limit How many notifications to return. Max is 50. Default is 50.
1146
- * @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.
1147
- * @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
1148
- */
1149
- public async getNotifications(appId: string, limit?: number, offset?: number, kind?: 0 | 1 | 3, _options?: Configuration): Promise<RequestContext> {
1150
- let _config = _options || this.configuration;
1151
-
1152
- // verify required parameter 'appId' is not null or undefined
1153
- if (appId === null || appId === undefined) {
1154
- throw new RequiredError("DefaultApi", "getNotifications", "appId");
1155
- }
1156
-
1157
-
1158
-
1159
-
1160
-
1161
- // Path Params
1162
- const localVarPath = '/notifications';
1163
-
1164
- // Make Request Context
1165
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1166
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1167
-
1168
- // Always add the One Signal telemetry to the request.
1169
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
1170
-
1171
- // Query Params
1172
- if (appId !== undefined) {
1173
- requestContext.setQueryParam("app_id", ObjectSerializer.serialize(appId, "string", ""));
1174
- }
1175
-
1176
- // Query Params
1177
- if (limit !== undefined) {
1178
- requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", ""));
1179
- }
1180
-
1181
- // Query Params
1182
- if (offset !== undefined) {
1183
- requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", ""));
1184
- }
1185
-
1186
- // Query Params
1187
- if (kind !== undefined) {
1188
- requestContext.setQueryParam("kind", ObjectSerializer.serialize(kind, "0 | 1 | 3", ""));
1189
- }
1190
-
1191
-
1192
- let authMethod: SecurityAuthentication | undefined;
1193
- // Apply auth methods
1194
- authMethod = _config.authMethods["rest_api_key"]
1195
- if (authMethod?.applySecurityAuthentication) {
1196
- await authMethod?.applySecurityAuthentication(requestContext);
1197
- }
1198
-
1199
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1200
- if (defaultAuth?.applySecurityAuthentication) {
1201
- await defaultAuth?.applySecurityAuthentication(requestContext);
1202
- }
1203
-
1204
- return requestContext;
1205
- }
1206
-
1207
- /**
1208
- * 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.
1209
- * View Outcomes
1210
- * @param appId The OneSignal App ID for your app. Available in Keys &amp; IDs.
1211
- * @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
1212
- * @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.
1213
- * @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.
1214
- * @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.
1215
- * @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.
1216
- */
1217
- public async getOutcomes(appId: string, outcomeNames: string, outcomeNames2?: string, outcomeTimeRange?: string, outcomePlatforms?: string, outcomeAttribution?: string, _options?: Configuration): Promise<RequestContext> {
1218
- let _config = _options || this.configuration;
1219
-
1220
- // verify required parameter 'appId' is not null or undefined
1221
- if (appId === null || appId === undefined) {
1222
- throw new RequiredError("DefaultApi", "getOutcomes", "appId");
1223
- }
1224
-
1225
-
1226
- // verify required parameter 'outcomeNames' is not null or undefined
1227
- if (outcomeNames === null || outcomeNames === undefined) {
1228
- throw new RequiredError("DefaultApi", "getOutcomes", "outcomeNames");
1229
- }
1230
-
1231
-
1232
-
1233
-
1234
-
1235
-
1236
- // Path Params
1237
- const localVarPath = '/apps/{app_id}/outcomes'
1238
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
1239
-
1240
- // Make Request Context
1241
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1242
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1243
-
1244
- // Always add the One Signal telemetry to the request.
1245
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
1246
-
1247
- // Query Params
1248
- if (outcomeNames !== undefined) {
1249
- requestContext.setQueryParam("outcome_names", ObjectSerializer.serialize(outcomeNames, "string", ""));
1250
- }
1251
-
1252
- // Query Params
1253
- if (outcomeNames2 !== undefined) {
1254
- requestContext.setQueryParam("outcome_names[]", ObjectSerializer.serialize(outcomeNames2, "string", ""));
1255
- }
1256
-
1257
- // Query Params
1258
- if (outcomeTimeRange !== undefined) {
1259
- requestContext.setQueryParam("outcome_time_range", ObjectSerializer.serialize(outcomeTimeRange, "string", ""));
1260
- }
1261
-
1262
- // Query Params
1263
- if (outcomePlatforms !== undefined) {
1264
- requestContext.setQueryParam("outcome_platforms", ObjectSerializer.serialize(outcomePlatforms, "string", ""));
1265
- }
1266
-
1267
- // Query Params
1268
- if (outcomeAttribution !== undefined) {
1269
- requestContext.setQueryParam("outcome_attribution", ObjectSerializer.serialize(outcomeAttribution, "string", ""));
1270
- }
1271
-
1272
-
1273
- let authMethod: SecurityAuthentication | undefined;
1274
- // Apply auth methods
1275
- authMethod = _config.authMethods["rest_api_key"]
1276
- if (authMethod?.applySecurityAuthentication) {
1277
- await authMethod?.applySecurityAuthentication(requestContext);
1278
- }
1279
-
1280
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1281
- if (defaultAuth?.applySecurityAuthentication) {
1282
- await defaultAuth?.applySecurityAuthentication(requestContext);
1283
- }
1284
-
1285
- return requestContext;
1286
- }
1287
-
1288
- /**
1289
- * Returns an array of segments from an app.
1290
- * Get Segments
1291
- * @param appId The OneSignal App ID for your app. Available in Keys &amp; IDs.
1292
- * @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.
1293
- * @param limit The amount of Segments in the response. Maximum 300.
1294
- */
1295
- public async getSegments(appId: string, offset?: number, limit?: number, _options?: Configuration): Promise<RequestContext> {
1296
- let _config = _options || this.configuration;
1297
-
1298
- // verify required parameter 'appId' is not null or undefined
1299
- if (appId === null || appId === undefined) {
1300
- throw new RequiredError("DefaultApi", "getSegments", "appId");
1301
- }
1302
-
1303
-
1304
-
1305
-
1306
- // Path Params
1307
- const localVarPath = '/apps/{app_id}/segments'
1308
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
1309
-
1310
- // Make Request Context
1311
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1312
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1313
-
1314
- // Always add the One Signal telemetry to the request.
1315
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
1316
-
1317
- // Query Params
1318
- if (offset !== undefined) {
1319
- requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", ""));
1320
- }
1321
-
1322
- // Query Params
1323
- if (limit !== undefined) {
1324
- requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", ""));
1325
- }
1326
-
1327
-
1328
- let authMethod: SecurityAuthentication | undefined;
1329
- // Apply auth methods
1330
- authMethod = _config.authMethods["rest_api_key"]
1331
- if (authMethod?.applySecurityAuthentication) {
1332
- await authMethod?.applySecurityAuthentication(requestContext);
1333
- }
1334
-
1335
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1336
- if (defaultAuth?.applySecurityAuthentication) {
1337
- await defaultAuth?.applySecurityAuthentication(requestContext);
1338
- }
1339
-
1340
- return requestContext;
1341
- }
1342
-
1343
- /**
1344
- * Returns the User’s properties, Aliases, and Subscriptions.
1345
- * @param appId
1346
- * @param aliasLabel
1347
- * @param aliasId
1348
- */
1349
- public async getUser(appId: string, aliasLabel: string, aliasId: string, _options?: Configuration): Promise<RequestContext> {
1350
- let _config = _options || this.configuration;
1351
-
1352
- // verify required parameter 'appId' is not null or undefined
1353
- if (appId === null || appId === undefined) {
1354
- throw new RequiredError("DefaultApi", "getUser", "appId");
1355
- }
1356
-
1357
-
1358
- // verify required parameter 'aliasLabel' is not null or undefined
1359
- if (aliasLabel === null || aliasLabel === undefined) {
1360
- throw new RequiredError("DefaultApi", "getUser", "aliasLabel");
1361
- }
1362
-
1363
-
1364
- // verify required parameter 'aliasId' is not null or undefined
1365
- if (aliasId === null || aliasId === undefined) {
1366
- throw new RequiredError("DefaultApi", "getUser", "aliasId");
1367
- }
1368
-
1369
-
1370
- // Path Params
1371
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'
1372
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1373
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
1374
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)));
1375
-
1376
- // Make Request Context
1377
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
1378
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1379
-
1380
- // Always add the One Signal telemetry to the request.
1381
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
1382
-
1383
-
1384
- let authMethod: SecurityAuthentication | undefined;
1385
- // Apply auth methods
1386
- authMethod = _config.authMethods["rest_api_key"]
1387
- if (authMethod?.applySecurityAuthentication) {
1388
- await authMethod?.applySecurityAuthentication(requestContext);
1389
- }
1390
-
1391
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1392
- if (defaultAuth?.applySecurityAuthentication) {
1393
- await defaultAuth?.applySecurityAuthentication(requestContext);
1394
- }
1395
-
1396
- return requestContext;
1397
- }
1398
-
1399
- /**
1400
- * Transfers this Subscription to the User identified by the identity in the payload.
1401
- * @param appId
1402
- * @param subscriptionId
1403
- * @param transferSubscriptionRequestBody
1404
- */
1405
- public async transferSubscription(appId: string, subscriptionId: string, transferSubscriptionRequestBody: TransferSubscriptionRequestBody, _options?: Configuration): Promise<RequestContext> {
1406
- let _config = _options || this.configuration;
1407
-
1408
- // verify required parameter 'appId' is not null or undefined
1409
- if (appId === null || appId === undefined) {
1410
- throw new RequiredError("DefaultApi", "transferSubscription", "appId");
1411
- }
1412
-
1413
-
1414
- // verify required parameter 'subscriptionId' is not null or undefined
1415
- if (subscriptionId === null || subscriptionId === undefined) {
1416
- throw new RequiredError("DefaultApi", "transferSubscription", "subscriptionId");
1417
- }
1418
-
1419
-
1420
- // verify required parameter 'transferSubscriptionRequestBody' is not null or undefined
1421
- if (transferSubscriptionRequestBody === null || transferSubscriptionRequestBody === undefined) {
1422
- throw new RequiredError("DefaultApi", "transferSubscription", "transferSubscriptionRequestBody");
1423
- }
1424
-
1425
-
1426
- // Path Params
1427
- const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/owner'
1428
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1429
- .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId)));
1430
-
1431
- // Make Request Context
1432
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
1433
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1434
-
1435
- // Always add the One Signal telemetry to the request.
1436
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
1437
-
1438
-
1439
- // Body Params
1440
- const contentType = ObjectSerializer.getPreferredMediaType([
1441
- "application/json"
1442
- ]);
1443
- requestContext.setHeaderParam("Content-Type", contentType);
1444
- const serializedBody = ObjectSerializer.stringify(
1445
- ObjectSerializer.serialize(transferSubscriptionRequestBody, "TransferSubscriptionRequestBody", ""),
1446
- contentType
1447
- );
1448
- requestContext.setBody(serializedBody);
1449
-
1450
- let authMethod: SecurityAuthentication | undefined;
1451
- // Apply auth methods
1452
- authMethod = _config.authMethods["rest_api_key"]
1453
- if (authMethod?.applySecurityAuthentication) {
1454
- await authMethod?.applySecurityAuthentication(requestContext);
1455
- }
1456
-
1457
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1458
- if (defaultAuth?.applySecurityAuthentication) {
1459
- await defaultAuth?.applySecurityAuthentication(requestContext);
1460
- }
1461
-
1462
- return requestContext;
1463
- }
1464
-
1465
- /**
1466
- * Unsubscribe an email with a token when using your own custom email unsubscribe landing page
1467
- * Unsubscribe with token
1468
- * @param appId The OneSignal App ID for your app. Available in Keys &amp; IDs.
1469
- * @param notificationId The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report.
1470
- * @param token The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email.
1471
- */
1472
- public async unsubscribeEmailWithToken(appId: string, notificationId: string, token: string, _options?: Configuration): Promise<RequestContext> {
1473
- let _config = _options || this.configuration;
1474
-
1475
- // verify required parameter 'appId' is not null or undefined
1476
- if (appId === null || appId === undefined) {
1477
- throw new RequiredError("DefaultApi", "unsubscribeEmailWithToken", "appId");
1478
- }
1479
-
1480
-
1481
- // verify required parameter 'notificationId' is not null or undefined
1482
- if (notificationId === null || notificationId === undefined) {
1483
- throw new RequiredError("DefaultApi", "unsubscribeEmailWithToken", "notificationId");
1484
- }
1485
-
1486
-
1487
- // verify required parameter 'token' is not null or undefined
1488
- if (token === null || token === undefined) {
1489
- throw new RequiredError("DefaultApi", "unsubscribeEmailWithToken", "token");
1490
- }
1491
-
1492
-
1493
- // Path Params
1494
- const localVarPath = '/apps/{app_id}/notifications/{notification_id}/unsubscribe'
1495
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1496
- .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId)));
1497
-
1498
- // Make Request Context
1499
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
1500
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1501
-
1502
- // Always add the One Signal telemetry to the request.
1503
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
1504
-
1505
- // Query Params
1506
- if (token !== undefined) {
1507
- requestContext.setQueryParam("token", ObjectSerializer.serialize(token, "string", ""));
1508
- }
1509
-
1510
-
1511
- let authMethod: SecurityAuthentication | undefined;
1512
- // Apply auth methods
1513
- authMethod = _config.authMethods["rest_api_key"]
1514
- if (authMethod?.applySecurityAuthentication) {
1515
- await authMethod?.applySecurityAuthentication(requestContext);
1516
- }
1517
-
1518
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1519
- if (defaultAuth?.applySecurityAuthentication) {
1520
- await defaultAuth?.applySecurityAuthentication(requestContext);
1521
- }
1522
-
1523
- return requestContext;
1524
- }
1525
-
1526
- /**
1527
- * Updates the name or configuration settings of an existing OneSignal app
1528
- * Update an app
1529
- * @param appId An app id
1530
- * @param app
1531
- */
1532
- public async updateApp(appId: string, app: App, _options?: Configuration): Promise<RequestContext> {
1533
- let _config = _options || this.configuration;
1534
-
1535
- // verify required parameter 'appId' is not null or undefined
1536
- if (appId === null || appId === undefined) {
1537
- throw new RequiredError("DefaultApi", "updateApp", "appId");
1538
- }
1539
-
1540
-
1541
- // verify required parameter 'app' is not null or undefined
1542
- if (app === null || app === undefined) {
1543
- throw new RequiredError("DefaultApi", "updateApp", "app");
1544
- }
1545
-
1546
-
1547
- // Path Params
1548
- const localVarPath = '/apps/{app_id}'
1549
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)));
1550
-
1551
- // Make Request Context
1552
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT);
1553
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1554
-
1555
- // Always add the One Signal telemetry to the request.
1556
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
1557
-
1558
-
1559
- // Body Params
1560
- const contentType = ObjectSerializer.getPreferredMediaType([
1561
- "application/json"
1562
- ]);
1563
- requestContext.setHeaderParam("Content-Type", contentType);
1564
- const serializedBody = ObjectSerializer.stringify(
1565
- ObjectSerializer.serialize(app, "App", ""),
1566
- contentType
1567
- );
1568
- requestContext.setBody(serializedBody);
1569
-
1570
- let authMethod: SecurityAuthentication | undefined;
1571
- // Apply auth methods
1572
- authMethod = _config.authMethods["organization_api_key"]
1573
- if (authMethod?.applySecurityAuthentication) {
1574
- await authMethod?.applySecurityAuthentication(requestContext);
1575
- }
1576
-
1577
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1578
- if (defaultAuth?.applySecurityAuthentication) {
1579
- await defaultAuth?.applySecurityAuthentication(requestContext);
1580
- }
1581
-
1582
- return requestContext;
1583
- }
1584
-
1585
- /**
1586
- * Updates a specified live activity.
1587
- * Update a Live Activity via Push
1588
- * @param appId The OneSignal App ID for your app. Available in Keys &amp; IDs.
1589
- * @param activityId Live Activity record ID
1590
- * @param updateLiveActivityRequest
1591
- */
1592
- public async updateLiveActivity(appId: string, activityId: string, updateLiveActivityRequest: UpdateLiveActivityRequest, _options?: Configuration): Promise<RequestContext> {
1593
- let _config = _options || this.configuration;
1594
-
1595
- // verify required parameter 'appId' is not null or undefined
1596
- if (appId === null || appId === undefined) {
1597
- throw new RequiredError("DefaultApi", "updateLiveActivity", "appId");
1598
- }
1599
-
1600
-
1601
- // verify required parameter 'activityId' is not null or undefined
1602
- if (activityId === null || activityId === undefined) {
1603
- throw new RequiredError("DefaultApi", "updateLiveActivity", "activityId");
1604
- }
1605
-
1606
-
1607
- // verify required parameter 'updateLiveActivityRequest' is not null or undefined
1608
- if (updateLiveActivityRequest === null || updateLiveActivityRequest === undefined) {
1609
- throw new RequiredError("DefaultApi", "updateLiveActivity", "updateLiveActivityRequest");
1610
- }
1611
-
1612
-
1613
- // Path Params
1614
- const localVarPath = '/apps/{app_id}/live_activities/{activity_id}/notifications'
1615
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1616
- .replace('{' + 'activity_id' + '}', encodeURIComponent(String(activityId)));
1617
-
1618
- // Make Request Context
1619
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
1620
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1621
-
1622
- // Always add the One Signal telemetry to the request.
1623
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
1624
-
1625
-
1626
- // Body Params
1627
- const contentType = ObjectSerializer.getPreferredMediaType([
1628
- "application/json"
1629
- ]);
1630
- requestContext.setHeaderParam("Content-Type", contentType);
1631
- const serializedBody = ObjectSerializer.stringify(
1632
- ObjectSerializer.serialize(updateLiveActivityRequest, "UpdateLiveActivityRequest", ""),
1633
- contentType
1634
- );
1635
- requestContext.setBody(serializedBody);
1636
-
1637
- let authMethod: SecurityAuthentication | undefined;
1638
- // Apply auth methods
1639
- authMethod = _config.authMethods["rest_api_key"]
1640
- if (authMethod?.applySecurityAuthentication) {
1641
- await authMethod?.applySecurityAuthentication(requestContext);
1642
- }
1643
-
1644
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1645
- if (defaultAuth?.applySecurityAuthentication) {
1646
- await defaultAuth?.applySecurityAuthentication(requestContext);
1647
- }
1648
-
1649
- return requestContext;
1650
- }
1651
-
1652
- /**
1653
- * Updates an existing Subscription’s properties.
1654
- * @param appId
1655
- * @param subscriptionId
1656
- * @param subscriptionBody
1657
- */
1658
- public async updateSubscription(appId: string, subscriptionId: string, subscriptionBody: SubscriptionBody, _options?: Configuration): Promise<RequestContext> {
1659
- let _config = _options || this.configuration;
1660
-
1661
- // verify required parameter 'appId' is not null or undefined
1662
- if (appId === null || appId === undefined) {
1663
- throw new RequiredError("DefaultApi", "updateSubscription", "appId");
1664
- }
1665
-
1666
-
1667
- // verify required parameter 'subscriptionId' is not null or undefined
1668
- if (subscriptionId === null || subscriptionId === undefined) {
1669
- throw new RequiredError("DefaultApi", "updateSubscription", "subscriptionId");
1670
- }
1671
-
1672
-
1673
- // verify required parameter 'subscriptionBody' is not null or undefined
1674
- if (subscriptionBody === null || subscriptionBody === undefined) {
1675
- throw new RequiredError("DefaultApi", "updateSubscription", "subscriptionBody");
1676
- }
1677
-
1678
-
1679
- // Path Params
1680
- const localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}'
1681
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1682
- .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId)));
1683
-
1684
- // Make Request Context
1685
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
1686
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1687
-
1688
- // Always add the One Signal telemetry to the request.
1689
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
1690
-
1691
-
1692
- // Body Params
1693
- const contentType = ObjectSerializer.getPreferredMediaType([
1694
- "application/json"
1695
- ]);
1696
- requestContext.setHeaderParam("Content-Type", contentType);
1697
- const serializedBody = ObjectSerializer.stringify(
1698
- ObjectSerializer.serialize(subscriptionBody, "SubscriptionBody", ""),
1699
- contentType
1700
- );
1701
- requestContext.setBody(serializedBody);
1702
-
1703
- let authMethod: SecurityAuthentication | undefined;
1704
- // Apply auth methods
1705
- authMethod = _config.authMethods["rest_api_key"]
1706
- if (authMethod?.applySecurityAuthentication) {
1707
- await authMethod?.applySecurityAuthentication(requestContext);
1708
- }
1709
-
1710
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1711
- if (defaultAuth?.applySecurityAuthentication) {
1712
- await defaultAuth?.applySecurityAuthentication(requestContext);
1713
- }
1714
-
1715
- return requestContext;
1716
- }
1717
-
1718
- /**
1719
- * Updates an existing User’s properties.
1720
- * @param appId
1721
- * @param aliasLabel
1722
- * @param aliasId
1723
- * @param updateUserRequest
1724
- */
1725
- public async updateUser(appId: string, aliasLabel: string, aliasId: string, updateUserRequest: UpdateUserRequest, _options?: Configuration): Promise<RequestContext> {
1726
- let _config = _options || this.configuration;
1727
-
1728
- // verify required parameter 'appId' is not null or undefined
1729
- if (appId === null || appId === undefined) {
1730
- throw new RequiredError("DefaultApi", "updateUser", "appId");
1731
- }
1732
-
1733
-
1734
- // verify required parameter 'aliasLabel' is not null or undefined
1735
- if (aliasLabel === null || aliasLabel === undefined) {
1736
- throw new RequiredError("DefaultApi", "updateUser", "aliasLabel");
1737
- }
1738
-
1739
-
1740
- // verify required parameter 'aliasId' is not null or undefined
1741
- if (aliasId === null || aliasId === undefined) {
1742
- throw new RequiredError("DefaultApi", "updateUser", "aliasId");
1743
- }
1744
-
1745
-
1746
- // verify required parameter 'updateUserRequest' is not null or undefined
1747
- if (updateUserRequest === null || updateUserRequest === undefined) {
1748
- throw new RequiredError("DefaultApi", "updateUser", "updateUserRequest");
1749
- }
1750
-
1751
-
1752
- // Path Params
1753
- const localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'
1754
- .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId)))
1755
- .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel)))
1756
- .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId)));
1757
-
1758
- // Make Request Context
1759
- const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
1760
- requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1761
-
1762
- // Always add the One Signal telemetry to the request.
1763
- requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1");
1764
-
1765
-
1766
- // Body Params
1767
- const contentType = ObjectSerializer.getPreferredMediaType([
1768
- "application/json"
1769
- ]);
1770
- requestContext.setHeaderParam("Content-Type", contentType);
1771
- const serializedBody = ObjectSerializer.stringify(
1772
- ObjectSerializer.serialize(updateUserRequest, "UpdateUserRequest", ""),
1773
- contentType
1774
- );
1775
- requestContext.setBody(serializedBody);
1776
-
1777
- let authMethod: SecurityAuthentication | undefined;
1778
- // Apply auth methods
1779
- authMethod = _config.authMethods["rest_api_key"]
1780
- if (authMethod?.applySecurityAuthentication) {
1781
- await authMethod?.applySecurityAuthentication(requestContext);
1782
- }
1783
-
1784
- const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1785
- if (defaultAuth?.applySecurityAuthentication) {
1786
- await defaultAuth?.applySecurityAuthentication(requestContext);
1787
- }
1788
-
1789
- return requestContext;
1790
- }
1791
-
1792
- }
1793
-
1794
- export class DefaultApiResponseProcessor {
1795
-
1796
- /**
1797
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
1798
- * to the expected objects
1799
- *
1800
- * @params response Response returned by the server for a request to cancelNotification
1801
- * @throws ApiException if the response code was not in [200, 299]
1802
- */
1803
- public async cancelNotification(response: ResponseContext): Promise<GenericSuccessBoolResponse > {
1804
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
1805
- if (isCodeInRange("200", response.httpStatusCode)) {
1806
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
1807
- ObjectSerializer.parse(await response.body.text(), contentType),
1808
- "GenericSuccessBoolResponse", ""
1809
- ) as GenericSuccessBoolResponse;
1810
- return body;
1811
- }
1812
- if (isCodeInRange("400", response.httpStatusCode)) {
1813
- const body: GenericError = ObjectSerializer.deserialize(
1814
- ObjectSerializer.parse(await response.body.text(), contentType),
1815
- "GenericError", ""
1816
- ) as GenericError;
1817
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
1818
- }
1819
- if (isCodeInRange("404", response.httpStatusCode)) {
1820
- const body: GenericError = ObjectSerializer.deserialize(
1821
- ObjectSerializer.parse(await response.body.text(), contentType),
1822
- "GenericError", ""
1823
- ) as GenericError;
1824
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
1825
- }
1826
- if (isCodeInRange("429", response.httpStatusCode)) {
1827
- const body: RateLimitError = ObjectSerializer.deserialize(
1828
- ObjectSerializer.parse(await response.body.text(), contentType),
1829
- "RateLimitError", ""
1830
- ) as RateLimitError;
1831
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
1832
- }
1833
-
1834
- // Work around for missing responses in specification, e.g. for petstore.yaml
1835
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
1836
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
1837
- ObjectSerializer.parse(await response.body.text(), contentType),
1838
- "GenericSuccessBoolResponse", ""
1839
- ) as GenericSuccessBoolResponse;
1840
- return body;
1841
- }
1842
-
1843
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
1844
- }
1845
-
1846
- /**
1847
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
1848
- * to the expected objects
1849
- *
1850
- * @params response Response returned by the server for a request to createAlias
1851
- * @throws ApiException if the response code was not in [200, 299]
1852
- */
1853
- public async createAlias(response: ResponseContext): Promise<UserIdentityBody > {
1854
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
1855
- if (isCodeInRange("200", response.httpStatusCode)) {
1856
- const body: UserIdentityBody = ObjectSerializer.deserialize(
1857
- ObjectSerializer.parse(await response.body.text(), contentType),
1858
- "UserIdentityBody", ""
1859
- ) as UserIdentityBody;
1860
- return body;
1861
- }
1862
- if (isCodeInRange("400", response.httpStatusCode)) {
1863
- const body: GenericError = ObjectSerializer.deserialize(
1864
- ObjectSerializer.parse(await response.body.text(), contentType),
1865
- "GenericError", ""
1866
- ) as GenericError;
1867
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
1868
- }
1869
- if (isCodeInRange("404", response.httpStatusCode)) {
1870
- const body: GenericError = ObjectSerializer.deserialize(
1871
- ObjectSerializer.parse(await response.body.text(), contentType),
1872
- "GenericError", ""
1873
- ) as GenericError;
1874
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
1875
- }
1876
- if (isCodeInRange("409", response.httpStatusCode)) {
1877
- const body: GenericError = ObjectSerializer.deserialize(
1878
- ObjectSerializer.parse(await response.body.text(), contentType),
1879
- "GenericError", ""
1880
- ) as GenericError;
1881
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
1882
- }
1883
- if (isCodeInRange("429", response.httpStatusCode)) {
1884
- const body: RateLimitError = ObjectSerializer.deserialize(
1885
- ObjectSerializer.parse(await response.body.text(), contentType),
1886
- "RateLimitError", ""
1887
- ) as RateLimitError;
1888
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
1889
- }
1890
-
1891
- // Work around for missing responses in specification, e.g. for petstore.yaml
1892
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
1893
- const body: UserIdentityBody = ObjectSerializer.deserialize(
1894
- ObjectSerializer.parse(await response.body.text(), contentType),
1895
- "UserIdentityBody", ""
1896
- ) as UserIdentityBody;
1897
- return body;
1898
- }
1899
-
1900
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
1901
- }
1902
-
1903
- /**
1904
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
1905
- * to the expected objects
1906
- *
1907
- * @params response Response returned by the server for a request to createAliasBySubscription
1908
- * @throws ApiException if the response code was not in [200, 299]
1909
- */
1910
- public async createAliasBySubscription(response: ResponseContext): Promise<UserIdentityBody > {
1911
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
1912
- if (isCodeInRange("200", response.httpStatusCode)) {
1913
- const body: UserIdentityBody = ObjectSerializer.deserialize(
1914
- ObjectSerializer.parse(await response.body.text(), contentType),
1915
- "UserIdentityBody", ""
1916
- ) as UserIdentityBody;
1917
- return body;
1918
- }
1919
- if (isCodeInRange("400", response.httpStatusCode)) {
1920
- const body: GenericError = ObjectSerializer.deserialize(
1921
- ObjectSerializer.parse(await response.body.text(), contentType),
1922
- "GenericError", ""
1923
- ) as GenericError;
1924
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
1925
- }
1926
- if (isCodeInRange("404", response.httpStatusCode)) {
1927
- const body: GenericError = ObjectSerializer.deserialize(
1928
- ObjectSerializer.parse(await response.body.text(), contentType),
1929
- "GenericError", ""
1930
- ) as GenericError;
1931
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
1932
- }
1933
- if (isCodeInRange("409", response.httpStatusCode)) {
1934
- const body: GenericError = ObjectSerializer.deserialize(
1935
- ObjectSerializer.parse(await response.body.text(), contentType),
1936
- "GenericError", ""
1937
- ) as GenericError;
1938
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
1939
- }
1940
- if (isCodeInRange("429", response.httpStatusCode)) {
1941
- const body: RateLimitError = ObjectSerializer.deserialize(
1942
- ObjectSerializer.parse(await response.body.text(), contentType),
1943
- "RateLimitError", ""
1944
- ) as RateLimitError;
1945
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
1946
- }
1947
-
1948
- // Work around for missing responses in specification, e.g. for petstore.yaml
1949
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
1950
- const body: UserIdentityBody = ObjectSerializer.deserialize(
1951
- ObjectSerializer.parse(await response.body.text(), contentType),
1952
- "UserIdentityBody", ""
1953
- ) as UserIdentityBody;
1954
- return body;
1955
- }
1956
-
1957
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
1958
- }
1959
-
1960
- /**
1961
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
1962
- * to the expected objects
1963
- *
1964
- * @params response Response returned by the server for a request to createApp
1965
- * @throws ApiException if the response code was not in [200, 299]
1966
- */
1967
- public async createApp(response: ResponseContext): Promise<App > {
1968
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
1969
- if (isCodeInRange("200", response.httpStatusCode)) {
1970
- const body: App = ObjectSerializer.deserialize(
1971
- ObjectSerializer.parse(await response.body.text(), contentType),
1972
- "App", ""
1973
- ) as App;
1974
- return body;
1975
- }
1976
- if (isCodeInRange("400", response.httpStatusCode)) {
1977
- const body: GenericError = ObjectSerializer.deserialize(
1978
- ObjectSerializer.parse(await response.body.text(), contentType),
1979
- "GenericError", ""
1980
- ) as GenericError;
1981
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
1982
- }
1983
- if (isCodeInRange("429", response.httpStatusCode)) {
1984
- const body: RateLimitError = ObjectSerializer.deserialize(
1985
- ObjectSerializer.parse(await response.body.text(), contentType),
1986
- "RateLimitError", ""
1987
- ) as RateLimitError;
1988
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
1989
- }
1990
-
1991
- // Work around for missing responses in specification, e.g. for petstore.yaml
1992
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
1993
- const body: App = ObjectSerializer.deserialize(
1994
- ObjectSerializer.parse(await response.body.text(), contentType),
1995
- "App", ""
1996
- ) as App;
1997
- return body;
1998
- }
1999
-
2000
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2001
- }
2002
-
2003
- /**
2004
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2005
- * to the expected objects
2006
- *
2007
- * @params response Response returned by the server for a request to createNotification
2008
- * @throws ApiException if the response code was not in [200, 299]
2009
- */
2010
- public async createNotification(response: ResponseContext): Promise<CreateNotificationSuccessResponse > {
2011
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2012
- if (isCodeInRange("200", response.httpStatusCode)) {
2013
- const body: CreateNotificationSuccessResponse = ObjectSerializer.deserialize(
2014
- ObjectSerializer.parse(await response.body.text(), contentType),
2015
- "CreateNotificationSuccessResponse", ""
2016
- ) as CreateNotificationSuccessResponse;
2017
- return body;
2018
- }
2019
- if (isCodeInRange("400", response.httpStatusCode)) {
2020
- const body: GenericError = ObjectSerializer.deserialize(
2021
- ObjectSerializer.parse(await response.body.text(), contentType),
2022
- "GenericError", ""
2023
- ) as GenericError;
2024
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2025
- }
2026
- if (isCodeInRange("429", response.httpStatusCode)) {
2027
- const body: RateLimitError = ObjectSerializer.deserialize(
2028
- ObjectSerializer.parse(await response.body.text(), contentType),
2029
- "RateLimitError", ""
2030
- ) as RateLimitError;
2031
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2032
- }
2033
-
2034
- // Work around for missing responses in specification, e.g. for petstore.yaml
2035
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2036
- const body: CreateNotificationSuccessResponse = ObjectSerializer.deserialize(
2037
- ObjectSerializer.parse(await response.body.text(), contentType),
2038
- "CreateNotificationSuccessResponse", ""
2039
- ) as CreateNotificationSuccessResponse;
2040
- return body;
2041
- }
2042
-
2043
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2044
- }
2045
-
2046
- /**
2047
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2048
- * to the expected objects
2049
- *
2050
- * @params response Response returned by the server for a request to createSegment
2051
- * @throws ApiException if the response code was not in [200, 299]
2052
- */
2053
- public async createSegment(response: ResponseContext): Promise<CreateSegmentSuccessResponse > {
2054
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2055
- if (isCodeInRange("201", response.httpStatusCode)) {
2056
- const body: CreateSegmentSuccessResponse = ObjectSerializer.deserialize(
2057
- ObjectSerializer.parse(await response.body.text(), contentType),
2058
- "CreateSegmentSuccessResponse", ""
2059
- ) as CreateSegmentSuccessResponse;
2060
- return body;
2061
- }
2062
- if (isCodeInRange("400", response.httpStatusCode)) {
2063
- const body: GenericError = ObjectSerializer.deserialize(
2064
- ObjectSerializer.parse(await response.body.text(), contentType),
2065
- "GenericError", ""
2066
- ) as GenericError;
2067
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2068
- }
2069
- if (isCodeInRange("409", response.httpStatusCode)) {
2070
- const body: CreateSegmentConflictResponse = ObjectSerializer.deserialize(
2071
- ObjectSerializer.parse(await response.body.text(), contentType),
2072
- "CreateSegmentConflictResponse", ""
2073
- ) as CreateSegmentConflictResponse;
2074
- throw new ApiException<CreateSegmentConflictResponse>(409, "Conflict", body, response.headers);
2075
- }
2076
- if (isCodeInRange("429", response.httpStatusCode)) {
2077
- const body: RateLimitError = ObjectSerializer.deserialize(
2078
- ObjectSerializer.parse(await response.body.text(), contentType),
2079
- "RateLimitError", ""
2080
- ) as RateLimitError;
2081
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2082
- }
2083
-
2084
- // Work around for missing responses in specification, e.g. for petstore.yaml
2085
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2086
- const body: CreateSegmentSuccessResponse = ObjectSerializer.deserialize(
2087
- ObjectSerializer.parse(await response.body.text(), contentType),
2088
- "CreateSegmentSuccessResponse", ""
2089
- ) as CreateSegmentSuccessResponse;
2090
- return body;
2091
- }
2092
-
2093
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2094
- }
2095
-
2096
- /**
2097
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2098
- * to the expected objects
2099
- *
2100
- * @params response Response returned by the server for a request to createSubscription
2101
- * @throws ApiException if the response code was not in [200, 299]
2102
- */
2103
- public async createSubscription(response: ResponseContext): Promise<SubscriptionBody > {
2104
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2105
- if (isCodeInRange("201", response.httpStatusCode)) {
2106
- const body: SubscriptionBody = ObjectSerializer.deserialize(
2107
- ObjectSerializer.parse(await response.body.text(), contentType),
2108
- "SubscriptionBody", ""
2109
- ) as SubscriptionBody;
2110
- return body;
2111
- }
2112
- if (isCodeInRange("202", response.httpStatusCode)) {
2113
- const body: SubscriptionBody = ObjectSerializer.deserialize(
2114
- ObjectSerializer.parse(await response.body.text(), contentType),
2115
- "SubscriptionBody", ""
2116
- ) as SubscriptionBody;
2117
- return body;
2118
- }
2119
- if (isCodeInRange("400", response.httpStatusCode)) {
2120
- const body: GenericError = ObjectSerializer.deserialize(
2121
- ObjectSerializer.parse(await response.body.text(), contentType),
2122
- "GenericError", ""
2123
- ) as GenericError;
2124
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2125
- }
2126
- if (isCodeInRange("404", response.httpStatusCode)) {
2127
- const body: GenericError = ObjectSerializer.deserialize(
2128
- ObjectSerializer.parse(await response.body.text(), contentType),
2129
- "GenericError", ""
2130
- ) as GenericError;
2131
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
2132
- }
2133
- if (isCodeInRange("409", response.httpStatusCode)) {
2134
- const body: GenericError = ObjectSerializer.deserialize(
2135
- ObjectSerializer.parse(await response.body.text(), contentType),
2136
- "GenericError", ""
2137
- ) as GenericError;
2138
- throw new ApiException<GenericError>(409, "Operation is not permitted due to user having the maximum number of subscriptions assigned", body, response.headers);
2139
- }
2140
- if (isCodeInRange("429", response.httpStatusCode)) {
2141
- const body: RateLimitError = ObjectSerializer.deserialize(
2142
- ObjectSerializer.parse(await response.body.text(), contentType),
2143
- "RateLimitError", ""
2144
- ) as RateLimitError;
2145
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2146
- }
2147
-
2148
- // Work around for missing responses in specification, e.g. for petstore.yaml
2149
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2150
- const body: SubscriptionBody = ObjectSerializer.deserialize(
2151
- ObjectSerializer.parse(await response.body.text(), contentType),
2152
- "SubscriptionBody", ""
2153
- ) as SubscriptionBody;
2154
- return body;
2155
- }
2156
-
2157
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2158
- }
2159
-
2160
- /**
2161
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2162
- * to the expected objects
2163
- *
2164
- * @params response Response returned by the server for a request to createUser
2165
- * @throws ApiException if the response code was not in [200, 299]
2166
- */
2167
- public async createUser(response: ResponseContext): Promise<User > {
2168
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2169
- if (isCodeInRange("200", response.httpStatusCode)) {
2170
- const body: User = ObjectSerializer.deserialize(
2171
- ObjectSerializer.parse(await response.body.text(), contentType),
2172
- "User", ""
2173
- ) as User;
2174
- return body;
2175
- }
2176
- if (isCodeInRange("201", response.httpStatusCode)) {
2177
- const body: User = ObjectSerializer.deserialize(
2178
- ObjectSerializer.parse(await response.body.text(), contentType),
2179
- "User", ""
2180
- ) as User;
2181
- return body;
2182
- }
2183
- if (isCodeInRange("202", response.httpStatusCode)) {
2184
- const body: User = ObjectSerializer.deserialize(
2185
- ObjectSerializer.parse(await response.body.text(), contentType),
2186
- "User", ""
2187
- ) as User;
2188
- return body;
2189
- }
2190
- if (isCodeInRange("400", response.httpStatusCode)) {
2191
- const body: GenericError = ObjectSerializer.deserialize(
2192
- ObjectSerializer.parse(await response.body.text(), contentType),
2193
- "GenericError", ""
2194
- ) as GenericError;
2195
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2196
- }
2197
- if (isCodeInRange("409", response.httpStatusCode)) {
2198
- const body: CreateUserConflictResponse = ObjectSerializer.deserialize(
2199
- ObjectSerializer.parse(await response.body.text(), contentType),
2200
- "CreateUserConflictResponse", ""
2201
- ) as CreateUserConflictResponse;
2202
- throw new ApiException<CreateUserConflictResponse>(409, "Multiple User Identity Conflict", body, response.headers);
2203
- }
2204
- if (isCodeInRange("429", response.httpStatusCode)) {
2205
- const body: RateLimitError = ObjectSerializer.deserialize(
2206
- ObjectSerializer.parse(await response.body.text(), contentType),
2207
- "RateLimitError", ""
2208
- ) as RateLimitError;
2209
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2210
- }
2211
-
2212
- // Work around for missing responses in specification, e.g. for petstore.yaml
2213
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2214
- const body: User = ObjectSerializer.deserialize(
2215
- ObjectSerializer.parse(await response.body.text(), contentType),
2216
- "User", ""
2217
- ) as User;
2218
- return body;
2219
- }
2220
-
2221
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2222
- }
2223
-
2224
- /**
2225
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2226
- * to the expected objects
2227
- *
2228
- * @params response Response returned by the server for a request to deleteAlias
2229
- * @throws ApiException if the response code was not in [200, 299]
2230
- */
2231
- public async deleteAlias(response: ResponseContext): Promise<UserIdentityBody > {
2232
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2233
- if (isCodeInRange("200", response.httpStatusCode)) {
2234
- const body: UserIdentityBody = ObjectSerializer.deserialize(
2235
- ObjectSerializer.parse(await response.body.text(), contentType),
2236
- "UserIdentityBody", ""
2237
- ) as UserIdentityBody;
2238
- return body;
2239
- }
2240
- if (isCodeInRange("400", response.httpStatusCode)) {
2241
- const body: GenericError = ObjectSerializer.deserialize(
2242
- ObjectSerializer.parse(await response.body.text(), contentType),
2243
- "GenericError", ""
2244
- ) as GenericError;
2245
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2246
- }
2247
- if (isCodeInRange("404", response.httpStatusCode)) {
2248
- const body: GenericError = ObjectSerializer.deserialize(
2249
- ObjectSerializer.parse(await response.body.text(), contentType),
2250
- "GenericError", ""
2251
- ) as GenericError;
2252
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
2253
- }
2254
- if (isCodeInRange("409", response.httpStatusCode)) {
2255
- const body: GenericError = ObjectSerializer.deserialize(
2256
- ObjectSerializer.parse(await response.body.text(), contentType),
2257
- "GenericError", ""
2258
- ) as GenericError;
2259
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
2260
- }
2261
- if (isCodeInRange("429", response.httpStatusCode)) {
2262
- const body: RateLimitError = ObjectSerializer.deserialize(
2263
- ObjectSerializer.parse(await response.body.text(), contentType),
2264
- "RateLimitError", ""
2265
- ) as RateLimitError;
2266
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2267
- }
2268
-
2269
- // Work around for missing responses in specification, e.g. for petstore.yaml
2270
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2271
- const body: UserIdentityBody = ObjectSerializer.deserialize(
2272
- ObjectSerializer.parse(await response.body.text(), contentType),
2273
- "UserIdentityBody", ""
2274
- ) as UserIdentityBody;
2275
- return body;
2276
- }
2277
-
2278
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2279
- }
2280
-
2281
- /**
2282
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2283
- * to the expected objects
2284
- *
2285
- * @params response Response returned by the server for a request to deleteSegment
2286
- * @throws ApiException if the response code was not in [200, 299]
2287
- */
2288
- public async deleteSegment(response: ResponseContext): Promise<GenericSuccessBoolResponse > {
2289
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2290
- if (isCodeInRange("200", response.httpStatusCode)) {
2291
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
2292
- ObjectSerializer.parse(await response.body.text(), contentType),
2293
- "GenericSuccessBoolResponse", ""
2294
- ) as GenericSuccessBoolResponse;
2295
- return body;
2296
- }
2297
- if (isCodeInRange("400", response.httpStatusCode)) {
2298
- const body: GenericError = ObjectSerializer.deserialize(
2299
- ObjectSerializer.parse(await response.body.text(), contentType),
2300
- "GenericError", ""
2301
- ) as GenericError;
2302
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2303
- }
2304
- if (isCodeInRange("404", response.httpStatusCode)) {
2305
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
2306
- ObjectSerializer.parse(await response.body.text(), contentType),
2307
- "GenericSuccessBoolResponse", ""
2308
- ) as GenericSuccessBoolResponse;
2309
- throw new ApiException<GenericSuccessBoolResponse>(404, "Not Found", body, response.headers);
2310
- }
2311
- if (isCodeInRange("429", response.httpStatusCode)) {
2312
- const body: RateLimitError = ObjectSerializer.deserialize(
2313
- ObjectSerializer.parse(await response.body.text(), contentType),
2314
- "RateLimitError", ""
2315
- ) as RateLimitError;
2316
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2317
- }
2318
-
2319
- // Work around for missing responses in specification, e.g. for petstore.yaml
2320
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2321
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
2322
- ObjectSerializer.parse(await response.body.text(), contentType),
2323
- "GenericSuccessBoolResponse", ""
2324
- ) as GenericSuccessBoolResponse;
2325
- return body;
2326
- }
2327
-
2328
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2329
- }
2330
-
2331
- /**
2332
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2333
- * to the expected objects
2334
- *
2335
- * @params response Response returned by the server for a request to deleteSubscription
2336
- * @throws ApiException if the response code was not in [200, 299]
2337
- */
2338
- public async deleteSubscription(response: ResponseContext): Promise<void > {
2339
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2340
- if (isCodeInRange("202", response.httpStatusCode)) {
2341
- return;
2342
- }
2343
- if (isCodeInRange("400", response.httpStatusCode)) {
2344
- const body: GenericError = ObjectSerializer.deserialize(
2345
- ObjectSerializer.parse(await response.body.text(), contentType),
2346
- "GenericError", ""
2347
- ) as GenericError;
2348
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2349
- }
2350
- if (isCodeInRange("404", response.httpStatusCode)) {
2351
- const body: GenericError = ObjectSerializer.deserialize(
2352
- ObjectSerializer.parse(await response.body.text(), contentType),
2353
- "GenericError", ""
2354
- ) as GenericError;
2355
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
2356
- }
2357
- if (isCodeInRange("409", response.httpStatusCode)) {
2358
- const body: GenericError = ObjectSerializer.deserialize(
2359
- ObjectSerializer.parse(await response.body.text(), contentType),
2360
- "GenericError", ""
2361
- ) as GenericError;
2362
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
2363
- }
2364
- if (isCodeInRange("429", response.httpStatusCode)) {
2365
- const body: RateLimitError = ObjectSerializer.deserialize(
2366
- ObjectSerializer.parse(await response.body.text(), contentType),
2367
- "RateLimitError", ""
2368
- ) as RateLimitError;
2369
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2370
- }
2371
-
2372
- // Work around for missing responses in specification, e.g. for petstore.yaml
2373
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2374
- const body: void = ObjectSerializer.deserialize(
2375
- ObjectSerializer.parse(await response.body.text(), contentType),
2376
- "void", ""
2377
- ) as void;
2378
- return body;
2379
- }
2380
-
2381
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2382
- }
2383
-
2384
- /**
2385
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2386
- * to the expected objects
2387
- *
2388
- * @params response Response returned by the server for a request to deleteUser
2389
- * @throws ApiException if the response code was not in [200, 299]
2390
- */
2391
- public async deleteUser(response: ResponseContext): Promise<void > {
2392
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2393
- if (isCodeInRange("200", response.httpStatusCode)) {
2394
- return;
2395
- }
2396
- if (isCodeInRange("400", response.httpStatusCode)) {
2397
- const body: GenericError = ObjectSerializer.deserialize(
2398
- ObjectSerializer.parse(await response.body.text(), contentType),
2399
- "GenericError", ""
2400
- ) as GenericError;
2401
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2402
- }
2403
- if (isCodeInRange("409", response.httpStatusCode)) {
2404
- const body: GenericError = ObjectSerializer.deserialize(
2405
- ObjectSerializer.parse(await response.body.text(), contentType),
2406
- "GenericError", ""
2407
- ) as GenericError;
2408
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
2409
- }
2410
- if (isCodeInRange("429", response.httpStatusCode)) {
2411
- const body: RateLimitError = ObjectSerializer.deserialize(
2412
- ObjectSerializer.parse(await response.body.text(), contentType),
2413
- "RateLimitError", ""
2414
- ) as RateLimitError;
2415
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2416
- }
2417
-
2418
- // Work around for missing responses in specification, e.g. for petstore.yaml
2419
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2420
- const body: void = ObjectSerializer.deserialize(
2421
- ObjectSerializer.parse(await response.body.text(), contentType),
2422
- "void", ""
2423
- ) as void;
2424
- return body;
2425
- }
2426
-
2427
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2428
- }
2429
-
2430
- /**
2431
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2432
- * to the expected objects
2433
- *
2434
- * @params response Response returned by the server for a request to exportEvents
2435
- * @throws ApiException if the response code was not in [200, 299]
2436
- */
2437
- public async exportEvents(response: ResponseContext): Promise<ExportEventsSuccessResponse > {
2438
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2439
- if (isCodeInRange("200", response.httpStatusCode)) {
2440
- const body: ExportEventsSuccessResponse = ObjectSerializer.deserialize(
2441
- ObjectSerializer.parse(await response.body.text(), contentType),
2442
- "ExportEventsSuccessResponse", ""
2443
- ) as ExportEventsSuccessResponse;
2444
- return body;
2445
- }
2446
- if (isCodeInRange("400", response.httpStatusCode)) {
2447
- const body: GenericError = ObjectSerializer.deserialize(
2448
- ObjectSerializer.parse(await response.body.text(), contentType),
2449
- "GenericError", ""
2450
- ) as GenericError;
2451
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2452
- }
2453
- if (isCodeInRange("404", response.httpStatusCode)) {
2454
- const body: GenericError = ObjectSerializer.deserialize(
2455
- ObjectSerializer.parse(await response.body.text(), contentType),
2456
- "GenericError", ""
2457
- ) as GenericError;
2458
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
2459
- }
2460
- if (isCodeInRange("429", response.httpStatusCode)) {
2461
- const body: RateLimitError = ObjectSerializer.deserialize(
2462
- ObjectSerializer.parse(await response.body.text(), contentType),
2463
- "RateLimitError", ""
2464
- ) as RateLimitError;
2465
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2466
- }
2467
-
2468
- // Work around for missing responses in specification, e.g. for petstore.yaml
2469
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2470
- const body: ExportEventsSuccessResponse = ObjectSerializer.deserialize(
2471
- ObjectSerializer.parse(await response.body.text(), contentType),
2472
- "ExportEventsSuccessResponse", ""
2473
- ) as ExportEventsSuccessResponse;
2474
- return body;
2475
- }
2476
-
2477
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2478
- }
2479
-
2480
- /**
2481
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2482
- * to the expected objects
2483
- *
2484
- * @params response Response returned by the server for a request to exportSubscriptions
2485
- * @throws ApiException if the response code was not in [200, 299]
2486
- */
2487
- public async exportSubscriptions(response: ResponseContext): Promise<ExportSubscriptionsSuccessResponse > {
2488
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2489
- if (isCodeInRange("200", response.httpStatusCode)) {
2490
- const body: ExportSubscriptionsSuccessResponse = ObjectSerializer.deserialize(
2491
- ObjectSerializer.parse(await response.body.text(), contentType),
2492
- "ExportSubscriptionsSuccessResponse", ""
2493
- ) as ExportSubscriptionsSuccessResponse;
2494
- return body;
2495
- }
2496
- if (isCodeInRange("400", response.httpStatusCode)) {
2497
- const body: GenericError = ObjectSerializer.deserialize(
2498
- ObjectSerializer.parse(await response.body.text(), contentType),
2499
- "GenericError", ""
2500
- ) as GenericError;
2501
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2502
- }
2503
- if (isCodeInRange("429", response.httpStatusCode)) {
2504
- const body: RateLimitError = ObjectSerializer.deserialize(
2505
- ObjectSerializer.parse(await response.body.text(), contentType),
2506
- "RateLimitError", ""
2507
- ) as RateLimitError;
2508
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2509
- }
2510
-
2511
- // Work around for missing responses in specification, e.g. for petstore.yaml
2512
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2513
- const body: ExportSubscriptionsSuccessResponse = ObjectSerializer.deserialize(
2514
- ObjectSerializer.parse(await response.body.text(), contentType),
2515
- "ExportSubscriptionsSuccessResponse", ""
2516
- ) as ExportSubscriptionsSuccessResponse;
2517
- return body;
2518
- }
2519
-
2520
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2521
- }
2522
-
2523
- /**
2524
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2525
- * to the expected objects
2526
- *
2527
- * @params response Response returned by the server for a request to getAliases
2528
- * @throws ApiException if the response code was not in [200, 299]
2529
- */
2530
- public async getAliases(response: ResponseContext): Promise<UserIdentityBody > {
2531
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2532
- if (isCodeInRange("200", response.httpStatusCode)) {
2533
- const body: UserIdentityBody = ObjectSerializer.deserialize(
2534
- ObjectSerializer.parse(await response.body.text(), contentType),
2535
- "UserIdentityBody", ""
2536
- ) as UserIdentityBody;
2537
- return body;
2538
- }
2539
- if (isCodeInRange("400", response.httpStatusCode)) {
2540
- const body: GenericError = ObjectSerializer.deserialize(
2541
- ObjectSerializer.parse(await response.body.text(), contentType),
2542
- "GenericError", ""
2543
- ) as GenericError;
2544
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2545
- }
2546
- if (isCodeInRange("404", response.httpStatusCode)) {
2547
- const body: GenericError = ObjectSerializer.deserialize(
2548
- ObjectSerializer.parse(await response.body.text(), contentType),
2549
- "GenericError", ""
2550
- ) as GenericError;
2551
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
2552
- }
2553
- if (isCodeInRange("429", response.httpStatusCode)) {
2554
- const body: RateLimitError = ObjectSerializer.deserialize(
2555
- ObjectSerializer.parse(await response.body.text(), contentType),
2556
- "RateLimitError", ""
2557
- ) as RateLimitError;
2558
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2559
- }
2560
-
2561
- // Work around for missing responses in specification, e.g. for petstore.yaml
2562
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2563
- const body: UserIdentityBody = ObjectSerializer.deserialize(
2564
- ObjectSerializer.parse(await response.body.text(), contentType),
2565
- "UserIdentityBody", ""
2566
- ) as UserIdentityBody;
2567
- return body;
2568
- }
2569
-
2570
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2571
- }
2572
-
2573
- /**
2574
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2575
- * to the expected objects
2576
- *
2577
- * @params response Response returned by the server for a request to getAliasesBySubscription
2578
- * @throws ApiException if the response code was not in [200, 299]
2579
- */
2580
- public async getAliasesBySubscription(response: ResponseContext): Promise<UserIdentityBody > {
2581
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2582
- if (isCodeInRange("200", response.httpStatusCode)) {
2583
- const body: UserIdentityBody = ObjectSerializer.deserialize(
2584
- ObjectSerializer.parse(await response.body.text(), contentType),
2585
- "UserIdentityBody", ""
2586
- ) as UserIdentityBody;
2587
- return body;
2588
- }
2589
- if (isCodeInRange("400", response.httpStatusCode)) {
2590
- const body: GenericError = ObjectSerializer.deserialize(
2591
- ObjectSerializer.parse(await response.body.text(), contentType),
2592
- "GenericError", ""
2593
- ) as GenericError;
2594
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2595
- }
2596
- if (isCodeInRange("404", response.httpStatusCode)) {
2597
- const body: GenericError = ObjectSerializer.deserialize(
2598
- ObjectSerializer.parse(await response.body.text(), contentType),
2599
- "GenericError", ""
2600
- ) as GenericError;
2601
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
2602
- }
2603
-
2604
- // Work around for missing responses in specification, e.g. for petstore.yaml
2605
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2606
- const body: UserIdentityBody = ObjectSerializer.deserialize(
2607
- ObjectSerializer.parse(await response.body.text(), contentType),
2608
- "UserIdentityBody", ""
2609
- ) as UserIdentityBody;
2610
- return body;
2611
- }
2612
-
2613
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2614
- }
2615
-
2616
- /**
2617
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2618
- * to the expected objects
2619
- *
2620
- * @params response Response returned by the server for a request to getApp
2621
- * @throws ApiException if the response code was not in [200, 299]
2622
- */
2623
- public async getApp(response: ResponseContext): Promise<App > {
2624
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2625
- if (isCodeInRange("200", response.httpStatusCode)) {
2626
- const body: App = ObjectSerializer.deserialize(
2627
- ObjectSerializer.parse(await response.body.text(), contentType),
2628
- "App", ""
2629
- ) as App;
2630
- return body;
2631
- }
2632
- if (isCodeInRange("400", response.httpStatusCode)) {
2633
- const body: GenericError = ObjectSerializer.deserialize(
2634
- ObjectSerializer.parse(await response.body.text(), contentType),
2635
- "GenericError", ""
2636
- ) as GenericError;
2637
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2638
- }
2639
- if (isCodeInRange("429", response.httpStatusCode)) {
2640
- const body: RateLimitError = ObjectSerializer.deserialize(
2641
- ObjectSerializer.parse(await response.body.text(), contentType),
2642
- "RateLimitError", ""
2643
- ) as RateLimitError;
2644
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2645
- }
2646
-
2647
- // Work around for missing responses in specification, e.g. for petstore.yaml
2648
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2649
- const body: App = ObjectSerializer.deserialize(
2650
- ObjectSerializer.parse(await response.body.text(), contentType),
2651
- "App", ""
2652
- ) as App;
2653
- return body;
2654
- }
2655
-
2656
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2657
- }
2658
-
2659
- /**
2660
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2661
- * to the expected objects
2662
- *
2663
- * @params response Response returned by the server for a request to getApps
2664
- * @throws ApiException if the response code was not in [200, 299]
2665
- */
2666
- public async getApps(response: ResponseContext): Promise<Array<App> > {
2667
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2668
- if (isCodeInRange("200", response.httpStatusCode)) {
2669
- const body: Array<App> = ObjectSerializer.deserialize(
2670
- ObjectSerializer.parse(await response.body.text(), contentType),
2671
- "Array<App>", ""
2672
- ) as Array<App>;
2673
- return body;
2674
- }
2675
- if (isCodeInRange("400", response.httpStatusCode)) {
2676
- const body: GenericError = ObjectSerializer.deserialize(
2677
- ObjectSerializer.parse(await response.body.text(), contentType),
2678
- "GenericError", ""
2679
- ) as GenericError;
2680
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2681
- }
2682
- if (isCodeInRange("429", response.httpStatusCode)) {
2683
- const body: RateLimitError = ObjectSerializer.deserialize(
2684
- ObjectSerializer.parse(await response.body.text(), contentType),
2685
- "RateLimitError", ""
2686
- ) as RateLimitError;
2687
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2688
- }
2689
-
2690
- // Work around for missing responses in specification, e.g. for petstore.yaml
2691
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2692
- const body: Array<App> = ObjectSerializer.deserialize(
2693
- ObjectSerializer.parse(await response.body.text(), contentType),
2694
- "Array<App>", ""
2695
- ) as Array<App>;
2696
- return body;
2697
- }
2698
-
2699
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2700
- }
2701
-
2702
- /**
2703
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2704
- * to the expected objects
2705
- *
2706
- * @params response Response returned by the server for a request to getNotification
2707
- * @throws ApiException if the response code was not in [200, 299]
2708
- */
2709
- public async getNotification(response: ResponseContext): Promise<NotificationWithMeta > {
2710
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2711
- if (isCodeInRange("200", response.httpStatusCode)) {
2712
- const body: NotificationWithMeta = ObjectSerializer.deserialize(
2713
- ObjectSerializer.parse(await response.body.text(), contentType),
2714
- "NotificationWithMeta", ""
2715
- ) as NotificationWithMeta;
2716
- return body;
2717
- }
2718
- if (isCodeInRange("400", response.httpStatusCode)) {
2719
- const body: GenericError = ObjectSerializer.deserialize(
2720
- ObjectSerializer.parse(await response.body.text(), contentType),
2721
- "GenericError", ""
2722
- ) as GenericError;
2723
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2724
- }
2725
- if (isCodeInRange("404", response.httpStatusCode)) {
2726
- const body: GenericError = ObjectSerializer.deserialize(
2727
- ObjectSerializer.parse(await response.body.text(), contentType),
2728
- "GenericError", ""
2729
- ) as GenericError;
2730
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
2731
- }
2732
- if (isCodeInRange("429", response.httpStatusCode)) {
2733
- const body: RateLimitError = ObjectSerializer.deserialize(
2734
- ObjectSerializer.parse(await response.body.text(), contentType),
2735
- "RateLimitError", ""
2736
- ) as RateLimitError;
2737
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2738
- }
2739
-
2740
- // Work around for missing responses in specification, e.g. for petstore.yaml
2741
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2742
- const body: NotificationWithMeta = ObjectSerializer.deserialize(
2743
- ObjectSerializer.parse(await response.body.text(), contentType),
2744
- "NotificationWithMeta", ""
2745
- ) as NotificationWithMeta;
2746
- return body;
2747
- }
2748
-
2749
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2750
- }
2751
-
2752
- /**
2753
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2754
- * to the expected objects
2755
- *
2756
- * @params response Response returned by the server for a request to getNotificationHistory
2757
- * @throws ApiException if the response code was not in [200, 299]
2758
- */
2759
- public async getNotificationHistory(response: ResponseContext): Promise<NotificationHistorySuccessResponse > {
2760
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2761
- if (isCodeInRange("200", response.httpStatusCode)) {
2762
- const body: NotificationHistorySuccessResponse = ObjectSerializer.deserialize(
2763
- ObjectSerializer.parse(await response.body.text(), contentType),
2764
- "NotificationHistorySuccessResponse", ""
2765
- ) as NotificationHistorySuccessResponse;
2766
- return body;
2767
- }
2768
- if (isCodeInRange("400", response.httpStatusCode)) {
2769
- const body: GenericError = ObjectSerializer.deserialize(
2770
- ObjectSerializer.parse(await response.body.text(), contentType),
2771
- "GenericError", ""
2772
- ) as GenericError;
2773
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2774
- }
2775
- if (isCodeInRange("404", response.httpStatusCode)) {
2776
- const body: GenericError = ObjectSerializer.deserialize(
2777
- ObjectSerializer.parse(await response.body.text(), contentType),
2778
- "GenericError", ""
2779
- ) as GenericError;
2780
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
2781
- }
2782
- if (isCodeInRange("429", response.httpStatusCode)) {
2783
- const body: RateLimitError = ObjectSerializer.deserialize(
2784
- ObjectSerializer.parse(await response.body.text(), contentType),
2785
- "RateLimitError", ""
2786
- ) as RateLimitError;
2787
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2788
- }
2789
-
2790
- // Work around for missing responses in specification, e.g. for petstore.yaml
2791
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2792
- const body: NotificationHistorySuccessResponse = ObjectSerializer.deserialize(
2793
- ObjectSerializer.parse(await response.body.text(), contentType),
2794
- "NotificationHistorySuccessResponse", ""
2795
- ) as NotificationHistorySuccessResponse;
2796
- return body;
2797
- }
2798
-
2799
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2800
- }
2801
-
2802
- /**
2803
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2804
- * to the expected objects
2805
- *
2806
- * @params response Response returned by the server for a request to getNotifications
2807
- * @throws ApiException if the response code was not in [200, 299]
2808
- */
2809
- public async getNotifications(response: ResponseContext): Promise<NotificationSlice > {
2810
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2811
- if (isCodeInRange("200", response.httpStatusCode)) {
2812
- const body: NotificationSlice = ObjectSerializer.deserialize(
2813
- ObjectSerializer.parse(await response.body.text(), contentType),
2814
- "NotificationSlice", ""
2815
- ) as NotificationSlice;
2816
- return body;
2817
- }
2818
- if (isCodeInRange("400", response.httpStatusCode)) {
2819
- const body: GenericError = ObjectSerializer.deserialize(
2820
- ObjectSerializer.parse(await response.body.text(), contentType),
2821
- "GenericError", ""
2822
- ) as GenericError;
2823
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2824
- }
2825
- if (isCodeInRange("429", response.httpStatusCode)) {
2826
- const body: RateLimitError = ObjectSerializer.deserialize(
2827
- ObjectSerializer.parse(await response.body.text(), contentType),
2828
- "RateLimitError", ""
2829
- ) as RateLimitError;
2830
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2831
- }
2832
-
2833
- // Work around for missing responses in specification, e.g. for petstore.yaml
2834
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2835
- const body: NotificationSlice = ObjectSerializer.deserialize(
2836
- ObjectSerializer.parse(await response.body.text(), contentType),
2837
- "NotificationSlice", ""
2838
- ) as NotificationSlice;
2839
- return body;
2840
- }
2841
-
2842
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2843
- }
2844
-
2845
- /**
2846
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2847
- * to the expected objects
2848
- *
2849
- * @params response Response returned by the server for a request to getOutcomes
2850
- * @throws ApiException if the response code was not in [200, 299]
2851
- */
2852
- public async getOutcomes(response: ResponseContext): Promise<OutcomesData > {
2853
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2854
- if (isCodeInRange("200", response.httpStatusCode)) {
2855
- const body: OutcomesData = ObjectSerializer.deserialize(
2856
- ObjectSerializer.parse(await response.body.text(), contentType),
2857
- "OutcomesData", ""
2858
- ) as OutcomesData;
2859
- return body;
2860
- }
2861
- if (isCodeInRange("400", response.httpStatusCode)) {
2862
- const body: GenericError = ObjectSerializer.deserialize(
2863
- ObjectSerializer.parse(await response.body.text(), contentType),
2864
- "GenericError", ""
2865
- ) as GenericError;
2866
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2867
- }
2868
- if (isCodeInRange("429", response.httpStatusCode)) {
2869
- const body: RateLimitError = ObjectSerializer.deserialize(
2870
- ObjectSerializer.parse(await response.body.text(), contentType),
2871
- "RateLimitError", ""
2872
- ) as RateLimitError;
2873
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2874
- }
2875
-
2876
- // Work around for missing responses in specification, e.g. for petstore.yaml
2877
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2878
- const body: OutcomesData = ObjectSerializer.deserialize(
2879
- ObjectSerializer.parse(await response.body.text(), contentType),
2880
- "OutcomesData", ""
2881
- ) as OutcomesData;
2882
- return body;
2883
- }
2884
-
2885
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2886
- }
2887
-
2888
- /**
2889
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2890
- * to the expected objects
2891
- *
2892
- * @params response Response returned by the server for a request to getSegments
2893
- * @throws ApiException if the response code was not in [200, 299]
2894
- */
2895
- public async getSegments(response: ResponseContext): Promise<GetSegmentsSuccessResponse > {
2896
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2897
- if (isCodeInRange("201", response.httpStatusCode)) {
2898
- const body: GetSegmentsSuccessResponse = ObjectSerializer.deserialize(
2899
- ObjectSerializer.parse(await response.body.text(), contentType),
2900
- "GetSegmentsSuccessResponse", ""
2901
- ) as GetSegmentsSuccessResponse;
2902
- return body;
2903
- }
2904
- if (isCodeInRange("400", response.httpStatusCode)) {
2905
- const body: GenericError = ObjectSerializer.deserialize(
2906
- ObjectSerializer.parse(await response.body.text(), contentType),
2907
- "GenericError", ""
2908
- ) as GenericError;
2909
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2910
- }
2911
- if (isCodeInRange("429", response.httpStatusCode)) {
2912
- const body: RateLimitError = ObjectSerializer.deserialize(
2913
- ObjectSerializer.parse(await response.body.text(), contentType),
2914
- "RateLimitError", ""
2915
- ) as RateLimitError;
2916
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2917
- }
2918
-
2919
- // Work around for missing responses in specification, e.g. for petstore.yaml
2920
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2921
- const body: GetSegmentsSuccessResponse = ObjectSerializer.deserialize(
2922
- ObjectSerializer.parse(await response.body.text(), contentType),
2923
- "GetSegmentsSuccessResponse", ""
2924
- ) as GetSegmentsSuccessResponse;
2925
- return body;
2926
- }
2927
-
2928
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2929
- }
2930
-
2931
- /**
2932
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2933
- * to the expected objects
2934
- *
2935
- * @params response Response returned by the server for a request to getUser
2936
- * @throws ApiException if the response code was not in [200, 299]
2937
- */
2938
- public async getUser(response: ResponseContext): Promise<User > {
2939
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2940
- if (isCodeInRange("200", response.httpStatusCode)) {
2941
- const body: User = ObjectSerializer.deserialize(
2942
- ObjectSerializer.parse(await response.body.text(), contentType),
2943
- "User", ""
2944
- ) as User;
2945
- return body;
2946
- }
2947
- if (isCodeInRange("400", response.httpStatusCode)) {
2948
- const body: GenericError = ObjectSerializer.deserialize(
2949
- ObjectSerializer.parse(await response.body.text(), contentType),
2950
- "GenericError", ""
2951
- ) as GenericError;
2952
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
2953
- }
2954
- if (isCodeInRange("404", response.httpStatusCode)) {
2955
- const body: GenericError = ObjectSerializer.deserialize(
2956
- ObjectSerializer.parse(await response.body.text(), contentType),
2957
- "GenericError", ""
2958
- ) as GenericError;
2959
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
2960
- }
2961
- if (isCodeInRange("429", response.httpStatusCode)) {
2962
- const body: RateLimitError = ObjectSerializer.deserialize(
2963
- ObjectSerializer.parse(await response.body.text(), contentType),
2964
- "RateLimitError", ""
2965
- ) as RateLimitError;
2966
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
2967
- }
2968
-
2969
- // Work around for missing responses in specification, e.g. for petstore.yaml
2970
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2971
- const body: User = ObjectSerializer.deserialize(
2972
- ObjectSerializer.parse(await response.body.text(), contentType),
2973
- "User", ""
2974
- ) as User;
2975
- return body;
2976
- }
2977
-
2978
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
2979
- }
2980
-
2981
- /**
2982
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
2983
- * to the expected objects
2984
- *
2985
- * @params response Response returned by the server for a request to transferSubscription
2986
- * @throws ApiException if the response code was not in [200, 299]
2987
- */
2988
- public async transferSubscription(response: ResponseContext): Promise<UserIdentityBody > {
2989
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
2990
- if (isCodeInRange("200", response.httpStatusCode)) {
2991
- const body: UserIdentityBody = ObjectSerializer.deserialize(
2992
- ObjectSerializer.parse(await response.body.text(), contentType),
2993
- "UserIdentityBody", ""
2994
- ) as UserIdentityBody;
2995
- return body;
2996
- }
2997
- if (isCodeInRange("400", response.httpStatusCode)) {
2998
- const body: GenericError = ObjectSerializer.deserialize(
2999
- ObjectSerializer.parse(await response.body.text(), contentType),
3000
- "GenericError", ""
3001
- ) as GenericError;
3002
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3003
- }
3004
- if (isCodeInRange("404", response.httpStatusCode)) {
3005
- const body: GenericError = ObjectSerializer.deserialize(
3006
- ObjectSerializer.parse(await response.body.text(), contentType),
3007
- "GenericError", ""
3008
- ) as GenericError;
3009
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
3010
- }
3011
- if (isCodeInRange("409", response.httpStatusCode)) {
3012
- const body: GenericError = ObjectSerializer.deserialize(
3013
- ObjectSerializer.parse(await response.body.text(), contentType),
3014
- "GenericError", ""
3015
- ) as GenericError;
3016
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
3017
- }
3018
- if (isCodeInRange("429", response.httpStatusCode)) {
3019
- const body: RateLimitError = ObjectSerializer.deserialize(
3020
- ObjectSerializer.parse(await response.body.text(), contentType),
3021
- "RateLimitError", ""
3022
- ) as RateLimitError;
3023
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3024
- }
3025
-
3026
- // Work around for missing responses in specification, e.g. for petstore.yaml
3027
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3028
- const body: UserIdentityBody = ObjectSerializer.deserialize(
3029
- ObjectSerializer.parse(await response.body.text(), contentType),
3030
- "UserIdentityBody", ""
3031
- ) as UserIdentityBody;
3032
- return body;
3033
- }
3034
-
3035
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3036
- }
3037
-
3038
- /**
3039
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3040
- * to the expected objects
3041
- *
3042
- * @params response Response returned by the server for a request to unsubscribeEmailWithToken
3043
- * @throws ApiException if the response code was not in [200, 299]
3044
- */
3045
- public async unsubscribeEmailWithToken(response: ResponseContext): Promise<GenericSuccessBoolResponse > {
3046
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3047
- if (isCodeInRange("202", response.httpStatusCode)) {
3048
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
3049
- ObjectSerializer.parse(await response.body.text(), contentType),
3050
- "GenericSuccessBoolResponse", ""
3051
- ) as GenericSuccessBoolResponse;
3052
- return body;
3053
- }
3054
- if (isCodeInRange("400", response.httpStatusCode)) {
3055
- const body: GenericError = ObjectSerializer.deserialize(
3056
- ObjectSerializer.parse(await response.body.text(), contentType),
3057
- "GenericError", ""
3058
- ) as GenericError;
3059
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3060
- }
3061
- if (isCodeInRange("429", response.httpStatusCode)) {
3062
- const body: RateLimitError = ObjectSerializer.deserialize(
3063
- ObjectSerializer.parse(await response.body.text(), contentType),
3064
- "RateLimitError", ""
3065
- ) as RateLimitError;
3066
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3067
- }
3068
-
3069
- // Work around for missing responses in specification, e.g. for petstore.yaml
3070
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3071
- const body: GenericSuccessBoolResponse = ObjectSerializer.deserialize(
3072
- ObjectSerializer.parse(await response.body.text(), contentType),
3073
- "GenericSuccessBoolResponse", ""
3074
- ) as GenericSuccessBoolResponse;
3075
- return body;
3076
- }
3077
-
3078
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3079
- }
3080
-
3081
- /**
3082
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3083
- * to the expected objects
3084
- *
3085
- * @params response Response returned by the server for a request to updateApp
3086
- * @throws ApiException if the response code was not in [200, 299]
3087
- */
3088
- public async updateApp(response: ResponseContext): Promise<App > {
3089
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3090
- if (isCodeInRange("200", response.httpStatusCode)) {
3091
- const body: App = ObjectSerializer.deserialize(
3092
- ObjectSerializer.parse(await response.body.text(), contentType),
3093
- "App", ""
3094
- ) as App;
3095
- return body;
3096
- }
3097
- if (isCodeInRange("400", response.httpStatusCode)) {
3098
- const body: GenericError = ObjectSerializer.deserialize(
3099
- ObjectSerializer.parse(await response.body.text(), contentType),
3100
- "GenericError", ""
3101
- ) as GenericError;
3102
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3103
- }
3104
- if (isCodeInRange("429", response.httpStatusCode)) {
3105
- const body: RateLimitError = ObjectSerializer.deserialize(
3106
- ObjectSerializer.parse(await response.body.text(), contentType),
3107
- "RateLimitError", ""
3108
- ) as RateLimitError;
3109
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3110
- }
3111
-
3112
- // Work around for missing responses in specification, e.g. for petstore.yaml
3113
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3114
- const body: App = ObjectSerializer.deserialize(
3115
- ObjectSerializer.parse(await response.body.text(), contentType),
3116
- "App", ""
3117
- ) as App;
3118
- return body;
3119
- }
3120
-
3121
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3122
- }
3123
-
3124
- /**
3125
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3126
- * to the expected objects
3127
- *
3128
- * @params response Response returned by the server for a request to updateLiveActivity
3129
- * @throws ApiException if the response code was not in [200, 299]
3130
- */
3131
- public async updateLiveActivity(response: ResponseContext): Promise<UpdateLiveActivitySuccessResponse > {
3132
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3133
- if (isCodeInRange("200", response.httpStatusCode)) {
3134
- const body: UpdateLiveActivitySuccessResponse = ObjectSerializer.deserialize(
3135
- ObjectSerializer.parse(await response.body.text(), contentType),
3136
- "UpdateLiveActivitySuccessResponse", ""
3137
- ) as UpdateLiveActivitySuccessResponse;
3138
- return body;
3139
- }
3140
- if (isCodeInRange("400", response.httpStatusCode)) {
3141
- const body: GenericError = ObjectSerializer.deserialize(
3142
- ObjectSerializer.parse(await response.body.text(), contentType),
3143
- "GenericError", ""
3144
- ) as GenericError;
3145
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3146
- }
3147
- if (isCodeInRange("429", response.httpStatusCode)) {
3148
- const body: RateLimitError = ObjectSerializer.deserialize(
3149
- ObjectSerializer.parse(await response.body.text(), contentType),
3150
- "RateLimitError", ""
3151
- ) as RateLimitError;
3152
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3153
- }
3154
-
3155
- // Work around for missing responses in specification, e.g. for petstore.yaml
3156
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3157
- const body: UpdateLiveActivitySuccessResponse = ObjectSerializer.deserialize(
3158
- ObjectSerializer.parse(await response.body.text(), contentType),
3159
- "UpdateLiveActivitySuccessResponse", ""
3160
- ) as UpdateLiveActivitySuccessResponse;
3161
- return body;
3162
- }
3163
-
3164
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3165
- }
3166
-
3167
- /**
3168
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3169
- * to the expected objects
3170
- *
3171
- * @params response Response returned by the server for a request to updateSubscription
3172
- * @throws ApiException if the response code was not in [200, 299]
3173
- */
3174
- public async updateSubscription(response: ResponseContext): Promise<void > {
3175
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3176
- if (isCodeInRange("200", response.httpStatusCode)) {
3177
- return;
3178
- }
3179
- if (isCodeInRange("400", response.httpStatusCode)) {
3180
- const body: GenericError = ObjectSerializer.deserialize(
3181
- ObjectSerializer.parse(await response.body.text(), contentType),
3182
- "GenericError", ""
3183
- ) as GenericError;
3184
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3185
- }
3186
- if (isCodeInRange("404", response.httpStatusCode)) {
3187
- const body: GenericError = ObjectSerializer.deserialize(
3188
- ObjectSerializer.parse(await response.body.text(), contentType),
3189
- "GenericError", ""
3190
- ) as GenericError;
3191
- throw new ApiException<GenericError>(404, "Not Found", body, response.headers);
3192
- }
3193
- if (isCodeInRange("409", response.httpStatusCode)) {
3194
- const body: GenericError = ObjectSerializer.deserialize(
3195
- ObjectSerializer.parse(await response.body.text(), contentType),
3196
- "GenericError", ""
3197
- ) as GenericError;
3198
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
3199
- }
3200
- if (isCodeInRange("429", response.httpStatusCode)) {
3201
- const body: RateLimitError = ObjectSerializer.deserialize(
3202
- ObjectSerializer.parse(await response.body.text(), contentType),
3203
- "RateLimitError", ""
3204
- ) as RateLimitError;
3205
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3206
- }
3207
-
3208
- // Work around for missing responses in specification, e.g. for petstore.yaml
3209
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3210
- const body: void = ObjectSerializer.deserialize(
3211
- ObjectSerializer.parse(await response.body.text(), contentType),
3212
- "void", ""
3213
- ) as void;
3214
- return body;
3215
- }
3216
-
3217
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3218
- }
3219
-
3220
- /**
3221
- * Unwraps the actual response sent by the server from the response context and deserializes the response content
3222
- * to the expected objects
3223
- *
3224
- * @params response Response returned by the server for a request to updateUser
3225
- * @throws ApiException if the response code was not in [200, 299]
3226
- */
3227
- public async updateUser(response: ResponseContext): Promise<PropertiesBody > {
3228
- const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
3229
- if (isCodeInRange("202", response.httpStatusCode)) {
3230
- const body: PropertiesBody = ObjectSerializer.deserialize(
3231
- ObjectSerializer.parse(await response.body.text(), contentType),
3232
- "PropertiesBody", ""
3233
- ) as PropertiesBody;
3234
- return body;
3235
- }
3236
- if (isCodeInRange("400", response.httpStatusCode)) {
3237
- const body: GenericError = ObjectSerializer.deserialize(
3238
- ObjectSerializer.parse(await response.body.text(), contentType),
3239
- "GenericError", ""
3240
- ) as GenericError;
3241
- throw new ApiException<GenericError>(400, "Bad Request", body, response.headers);
3242
- }
3243
- if (isCodeInRange("409", response.httpStatusCode)) {
3244
- const body: GenericError = ObjectSerializer.deserialize(
3245
- ObjectSerializer.parse(await response.body.text(), contentType),
3246
- "GenericError", ""
3247
- ) as GenericError;
3248
- throw new ApiException<GenericError>(409, "Conflict", body, response.headers);
3249
- }
3250
- if (isCodeInRange("429", response.httpStatusCode)) {
3251
- const body: RateLimitError = ObjectSerializer.deserialize(
3252
- ObjectSerializer.parse(await response.body.text(), contentType),
3253
- "RateLimitError", ""
3254
- ) as RateLimitError;
3255
- throw new ApiException<RateLimitError>(429, "Rate Limit Exceeded", body, response.headers);
3256
- }
3257
-
3258
- // Work around for missing responses in specification, e.g. for petstore.yaml
3259
- if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
3260
- const body: PropertiesBody = ObjectSerializer.deserialize(
3261
- ObjectSerializer.parse(await response.body.text(), contentType),
3262
- "PropertiesBody", ""
3263
- ) as PropertiesBody;
3264
- return body;
3265
- }
3266
-
3267
- throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
3268
- }
3269
-
3270
- }