@aws/nx-plugin 0.39.2 → 0.39.4
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/package.json +2 -2
- package/src/open-api/ts-client/__snapshots__/generator.complex-types.spec.ts.snap +10 -10
- package/src/open-api/ts-client/__snapshots__/generator.composite-types.spec.ts.snap +0 -6
- package/src/open-api/ts-client/__snapshots__/generator.duplicate-types.spec.ts.snap +529 -0
- package/src/open-api/ts-client/__snapshots__/generator.fast-api.spec.ts.snap +618 -0
- package/src/open-api/ts-client/__snapshots__/generator.reserved-keywords.spec.ts.snap +2157 -0
- package/src/open-api/ts-client/__snapshots__/generator.streaming.spec.ts.snap +1 -1
- package/src/open-api/ts-client/files/client.gen.ts.template +10 -10
- package/src/open-api/ts-client/files/types.gen.ts.template +3 -3
- package/src/open-api/ts-hooks/files/options-proxy.gen.ts.template +1 -1
- package/src/open-api/utils/codegen-data/languages.d.ts +1 -0
- package/src/open-api/utils/codegen-data/languages.js +38 -4
- package/src/open-api/utils/codegen-data/languages.js.map +1 -1
- package/src/open-api/utils/codegen-data.js +5 -0
- package/src/open-api/utils/codegen-data.js.map +1 -1
- package/src/open-api/utils/normalise.js +24 -6
- package/src/open-api/utils/normalise.js.map +1 -1
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/fast-api/generator.js +1 -2
- package/src/py/fast-api/generator.js.map +1 -1
- package/src/py/project/generator.js +2 -0
- package/src/py/project/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/generator.js +3 -0
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/utils/api-constructs/api-constructs.d.ts +1 -1
- package/src/utils/api-constructs/files/app/apis/http/__apiNameKebabCase__.ts.template +1 -1
- package/src/utils/api-constructs/files/app/apis/rest/__apiNameKebabCase__.ts.template +1 -1
- package/src/utils/versions.d.ts +2 -2
- package/src/utils/versions.js +1 -1
|
@@ -0,0 +1,2157 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`openApiTsClientGenerator - reserved keywords > should handle reserved TypeScript object built-ins 1`] = `
|
|
4
|
+
"export type _Array = {
|
|
5
|
+
items: Array<string>;
|
|
6
|
+
};
|
|
7
|
+
export type _Blob = {
|
|
8
|
+
data: string;
|
|
9
|
+
};
|
|
10
|
+
export type _Boolean = {
|
|
11
|
+
flag: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type _Date = {
|
|
14
|
+
timestamp: string;
|
|
15
|
+
};
|
|
16
|
+
export type _Error = {
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
export type _Function = {
|
|
20
|
+
name: string;
|
|
21
|
+
};
|
|
22
|
+
export type _JSON = {
|
|
23
|
+
data: string;
|
|
24
|
+
};
|
|
25
|
+
export type _Map = {
|
|
26
|
+
entries: { [key: string]: unknown };
|
|
27
|
+
};
|
|
28
|
+
export type _Number = {
|
|
29
|
+
value: number;
|
|
30
|
+
};
|
|
31
|
+
export type _Object = {
|
|
32
|
+
value: string;
|
|
33
|
+
};
|
|
34
|
+
export type _Promise = {
|
|
35
|
+
result: string;
|
|
36
|
+
};
|
|
37
|
+
export type _RegExp = {
|
|
38
|
+
pattern: string;
|
|
39
|
+
};
|
|
40
|
+
export type _Set = {
|
|
41
|
+
values: Array<string>;
|
|
42
|
+
};
|
|
43
|
+
export type _String = {
|
|
44
|
+
content: string;
|
|
45
|
+
};
|
|
46
|
+
export type _Symbol = {
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
export type TestReservedModelsRequestContent = {
|
|
50
|
+
dateModel?: _Date;
|
|
51
|
+
blobModel?: _Blob;
|
|
52
|
+
objectModel?: _Object;
|
|
53
|
+
stringModel?: _String;
|
|
54
|
+
booleanModel?: _Boolean;
|
|
55
|
+
numberModel?: _Number;
|
|
56
|
+
arrayModel?: _Array;
|
|
57
|
+
functionModel?: _Function;
|
|
58
|
+
promiseModel?: _Promise;
|
|
59
|
+
errorModel?: _Error;
|
|
60
|
+
mapModel?: _Map;
|
|
61
|
+
setModel?: _Set;
|
|
62
|
+
symbolModel?: _Symbol;
|
|
63
|
+
regexpModel?: _RegExp;
|
|
64
|
+
jsonModel?: _JSON;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type TestReservedModelsRequest = TestReservedModelsRequestContent;
|
|
68
|
+
export type TestReservedModelsError = never;
|
|
69
|
+
"
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
exports[`openApiTsClientGenerator - reserved keywords > should handle reserved TypeScript object built-ins 2`] = `
|
|
73
|
+
"import type {
|
|
74
|
+
_Array,
|
|
75
|
+
_Blob,
|
|
76
|
+
_Boolean,
|
|
77
|
+
_Date,
|
|
78
|
+
_Error,
|
|
79
|
+
_Function,
|
|
80
|
+
_JSON,
|
|
81
|
+
_Map,
|
|
82
|
+
_Number,
|
|
83
|
+
_Object,
|
|
84
|
+
_Promise,
|
|
85
|
+
_RegExp,
|
|
86
|
+
_Set,
|
|
87
|
+
_String,
|
|
88
|
+
_Symbol,
|
|
89
|
+
TestReservedModelsRequestContent,
|
|
90
|
+
TestReservedModelsRequest,
|
|
91
|
+
} from './types.gen.js';
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Utility for serialisation and deserialisation of API types.
|
|
95
|
+
*/
|
|
96
|
+
export class $IO {
|
|
97
|
+
protected static $mapValues = (data: any, fn: (item: any) => any) =>
|
|
98
|
+
Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
|
|
99
|
+
|
|
100
|
+
public static _Array = {
|
|
101
|
+
toJson: (model: _Array): any => {
|
|
102
|
+
if (model === undefined || model === null) {
|
|
103
|
+
return model;
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
...(model.items === undefined
|
|
107
|
+
? {}
|
|
108
|
+
: {
|
|
109
|
+
items: model.items,
|
|
110
|
+
}),
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
fromJson: (json: any): _Array => {
|
|
114
|
+
if (json === undefined || json === null) {
|
|
115
|
+
return json;
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
items: json['items'],
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
public static _Blob = {
|
|
124
|
+
toJson: (model: _Blob): any => {
|
|
125
|
+
if (model === undefined || model === null) {
|
|
126
|
+
return model;
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
...(model.data === undefined
|
|
130
|
+
? {}
|
|
131
|
+
: {
|
|
132
|
+
data: model.data,
|
|
133
|
+
}),
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
fromJson: (json: any): _Blob => {
|
|
137
|
+
if (json === undefined || json === null) {
|
|
138
|
+
return json;
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
data: json['data'],
|
|
142
|
+
};
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
public static _Boolean = {
|
|
147
|
+
toJson: (model: _Boolean): any => {
|
|
148
|
+
if (model === undefined || model === null) {
|
|
149
|
+
return model;
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
...(model.flag === undefined
|
|
153
|
+
? {}
|
|
154
|
+
: {
|
|
155
|
+
flag: model.flag,
|
|
156
|
+
}),
|
|
157
|
+
};
|
|
158
|
+
},
|
|
159
|
+
fromJson: (json: any): _Boolean => {
|
|
160
|
+
if (json === undefined || json === null) {
|
|
161
|
+
return json;
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
flag: json['flag'],
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
public static _Date = {
|
|
170
|
+
toJson: (model: _Date): any => {
|
|
171
|
+
if (model === undefined || model === null) {
|
|
172
|
+
return model;
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
...(model.timestamp === undefined
|
|
176
|
+
? {}
|
|
177
|
+
: {
|
|
178
|
+
timestamp: model.timestamp,
|
|
179
|
+
}),
|
|
180
|
+
};
|
|
181
|
+
},
|
|
182
|
+
fromJson: (json: any): _Date => {
|
|
183
|
+
if (json === undefined || json === null) {
|
|
184
|
+
return json;
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
timestamp: json['timestamp'],
|
|
188
|
+
};
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
public static _Error = {
|
|
193
|
+
toJson: (model: _Error): any => {
|
|
194
|
+
if (model === undefined || model === null) {
|
|
195
|
+
return model;
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
...(model.message === undefined
|
|
199
|
+
? {}
|
|
200
|
+
: {
|
|
201
|
+
message: model.message,
|
|
202
|
+
}),
|
|
203
|
+
};
|
|
204
|
+
},
|
|
205
|
+
fromJson: (json: any): _Error => {
|
|
206
|
+
if (json === undefined || json === null) {
|
|
207
|
+
return json;
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
message: json['message'],
|
|
211
|
+
};
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
public static _Function = {
|
|
216
|
+
toJson: (model: _Function): any => {
|
|
217
|
+
if (model === undefined || model === null) {
|
|
218
|
+
return model;
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
...(model.name === undefined
|
|
222
|
+
? {}
|
|
223
|
+
: {
|
|
224
|
+
name: model.name,
|
|
225
|
+
}),
|
|
226
|
+
};
|
|
227
|
+
},
|
|
228
|
+
fromJson: (json: any): _Function => {
|
|
229
|
+
if (json === undefined || json === null) {
|
|
230
|
+
return json;
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
name: json['name'],
|
|
234
|
+
};
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
public static _JSON = {
|
|
239
|
+
toJson: (model: _JSON): any => {
|
|
240
|
+
if (model === undefined || model === null) {
|
|
241
|
+
return model;
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
...(model.data === undefined
|
|
245
|
+
? {}
|
|
246
|
+
: {
|
|
247
|
+
data: model.data,
|
|
248
|
+
}),
|
|
249
|
+
};
|
|
250
|
+
},
|
|
251
|
+
fromJson: (json: any): _JSON => {
|
|
252
|
+
if (json === undefined || json === null) {
|
|
253
|
+
return json;
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
data: json['data'],
|
|
257
|
+
};
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
public static _Map = {
|
|
262
|
+
toJson: (model: _Map): any => {
|
|
263
|
+
if (model === undefined || model === null) {
|
|
264
|
+
return model;
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
...(model.entries === undefined
|
|
268
|
+
? {}
|
|
269
|
+
: {
|
|
270
|
+
entries: $IO.$mapValues(model.entries, (item0) => item0),
|
|
271
|
+
}),
|
|
272
|
+
};
|
|
273
|
+
},
|
|
274
|
+
fromJson: (json: any): _Map => {
|
|
275
|
+
if (json === undefined || json === null) {
|
|
276
|
+
return json;
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
entries: $IO.$mapValues(json['entries'], (item0) => item0),
|
|
280
|
+
};
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
public static _Number = {
|
|
285
|
+
toJson: (model: _Number): any => {
|
|
286
|
+
if (model === undefined || model === null) {
|
|
287
|
+
return model;
|
|
288
|
+
}
|
|
289
|
+
return {
|
|
290
|
+
...(model.value === undefined
|
|
291
|
+
? {}
|
|
292
|
+
: {
|
|
293
|
+
value: model.value,
|
|
294
|
+
}),
|
|
295
|
+
};
|
|
296
|
+
},
|
|
297
|
+
fromJson: (json: any): _Number => {
|
|
298
|
+
if (json === undefined || json === null) {
|
|
299
|
+
return json;
|
|
300
|
+
}
|
|
301
|
+
return {
|
|
302
|
+
value: json['value'],
|
|
303
|
+
};
|
|
304
|
+
},
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
public static _Object = {
|
|
308
|
+
toJson: (model: _Object): any => {
|
|
309
|
+
if (model === undefined || model === null) {
|
|
310
|
+
return model;
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
...(model.value === undefined
|
|
314
|
+
? {}
|
|
315
|
+
: {
|
|
316
|
+
value: model.value,
|
|
317
|
+
}),
|
|
318
|
+
};
|
|
319
|
+
},
|
|
320
|
+
fromJson: (json: any): _Object => {
|
|
321
|
+
if (json === undefined || json === null) {
|
|
322
|
+
return json;
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
value: json['value'],
|
|
326
|
+
};
|
|
327
|
+
},
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
public static _Promise = {
|
|
331
|
+
toJson: (model: _Promise): any => {
|
|
332
|
+
if (model === undefined || model === null) {
|
|
333
|
+
return model;
|
|
334
|
+
}
|
|
335
|
+
return {
|
|
336
|
+
...(model.result === undefined
|
|
337
|
+
? {}
|
|
338
|
+
: {
|
|
339
|
+
result: model.result,
|
|
340
|
+
}),
|
|
341
|
+
};
|
|
342
|
+
},
|
|
343
|
+
fromJson: (json: any): _Promise => {
|
|
344
|
+
if (json === undefined || json === null) {
|
|
345
|
+
return json;
|
|
346
|
+
}
|
|
347
|
+
return {
|
|
348
|
+
result: json['result'],
|
|
349
|
+
};
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
public static _RegExp = {
|
|
354
|
+
toJson: (model: _RegExp): any => {
|
|
355
|
+
if (model === undefined || model === null) {
|
|
356
|
+
return model;
|
|
357
|
+
}
|
|
358
|
+
return {
|
|
359
|
+
...(model.pattern === undefined
|
|
360
|
+
? {}
|
|
361
|
+
: {
|
|
362
|
+
pattern: model.pattern,
|
|
363
|
+
}),
|
|
364
|
+
};
|
|
365
|
+
},
|
|
366
|
+
fromJson: (json: any): _RegExp => {
|
|
367
|
+
if (json === undefined || json === null) {
|
|
368
|
+
return json;
|
|
369
|
+
}
|
|
370
|
+
return {
|
|
371
|
+
pattern: json['pattern'],
|
|
372
|
+
};
|
|
373
|
+
},
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
public static _Set = {
|
|
377
|
+
toJson: (model: _Set): any => {
|
|
378
|
+
if (model === undefined || model === null) {
|
|
379
|
+
return model;
|
|
380
|
+
}
|
|
381
|
+
return {
|
|
382
|
+
...(model.values === undefined
|
|
383
|
+
? {}
|
|
384
|
+
: {
|
|
385
|
+
values: model.values,
|
|
386
|
+
}),
|
|
387
|
+
};
|
|
388
|
+
},
|
|
389
|
+
fromJson: (json: any): _Set => {
|
|
390
|
+
if (json === undefined || json === null) {
|
|
391
|
+
return json;
|
|
392
|
+
}
|
|
393
|
+
return {
|
|
394
|
+
values: json['values'],
|
|
395
|
+
};
|
|
396
|
+
},
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
public static _String = {
|
|
400
|
+
toJson: (model: _String): any => {
|
|
401
|
+
if (model === undefined || model === null) {
|
|
402
|
+
return model;
|
|
403
|
+
}
|
|
404
|
+
return {
|
|
405
|
+
...(model.content === undefined
|
|
406
|
+
? {}
|
|
407
|
+
: {
|
|
408
|
+
content: model.content,
|
|
409
|
+
}),
|
|
410
|
+
};
|
|
411
|
+
},
|
|
412
|
+
fromJson: (json: any): _String => {
|
|
413
|
+
if (json === undefined || json === null) {
|
|
414
|
+
return json;
|
|
415
|
+
}
|
|
416
|
+
return {
|
|
417
|
+
content: json['content'],
|
|
418
|
+
};
|
|
419
|
+
},
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
public static _Symbol = {
|
|
423
|
+
toJson: (model: _Symbol): any => {
|
|
424
|
+
if (model === undefined || model === null) {
|
|
425
|
+
return model;
|
|
426
|
+
}
|
|
427
|
+
return {
|
|
428
|
+
...(model.description === undefined
|
|
429
|
+
? {}
|
|
430
|
+
: {
|
|
431
|
+
description: model.description,
|
|
432
|
+
}),
|
|
433
|
+
};
|
|
434
|
+
},
|
|
435
|
+
fromJson: (json: any): _Symbol => {
|
|
436
|
+
if (json === undefined || json === null) {
|
|
437
|
+
return json;
|
|
438
|
+
}
|
|
439
|
+
return {
|
|
440
|
+
description: json['description'],
|
|
441
|
+
};
|
|
442
|
+
},
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
public static TestReservedModelsRequestContent = {
|
|
446
|
+
toJson: (model: TestReservedModelsRequestContent): any => {
|
|
447
|
+
if (model === undefined || model === null) {
|
|
448
|
+
return model;
|
|
449
|
+
}
|
|
450
|
+
return {
|
|
451
|
+
...(model.dateModel === undefined
|
|
452
|
+
? {}
|
|
453
|
+
: {
|
|
454
|
+
dateModel: $IO._Date.toJson(model.dateModel),
|
|
455
|
+
}),
|
|
456
|
+
...(model.blobModel === undefined
|
|
457
|
+
? {}
|
|
458
|
+
: {
|
|
459
|
+
blobModel: $IO._Blob.toJson(model.blobModel),
|
|
460
|
+
}),
|
|
461
|
+
...(model.objectModel === undefined
|
|
462
|
+
? {}
|
|
463
|
+
: {
|
|
464
|
+
objectModel: $IO._Object.toJson(model.objectModel),
|
|
465
|
+
}),
|
|
466
|
+
...(model.stringModel === undefined
|
|
467
|
+
? {}
|
|
468
|
+
: {
|
|
469
|
+
stringModel: $IO._String.toJson(model.stringModel),
|
|
470
|
+
}),
|
|
471
|
+
...(model.booleanModel === undefined
|
|
472
|
+
? {}
|
|
473
|
+
: {
|
|
474
|
+
booleanModel: $IO._Boolean.toJson(model.booleanModel),
|
|
475
|
+
}),
|
|
476
|
+
...(model.numberModel === undefined
|
|
477
|
+
? {}
|
|
478
|
+
: {
|
|
479
|
+
numberModel: $IO._Number.toJson(model.numberModel),
|
|
480
|
+
}),
|
|
481
|
+
...(model.arrayModel === undefined
|
|
482
|
+
? {}
|
|
483
|
+
: {
|
|
484
|
+
arrayModel: $IO._Array.toJson(model.arrayModel),
|
|
485
|
+
}),
|
|
486
|
+
...(model.functionModel === undefined
|
|
487
|
+
? {}
|
|
488
|
+
: {
|
|
489
|
+
functionModel: $IO._Function.toJson(model.functionModel),
|
|
490
|
+
}),
|
|
491
|
+
...(model.promiseModel === undefined
|
|
492
|
+
? {}
|
|
493
|
+
: {
|
|
494
|
+
promiseModel: $IO._Promise.toJson(model.promiseModel),
|
|
495
|
+
}),
|
|
496
|
+
...(model.errorModel === undefined
|
|
497
|
+
? {}
|
|
498
|
+
: {
|
|
499
|
+
errorModel: $IO._Error.toJson(model.errorModel),
|
|
500
|
+
}),
|
|
501
|
+
...(model.mapModel === undefined
|
|
502
|
+
? {}
|
|
503
|
+
: {
|
|
504
|
+
mapModel: $IO._Map.toJson(model.mapModel),
|
|
505
|
+
}),
|
|
506
|
+
...(model.setModel === undefined
|
|
507
|
+
? {}
|
|
508
|
+
: {
|
|
509
|
+
setModel: $IO._Set.toJson(model.setModel),
|
|
510
|
+
}),
|
|
511
|
+
...(model.symbolModel === undefined
|
|
512
|
+
? {}
|
|
513
|
+
: {
|
|
514
|
+
symbolModel: $IO._Symbol.toJson(model.symbolModel),
|
|
515
|
+
}),
|
|
516
|
+
...(model.regexpModel === undefined
|
|
517
|
+
? {}
|
|
518
|
+
: {
|
|
519
|
+
regexpModel: $IO._RegExp.toJson(model.regexpModel),
|
|
520
|
+
}),
|
|
521
|
+
...(model.jsonModel === undefined
|
|
522
|
+
? {}
|
|
523
|
+
: {
|
|
524
|
+
jsonModel: $IO._JSON.toJson(model.jsonModel),
|
|
525
|
+
}),
|
|
526
|
+
};
|
|
527
|
+
},
|
|
528
|
+
fromJson: (json: any): TestReservedModelsRequestContent => {
|
|
529
|
+
if (json === undefined || json === null) {
|
|
530
|
+
return json;
|
|
531
|
+
}
|
|
532
|
+
return {
|
|
533
|
+
...(json['dateModel'] === undefined
|
|
534
|
+
? {}
|
|
535
|
+
: {
|
|
536
|
+
dateModel: $IO._Date.fromJson(json['dateModel']),
|
|
537
|
+
}),
|
|
538
|
+
...(json['blobModel'] === undefined
|
|
539
|
+
? {}
|
|
540
|
+
: {
|
|
541
|
+
blobModel: $IO._Blob.fromJson(json['blobModel']),
|
|
542
|
+
}),
|
|
543
|
+
...(json['objectModel'] === undefined
|
|
544
|
+
? {}
|
|
545
|
+
: {
|
|
546
|
+
objectModel: $IO._Object.fromJson(json['objectModel']),
|
|
547
|
+
}),
|
|
548
|
+
...(json['stringModel'] === undefined
|
|
549
|
+
? {}
|
|
550
|
+
: {
|
|
551
|
+
stringModel: $IO._String.fromJson(json['stringModel']),
|
|
552
|
+
}),
|
|
553
|
+
...(json['booleanModel'] === undefined
|
|
554
|
+
? {}
|
|
555
|
+
: {
|
|
556
|
+
booleanModel: $IO._Boolean.fromJson(json['booleanModel']),
|
|
557
|
+
}),
|
|
558
|
+
...(json['numberModel'] === undefined
|
|
559
|
+
? {}
|
|
560
|
+
: {
|
|
561
|
+
numberModel: $IO._Number.fromJson(json['numberModel']),
|
|
562
|
+
}),
|
|
563
|
+
...(json['arrayModel'] === undefined
|
|
564
|
+
? {}
|
|
565
|
+
: {
|
|
566
|
+
arrayModel: $IO._Array.fromJson(json['arrayModel']),
|
|
567
|
+
}),
|
|
568
|
+
...(json['functionModel'] === undefined
|
|
569
|
+
? {}
|
|
570
|
+
: {
|
|
571
|
+
functionModel: $IO._Function.fromJson(json['functionModel']),
|
|
572
|
+
}),
|
|
573
|
+
...(json['promiseModel'] === undefined
|
|
574
|
+
? {}
|
|
575
|
+
: {
|
|
576
|
+
promiseModel: $IO._Promise.fromJson(json['promiseModel']),
|
|
577
|
+
}),
|
|
578
|
+
...(json['errorModel'] === undefined
|
|
579
|
+
? {}
|
|
580
|
+
: {
|
|
581
|
+
errorModel: $IO._Error.fromJson(json['errorModel']),
|
|
582
|
+
}),
|
|
583
|
+
...(json['mapModel'] === undefined
|
|
584
|
+
? {}
|
|
585
|
+
: {
|
|
586
|
+
mapModel: $IO._Map.fromJson(json['mapModel']),
|
|
587
|
+
}),
|
|
588
|
+
...(json['setModel'] === undefined
|
|
589
|
+
? {}
|
|
590
|
+
: {
|
|
591
|
+
setModel: $IO._Set.fromJson(json['setModel']),
|
|
592
|
+
}),
|
|
593
|
+
...(json['symbolModel'] === undefined
|
|
594
|
+
? {}
|
|
595
|
+
: {
|
|
596
|
+
symbolModel: $IO._Symbol.fromJson(json['symbolModel']),
|
|
597
|
+
}),
|
|
598
|
+
...(json['regexpModel'] === undefined
|
|
599
|
+
? {}
|
|
600
|
+
: {
|
|
601
|
+
regexpModel: $IO._RegExp.fromJson(json['regexpModel']),
|
|
602
|
+
}),
|
|
603
|
+
...(json['jsonModel'] === undefined
|
|
604
|
+
? {}
|
|
605
|
+
: {
|
|
606
|
+
jsonModel: $IO._JSON.fromJson(json['jsonModel']),
|
|
607
|
+
}),
|
|
608
|
+
};
|
|
609
|
+
},
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Client configuration for TestApi
|
|
615
|
+
*/
|
|
616
|
+
export interface TestApiConfig {
|
|
617
|
+
/**
|
|
618
|
+
* Base URL for the API
|
|
619
|
+
*/
|
|
620
|
+
url: string;
|
|
621
|
+
/**
|
|
622
|
+
* Custom instance of fetch. By default the global 'fetch' is used.
|
|
623
|
+
* You can override this to add custom middleware for use cases such as adding authentication headers.
|
|
624
|
+
*/
|
|
625
|
+
fetch?: typeof fetch;
|
|
626
|
+
/**
|
|
627
|
+
* Additional configuration
|
|
628
|
+
*/
|
|
629
|
+
options?: {
|
|
630
|
+
/**
|
|
631
|
+
* By default, the client will add a Content-Type header, set to the media type defined for
|
|
632
|
+
* the request in the OpenAPI specification.
|
|
633
|
+
* Set this to false to omit this header.
|
|
634
|
+
*/
|
|
635
|
+
omitContentTypeHeader?: boolean;
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* API Client for TestApi
|
|
641
|
+
*/
|
|
642
|
+
export class TestApi {
|
|
643
|
+
private $config: TestApiConfig;
|
|
644
|
+
|
|
645
|
+
constructor(config: TestApiConfig) {
|
|
646
|
+
this.$config = config;
|
|
647
|
+
|
|
648
|
+
this.testReservedModels = this.testReservedModels.bind(this);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
private $url = (
|
|
652
|
+
path: string,
|
|
653
|
+
pathParameters: { [key: string]: any },
|
|
654
|
+
queryParameters: { [key: string]: any },
|
|
655
|
+
collectionFormats?: { [key: string]: 'multi' | 'csv' },
|
|
656
|
+
): string => {
|
|
657
|
+
const baseUrl = this.$config.url.endsWith('/')
|
|
658
|
+
? this.$config.url.slice(0, -1)
|
|
659
|
+
: this.$config.url;
|
|
660
|
+
const pathWithParameters = Object.entries(pathParameters).reduce(
|
|
661
|
+
(withParams, [key, value]) =>
|
|
662
|
+
withParams.replace(\`{\${key}}\`, encodeURIComponent(\`\${value}\`)),
|
|
663
|
+
path,
|
|
664
|
+
);
|
|
665
|
+
const queryString = Object.entries(queryParameters)
|
|
666
|
+
.map(([key, value]) => {
|
|
667
|
+
if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
|
|
668
|
+
return value
|
|
669
|
+
.map(
|
|
670
|
+
(v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
|
|
671
|
+
)
|
|
672
|
+
.join('&');
|
|
673
|
+
}
|
|
674
|
+
return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
|
|
675
|
+
})
|
|
676
|
+
.join('&');
|
|
677
|
+
return (
|
|
678
|
+
baseUrl + pathWithParameters + (queryString ? \`?\${queryString}\` : '')
|
|
679
|
+
);
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
private $headers = (
|
|
683
|
+
headerParameters: { [key: string]: any },
|
|
684
|
+
collectionFormats?: { [key: string]: 'multi' | 'csv' },
|
|
685
|
+
): [string, string][] => {
|
|
686
|
+
return Object.entries(headerParameters).flatMap(([key, value]) => {
|
|
687
|
+
if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
|
|
688
|
+
return value.map((v) => [key, String(v)]) as [string, string][];
|
|
689
|
+
}
|
|
690
|
+
return [[key, String(value)]];
|
|
691
|
+
});
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
private $fetch: typeof fetch = (...args) =>
|
|
695
|
+
(this.$config.fetch ?? fetch)(...args);
|
|
696
|
+
|
|
697
|
+
public async testReservedModels(
|
|
698
|
+
input: TestReservedModelsRequest,
|
|
699
|
+
): Promise<string> {
|
|
700
|
+
const pathParameters: { [key: string]: any } = {};
|
|
701
|
+
const queryParameters: { [key: string]: any } = {};
|
|
702
|
+
const headerParameters: { [key: string]: any } = {};
|
|
703
|
+
if (!this.$config.options?.omitContentTypeHeader) {
|
|
704
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
705
|
+
}
|
|
706
|
+
const body =
|
|
707
|
+
typeof input === 'object'
|
|
708
|
+
? JSON.stringify($IO.TestReservedModelsRequestContent.toJson(input))
|
|
709
|
+
: String($IO.TestReservedModelsRequestContent.toJson(input));
|
|
710
|
+
|
|
711
|
+
const response = await this.$fetch(
|
|
712
|
+
this.$url('/reserved-models', pathParameters, queryParameters),
|
|
713
|
+
{
|
|
714
|
+
headers: this.$headers(headerParameters),
|
|
715
|
+
method: 'POST',
|
|
716
|
+
body,
|
|
717
|
+
},
|
|
718
|
+
);
|
|
719
|
+
|
|
720
|
+
if (response.status === 200) {
|
|
721
|
+
return await response.text();
|
|
722
|
+
}
|
|
723
|
+
throw new Error(
|
|
724
|
+
\`Unknown response status \${response.status} returned by API\`,
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
"
|
|
729
|
+
`;
|
|
730
|
+
|
|
731
|
+
exports[`openApiTsClientGenerator - reserved keywords > should handle reserved language keywords 1`] = `
|
|
732
|
+
"export type ReservedProperties = {
|
|
733
|
+
for?: string;
|
|
734
|
+
while: string;
|
|
735
|
+
if: string;
|
|
736
|
+
else: number;
|
|
737
|
+
function: boolean;
|
|
738
|
+
var?: string;
|
|
739
|
+
let?: string;
|
|
740
|
+
const?: string;
|
|
741
|
+
return?: string;
|
|
742
|
+
break?: string;
|
|
743
|
+
continue?: string;
|
|
744
|
+
switch?: string;
|
|
745
|
+
case?: string;
|
|
746
|
+
default?: string;
|
|
747
|
+
try?: string;
|
|
748
|
+
catch?: string;
|
|
749
|
+
finally?: string;
|
|
750
|
+
throw?: string;
|
|
751
|
+
new?: string;
|
|
752
|
+
this?: string;
|
|
753
|
+
super?: string;
|
|
754
|
+
class?: string;
|
|
755
|
+
extends?: string;
|
|
756
|
+
implements?: string;
|
|
757
|
+
interface?: string;
|
|
758
|
+
enum?: string;
|
|
759
|
+
type?: string;
|
|
760
|
+
namespace?: string;
|
|
761
|
+
module?: string;
|
|
762
|
+
import?: string;
|
|
763
|
+
export?: string;
|
|
764
|
+
from?: string;
|
|
765
|
+
as?: string;
|
|
766
|
+
async?: string;
|
|
767
|
+
await?: string;
|
|
768
|
+
yield?: string;
|
|
769
|
+
typeof?: string;
|
|
770
|
+
instanceof?: string;
|
|
771
|
+
in?: string;
|
|
772
|
+
of?: string;
|
|
773
|
+
with?: string;
|
|
774
|
+
do?: string;
|
|
775
|
+
null?: string;
|
|
776
|
+
undefined?: string;
|
|
777
|
+
true?: string;
|
|
778
|
+
false?: string;
|
|
779
|
+
};
|
|
780
|
+
export type Async = {};
|
|
781
|
+
export type Await = {};
|
|
782
|
+
export type Break = {};
|
|
783
|
+
export type Case = {};
|
|
784
|
+
export type Catch = {};
|
|
785
|
+
export type Class = {};
|
|
786
|
+
export type Const = {};
|
|
787
|
+
export type Continue = {};
|
|
788
|
+
export type Default = {};
|
|
789
|
+
export type Do = {};
|
|
790
|
+
export type Else = {};
|
|
791
|
+
export type Enum = {};
|
|
792
|
+
export type Export = {};
|
|
793
|
+
export type Extends = {};
|
|
794
|
+
export type False = {};
|
|
795
|
+
export type Finally = {};
|
|
796
|
+
export type For = {};
|
|
797
|
+
export type From = {};
|
|
798
|
+
export type _Function = {};
|
|
799
|
+
export type If = {};
|
|
800
|
+
export type Implements = {};
|
|
801
|
+
export type Import = {};
|
|
802
|
+
export type In = {};
|
|
803
|
+
export type Instanceof = {};
|
|
804
|
+
export type Interface = {};
|
|
805
|
+
export type Let = {};
|
|
806
|
+
export type New = {};
|
|
807
|
+
export type Null = {};
|
|
808
|
+
export type Return = {};
|
|
809
|
+
export type Super = {};
|
|
810
|
+
export type Switch = {};
|
|
811
|
+
export type This = {};
|
|
812
|
+
export type Throw = {};
|
|
813
|
+
export type True = {};
|
|
814
|
+
export type Try = {};
|
|
815
|
+
export type Typeof = {};
|
|
816
|
+
export type Var = {};
|
|
817
|
+
export type While = {};
|
|
818
|
+
export type With = {};
|
|
819
|
+
export type Yield = {};
|
|
820
|
+
export type As = {};
|
|
821
|
+
export type Module = {};
|
|
822
|
+
export type Namespace = {};
|
|
823
|
+
export type Of = {};
|
|
824
|
+
export type Type = {};
|
|
825
|
+
export type Undefined = {};
|
|
826
|
+
|
|
827
|
+
export type OpRequest = ReservedProperties;
|
|
828
|
+
export type OpError = never;
|
|
829
|
+
"
|
|
830
|
+
`;
|
|
831
|
+
|
|
832
|
+
exports[`openApiTsClientGenerator - reserved keywords > should handle reserved language keywords 2`] = `
|
|
833
|
+
"import type {
|
|
834
|
+
ReservedProperties,
|
|
835
|
+
Async,
|
|
836
|
+
Await,
|
|
837
|
+
Break,
|
|
838
|
+
Case,
|
|
839
|
+
Catch,
|
|
840
|
+
Class,
|
|
841
|
+
Const,
|
|
842
|
+
Continue,
|
|
843
|
+
Default,
|
|
844
|
+
Do,
|
|
845
|
+
Else,
|
|
846
|
+
Enum,
|
|
847
|
+
Export,
|
|
848
|
+
Extends,
|
|
849
|
+
False,
|
|
850
|
+
Finally,
|
|
851
|
+
For,
|
|
852
|
+
From,
|
|
853
|
+
_Function,
|
|
854
|
+
If,
|
|
855
|
+
Implements,
|
|
856
|
+
Import,
|
|
857
|
+
In,
|
|
858
|
+
Instanceof,
|
|
859
|
+
Interface,
|
|
860
|
+
Let,
|
|
861
|
+
New,
|
|
862
|
+
Null,
|
|
863
|
+
Return,
|
|
864
|
+
Super,
|
|
865
|
+
Switch,
|
|
866
|
+
This,
|
|
867
|
+
Throw,
|
|
868
|
+
True,
|
|
869
|
+
Try,
|
|
870
|
+
Typeof,
|
|
871
|
+
Var,
|
|
872
|
+
While,
|
|
873
|
+
With,
|
|
874
|
+
Yield,
|
|
875
|
+
As,
|
|
876
|
+
Module,
|
|
877
|
+
Namespace,
|
|
878
|
+
Of,
|
|
879
|
+
Type,
|
|
880
|
+
Undefined,
|
|
881
|
+
OpRequest,
|
|
882
|
+
} from './types.gen.js';
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Utility for serialisation and deserialisation of API types.
|
|
886
|
+
*/
|
|
887
|
+
export class $IO {
|
|
888
|
+
protected static $mapValues = (data: any, fn: (item: any) => any) =>
|
|
889
|
+
Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
|
|
890
|
+
|
|
891
|
+
public static ReservedProperties = {
|
|
892
|
+
toJson: (model: ReservedProperties): any => {
|
|
893
|
+
if (model === undefined || model === null) {
|
|
894
|
+
return model;
|
|
895
|
+
}
|
|
896
|
+
return {
|
|
897
|
+
...(model.for === undefined
|
|
898
|
+
? {}
|
|
899
|
+
: {
|
|
900
|
+
for: model.for,
|
|
901
|
+
}),
|
|
902
|
+
...(model.while === undefined
|
|
903
|
+
? {}
|
|
904
|
+
: {
|
|
905
|
+
while: model.while,
|
|
906
|
+
}),
|
|
907
|
+
...(model.if === undefined
|
|
908
|
+
? {}
|
|
909
|
+
: {
|
|
910
|
+
if: model.if,
|
|
911
|
+
}),
|
|
912
|
+
...(model.else === undefined
|
|
913
|
+
? {}
|
|
914
|
+
: {
|
|
915
|
+
else: model.else,
|
|
916
|
+
}),
|
|
917
|
+
...(model.function === undefined
|
|
918
|
+
? {}
|
|
919
|
+
: {
|
|
920
|
+
function: model.function,
|
|
921
|
+
}),
|
|
922
|
+
...(model.var === undefined
|
|
923
|
+
? {}
|
|
924
|
+
: {
|
|
925
|
+
var: model.var,
|
|
926
|
+
}),
|
|
927
|
+
...(model.let === undefined
|
|
928
|
+
? {}
|
|
929
|
+
: {
|
|
930
|
+
let: model.let,
|
|
931
|
+
}),
|
|
932
|
+
...(model.const === undefined
|
|
933
|
+
? {}
|
|
934
|
+
: {
|
|
935
|
+
const: model.const,
|
|
936
|
+
}),
|
|
937
|
+
...(model.return === undefined
|
|
938
|
+
? {}
|
|
939
|
+
: {
|
|
940
|
+
return: model.return,
|
|
941
|
+
}),
|
|
942
|
+
...(model.break === undefined
|
|
943
|
+
? {}
|
|
944
|
+
: {
|
|
945
|
+
break: model.break,
|
|
946
|
+
}),
|
|
947
|
+
...(model.continue === undefined
|
|
948
|
+
? {}
|
|
949
|
+
: {
|
|
950
|
+
continue: model.continue,
|
|
951
|
+
}),
|
|
952
|
+
...(model.switch === undefined
|
|
953
|
+
? {}
|
|
954
|
+
: {
|
|
955
|
+
switch: model.switch,
|
|
956
|
+
}),
|
|
957
|
+
...(model.case === undefined
|
|
958
|
+
? {}
|
|
959
|
+
: {
|
|
960
|
+
case: model.case,
|
|
961
|
+
}),
|
|
962
|
+
...(model.default === undefined
|
|
963
|
+
? {}
|
|
964
|
+
: {
|
|
965
|
+
default: model.default,
|
|
966
|
+
}),
|
|
967
|
+
...(model.try === undefined
|
|
968
|
+
? {}
|
|
969
|
+
: {
|
|
970
|
+
try: model.try,
|
|
971
|
+
}),
|
|
972
|
+
...(model.catch === undefined
|
|
973
|
+
? {}
|
|
974
|
+
: {
|
|
975
|
+
catch: model.catch,
|
|
976
|
+
}),
|
|
977
|
+
...(model.finally === undefined
|
|
978
|
+
? {}
|
|
979
|
+
: {
|
|
980
|
+
finally: model.finally,
|
|
981
|
+
}),
|
|
982
|
+
...(model.throw === undefined
|
|
983
|
+
? {}
|
|
984
|
+
: {
|
|
985
|
+
throw: model.throw,
|
|
986
|
+
}),
|
|
987
|
+
...(model.new === undefined
|
|
988
|
+
? {}
|
|
989
|
+
: {
|
|
990
|
+
new: model.new,
|
|
991
|
+
}),
|
|
992
|
+
...(model.this === undefined
|
|
993
|
+
? {}
|
|
994
|
+
: {
|
|
995
|
+
this: model.this,
|
|
996
|
+
}),
|
|
997
|
+
...(model.super === undefined
|
|
998
|
+
? {}
|
|
999
|
+
: {
|
|
1000
|
+
super: model.super,
|
|
1001
|
+
}),
|
|
1002
|
+
...(model.class === undefined
|
|
1003
|
+
? {}
|
|
1004
|
+
: {
|
|
1005
|
+
class: model.class,
|
|
1006
|
+
}),
|
|
1007
|
+
...(model.extends === undefined
|
|
1008
|
+
? {}
|
|
1009
|
+
: {
|
|
1010
|
+
extends: model.extends,
|
|
1011
|
+
}),
|
|
1012
|
+
...(model.implements === undefined
|
|
1013
|
+
? {}
|
|
1014
|
+
: {
|
|
1015
|
+
implements: model.implements,
|
|
1016
|
+
}),
|
|
1017
|
+
...(model.interface === undefined
|
|
1018
|
+
? {}
|
|
1019
|
+
: {
|
|
1020
|
+
interface: model.interface,
|
|
1021
|
+
}),
|
|
1022
|
+
...(model.enum === undefined
|
|
1023
|
+
? {}
|
|
1024
|
+
: {
|
|
1025
|
+
enum: model.enum,
|
|
1026
|
+
}),
|
|
1027
|
+
...(model.type === undefined
|
|
1028
|
+
? {}
|
|
1029
|
+
: {
|
|
1030
|
+
type: model.type,
|
|
1031
|
+
}),
|
|
1032
|
+
...(model.namespace === undefined
|
|
1033
|
+
? {}
|
|
1034
|
+
: {
|
|
1035
|
+
namespace: model.namespace,
|
|
1036
|
+
}),
|
|
1037
|
+
...(model.module === undefined
|
|
1038
|
+
? {}
|
|
1039
|
+
: {
|
|
1040
|
+
module: model.module,
|
|
1041
|
+
}),
|
|
1042
|
+
...(model.import === undefined
|
|
1043
|
+
? {}
|
|
1044
|
+
: {
|
|
1045
|
+
import: model.import,
|
|
1046
|
+
}),
|
|
1047
|
+
...(model.export === undefined
|
|
1048
|
+
? {}
|
|
1049
|
+
: {
|
|
1050
|
+
export: model.export,
|
|
1051
|
+
}),
|
|
1052
|
+
...(model.from === undefined
|
|
1053
|
+
? {}
|
|
1054
|
+
: {
|
|
1055
|
+
from: model.from,
|
|
1056
|
+
}),
|
|
1057
|
+
...(model.as === undefined
|
|
1058
|
+
? {}
|
|
1059
|
+
: {
|
|
1060
|
+
as: model.as,
|
|
1061
|
+
}),
|
|
1062
|
+
...(model.async === undefined
|
|
1063
|
+
? {}
|
|
1064
|
+
: {
|
|
1065
|
+
async: model.async,
|
|
1066
|
+
}),
|
|
1067
|
+
...(model.await === undefined
|
|
1068
|
+
? {}
|
|
1069
|
+
: {
|
|
1070
|
+
await: model.await,
|
|
1071
|
+
}),
|
|
1072
|
+
...(model.yield === undefined
|
|
1073
|
+
? {}
|
|
1074
|
+
: {
|
|
1075
|
+
yield: model.yield,
|
|
1076
|
+
}),
|
|
1077
|
+
...(model.typeof === undefined
|
|
1078
|
+
? {}
|
|
1079
|
+
: {
|
|
1080
|
+
typeof: model.typeof,
|
|
1081
|
+
}),
|
|
1082
|
+
...(model.instanceof === undefined
|
|
1083
|
+
? {}
|
|
1084
|
+
: {
|
|
1085
|
+
instanceof: model.instanceof,
|
|
1086
|
+
}),
|
|
1087
|
+
...(model.in === undefined
|
|
1088
|
+
? {}
|
|
1089
|
+
: {
|
|
1090
|
+
in: model.in,
|
|
1091
|
+
}),
|
|
1092
|
+
...(model.of === undefined
|
|
1093
|
+
? {}
|
|
1094
|
+
: {
|
|
1095
|
+
of: model.of,
|
|
1096
|
+
}),
|
|
1097
|
+
...(model.with === undefined
|
|
1098
|
+
? {}
|
|
1099
|
+
: {
|
|
1100
|
+
with: model.with,
|
|
1101
|
+
}),
|
|
1102
|
+
...(model.do === undefined
|
|
1103
|
+
? {}
|
|
1104
|
+
: {
|
|
1105
|
+
do: model.do,
|
|
1106
|
+
}),
|
|
1107
|
+
...(model.null === undefined
|
|
1108
|
+
? {}
|
|
1109
|
+
: {
|
|
1110
|
+
null: model.null,
|
|
1111
|
+
}),
|
|
1112
|
+
...(model.undefined === undefined
|
|
1113
|
+
? {}
|
|
1114
|
+
: {
|
|
1115
|
+
undefined: model.undefined,
|
|
1116
|
+
}),
|
|
1117
|
+
...(model.true === undefined
|
|
1118
|
+
? {}
|
|
1119
|
+
: {
|
|
1120
|
+
true: model.true,
|
|
1121
|
+
}),
|
|
1122
|
+
...(model.false === undefined
|
|
1123
|
+
? {}
|
|
1124
|
+
: {
|
|
1125
|
+
false: model.false,
|
|
1126
|
+
}),
|
|
1127
|
+
};
|
|
1128
|
+
},
|
|
1129
|
+
fromJson: (json: any): ReservedProperties => {
|
|
1130
|
+
if (json === undefined || json === null) {
|
|
1131
|
+
return json;
|
|
1132
|
+
}
|
|
1133
|
+
return {
|
|
1134
|
+
...(json['for'] === undefined
|
|
1135
|
+
? {}
|
|
1136
|
+
: {
|
|
1137
|
+
for: json['for'],
|
|
1138
|
+
}),
|
|
1139
|
+
while: json['while'],
|
|
1140
|
+
if: json['if'],
|
|
1141
|
+
else: json['else'],
|
|
1142
|
+
function: json['function'],
|
|
1143
|
+
...(json['var'] === undefined
|
|
1144
|
+
? {}
|
|
1145
|
+
: {
|
|
1146
|
+
var: json['var'],
|
|
1147
|
+
}),
|
|
1148
|
+
...(json['let'] === undefined
|
|
1149
|
+
? {}
|
|
1150
|
+
: {
|
|
1151
|
+
let: json['let'],
|
|
1152
|
+
}),
|
|
1153
|
+
...(json['const'] === undefined
|
|
1154
|
+
? {}
|
|
1155
|
+
: {
|
|
1156
|
+
const: json['const'],
|
|
1157
|
+
}),
|
|
1158
|
+
...(json['return'] === undefined
|
|
1159
|
+
? {}
|
|
1160
|
+
: {
|
|
1161
|
+
return: json['return'],
|
|
1162
|
+
}),
|
|
1163
|
+
...(json['break'] === undefined
|
|
1164
|
+
? {}
|
|
1165
|
+
: {
|
|
1166
|
+
break: json['break'],
|
|
1167
|
+
}),
|
|
1168
|
+
...(json['continue'] === undefined
|
|
1169
|
+
? {}
|
|
1170
|
+
: {
|
|
1171
|
+
continue: json['continue'],
|
|
1172
|
+
}),
|
|
1173
|
+
...(json['switch'] === undefined
|
|
1174
|
+
? {}
|
|
1175
|
+
: {
|
|
1176
|
+
switch: json['switch'],
|
|
1177
|
+
}),
|
|
1178
|
+
...(json['case'] === undefined
|
|
1179
|
+
? {}
|
|
1180
|
+
: {
|
|
1181
|
+
case: json['case'],
|
|
1182
|
+
}),
|
|
1183
|
+
...(json['default'] === undefined
|
|
1184
|
+
? {}
|
|
1185
|
+
: {
|
|
1186
|
+
default: json['default'],
|
|
1187
|
+
}),
|
|
1188
|
+
...(json['try'] === undefined
|
|
1189
|
+
? {}
|
|
1190
|
+
: {
|
|
1191
|
+
try: json['try'],
|
|
1192
|
+
}),
|
|
1193
|
+
...(json['catch'] === undefined
|
|
1194
|
+
? {}
|
|
1195
|
+
: {
|
|
1196
|
+
catch: json['catch'],
|
|
1197
|
+
}),
|
|
1198
|
+
...(json['finally'] === undefined
|
|
1199
|
+
? {}
|
|
1200
|
+
: {
|
|
1201
|
+
finally: json['finally'],
|
|
1202
|
+
}),
|
|
1203
|
+
...(json['throw'] === undefined
|
|
1204
|
+
? {}
|
|
1205
|
+
: {
|
|
1206
|
+
throw: json['throw'],
|
|
1207
|
+
}),
|
|
1208
|
+
...(json['new'] === undefined
|
|
1209
|
+
? {}
|
|
1210
|
+
: {
|
|
1211
|
+
new: json['new'],
|
|
1212
|
+
}),
|
|
1213
|
+
...(json['this'] === undefined
|
|
1214
|
+
? {}
|
|
1215
|
+
: {
|
|
1216
|
+
this: json['this'],
|
|
1217
|
+
}),
|
|
1218
|
+
...(json['super'] === undefined
|
|
1219
|
+
? {}
|
|
1220
|
+
: {
|
|
1221
|
+
super: json['super'],
|
|
1222
|
+
}),
|
|
1223
|
+
...(json['class'] === undefined
|
|
1224
|
+
? {}
|
|
1225
|
+
: {
|
|
1226
|
+
class: json['class'],
|
|
1227
|
+
}),
|
|
1228
|
+
...(json['extends'] === undefined
|
|
1229
|
+
? {}
|
|
1230
|
+
: {
|
|
1231
|
+
extends: json['extends'],
|
|
1232
|
+
}),
|
|
1233
|
+
...(json['implements'] === undefined
|
|
1234
|
+
? {}
|
|
1235
|
+
: {
|
|
1236
|
+
implements: json['implements'],
|
|
1237
|
+
}),
|
|
1238
|
+
...(json['interface'] === undefined
|
|
1239
|
+
? {}
|
|
1240
|
+
: {
|
|
1241
|
+
interface: json['interface'],
|
|
1242
|
+
}),
|
|
1243
|
+
...(json['enum'] === undefined
|
|
1244
|
+
? {}
|
|
1245
|
+
: {
|
|
1246
|
+
enum: json['enum'],
|
|
1247
|
+
}),
|
|
1248
|
+
...(json['type'] === undefined
|
|
1249
|
+
? {}
|
|
1250
|
+
: {
|
|
1251
|
+
type: json['type'],
|
|
1252
|
+
}),
|
|
1253
|
+
...(json['namespace'] === undefined
|
|
1254
|
+
? {}
|
|
1255
|
+
: {
|
|
1256
|
+
namespace: json['namespace'],
|
|
1257
|
+
}),
|
|
1258
|
+
...(json['module'] === undefined
|
|
1259
|
+
? {}
|
|
1260
|
+
: {
|
|
1261
|
+
module: json['module'],
|
|
1262
|
+
}),
|
|
1263
|
+
...(json['import'] === undefined
|
|
1264
|
+
? {}
|
|
1265
|
+
: {
|
|
1266
|
+
import: json['import'],
|
|
1267
|
+
}),
|
|
1268
|
+
...(json['export'] === undefined
|
|
1269
|
+
? {}
|
|
1270
|
+
: {
|
|
1271
|
+
export: json['export'],
|
|
1272
|
+
}),
|
|
1273
|
+
...(json['from'] === undefined
|
|
1274
|
+
? {}
|
|
1275
|
+
: {
|
|
1276
|
+
from: json['from'],
|
|
1277
|
+
}),
|
|
1278
|
+
...(json['as'] === undefined
|
|
1279
|
+
? {}
|
|
1280
|
+
: {
|
|
1281
|
+
as: json['as'],
|
|
1282
|
+
}),
|
|
1283
|
+
...(json['async'] === undefined
|
|
1284
|
+
? {}
|
|
1285
|
+
: {
|
|
1286
|
+
async: json['async'],
|
|
1287
|
+
}),
|
|
1288
|
+
...(json['await'] === undefined
|
|
1289
|
+
? {}
|
|
1290
|
+
: {
|
|
1291
|
+
await: json['await'],
|
|
1292
|
+
}),
|
|
1293
|
+
...(json['yield'] === undefined
|
|
1294
|
+
? {}
|
|
1295
|
+
: {
|
|
1296
|
+
yield: json['yield'],
|
|
1297
|
+
}),
|
|
1298
|
+
...(json['typeof'] === undefined
|
|
1299
|
+
? {}
|
|
1300
|
+
: {
|
|
1301
|
+
typeof: json['typeof'],
|
|
1302
|
+
}),
|
|
1303
|
+
...(json['instanceof'] === undefined
|
|
1304
|
+
? {}
|
|
1305
|
+
: {
|
|
1306
|
+
instanceof: json['instanceof'],
|
|
1307
|
+
}),
|
|
1308
|
+
...(json['in'] === undefined
|
|
1309
|
+
? {}
|
|
1310
|
+
: {
|
|
1311
|
+
in: json['in'],
|
|
1312
|
+
}),
|
|
1313
|
+
...(json['of'] === undefined
|
|
1314
|
+
? {}
|
|
1315
|
+
: {
|
|
1316
|
+
of: json['of'],
|
|
1317
|
+
}),
|
|
1318
|
+
...(json['with'] === undefined
|
|
1319
|
+
? {}
|
|
1320
|
+
: {
|
|
1321
|
+
with: json['with'],
|
|
1322
|
+
}),
|
|
1323
|
+
...(json['do'] === undefined
|
|
1324
|
+
? {}
|
|
1325
|
+
: {
|
|
1326
|
+
do: json['do'],
|
|
1327
|
+
}),
|
|
1328
|
+
...(json['null'] === undefined
|
|
1329
|
+
? {}
|
|
1330
|
+
: {
|
|
1331
|
+
null: json['null'],
|
|
1332
|
+
}),
|
|
1333
|
+
...(json['undefined'] === undefined
|
|
1334
|
+
? {}
|
|
1335
|
+
: {
|
|
1336
|
+
undefined: json['undefined'],
|
|
1337
|
+
}),
|
|
1338
|
+
...(json['true'] === undefined
|
|
1339
|
+
? {}
|
|
1340
|
+
: {
|
|
1341
|
+
true: json['true'],
|
|
1342
|
+
}),
|
|
1343
|
+
...(json['false'] === undefined
|
|
1344
|
+
? {}
|
|
1345
|
+
: {
|
|
1346
|
+
false: json['false'],
|
|
1347
|
+
}),
|
|
1348
|
+
};
|
|
1349
|
+
},
|
|
1350
|
+
};
|
|
1351
|
+
|
|
1352
|
+
public static Async = {
|
|
1353
|
+
toJson: (model: Async): any => {
|
|
1354
|
+
if (model === undefined || model === null) {
|
|
1355
|
+
return model;
|
|
1356
|
+
}
|
|
1357
|
+
return {};
|
|
1358
|
+
},
|
|
1359
|
+
fromJson: (json: any): Async => {
|
|
1360
|
+
if (json === undefined || json === null) {
|
|
1361
|
+
return json;
|
|
1362
|
+
}
|
|
1363
|
+
return {};
|
|
1364
|
+
},
|
|
1365
|
+
};
|
|
1366
|
+
|
|
1367
|
+
public static Await = {
|
|
1368
|
+
toJson: (model: Await): any => {
|
|
1369
|
+
if (model === undefined || model === null) {
|
|
1370
|
+
return model;
|
|
1371
|
+
}
|
|
1372
|
+
return {};
|
|
1373
|
+
},
|
|
1374
|
+
fromJson: (json: any): Await => {
|
|
1375
|
+
if (json === undefined || json === null) {
|
|
1376
|
+
return json;
|
|
1377
|
+
}
|
|
1378
|
+
return {};
|
|
1379
|
+
},
|
|
1380
|
+
};
|
|
1381
|
+
|
|
1382
|
+
public static Break = {
|
|
1383
|
+
toJson: (model: Break): any => {
|
|
1384
|
+
if (model === undefined || model === null) {
|
|
1385
|
+
return model;
|
|
1386
|
+
}
|
|
1387
|
+
return {};
|
|
1388
|
+
},
|
|
1389
|
+
fromJson: (json: any): Break => {
|
|
1390
|
+
if (json === undefined || json === null) {
|
|
1391
|
+
return json;
|
|
1392
|
+
}
|
|
1393
|
+
return {};
|
|
1394
|
+
},
|
|
1395
|
+
};
|
|
1396
|
+
|
|
1397
|
+
public static Case = {
|
|
1398
|
+
toJson: (model: Case): any => {
|
|
1399
|
+
if (model === undefined || model === null) {
|
|
1400
|
+
return model;
|
|
1401
|
+
}
|
|
1402
|
+
return {};
|
|
1403
|
+
},
|
|
1404
|
+
fromJson: (json: any): Case => {
|
|
1405
|
+
if (json === undefined || json === null) {
|
|
1406
|
+
return json;
|
|
1407
|
+
}
|
|
1408
|
+
return {};
|
|
1409
|
+
},
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
public static Catch = {
|
|
1413
|
+
toJson: (model: Catch): any => {
|
|
1414
|
+
if (model === undefined || model === null) {
|
|
1415
|
+
return model;
|
|
1416
|
+
}
|
|
1417
|
+
return {};
|
|
1418
|
+
},
|
|
1419
|
+
fromJson: (json: any): Catch => {
|
|
1420
|
+
if (json === undefined || json === null) {
|
|
1421
|
+
return json;
|
|
1422
|
+
}
|
|
1423
|
+
return {};
|
|
1424
|
+
},
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
public static Class = {
|
|
1428
|
+
toJson: (model: Class): any => {
|
|
1429
|
+
if (model === undefined || model === null) {
|
|
1430
|
+
return model;
|
|
1431
|
+
}
|
|
1432
|
+
return {};
|
|
1433
|
+
},
|
|
1434
|
+
fromJson: (json: any): Class => {
|
|
1435
|
+
if (json === undefined || json === null) {
|
|
1436
|
+
return json;
|
|
1437
|
+
}
|
|
1438
|
+
return {};
|
|
1439
|
+
},
|
|
1440
|
+
};
|
|
1441
|
+
|
|
1442
|
+
public static Const = {
|
|
1443
|
+
toJson: (model: Const): any => {
|
|
1444
|
+
if (model === undefined || model === null) {
|
|
1445
|
+
return model;
|
|
1446
|
+
}
|
|
1447
|
+
return {};
|
|
1448
|
+
},
|
|
1449
|
+
fromJson: (json: any): Const => {
|
|
1450
|
+
if (json === undefined || json === null) {
|
|
1451
|
+
return json;
|
|
1452
|
+
}
|
|
1453
|
+
return {};
|
|
1454
|
+
},
|
|
1455
|
+
};
|
|
1456
|
+
|
|
1457
|
+
public static Continue = {
|
|
1458
|
+
toJson: (model: Continue): any => {
|
|
1459
|
+
if (model === undefined || model === null) {
|
|
1460
|
+
return model;
|
|
1461
|
+
}
|
|
1462
|
+
return {};
|
|
1463
|
+
},
|
|
1464
|
+
fromJson: (json: any): Continue => {
|
|
1465
|
+
if (json === undefined || json === null) {
|
|
1466
|
+
return json;
|
|
1467
|
+
}
|
|
1468
|
+
return {};
|
|
1469
|
+
},
|
|
1470
|
+
};
|
|
1471
|
+
|
|
1472
|
+
public static Default = {
|
|
1473
|
+
toJson: (model: Default): any => {
|
|
1474
|
+
if (model === undefined || model === null) {
|
|
1475
|
+
return model;
|
|
1476
|
+
}
|
|
1477
|
+
return {};
|
|
1478
|
+
},
|
|
1479
|
+
fromJson: (json: any): Default => {
|
|
1480
|
+
if (json === undefined || json === null) {
|
|
1481
|
+
return json;
|
|
1482
|
+
}
|
|
1483
|
+
return {};
|
|
1484
|
+
},
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1487
|
+
public static Do = {
|
|
1488
|
+
toJson: (model: Do): any => {
|
|
1489
|
+
if (model === undefined || model === null) {
|
|
1490
|
+
return model;
|
|
1491
|
+
}
|
|
1492
|
+
return {};
|
|
1493
|
+
},
|
|
1494
|
+
fromJson: (json: any): Do => {
|
|
1495
|
+
if (json === undefined || json === null) {
|
|
1496
|
+
return json;
|
|
1497
|
+
}
|
|
1498
|
+
return {};
|
|
1499
|
+
},
|
|
1500
|
+
};
|
|
1501
|
+
|
|
1502
|
+
public static Else = {
|
|
1503
|
+
toJson: (model: Else): any => {
|
|
1504
|
+
if (model === undefined || model === null) {
|
|
1505
|
+
return model;
|
|
1506
|
+
}
|
|
1507
|
+
return {};
|
|
1508
|
+
},
|
|
1509
|
+
fromJson: (json: any): Else => {
|
|
1510
|
+
if (json === undefined || json === null) {
|
|
1511
|
+
return json;
|
|
1512
|
+
}
|
|
1513
|
+
return {};
|
|
1514
|
+
},
|
|
1515
|
+
};
|
|
1516
|
+
|
|
1517
|
+
public static Enum = {
|
|
1518
|
+
toJson: (model: Enum): any => {
|
|
1519
|
+
if (model === undefined || model === null) {
|
|
1520
|
+
return model;
|
|
1521
|
+
}
|
|
1522
|
+
return {};
|
|
1523
|
+
},
|
|
1524
|
+
fromJson: (json: any): Enum => {
|
|
1525
|
+
if (json === undefined || json === null) {
|
|
1526
|
+
return json;
|
|
1527
|
+
}
|
|
1528
|
+
return {};
|
|
1529
|
+
},
|
|
1530
|
+
};
|
|
1531
|
+
|
|
1532
|
+
public static Export = {
|
|
1533
|
+
toJson: (model: Export): any => {
|
|
1534
|
+
if (model === undefined || model === null) {
|
|
1535
|
+
return model;
|
|
1536
|
+
}
|
|
1537
|
+
return {};
|
|
1538
|
+
},
|
|
1539
|
+
fromJson: (json: any): Export => {
|
|
1540
|
+
if (json === undefined || json === null) {
|
|
1541
|
+
return json;
|
|
1542
|
+
}
|
|
1543
|
+
return {};
|
|
1544
|
+
},
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1547
|
+
public static Extends = {
|
|
1548
|
+
toJson: (model: Extends): any => {
|
|
1549
|
+
if (model === undefined || model === null) {
|
|
1550
|
+
return model;
|
|
1551
|
+
}
|
|
1552
|
+
return {};
|
|
1553
|
+
},
|
|
1554
|
+
fromJson: (json: any): Extends => {
|
|
1555
|
+
if (json === undefined || json === null) {
|
|
1556
|
+
return json;
|
|
1557
|
+
}
|
|
1558
|
+
return {};
|
|
1559
|
+
},
|
|
1560
|
+
};
|
|
1561
|
+
|
|
1562
|
+
public static False = {
|
|
1563
|
+
toJson: (model: False): any => {
|
|
1564
|
+
if (model === undefined || model === null) {
|
|
1565
|
+
return model;
|
|
1566
|
+
}
|
|
1567
|
+
return {};
|
|
1568
|
+
},
|
|
1569
|
+
fromJson: (json: any): False => {
|
|
1570
|
+
if (json === undefined || json === null) {
|
|
1571
|
+
return json;
|
|
1572
|
+
}
|
|
1573
|
+
return {};
|
|
1574
|
+
},
|
|
1575
|
+
};
|
|
1576
|
+
|
|
1577
|
+
public static Finally = {
|
|
1578
|
+
toJson: (model: Finally): any => {
|
|
1579
|
+
if (model === undefined || model === null) {
|
|
1580
|
+
return model;
|
|
1581
|
+
}
|
|
1582
|
+
return {};
|
|
1583
|
+
},
|
|
1584
|
+
fromJson: (json: any): Finally => {
|
|
1585
|
+
if (json === undefined || json === null) {
|
|
1586
|
+
return json;
|
|
1587
|
+
}
|
|
1588
|
+
return {};
|
|
1589
|
+
},
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
public static For = {
|
|
1593
|
+
toJson: (model: For): any => {
|
|
1594
|
+
if (model === undefined || model === null) {
|
|
1595
|
+
return model;
|
|
1596
|
+
}
|
|
1597
|
+
return {};
|
|
1598
|
+
},
|
|
1599
|
+
fromJson: (json: any): For => {
|
|
1600
|
+
if (json === undefined || json === null) {
|
|
1601
|
+
return json;
|
|
1602
|
+
}
|
|
1603
|
+
return {};
|
|
1604
|
+
},
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
public static From = {
|
|
1608
|
+
toJson: (model: From): any => {
|
|
1609
|
+
if (model === undefined || model === null) {
|
|
1610
|
+
return model;
|
|
1611
|
+
}
|
|
1612
|
+
return {};
|
|
1613
|
+
},
|
|
1614
|
+
fromJson: (json: any): From => {
|
|
1615
|
+
if (json === undefined || json === null) {
|
|
1616
|
+
return json;
|
|
1617
|
+
}
|
|
1618
|
+
return {};
|
|
1619
|
+
},
|
|
1620
|
+
};
|
|
1621
|
+
|
|
1622
|
+
public static _Function = {
|
|
1623
|
+
toJson: (model: _Function): any => {
|
|
1624
|
+
if (model === undefined || model === null) {
|
|
1625
|
+
return model;
|
|
1626
|
+
}
|
|
1627
|
+
return {};
|
|
1628
|
+
},
|
|
1629
|
+
fromJson: (json: any): _Function => {
|
|
1630
|
+
if (json === undefined || json === null) {
|
|
1631
|
+
return json;
|
|
1632
|
+
}
|
|
1633
|
+
return {};
|
|
1634
|
+
},
|
|
1635
|
+
};
|
|
1636
|
+
|
|
1637
|
+
public static If = {
|
|
1638
|
+
toJson: (model: If): any => {
|
|
1639
|
+
if (model === undefined || model === null) {
|
|
1640
|
+
return model;
|
|
1641
|
+
}
|
|
1642
|
+
return {};
|
|
1643
|
+
},
|
|
1644
|
+
fromJson: (json: any): If => {
|
|
1645
|
+
if (json === undefined || json === null) {
|
|
1646
|
+
return json;
|
|
1647
|
+
}
|
|
1648
|
+
return {};
|
|
1649
|
+
},
|
|
1650
|
+
};
|
|
1651
|
+
|
|
1652
|
+
public static Implements = {
|
|
1653
|
+
toJson: (model: Implements): any => {
|
|
1654
|
+
if (model === undefined || model === null) {
|
|
1655
|
+
return model;
|
|
1656
|
+
}
|
|
1657
|
+
return {};
|
|
1658
|
+
},
|
|
1659
|
+
fromJson: (json: any): Implements => {
|
|
1660
|
+
if (json === undefined || json === null) {
|
|
1661
|
+
return json;
|
|
1662
|
+
}
|
|
1663
|
+
return {};
|
|
1664
|
+
},
|
|
1665
|
+
};
|
|
1666
|
+
|
|
1667
|
+
public static Import = {
|
|
1668
|
+
toJson: (model: Import): any => {
|
|
1669
|
+
if (model === undefined || model === null) {
|
|
1670
|
+
return model;
|
|
1671
|
+
}
|
|
1672
|
+
return {};
|
|
1673
|
+
},
|
|
1674
|
+
fromJson: (json: any): Import => {
|
|
1675
|
+
if (json === undefined || json === null) {
|
|
1676
|
+
return json;
|
|
1677
|
+
}
|
|
1678
|
+
return {};
|
|
1679
|
+
},
|
|
1680
|
+
};
|
|
1681
|
+
|
|
1682
|
+
public static In = {
|
|
1683
|
+
toJson: (model: In): any => {
|
|
1684
|
+
if (model === undefined || model === null) {
|
|
1685
|
+
return model;
|
|
1686
|
+
}
|
|
1687
|
+
return {};
|
|
1688
|
+
},
|
|
1689
|
+
fromJson: (json: any): In => {
|
|
1690
|
+
if (json === undefined || json === null) {
|
|
1691
|
+
return json;
|
|
1692
|
+
}
|
|
1693
|
+
return {};
|
|
1694
|
+
},
|
|
1695
|
+
};
|
|
1696
|
+
|
|
1697
|
+
public static Instanceof = {
|
|
1698
|
+
toJson: (model: Instanceof): any => {
|
|
1699
|
+
if (model === undefined || model === null) {
|
|
1700
|
+
return model;
|
|
1701
|
+
}
|
|
1702
|
+
return {};
|
|
1703
|
+
},
|
|
1704
|
+
fromJson: (json: any): Instanceof => {
|
|
1705
|
+
if (json === undefined || json === null) {
|
|
1706
|
+
return json;
|
|
1707
|
+
}
|
|
1708
|
+
return {};
|
|
1709
|
+
},
|
|
1710
|
+
};
|
|
1711
|
+
|
|
1712
|
+
public static Interface = {
|
|
1713
|
+
toJson: (model: Interface): any => {
|
|
1714
|
+
if (model === undefined || model === null) {
|
|
1715
|
+
return model;
|
|
1716
|
+
}
|
|
1717
|
+
return {};
|
|
1718
|
+
},
|
|
1719
|
+
fromJson: (json: any): Interface => {
|
|
1720
|
+
if (json === undefined || json === null) {
|
|
1721
|
+
return json;
|
|
1722
|
+
}
|
|
1723
|
+
return {};
|
|
1724
|
+
},
|
|
1725
|
+
};
|
|
1726
|
+
|
|
1727
|
+
public static Let = {
|
|
1728
|
+
toJson: (model: Let): any => {
|
|
1729
|
+
if (model === undefined || model === null) {
|
|
1730
|
+
return model;
|
|
1731
|
+
}
|
|
1732
|
+
return {};
|
|
1733
|
+
},
|
|
1734
|
+
fromJson: (json: any): Let => {
|
|
1735
|
+
if (json === undefined || json === null) {
|
|
1736
|
+
return json;
|
|
1737
|
+
}
|
|
1738
|
+
return {};
|
|
1739
|
+
},
|
|
1740
|
+
};
|
|
1741
|
+
|
|
1742
|
+
public static New = {
|
|
1743
|
+
toJson: (model: New): any => {
|
|
1744
|
+
if (model === undefined || model === null) {
|
|
1745
|
+
return model;
|
|
1746
|
+
}
|
|
1747
|
+
return {};
|
|
1748
|
+
},
|
|
1749
|
+
fromJson: (json: any): New => {
|
|
1750
|
+
if (json === undefined || json === null) {
|
|
1751
|
+
return json;
|
|
1752
|
+
}
|
|
1753
|
+
return {};
|
|
1754
|
+
},
|
|
1755
|
+
};
|
|
1756
|
+
|
|
1757
|
+
public static Null = {
|
|
1758
|
+
toJson: (model: Null): any => {
|
|
1759
|
+
if (model === undefined || model === null) {
|
|
1760
|
+
return model;
|
|
1761
|
+
}
|
|
1762
|
+
return {};
|
|
1763
|
+
},
|
|
1764
|
+
fromJson: (json: any): Null => {
|
|
1765
|
+
if (json === undefined || json === null) {
|
|
1766
|
+
return json;
|
|
1767
|
+
}
|
|
1768
|
+
return {};
|
|
1769
|
+
},
|
|
1770
|
+
};
|
|
1771
|
+
|
|
1772
|
+
public static Return = {
|
|
1773
|
+
toJson: (model: Return): any => {
|
|
1774
|
+
if (model === undefined || model === null) {
|
|
1775
|
+
return model;
|
|
1776
|
+
}
|
|
1777
|
+
return {};
|
|
1778
|
+
},
|
|
1779
|
+
fromJson: (json: any): Return => {
|
|
1780
|
+
if (json === undefined || json === null) {
|
|
1781
|
+
return json;
|
|
1782
|
+
}
|
|
1783
|
+
return {};
|
|
1784
|
+
},
|
|
1785
|
+
};
|
|
1786
|
+
|
|
1787
|
+
public static Super = {
|
|
1788
|
+
toJson: (model: Super): any => {
|
|
1789
|
+
if (model === undefined || model === null) {
|
|
1790
|
+
return model;
|
|
1791
|
+
}
|
|
1792
|
+
return {};
|
|
1793
|
+
},
|
|
1794
|
+
fromJson: (json: any): Super => {
|
|
1795
|
+
if (json === undefined || json === null) {
|
|
1796
|
+
return json;
|
|
1797
|
+
}
|
|
1798
|
+
return {};
|
|
1799
|
+
},
|
|
1800
|
+
};
|
|
1801
|
+
|
|
1802
|
+
public static Switch = {
|
|
1803
|
+
toJson: (model: Switch): any => {
|
|
1804
|
+
if (model === undefined || model === null) {
|
|
1805
|
+
return model;
|
|
1806
|
+
}
|
|
1807
|
+
return {};
|
|
1808
|
+
},
|
|
1809
|
+
fromJson: (json: any): Switch => {
|
|
1810
|
+
if (json === undefined || json === null) {
|
|
1811
|
+
return json;
|
|
1812
|
+
}
|
|
1813
|
+
return {};
|
|
1814
|
+
},
|
|
1815
|
+
};
|
|
1816
|
+
|
|
1817
|
+
public static This = {
|
|
1818
|
+
toJson: (model: This): any => {
|
|
1819
|
+
if (model === undefined || model === null) {
|
|
1820
|
+
return model;
|
|
1821
|
+
}
|
|
1822
|
+
return {};
|
|
1823
|
+
},
|
|
1824
|
+
fromJson: (json: any): This => {
|
|
1825
|
+
if (json === undefined || json === null) {
|
|
1826
|
+
return json;
|
|
1827
|
+
}
|
|
1828
|
+
return {};
|
|
1829
|
+
},
|
|
1830
|
+
};
|
|
1831
|
+
|
|
1832
|
+
public static Throw = {
|
|
1833
|
+
toJson: (model: Throw): any => {
|
|
1834
|
+
if (model === undefined || model === null) {
|
|
1835
|
+
return model;
|
|
1836
|
+
}
|
|
1837
|
+
return {};
|
|
1838
|
+
},
|
|
1839
|
+
fromJson: (json: any): Throw => {
|
|
1840
|
+
if (json === undefined || json === null) {
|
|
1841
|
+
return json;
|
|
1842
|
+
}
|
|
1843
|
+
return {};
|
|
1844
|
+
},
|
|
1845
|
+
};
|
|
1846
|
+
|
|
1847
|
+
public static True = {
|
|
1848
|
+
toJson: (model: True): any => {
|
|
1849
|
+
if (model === undefined || model === null) {
|
|
1850
|
+
return model;
|
|
1851
|
+
}
|
|
1852
|
+
return {};
|
|
1853
|
+
},
|
|
1854
|
+
fromJson: (json: any): True => {
|
|
1855
|
+
if (json === undefined || json === null) {
|
|
1856
|
+
return json;
|
|
1857
|
+
}
|
|
1858
|
+
return {};
|
|
1859
|
+
},
|
|
1860
|
+
};
|
|
1861
|
+
|
|
1862
|
+
public static Try = {
|
|
1863
|
+
toJson: (model: Try): any => {
|
|
1864
|
+
if (model === undefined || model === null) {
|
|
1865
|
+
return model;
|
|
1866
|
+
}
|
|
1867
|
+
return {};
|
|
1868
|
+
},
|
|
1869
|
+
fromJson: (json: any): Try => {
|
|
1870
|
+
if (json === undefined || json === null) {
|
|
1871
|
+
return json;
|
|
1872
|
+
}
|
|
1873
|
+
return {};
|
|
1874
|
+
},
|
|
1875
|
+
};
|
|
1876
|
+
|
|
1877
|
+
public static Typeof = {
|
|
1878
|
+
toJson: (model: Typeof): any => {
|
|
1879
|
+
if (model === undefined || model === null) {
|
|
1880
|
+
return model;
|
|
1881
|
+
}
|
|
1882
|
+
return {};
|
|
1883
|
+
},
|
|
1884
|
+
fromJson: (json: any): Typeof => {
|
|
1885
|
+
if (json === undefined || json === null) {
|
|
1886
|
+
return json;
|
|
1887
|
+
}
|
|
1888
|
+
return {};
|
|
1889
|
+
},
|
|
1890
|
+
};
|
|
1891
|
+
|
|
1892
|
+
public static Var = {
|
|
1893
|
+
toJson: (model: Var): any => {
|
|
1894
|
+
if (model === undefined || model === null) {
|
|
1895
|
+
return model;
|
|
1896
|
+
}
|
|
1897
|
+
return {};
|
|
1898
|
+
},
|
|
1899
|
+
fromJson: (json: any): Var => {
|
|
1900
|
+
if (json === undefined || json === null) {
|
|
1901
|
+
return json;
|
|
1902
|
+
}
|
|
1903
|
+
return {};
|
|
1904
|
+
},
|
|
1905
|
+
};
|
|
1906
|
+
|
|
1907
|
+
public static While = {
|
|
1908
|
+
toJson: (model: While): any => {
|
|
1909
|
+
if (model === undefined || model === null) {
|
|
1910
|
+
return model;
|
|
1911
|
+
}
|
|
1912
|
+
return {};
|
|
1913
|
+
},
|
|
1914
|
+
fromJson: (json: any): While => {
|
|
1915
|
+
if (json === undefined || json === null) {
|
|
1916
|
+
return json;
|
|
1917
|
+
}
|
|
1918
|
+
return {};
|
|
1919
|
+
},
|
|
1920
|
+
};
|
|
1921
|
+
|
|
1922
|
+
public static With = {
|
|
1923
|
+
toJson: (model: With): any => {
|
|
1924
|
+
if (model === undefined || model === null) {
|
|
1925
|
+
return model;
|
|
1926
|
+
}
|
|
1927
|
+
return {};
|
|
1928
|
+
},
|
|
1929
|
+
fromJson: (json: any): With => {
|
|
1930
|
+
if (json === undefined || json === null) {
|
|
1931
|
+
return json;
|
|
1932
|
+
}
|
|
1933
|
+
return {};
|
|
1934
|
+
},
|
|
1935
|
+
};
|
|
1936
|
+
|
|
1937
|
+
public static Yield = {
|
|
1938
|
+
toJson: (model: Yield): any => {
|
|
1939
|
+
if (model === undefined || model === null) {
|
|
1940
|
+
return model;
|
|
1941
|
+
}
|
|
1942
|
+
return {};
|
|
1943
|
+
},
|
|
1944
|
+
fromJson: (json: any): Yield => {
|
|
1945
|
+
if (json === undefined || json === null) {
|
|
1946
|
+
return json;
|
|
1947
|
+
}
|
|
1948
|
+
return {};
|
|
1949
|
+
},
|
|
1950
|
+
};
|
|
1951
|
+
|
|
1952
|
+
public static As = {
|
|
1953
|
+
toJson: (model: As): any => {
|
|
1954
|
+
if (model === undefined || model === null) {
|
|
1955
|
+
return model;
|
|
1956
|
+
}
|
|
1957
|
+
return {};
|
|
1958
|
+
},
|
|
1959
|
+
fromJson: (json: any): As => {
|
|
1960
|
+
if (json === undefined || json === null) {
|
|
1961
|
+
return json;
|
|
1962
|
+
}
|
|
1963
|
+
return {};
|
|
1964
|
+
},
|
|
1965
|
+
};
|
|
1966
|
+
|
|
1967
|
+
public static Module = {
|
|
1968
|
+
toJson: (model: Module): any => {
|
|
1969
|
+
if (model === undefined || model === null) {
|
|
1970
|
+
return model;
|
|
1971
|
+
}
|
|
1972
|
+
return {};
|
|
1973
|
+
},
|
|
1974
|
+
fromJson: (json: any): Module => {
|
|
1975
|
+
if (json === undefined || json === null) {
|
|
1976
|
+
return json;
|
|
1977
|
+
}
|
|
1978
|
+
return {};
|
|
1979
|
+
},
|
|
1980
|
+
};
|
|
1981
|
+
|
|
1982
|
+
public static Namespace = {
|
|
1983
|
+
toJson: (model: Namespace): any => {
|
|
1984
|
+
if (model === undefined || model === null) {
|
|
1985
|
+
return model;
|
|
1986
|
+
}
|
|
1987
|
+
return {};
|
|
1988
|
+
},
|
|
1989
|
+
fromJson: (json: any): Namespace => {
|
|
1990
|
+
if (json === undefined || json === null) {
|
|
1991
|
+
return json;
|
|
1992
|
+
}
|
|
1993
|
+
return {};
|
|
1994
|
+
},
|
|
1995
|
+
};
|
|
1996
|
+
|
|
1997
|
+
public static Of = {
|
|
1998
|
+
toJson: (model: Of): any => {
|
|
1999
|
+
if (model === undefined || model === null) {
|
|
2000
|
+
return model;
|
|
2001
|
+
}
|
|
2002
|
+
return {};
|
|
2003
|
+
},
|
|
2004
|
+
fromJson: (json: any): Of => {
|
|
2005
|
+
if (json === undefined || json === null) {
|
|
2006
|
+
return json;
|
|
2007
|
+
}
|
|
2008
|
+
return {};
|
|
2009
|
+
},
|
|
2010
|
+
};
|
|
2011
|
+
|
|
2012
|
+
public static Type = {
|
|
2013
|
+
toJson: (model: Type): any => {
|
|
2014
|
+
if (model === undefined || model === null) {
|
|
2015
|
+
return model;
|
|
2016
|
+
}
|
|
2017
|
+
return {};
|
|
2018
|
+
},
|
|
2019
|
+
fromJson: (json: any): Type => {
|
|
2020
|
+
if (json === undefined || json === null) {
|
|
2021
|
+
return json;
|
|
2022
|
+
}
|
|
2023
|
+
return {};
|
|
2024
|
+
},
|
|
2025
|
+
};
|
|
2026
|
+
|
|
2027
|
+
public static Undefined = {
|
|
2028
|
+
toJson: (model: Undefined): any => {
|
|
2029
|
+
if (model === undefined || model === null) {
|
|
2030
|
+
return model;
|
|
2031
|
+
}
|
|
2032
|
+
return {};
|
|
2033
|
+
},
|
|
2034
|
+
fromJson: (json: any): Undefined => {
|
|
2035
|
+
if (json === undefined || json === null) {
|
|
2036
|
+
return json;
|
|
2037
|
+
}
|
|
2038
|
+
return {};
|
|
2039
|
+
},
|
|
2040
|
+
};
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
/**
|
|
2044
|
+
* Client configuration for TestApi
|
|
2045
|
+
*/
|
|
2046
|
+
export interface TestApiConfig {
|
|
2047
|
+
/**
|
|
2048
|
+
* Base URL for the API
|
|
2049
|
+
*/
|
|
2050
|
+
url: string;
|
|
2051
|
+
/**
|
|
2052
|
+
* Custom instance of fetch. By default the global 'fetch' is used.
|
|
2053
|
+
* You can override this to add custom middleware for use cases such as adding authentication headers.
|
|
2054
|
+
*/
|
|
2055
|
+
fetch?: typeof fetch;
|
|
2056
|
+
/**
|
|
2057
|
+
* Additional configuration
|
|
2058
|
+
*/
|
|
2059
|
+
options?: {
|
|
2060
|
+
/**
|
|
2061
|
+
* By default, the client will add a Content-Type header, set to the media type defined for
|
|
2062
|
+
* the request in the OpenAPI specification.
|
|
2063
|
+
* Set this to false to omit this header.
|
|
2064
|
+
*/
|
|
2065
|
+
omitContentTypeHeader?: boolean;
|
|
2066
|
+
};
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
/**
|
|
2070
|
+
* API Client for TestApi
|
|
2071
|
+
*/
|
|
2072
|
+
export class TestApi {
|
|
2073
|
+
private $config: TestApiConfig;
|
|
2074
|
+
|
|
2075
|
+
constructor(config: TestApiConfig) {
|
|
2076
|
+
this.$config = config;
|
|
2077
|
+
|
|
2078
|
+
this.op = this.op.bind(this);
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
private $url = (
|
|
2082
|
+
path: string,
|
|
2083
|
+
pathParameters: { [key: string]: any },
|
|
2084
|
+
queryParameters: { [key: string]: any },
|
|
2085
|
+
collectionFormats?: { [key: string]: 'multi' | 'csv' },
|
|
2086
|
+
): string => {
|
|
2087
|
+
const baseUrl = this.$config.url.endsWith('/')
|
|
2088
|
+
? this.$config.url.slice(0, -1)
|
|
2089
|
+
: this.$config.url;
|
|
2090
|
+
const pathWithParameters = Object.entries(pathParameters).reduce(
|
|
2091
|
+
(withParams, [key, value]) =>
|
|
2092
|
+
withParams.replace(\`{\${key}}\`, encodeURIComponent(\`\${value}\`)),
|
|
2093
|
+
path,
|
|
2094
|
+
);
|
|
2095
|
+
const queryString = Object.entries(queryParameters)
|
|
2096
|
+
.map(([key, value]) => {
|
|
2097
|
+
if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
|
|
2098
|
+
return value
|
|
2099
|
+
.map(
|
|
2100
|
+
(v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
|
|
2101
|
+
)
|
|
2102
|
+
.join('&');
|
|
2103
|
+
}
|
|
2104
|
+
return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
|
|
2105
|
+
})
|
|
2106
|
+
.join('&');
|
|
2107
|
+
return (
|
|
2108
|
+
baseUrl + pathWithParameters + (queryString ? \`?\${queryString}\` : '')
|
|
2109
|
+
);
|
|
2110
|
+
};
|
|
2111
|
+
|
|
2112
|
+
private $headers = (
|
|
2113
|
+
headerParameters: { [key: string]: any },
|
|
2114
|
+
collectionFormats?: { [key: string]: 'multi' | 'csv' },
|
|
2115
|
+
): [string, string][] => {
|
|
2116
|
+
return Object.entries(headerParameters).flatMap(([key, value]) => {
|
|
2117
|
+
if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
|
|
2118
|
+
return value.map((v) => [key, String(v)]) as [string, string][];
|
|
2119
|
+
}
|
|
2120
|
+
return [[key, String(value)]];
|
|
2121
|
+
});
|
|
2122
|
+
};
|
|
2123
|
+
|
|
2124
|
+
private $fetch: typeof fetch = (...args) =>
|
|
2125
|
+
(this.$config.fetch ?? fetch)(...args);
|
|
2126
|
+
|
|
2127
|
+
public async op(input: OpRequest): Promise<string> {
|
|
2128
|
+
const pathParameters: { [key: string]: any } = {};
|
|
2129
|
+
const queryParameters: { [key: string]: any } = {};
|
|
2130
|
+
const headerParameters: { [key: string]: any } = {};
|
|
2131
|
+
if (!this.$config.options?.omitContentTypeHeader) {
|
|
2132
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
2133
|
+
}
|
|
2134
|
+
const body =
|
|
2135
|
+
typeof input === 'object'
|
|
2136
|
+
? JSON.stringify($IO.ReservedProperties.toJson(input))
|
|
2137
|
+
: String($IO.ReservedProperties.toJson(input));
|
|
2138
|
+
|
|
2139
|
+
const response = await this.$fetch(
|
|
2140
|
+
this.$url('/op', pathParameters, queryParameters),
|
|
2141
|
+
{
|
|
2142
|
+
headers: this.$headers(headerParameters),
|
|
2143
|
+
method: 'POST',
|
|
2144
|
+
body,
|
|
2145
|
+
},
|
|
2146
|
+
);
|
|
2147
|
+
|
|
2148
|
+
if (response.status === 200) {
|
|
2149
|
+
return await response.text();
|
|
2150
|
+
}
|
|
2151
|
+
throw new Error(
|
|
2152
|
+
\`Unknown response status \${response.status} returned by API\`,
|
|
2153
|
+
);
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
"
|
|
2157
|
+
`;
|