@n3oltd/umbraco-accounts-client 9.0.0-beta-77
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.
- package/README.md +1 -0
- package/dist/esm/index.d.ts +111 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +410 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.ts +111 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +410 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +1 -0
- package/dist/index.min.js.map +1 -0
- package/esm/index.d.ts +111 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +410 -0
- package/esm/index.js.map +1 -0
- package/package.json +40 -0
- package/src/index.ts +437 -0
- package/tsconfig.json +21 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
//----------------------
|
|
4
|
+
// <auto-generated>
|
|
5
|
+
// Generated using the NSwag toolchain v13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v9.0.0.0)) (http://NSwag.org)
|
|
6
|
+
// </auto-generated>
|
|
7
|
+
//----------------------
|
|
8
|
+
// ReSharper disable InconsistentNaming
|
|
9
|
+
|
|
10
|
+
export class AccountsClient {
|
|
11
|
+
private http: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> };
|
|
12
|
+
private baseUrl: string;
|
|
13
|
+
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
|
|
14
|
+
|
|
15
|
+
constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> }) {
|
|
16
|
+
this.http = http ? http : <any>window;
|
|
17
|
+
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "https://localhost:5001";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getConsentOptions(): Promise<ConsentOption[]> {
|
|
21
|
+
let url_ = this.baseUrl + "/umbraco/api/Accounts/consentOptions";
|
|
22
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
23
|
+
|
|
24
|
+
let options_ = <RequestInit>{
|
|
25
|
+
method: "GET",
|
|
26
|
+
headers: {
|
|
27
|
+
"Accept": "application/json"
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return this.http.fetch(url_, options_).then((_response: Response) => {
|
|
32
|
+
return this.processGetConsentOptions(_response);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
protected processGetConsentOptions(response: Response): Promise<ConsentOption[]> {
|
|
37
|
+
const status = response.status;
|
|
38
|
+
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
|
39
|
+
if (status === 200) {
|
|
40
|
+
return response.text().then((_responseText) => {
|
|
41
|
+
let result200: any = null;
|
|
42
|
+
result200 = _responseText === "" ? null : <ConsentOption[]>JSON.parse(_responseText, this.jsonParseReviver);
|
|
43
|
+
return result200;
|
|
44
|
+
});
|
|
45
|
+
} else if (status === 400) {
|
|
46
|
+
return response.text().then((_responseText) => {
|
|
47
|
+
let result400: any = null;
|
|
48
|
+
result400 = _responseText === "" ? null : <ProblemDetails>JSON.parse(_responseText, this.jsonParseReviver);
|
|
49
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
50
|
+
});
|
|
51
|
+
} else if (status === 500) {
|
|
52
|
+
return response.text().then((_responseText) => {
|
|
53
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
54
|
+
});
|
|
55
|
+
} else if (status !== 200 && status !== 204) {
|
|
56
|
+
return response.text().then((_responseText) => {
|
|
57
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return Promise.resolve<ConsentOption[]>(<any>null);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
getLookupConsentCategories(): Promise<NamedLookupRes[]> {
|
|
64
|
+
let url_ = this.baseUrl + "/umbraco/api/Accounts/lookups/consentCategories";
|
|
65
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
66
|
+
|
|
67
|
+
let options_ = <RequestInit>{
|
|
68
|
+
method: "GET",
|
|
69
|
+
headers: {
|
|
70
|
+
"Accept": "application/json"
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return this.http.fetch(url_, options_).then((_response: Response) => {
|
|
75
|
+
return this.processGetLookupConsentCategories(_response);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
protected processGetLookupConsentCategories(response: Response): Promise<NamedLookupRes[]> {
|
|
80
|
+
const status = response.status;
|
|
81
|
+
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
|
82
|
+
if (status === 200) {
|
|
83
|
+
return response.text().then((_responseText) => {
|
|
84
|
+
let result200: any = null;
|
|
85
|
+
result200 = _responseText === "" ? null : <NamedLookupRes[]>JSON.parse(_responseText, this.jsonParseReviver);
|
|
86
|
+
return result200;
|
|
87
|
+
});
|
|
88
|
+
} else if (status === 400) {
|
|
89
|
+
return response.text().then((_responseText) => {
|
|
90
|
+
let result400: any = null;
|
|
91
|
+
result400 = _responseText === "" ? null : <ProblemDetails>JSON.parse(_responseText, this.jsonParseReviver);
|
|
92
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
93
|
+
});
|
|
94
|
+
} else if (status === 500) {
|
|
95
|
+
return response.text().then((_responseText) => {
|
|
96
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
97
|
+
});
|
|
98
|
+
} else if (status !== 200 && status !== 204) {
|
|
99
|
+
return response.text().then((_responseText) => {
|
|
100
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return Promise.resolve<NamedLookupRes[]>(<any>null);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
getLookupConsentChannels(): Promise<NamedLookupRes[]> {
|
|
107
|
+
let url_ = this.baseUrl + "/umbraco/api/Accounts/lookups/consentChannels";
|
|
108
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
109
|
+
|
|
110
|
+
let options_ = <RequestInit>{
|
|
111
|
+
method: "GET",
|
|
112
|
+
headers: {
|
|
113
|
+
"Accept": "application/json"
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
return this.http.fetch(url_, options_).then((_response: Response) => {
|
|
118
|
+
return this.processGetLookupConsentChannels(_response);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
protected processGetLookupConsentChannels(response: Response): Promise<NamedLookupRes[]> {
|
|
123
|
+
const status = response.status;
|
|
124
|
+
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
|
125
|
+
if (status === 200) {
|
|
126
|
+
return response.text().then((_responseText) => {
|
|
127
|
+
let result200: any = null;
|
|
128
|
+
result200 = _responseText === "" ? null : <NamedLookupRes[]>JSON.parse(_responseText, this.jsonParseReviver);
|
|
129
|
+
return result200;
|
|
130
|
+
});
|
|
131
|
+
} else if (status === 400) {
|
|
132
|
+
return response.text().then((_responseText) => {
|
|
133
|
+
let result400: any = null;
|
|
134
|
+
result400 = _responseText === "" ? null : <ProblemDetails>JSON.parse(_responseText, this.jsonParseReviver);
|
|
135
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
136
|
+
});
|
|
137
|
+
} else if (status === 500) {
|
|
138
|
+
return response.text().then((_responseText) => {
|
|
139
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
140
|
+
});
|
|
141
|
+
} else if (status !== 200 && status !== 204) {
|
|
142
|
+
return response.text().then((_responseText) => {
|
|
143
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return Promise.resolve<NamedLookupRes[]>(<any>null);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
getLookupConsentResponses(): Promise<NamedLookupRes[]> {
|
|
150
|
+
let url_ = this.baseUrl + "/umbraco/api/Accounts/lookups/consentResponses";
|
|
151
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
152
|
+
|
|
153
|
+
let options_ = <RequestInit>{
|
|
154
|
+
method: "GET",
|
|
155
|
+
headers: {
|
|
156
|
+
"Accept": "application/json"
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
return this.http.fetch(url_, options_).then((_response: Response) => {
|
|
161
|
+
return this.processGetLookupConsentResponses(_response);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
protected processGetLookupConsentResponses(response: Response): Promise<NamedLookupRes[]> {
|
|
166
|
+
const status = response.status;
|
|
167
|
+
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
|
168
|
+
if (status === 200) {
|
|
169
|
+
return response.text().then((_responseText) => {
|
|
170
|
+
let result200: any = null;
|
|
171
|
+
result200 = _responseText === "" ? null : <NamedLookupRes[]>JSON.parse(_responseText, this.jsonParseReviver);
|
|
172
|
+
return result200;
|
|
173
|
+
});
|
|
174
|
+
} else if (status === 400) {
|
|
175
|
+
return response.text().then((_responseText) => {
|
|
176
|
+
let result400: any = null;
|
|
177
|
+
result400 = _responseText === "" ? null : <ProblemDetails>JSON.parse(_responseText, this.jsonParseReviver);
|
|
178
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
179
|
+
});
|
|
180
|
+
} else if (status === 500) {
|
|
181
|
+
return response.text().then((_responseText) => {
|
|
182
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
183
|
+
});
|
|
184
|
+
} else if (status !== 200 && status !== 204) {
|
|
185
|
+
return response.text().then((_responseText) => {
|
|
186
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return Promise.resolve<NamedLookupRes[]>(<any>null);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
getLookupCountries(): Promise<CountryRes[]> {
|
|
193
|
+
let url_ = this.baseUrl + "/umbraco/api/Accounts/lookups/countries";
|
|
194
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
195
|
+
|
|
196
|
+
let options_ = <RequestInit>{
|
|
197
|
+
method: "GET",
|
|
198
|
+
headers: {
|
|
199
|
+
"Accept": "application/json"
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
return this.http.fetch(url_, options_).then((_response: Response) => {
|
|
204
|
+
return this.processGetLookupCountries(_response);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
protected processGetLookupCountries(response: Response): Promise<CountryRes[]> {
|
|
209
|
+
const status = response.status;
|
|
210
|
+
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
|
211
|
+
if (status === 200) {
|
|
212
|
+
return response.text().then((_responseText) => {
|
|
213
|
+
let result200: any = null;
|
|
214
|
+
result200 = _responseText === "" ? null : <CountryRes[]>JSON.parse(_responseText, this.jsonParseReviver);
|
|
215
|
+
return result200;
|
|
216
|
+
});
|
|
217
|
+
} else if (status === 400) {
|
|
218
|
+
return response.text().then((_responseText) => {
|
|
219
|
+
let result400: any = null;
|
|
220
|
+
result400 = _responseText === "" ? null : <ProblemDetails>JSON.parse(_responseText, this.jsonParseReviver);
|
|
221
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
222
|
+
});
|
|
223
|
+
} else if (status === 500) {
|
|
224
|
+
return response.text().then((_responseText) => {
|
|
225
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
226
|
+
});
|
|
227
|
+
} else if (status !== 200 && status !== 204) {
|
|
228
|
+
return response.text().then((_responseText) => {
|
|
229
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
return Promise.resolve<CountryRes[]>(<any>null);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
getLookupTaxStatuses(): Promise<NamedLookupRes[]> {
|
|
236
|
+
let url_ = this.baseUrl + "/umbraco/api/Accounts/lookups/taxStatuses";
|
|
237
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
238
|
+
|
|
239
|
+
let options_ = <RequestInit>{
|
|
240
|
+
method: "GET",
|
|
241
|
+
headers: {
|
|
242
|
+
"Accept": "application/json"
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
return this.http.fetch(url_, options_).then((_response: Response) => {
|
|
247
|
+
return this.processGetLookupTaxStatuses(_response);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
protected processGetLookupTaxStatuses(response: Response): Promise<NamedLookupRes[]> {
|
|
252
|
+
const status = response.status;
|
|
253
|
+
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
|
254
|
+
if (status === 200) {
|
|
255
|
+
return response.text().then((_responseText) => {
|
|
256
|
+
let result200: any = null;
|
|
257
|
+
result200 = _responseText === "" ? null : <NamedLookupRes[]>JSON.parse(_responseText, this.jsonParseReviver);
|
|
258
|
+
return result200;
|
|
259
|
+
});
|
|
260
|
+
} else if (status === 400) {
|
|
261
|
+
return response.text().then((_responseText) => {
|
|
262
|
+
let result400: any = null;
|
|
263
|
+
result400 = _responseText === "" ? null : <ProblemDetails>JSON.parse(_responseText, this.jsonParseReviver);
|
|
264
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
265
|
+
});
|
|
266
|
+
} else if (status === 500) {
|
|
267
|
+
return response.text().then((_responseText) => {
|
|
268
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
269
|
+
});
|
|
270
|
+
} else if (status !== 200 && status !== 204) {
|
|
271
|
+
return response.text().then((_responseText) => {
|
|
272
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
return Promise.resolve<NamedLookupRes[]>(<any>null);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
getAllLookups(criteria: LookupsCriteria): Promise<AccountsLookupsRes> {
|
|
279
|
+
let url_ = this.baseUrl + "/umbraco/api/Accounts/lookups/all";
|
|
280
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
281
|
+
|
|
282
|
+
const content_ = JSON.stringify(criteria);
|
|
283
|
+
|
|
284
|
+
let options_ = <RequestInit>{
|
|
285
|
+
body: content_,
|
|
286
|
+
method: "POST",
|
|
287
|
+
headers: {
|
|
288
|
+
"Content-Type": "application/json",
|
|
289
|
+
"Accept": "application/json"
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
return this.http.fetch(url_, options_).then((_response: Response) => {
|
|
294
|
+
return this.processGetAllLookups(_response);
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
protected processGetAllLookups(response: Response): Promise<AccountsLookupsRes> {
|
|
299
|
+
const status = response.status;
|
|
300
|
+
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
|
301
|
+
if (status === 200) {
|
|
302
|
+
return response.text().then((_responseText) => {
|
|
303
|
+
let result200: any = null;
|
|
304
|
+
result200 = _responseText === "" ? null : <AccountsLookupsRes>JSON.parse(_responseText, this.jsonParseReviver);
|
|
305
|
+
return result200;
|
|
306
|
+
});
|
|
307
|
+
} else if (status === 400) {
|
|
308
|
+
return response.text().then((_responseText) => {
|
|
309
|
+
let result400: any = null;
|
|
310
|
+
result400 = _responseText === "" ? null : <ProblemDetails>JSON.parse(_responseText, this.jsonParseReviver);
|
|
311
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
312
|
+
});
|
|
313
|
+
} else if (status === 500) {
|
|
314
|
+
return response.text().then((_responseText) => {
|
|
315
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
316
|
+
});
|
|
317
|
+
} else if (status !== 200 && status !== 204) {
|
|
318
|
+
return response.text().then((_responseText) => {
|
|
319
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
return Promise.resolve<AccountsLookupsRes>(<any>null);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export interface ConsentOption {
|
|
327
|
+
channel?: ConsentChannel | undefined;
|
|
328
|
+
categories?: string[] | undefined;
|
|
329
|
+
statement?: string | undefined;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** One of 'email', 'sms', 'post', 'telephone' */
|
|
333
|
+
export enum ConsentChannel {
|
|
334
|
+
Email = "email",
|
|
335
|
+
Sms = "sms",
|
|
336
|
+
Post = "post",
|
|
337
|
+
Telephone = "telephone",
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export interface IPublishedContent {
|
|
341
|
+
id?: number;
|
|
342
|
+
name?: string | undefined;
|
|
343
|
+
urlSegment?: string | undefined;
|
|
344
|
+
sortOrder?: number;
|
|
345
|
+
level?: number;
|
|
346
|
+
path?: string | undefined;
|
|
347
|
+
templateId?: number | undefined;
|
|
348
|
+
creatorId?: number;
|
|
349
|
+
createDate?: Date;
|
|
350
|
+
writerId?: number;
|
|
351
|
+
updateDate?: Date;
|
|
352
|
+
cultures?: { [key: string]: PublishedCultureInfo; } | undefined;
|
|
353
|
+
itemType?: PublishedItemType;
|
|
354
|
+
parent?: IPublishedContent | undefined;
|
|
355
|
+
children?: IPublishedContent[] | undefined;
|
|
356
|
+
childrenForAllCultures?: IPublishedContent[] | undefined;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export interface PublishedCultureInfo {
|
|
360
|
+
culture?: string | undefined;
|
|
361
|
+
name?: string | undefined;
|
|
362
|
+
urlSegment?: string | undefined;
|
|
363
|
+
date?: Date;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export enum PublishedItemType {
|
|
367
|
+
Unknown = 0,
|
|
368
|
+
Element = 1,
|
|
369
|
+
Content = 2,
|
|
370
|
+
Media = 3,
|
|
371
|
+
Member = 4,
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export interface ProblemDetails {
|
|
375
|
+
type?: string | undefined;
|
|
376
|
+
title?: string | undefined;
|
|
377
|
+
status?: number | undefined;
|
|
378
|
+
detail?: string | undefined;
|
|
379
|
+
instance?: string | undefined;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export interface NamedLookupRes {
|
|
383
|
+
id?: string | undefined;
|
|
384
|
+
name?: string | undefined;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export interface CountryRes {
|
|
388
|
+
name?: string | undefined;
|
|
389
|
+
id?: string | undefined;
|
|
390
|
+
iso2Code?: string | undefined;
|
|
391
|
+
iso3Code?: string | undefined;
|
|
392
|
+
localityOptional?: boolean;
|
|
393
|
+
postalCodeOptional?: boolean;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export interface AccountsLookupsRes {
|
|
397
|
+
consentCategories?: NamedLookupRes[] | undefined;
|
|
398
|
+
consentChannels?: NamedLookupRes[] | undefined;
|
|
399
|
+
consentResponses?: NamedLookupRes[] | undefined;
|
|
400
|
+
countries?: CountryRes[] | undefined;
|
|
401
|
+
taxStatuses?: NamedLookupRes[] | undefined;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export interface LookupsCriteria {
|
|
405
|
+
types?: string[] | undefined;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export class ApiException extends Error {
|
|
409
|
+
message: string;
|
|
410
|
+
status: number;
|
|
411
|
+
response: string;
|
|
412
|
+
headers: { [key: string]: any; };
|
|
413
|
+
result: any;
|
|
414
|
+
|
|
415
|
+
constructor(message: string, status: number, response: string, headers: { [key: string]: any; }, result: any) {
|
|
416
|
+
super();
|
|
417
|
+
|
|
418
|
+
this.message = message;
|
|
419
|
+
this.status = status;
|
|
420
|
+
this.response = response;
|
|
421
|
+
this.headers = headers;
|
|
422
|
+
this.result = result;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
protected isApiException = true;
|
|
426
|
+
|
|
427
|
+
static isApiException(obj: any): obj is ApiException {
|
|
428
|
+
return obj.isApiException === true;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function throwException(message: string, status: number, response: string, headers: { [key: string]: any; }, result?: any): any {
|
|
433
|
+
if (result !== null && result !== undefined)
|
|
434
|
+
throw result;
|
|
435
|
+
else
|
|
436
|
+
throw new ApiException(message, status, response, headers, null);
|
|
437
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "es6",
|
|
4
|
+
"moduleResolution": "node",
|
|
5
|
+
"strict": true,
|
|
6
|
+
"target": "es5",
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"declarationMap": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"lib": ["es6", "dom"],
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"outDir": "./esm",
|
|
15
|
+
"importHelpers": false,
|
|
16
|
+
"noEmitHelpers": false,
|
|
17
|
+
"rootDir": "src"
|
|
18
|
+
},
|
|
19
|
+
"include": ["./src/**/*.ts"],
|
|
20
|
+
"exclude": ["node_modules"]
|
|
21
|
+
}
|