@aws/nx-plugin 0.10.0 → 0.12.0

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.
@@ -11,7 +11,7 @@ exports[`openApiTsClientGenerator > should allow duplicate operation ids discrim
11
11
  * Utility for serialisation and deserialisation of API types.
12
12
  */
13
13
  class $IO {
14
- private static mapValues = (data: any, fn: (item: any) => any) =>
14
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
15
15
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
16
16
  }
17
17
 
@@ -19,8 +19,26 @@ class $IO {
19
19
  * Client configuration for TestApi
20
20
  */
21
21
  export interface TestApiConfig {
22
+ /**
23
+ * Base URL for the API
24
+ */
22
25
  url: string;
26
+ /**
27
+ * Custom instance of fetch. By default the global 'fetch' is used.
28
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
29
+ */
23
30
  fetch?: typeof fetch;
31
+ /**
32
+ * Additional configuration
33
+ */
34
+ options?: {
35
+ /**
36
+ * By default, the client will add a Content-Type header, set to the media type defined for
37
+ * the request in the OpenAPI specification.
38
+ * Set this to false to omit this header.
39
+ */
40
+ omitContentTypeHeader?: boolean;
41
+ };
24
42
  }
25
43
 
26
44
  /**
@@ -31,6 +49,9 @@ export class TestApi {
31
49
 
32
50
  constructor(config: TestApiConfig) {
33
51
  this.$config = config;
52
+
53
+ this._itemsStockList = this._itemsStockList.bind(this);
54
+ this._usersPeopleList = this._usersPeopleList.bind(this);
34
55
  }
35
56
 
36
57
  private $url = (
@@ -79,10 +100,10 @@ export class TestApi {
79
100
  private $fetch: typeof fetch = (...args) =>
80
101
  (this.$config.fetch ?? fetch)(...args);
81
102
 
82
- private _itemsStockList = async (): Promise<Array<string>> => {
83
- const pathParameters = {};
84
- const queryParameters = {};
85
- const headerParameters = {};
103
+ private async _itemsStockList(): Promise<Array<string>> {
104
+ const pathParameters: { [key: string]: any } = {};
105
+ const queryParameters: { [key: string]: any } = {};
106
+ const headerParameters: { [key: string]: any } = {};
86
107
 
87
108
  const body = undefined;
88
109
 
@@ -96,17 +117,17 @@ export class TestApi {
96
117
  );
97
118
 
98
119
  if (response.status === 200) {
99
- return (await response.json()) as Array<string>;
120
+ return await response.json();
100
121
  }
101
122
  throw new Error(
102
123
  \`Unknown response status \${response.status} returned by API\`,
103
124
  );
104
- };
125
+ }
105
126
 
106
- private _usersPeopleList = async (): Promise<Array<string>> => {
107
- const pathParameters = {};
108
- const queryParameters = {};
109
- const headerParameters = {};
127
+ private async _usersPeopleList(): Promise<Array<string>> {
128
+ const pathParameters: { [key: string]: any } = {};
129
+ const queryParameters: { [key: string]: any } = {};
130
+ const headerParameters: { [key: string]: any } = {};
110
131
 
111
132
  const body = undefined;
112
133
 
@@ -120,39 +141,39 @@ export class TestApi {
120
141
  );
121
142
 
122
143
  if (response.status === 200) {
123
- return (await response.json()) as Array<string>;
144
+ return await response.json();
124
145
  }
125
146
  throw new Error(
126
147
  \`Unknown response status \${response.status} returned by API\`,
127
148
  );
128
- };
149
+ }
129
150
 
130
151
  /**
131
152
  * items operations
132
153
  */
133
154
  public items = {
134
- list: this._itemsStockList,
155
+ list: this._itemsStockList.bind(this),
135
156
  };
136
157
 
137
158
  /**
138
159
  * stock operations
139
160
  */
140
161
  public stock = {
141
- list: this._itemsStockList,
162
+ list: this._itemsStockList.bind(this),
142
163
  };
143
164
 
144
165
  /**
145
166
  * users operations
146
167
  */
147
168
  public users = {
148
- list: this._usersPeopleList,
169
+ list: this._usersPeopleList.bind(this),
149
170
  };
150
171
 
151
172
  /**
152
173
  * people operations
153
174
  */
154
175
  public people = {
155
- list: this._usersPeopleList,
176
+ list: this._usersPeopleList.bind(this),
156
177
  };
157
178
  }
158
179
  "
@@ -169,7 +190,7 @@ exports[`openApiTsClientGenerator > should allow duplicate operation ids discrim
169
190
  * Utility for serialisation and deserialisation of API types.
170
191
  */
171
192
  class $IO {
172
- private static mapValues = (data: any, fn: (item: any) => any) =>
193
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
173
194
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
174
195
  }
175
196
 
@@ -177,8 +198,26 @@ class $IO {
177
198
  * Client configuration for TestApi
178
199
  */
179
200
  export interface TestApiConfig {
201
+ /**
202
+ * Base URL for the API
203
+ */
180
204
  url: string;
205
+ /**
206
+ * Custom instance of fetch. By default the global 'fetch' is used.
207
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
208
+ */
181
209
  fetch?: typeof fetch;
210
+ /**
211
+ * Additional configuration
212
+ */
213
+ options?: {
214
+ /**
215
+ * By default, the client will add a Content-Type header, set to the media type defined for
216
+ * the request in the OpenAPI specification.
217
+ * Set this to false to omit this header.
218
+ */
219
+ omitContentTypeHeader?: boolean;
220
+ };
182
221
  }
183
222
 
184
223
  /**
@@ -189,6 +228,9 @@ export class TestApi {
189
228
 
190
229
  constructor(config: TestApiConfig) {
191
230
  this.$config = config;
231
+
232
+ this._itemsList = this._itemsList.bind(this);
233
+ this._usersList = this._usersList.bind(this);
192
234
  }
193
235
 
194
236
  private $url = (
@@ -237,10 +279,10 @@ export class TestApi {
237
279
  private $fetch: typeof fetch = (...args) =>
238
280
  (this.$config.fetch ?? fetch)(...args);
239
281
 
240
- private _itemsList = async (): Promise<Array<string>> => {
241
- const pathParameters = {};
242
- const queryParameters = {};
243
- const headerParameters = {};
282
+ private async _itemsList(): Promise<Array<string>> {
283
+ const pathParameters: { [key: string]: any } = {};
284
+ const queryParameters: { [key: string]: any } = {};
285
+ const headerParameters: { [key: string]: any } = {};
244
286
 
245
287
  const body = undefined;
246
288
 
@@ -254,17 +296,17 @@ export class TestApi {
254
296
  );
255
297
 
256
298
  if (response.status === 200) {
257
- return (await response.json()) as Array<string>;
299
+ return await response.json();
258
300
  }
259
301
  throw new Error(
260
302
  \`Unknown response status \${response.status} returned by API\`,
261
303
  );
262
- };
304
+ }
263
305
 
264
- private _usersList = async (): Promise<Array<string>> => {
265
- const pathParameters = {};
266
- const queryParameters = {};
267
- const headerParameters = {};
306
+ private async _usersList(): Promise<Array<string>> {
307
+ const pathParameters: { [key: string]: any } = {};
308
+ const queryParameters: { [key: string]: any } = {};
309
+ const headerParameters: { [key: string]: any } = {};
268
310
 
269
311
  const body = undefined;
270
312
 
@@ -278,25 +320,25 @@ export class TestApi {
278
320
  );
279
321
 
280
322
  if (response.status === 200) {
281
- return (await response.json()) as Array<string>;
323
+ return await response.json();
282
324
  }
283
325
  throw new Error(
284
326
  \`Unknown response status \${response.status} returned by API\`,
285
327
  );
286
- };
328
+ }
287
329
 
288
330
  /**
289
331
  * items operations
290
332
  */
291
333
  public items = {
292
- list: this._itemsList,
334
+ list: this._itemsList.bind(this),
293
335
  };
294
336
 
295
337
  /**
296
338
  * users operations
297
339
  */
298
340
  public users = {
299
- list: this._usersList,
341
+ list: this._usersList.bind(this),
300
342
  };
301
343
  }
302
344
  "
@@ -335,7 +377,7 @@ exports[`openApiTsClientGenerator > should generate valid TypeScript for arrays
335
377
  * Utility for serialisation and deserialisation of API types.
336
378
  */
337
379
  class $IO {
338
- private static mapValues = (data: any, fn: (item: any) => any) =>
380
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
339
381
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
340
382
 
341
383
  public static PostTest200ResponseItem = {
@@ -395,7 +437,7 @@ class $IO {
395
437
  ...(model.complexDict === undefined
396
438
  ? {}
397
439
  : {
398
- complexDict: $IO.mapValues(
440
+ complexDict: $IO.$mapValues(
399
441
  model.complexDict,
400
442
  $IO.PostTestRequestContentComplexDictValue.toJson,
401
443
  ),
@@ -425,7 +467,7 @@ class $IO {
425
467
  ...(json['complexDict'] === undefined
426
468
  ? {}
427
469
  : {
428
- complexDict: $IO.mapValues(
470
+ complexDict: $IO.$mapValues(
429
471
  json['complexDict'],
430
472
  $IO.PostTestRequestContentComplexDictValue.fromJson,
431
473
  ),
@@ -468,8 +510,26 @@ class $IO {
468
510
  * Client configuration for TestApi
469
511
  */
470
512
  export interface TestApiConfig {
513
+ /**
514
+ * Base URL for the API
515
+ */
471
516
  url: string;
517
+ /**
518
+ * Custom instance of fetch. By default the global 'fetch' is used.
519
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
520
+ */
472
521
  fetch?: typeof fetch;
522
+ /**
523
+ * Additional configuration
524
+ */
525
+ options?: {
526
+ /**
527
+ * By default, the client will add a Content-Type header, set to the media type defined for
528
+ * the request in the OpenAPI specification.
529
+ * Set this to false to omit this header.
530
+ */
531
+ omitContentTypeHeader?: boolean;
532
+ };
473
533
  }
474
534
 
475
535
  /**
@@ -480,6 +540,8 @@ export class TestApi {
480
540
 
481
541
  constructor(config: TestApiConfig) {
482
542
  this.$config = config;
543
+
544
+ this.postTest = this.postTest.bind(this);
483
545
  }
484
546
 
485
547
  private $url = (
@@ -528,12 +590,15 @@ export class TestApi {
528
590
  private $fetch: typeof fetch = (...args) =>
529
591
  (this.$config.fetch ?? fetch)(...args);
530
592
 
531
- public postTest = async (
593
+ public async postTest(
532
594
  input?: PostTestRequest,
533
- ): Promise<Array<PostTest200ResponseItem>> => {
534
- const pathParameters = {};
535
- const queryParameters = {};
536
- const headerParameters = {};
595
+ ): Promise<Array<PostTest200ResponseItem>> {
596
+ const pathParameters: { [key: string]: any } = {};
597
+ const queryParameters: { [key: string]: any } = {};
598
+ const headerParameters: { [key: string]: any } = {};
599
+ if (!this.$config.options?.omitContentTypeHeader) {
600
+ headerParameters['Content-Type'] = 'application/json';
601
+ }
537
602
  const body =
538
603
  input === undefined
539
604
  ? undefined
@@ -551,12 +616,14 @@ export class TestApi {
551
616
  );
552
617
 
553
618
  if (response.status === 200) {
554
- return (await response.json()).map($IO.PostTest200ResponseItem.fromJson);
619
+ return ((await response.json()) as Array<any>).map(
620
+ $IO.PostTest200ResponseItem.fromJson,
621
+ );
555
622
  }
556
623
  throw new Error(
557
624
  \`Unknown response status \${response.status} returned by API\`,
558
625
  );
559
- };
626
+ }
560
627
  }
561
628
  "
562
629
  `;
@@ -610,7 +677,7 @@ exports[`openApiTsClientGenerator > should generate valid TypeScript for composi
610
677
  * Utility for serialisation and deserialisation of API types.
611
678
  */
612
679
  class $IO {
613
- private static mapValues = (data: any, fn: (item: any) => any) =>
680
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
614
681
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
615
682
 
616
683
  public static PutTest200Response = {
@@ -803,8 +870,26 @@ class $IO {
803
870
  * Client configuration for TestApi
804
871
  */
805
872
  export interface TestApiConfig {
873
+ /**
874
+ * Base URL for the API
875
+ */
806
876
  url: string;
877
+ /**
878
+ * Custom instance of fetch. By default the global 'fetch' is used.
879
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
880
+ */
807
881
  fetch?: typeof fetch;
882
+ /**
883
+ * Additional configuration
884
+ */
885
+ options?: {
886
+ /**
887
+ * By default, the client will add a Content-Type header, set to the media type defined for
888
+ * the request in the OpenAPI specification.
889
+ * Set this to false to omit this header.
890
+ */
891
+ omitContentTypeHeader?: boolean;
892
+ };
808
893
  }
809
894
 
810
895
  /**
@@ -815,6 +900,8 @@ export class TestApi {
815
900
 
816
901
  constructor(config: TestApiConfig) {
817
902
  this.$config = config;
903
+
904
+ this.putTest = this.putTest.bind(this);
818
905
  }
819
906
 
820
907
  private $url = (
@@ -863,12 +950,13 @@ export class TestApi {
863
950
  private $fetch: typeof fetch = (...args) =>
864
951
  (this.$config.fetch ?? fetch)(...args);
865
952
 
866
- public putTest = async (
867
- input?: PutTestRequest,
868
- ): Promise<PutTest200Response> => {
869
- const pathParameters = {};
870
- const queryParameters = {};
871
- const headerParameters = {};
953
+ public async putTest(input?: PutTestRequest): Promise<PutTest200Response> {
954
+ const pathParameters: { [key: string]: any } = {};
955
+ const queryParameters: { [key: string]: any } = {};
956
+ const headerParameters: { [key: string]: any } = {};
957
+ if (!this.$config.options?.omitContentTypeHeader) {
958
+ headerParameters['Content-Type'] = 'application/json';
959
+ }
872
960
  const body =
873
961
  input === undefined
874
962
  ? undefined
@@ -891,7 +979,7 @@ export class TestApi {
891
979
  throw new Error(
892
980
  \`Unknown response status \${response.status} returned by API\`,
893
981
  );
894
- };
982
+ }
895
983
  }
896
984
  "
897
985
  `;
@@ -943,7 +1031,7 @@ exports[`openApiTsClientGenerator > should generate valid TypeScript for paramet
943
1031
  * Utility for serialisation and deserialisation of API types.
944
1032
  */
945
1033
  class $IO {
946
- private static mapValues = (data: any, fn: (item: any) => any) =>
1034
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
947
1035
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
948
1036
 
949
1037
  public static GetTest200Response = {
@@ -1088,8 +1176,26 @@ class $IO {
1088
1176
  * Client configuration for TestApi
1089
1177
  */
1090
1178
  export interface TestApiConfig {
1179
+ /**
1180
+ * Base URL for the API
1181
+ */
1091
1182
  url: string;
1183
+ /**
1184
+ * Custom instance of fetch. By default the global 'fetch' is used.
1185
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
1186
+ */
1092
1187
  fetch?: typeof fetch;
1188
+ /**
1189
+ * Additional configuration
1190
+ */
1191
+ options?: {
1192
+ /**
1193
+ * By default, the client will add a Content-Type header, set to the media type defined for
1194
+ * the request in the OpenAPI specification.
1195
+ * Set this to false to omit this header.
1196
+ */
1197
+ omitContentTypeHeader?: boolean;
1198
+ };
1093
1199
  }
1094
1200
 
1095
1201
  /**
@@ -1100,6 +1206,8 @@ export class TestApi {
1100
1206
 
1101
1207
  constructor(config: TestApiConfig) {
1102
1208
  this.$config = config;
1209
+
1210
+ this.getTest = this.getTest.bind(this);
1103
1211
  }
1104
1212
 
1105
1213
  private $url = (
@@ -1148,12 +1256,13 @@ export class TestApi {
1148
1256
  private $fetch: typeof fetch = (...args) =>
1149
1257
  (this.$config.fetch ?? fetch)(...args);
1150
1258
 
1151
- public getTest = async (
1152
- input: GetTestRequest,
1153
- ): Promise<GetTest200Response> => {
1154
- const pathParameters = $IO.GetTestRequestPathParameters.toJson(input);
1155
- const queryParameters = $IO.GetTestRequestQueryParameters.toJson(input);
1156
- const headerParameters = $IO.GetTestRequestHeaderParameters.toJson(input);
1259
+ public async getTest(input: GetTestRequest): Promise<GetTest200Response> {
1260
+ const pathParameters: { [key: string]: any } =
1261
+ $IO.GetTestRequestPathParameters.toJson(input);
1262
+ const queryParameters: { [key: string]: any } =
1263
+ $IO.GetTestRequestQueryParameters.toJson(input);
1264
+ const headerParameters: { [key: string]: any } =
1265
+ $IO.GetTestRequestHeaderParameters.toJson(input);
1157
1266
  const collectionFormats = {
1158
1267
  'x-api-key': 'csv',
1159
1268
  filter: 'multi',
@@ -1193,7 +1302,7 @@ export class TestApi {
1193
1302
  throw new Error(
1194
1303
  \`Unknown response status \${response.status} returned by API\`,
1195
1304
  );
1196
- };
1305
+ }
1197
1306
  }
1198
1307
  "
1199
1308
  `;
@@ -1218,7 +1327,7 @@ exports[`openApiTsClientGenerator > should generate valid TypeScript for primiti
1218
1327
  * Utility for serialisation and deserialisation of API types.
1219
1328
  */
1220
1329
  class $IO {
1221
- private static mapValues = (data: any, fn: (item: any) => any) =>
1330
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
1222
1331
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
1223
1332
 
1224
1333
  public static GetTest200Response = {
@@ -1290,8 +1399,26 @@ class $IO {
1290
1399
  * Client configuration for TestApi
1291
1400
  */
1292
1401
  export interface TestApiConfig {
1402
+ /**
1403
+ * Base URL for the API
1404
+ */
1293
1405
  url: string;
1406
+ /**
1407
+ * Custom instance of fetch. By default the global 'fetch' is used.
1408
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
1409
+ */
1294
1410
  fetch?: typeof fetch;
1411
+ /**
1412
+ * Additional configuration
1413
+ */
1414
+ options?: {
1415
+ /**
1416
+ * By default, the client will add a Content-Type header, set to the media type defined for
1417
+ * the request in the OpenAPI specification.
1418
+ * Set this to false to omit this header.
1419
+ */
1420
+ omitContentTypeHeader?: boolean;
1421
+ };
1295
1422
  }
1296
1423
 
1297
1424
  /**
@@ -1302,6 +1429,8 @@ export class TestApi {
1302
1429
 
1303
1430
  constructor(config: TestApiConfig) {
1304
1431
  this.$config = config;
1432
+
1433
+ this.getTest = this.getTest.bind(this);
1305
1434
  }
1306
1435
 
1307
1436
  private $url = (
@@ -1353,10 +1482,10 @@ export class TestApi {
1353
1482
  /**
1354
1483
  * Sends a test request!
1355
1484
  */
1356
- public getTest = async (): Promise<GetTest200Response> => {
1357
- const pathParameters = {};
1358
- const queryParameters = {};
1359
- const headerParameters = {};
1485
+ public async getTest(): Promise<GetTest200Response> {
1486
+ const pathParameters: { [key: string]: any } = {};
1487
+ const queryParameters: { [key: string]: any } = {};
1488
+ const headerParameters: { [key: string]: any } = {};
1360
1489
 
1361
1490
  const body = undefined;
1362
1491
 
@@ -1375,7 +1504,7 @@ export class TestApi {
1375
1504
  throw new Error(
1376
1505
  \`Unknown response status \${response.status} returned by API\`,
1377
1506
  );
1378
- };
1507
+ }
1379
1508
  }
1380
1509
  "
1381
1510
  `;
@@ -1418,7 +1547,7 @@ exports[`openApiTsClientGenerator > should handle composite primitive and array
1418
1547
  * Utility for serialisation and deserialisation of API types.
1419
1548
  */
1420
1549
  class $IO {
1421
- private static mapValues = (data: any, fn: (item: any) => any) =>
1550
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
1422
1551
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
1423
1552
 
1424
1553
  public static CompositeRequestContent = {
@@ -1453,7 +1582,7 @@ class $IO {
1453
1582
  ...(model === null ? null : model),
1454
1583
  ...(model === null
1455
1584
  ? null
1456
- : $IO.mapValues(
1585
+ : $IO.$mapValues(
1457
1586
  model,
1458
1587
  $IO.CompositeRequestContentOneOf3Value.toJson,
1459
1588
  )),
@@ -1495,7 +1624,7 @@ class $IO {
1495
1624
  ...(json === null ? null : json),
1496
1625
  ...(json === null
1497
1626
  ? null
1498
- : $IO.mapValues(
1627
+ : $IO.$mapValues(
1499
1628
  json,
1500
1629
  $IO.CompositeRequestContentOneOf3Value.fromJson,
1501
1630
  )),
@@ -1590,8 +1719,26 @@ class $IO {
1590
1719
  * Client configuration for TestApi
1591
1720
  */
1592
1721
  export interface TestApiConfig {
1722
+ /**
1723
+ * Base URL for the API
1724
+ */
1593
1725
  url: string;
1726
+ /**
1727
+ * Custom instance of fetch. By default the global 'fetch' is used.
1728
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
1729
+ */
1594
1730
  fetch?: typeof fetch;
1731
+ /**
1732
+ * Additional configuration
1733
+ */
1734
+ options?: {
1735
+ /**
1736
+ * By default, the client will add a Content-Type header, set to the media type defined for
1737
+ * the request in the OpenAPI specification.
1738
+ * Set this to false to omit this header.
1739
+ */
1740
+ omitContentTypeHeader?: boolean;
1741
+ };
1595
1742
  }
1596
1743
 
1597
1744
  /**
@@ -1602,6 +1749,8 @@ export class TestApi {
1602
1749
 
1603
1750
  constructor(config: TestApiConfig) {
1604
1751
  this.$config = config;
1752
+
1753
+ this.composite = this.composite.bind(this);
1605
1754
  }
1606
1755
 
1607
1756
  private $url = (
@@ -1650,10 +1799,13 @@ export class TestApi {
1650
1799
  private $fetch: typeof fetch = (...args) =>
1651
1800
  (this.$config.fetch ?? fetch)(...args);
1652
1801
 
1653
- public composite = async (input?: CompositeRequest): Promise<string> => {
1654
- const pathParameters = {};
1655
- const queryParameters = {};
1656
- const headerParameters = {};
1802
+ public async composite(input?: CompositeRequest): Promise<string> {
1803
+ const pathParameters: { [key: string]: any } = {};
1804
+ const queryParameters: { [key: string]: any } = {};
1805
+ const headerParameters: { [key: string]: any } = {};
1806
+ if (!this.$config.options?.omitContentTypeHeader) {
1807
+ headerParameters['Content-Type'] = 'application/json';
1808
+ }
1657
1809
  const body =
1658
1810
  input === undefined
1659
1811
  ? undefined
@@ -1676,7 +1828,7 @@ export class TestApi {
1676
1828
  throw new Error(
1677
1829
  \`Unknown response status \${response.status} returned by API\`,
1678
1830
  );
1679
- };
1831
+ }
1680
1832
  }
1681
1833
  "
1682
1834
  `;
@@ -1713,7 +1865,7 @@ exports[`openApiTsClientGenerator > should handle date and date-time formats 2`]
1713
1865
  * Utility for serialisation and deserialisation of API types.
1714
1866
  */
1715
1867
  class $IO {
1716
- private static mapValues = (data: any, fn: (item: any) => any) =>
1868
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
1717
1869
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
1718
1870
 
1719
1871
  public static PostDates200Response = {
@@ -1815,8 +1967,26 @@ class $IO {
1815
1967
  * Client configuration for TestApi
1816
1968
  */
1817
1969
  export interface TestApiConfig {
1970
+ /**
1971
+ * Base URL for the API
1972
+ */
1818
1973
  url: string;
1974
+ /**
1975
+ * Custom instance of fetch. By default the global 'fetch' is used.
1976
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
1977
+ */
1819
1978
  fetch?: typeof fetch;
1979
+ /**
1980
+ * Additional configuration
1981
+ */
1982
+ options?: {
1983
+ /**
1984
+ * By default, the client will add a Content-Type header, set to the media type defined for
1985
+ * the request in the OpenAPI specification.
1986
+ * Set this to false to omit this header.
1987
+ */
1988
+ omitContentTypeHeader?: boolean;
1989
+ };
1820
1990
  }
1821
1991
 
1822
1992
  /**
@@ -1827,6 +1997,9 @@ export class TestApi {
1827
1997
 
1828
1998
  constructor(config: TestApiConfig) {
1829
1999
  this.$config = config;
2000
+
2001
+ this.postDates = this.postDates.bind(this);
2002
+ this.postSingleDate = this.postSingleDate.bind(this);
1830
2003
  }
1831
2004
 
1832
2005
  private $url = (
@@ -1875,12 +2048,15 @@ export class TestApi {
1875
2048
  private $fetch: typeof fetch = (...args) =>
1876
2049
  (this.$config.fetch ?? fetch)(...args);
1877
2050
 
1878
- public postDates = async (
2051
+ public async postDates(
1879
2052
  input?: PostDatesRequest,
1880
- ): Promise<PostDates200Response> => {
1881
- const pathParameters = {};
1882
- const queryParameters = {};
1883
- const headerParameters = {};
2053
+ ): Promise<PostDates200Response> {
2054
+ const pathParameters: { [key: string]: any } = {};
2055
+ const queryParameters: { [key: string]: any } = {};
2056
+ const headerParameters: { [key: string]: any } = {};
2057
+ if (!this.$config.options?.omitContentTypeHeader) {
2058
+ headerParameters['Content-Type'] = 'application/json';
2059
+ }
1884
2060
  const body =
1885
2061
  input === undefined
1886
2062
  ? undefined
@@ -1903,14 +2079,15 @@ export class TestApi {
1903
2079
  throw new Error(
1904
2080
  \`Unknown response status \${response.status} returned by API\`,
1905
2081
  );
1906
- };
2082
+ }
1907
2083
 
1908
- public postSingleDate = async (
1909
- input: PostSingleDateRequest,
1910
- ): Promise<Date> => {
1911
- const pathParameters = {};
1912
- const queryParameters = {};
1913
- const headerParameters = {};
2084
+ public async postSingleDate(input: PostSingleDateRequest): Promise<Date> {
2085
+ const pathParameters: { [key: string]: any } = {};
2086
+ const queryParameters: { [key: string]: any } = {};
2087
+ const headerParameters: { [key: string]: any } = {};
2088
+ if (!this.$config.options?.omitContentTypeHeader) {
2089
+ headerParameters['Content-Type'] = 'application/json';
2090
+ }
1914
2091
  const body = input.toISOString().slice(0, 10);
1915
2092
 
1916
2093
  const response = await this.$fetch(
@@ -1928,7 +2105,7 @@ export class TestApi {
1928
2105
  throw new Error(
1929
2106
  \`Unknown response status \${response.status} returned by API\`,
1930
2107
  );
1931
- };
2108
+ }
1932
2109
  }
1933
2110
  "
1934
2111
  `;
@@ -1958,7 +2135,7 @@ exports[`openApiTsClientGenerator > should handle default responses 2`] = `
1958
2135
  * Utility for serialisation and deserialisation of API types.
1959
2136
  */
1960
2137
  class $IO {
1961
- private static mapValues = (data: any, fn: (item: any) => any) =>
2138
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
1962
2139
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
1963
2140
 
1964
2141
  public static GetTest200Response = {
@@ -2012,8 +2189,26 @@ class $IO {
2012
2189
  * Client configuration for TestApi
2013
2190
  */
2014
2191
  export interface TestApiConfig {
2192
+ /**
2193
+ * Base URL for the API
2194
+ */
2015
2195
  url: string;
2196
+ /**
2197
+ * Custom instance of fetch. By default the global 'fetch' is used.
2198
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
2199
+ */
2016
2200
  fetch?: typeof fetch;
2201
+ /**
2202
+ * Additional configuration
2203
+ */
2204
+ options?: {
2205
+ /**
2206
+ * By default, the client will add a Content-Type header, set to the media type defined for
2207
+ * the request in the OpenAPI specification.
2208
+ * Set this to false to omit this header.
2209
+ */
2210
+ omitContentTypeHeader?: boolean;
2211
+ };
2017
2212
  }
2018
2213
 
2019
2214
  /**
@@ -2024,6 +2219,8 @@ export class TestApi {
2024
2219
 
2025
2220
  constructor(config: TestApiConfig) {
2026
2221
  this.$config = config;
2222
+
2223
+ this.getTest = this.getTest.bind(this);
2027
2224
  }
2028
2225
 
2029
2226
  private $url = (
@@ -2072,10 +2269,10 @@ export class TestApi {
2072
2269
  private $fetch: typeof fetch = (...args) =>
2073
2270
  (this.$config.fetch ?? fetch)(...args);
2074
2271
 
2075
- public getTest = async (): Promise<GetTest200Response> => {
2076
- const pathParameters = {};
2077
- const queryParameters = {};
2078
- const headerParameters = {};
2272
+ public async getTest(): Promise<GetTest200Response> {
2273
+ const pathParameters: { [key: string]: any } = {};
2274
+ const queryParameters: { [key: string]: any } = {};
2275
+ const headerParameters: { [key: string]: any } = {};
2079
2276
 
2080
2277
  const body = undefined;
2081
2278
 
@@ -2095,7 +2292,7 @@ export class TestApi {
2095
2292
  status: response.status,
2096
2293
  error: $IO.GetTestdefaultResponse.fromJson(await response.json()),
2097
2294
  };
2098
- };
2295
+ }
2099
2296
  }
2100
2297
  "
2101
2298
  `;
@@ -2124,7 +2321,7 @@ exports[`openApiTsClientGenerator > should handle enum request and response bodi
2124
2321
  * Utility for serialisation and deserialisation of API types.
2125
2322
  */
2126
2323
  class $IO {
2127
- private static mapValues = (data: any, fn: (item: any) => any) =>
2324
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
2128
2325
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
2129
2326
  }
2130
2327
 
@@ -2132,8 +2329,26 @@ class $IO {
2132
2329
  * Client configuration for TestApi
2133
2330
  */
2134
2331
  export interface TestApiConfig {
2332
+ /**
2333
+ * Base URL for the API
2334
+ */
2135
2335
  url: string;
2336
+ /**
2337
+ * Custom instance of fetch. By default the global 'fetch' is used.
2338
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
2339
+ */
2136
2340
  fetch?: typeof fetch;
2341
+ /**
2342
+ * Additional configuration
2343
+ */
2344
+ options?: {
2345
+ /**
2346
+ * By default, the client will add a Content-Type header, set to the media type defined for
2347
+ * the request in the OpenAPI specification.
2348
+ * Set this to false to omit this header.
2349
+ */
2350
+ omitContentTypeHeader?: boolean;
2351
+ };
2137
2352
  }
2138
2353
 
2139
2354
  /**
@@ -2144,6 +2359,8 @@ export class TestApi {
2144
2359
 
2145
2360
  constructor(config: TestApiConfig) {
2146
2361
  this.$config = config;
2362
+
2363
+ this.updateStatus = this.updateStatus.bind(this);
2147
2364
  }
2148
2365
 
2149
2366
  private $url = (
@@ -2192,12 +2409,15 @@ export class TestApi {
2192
2409
  private $fetch: typeof fetch = (...args) =>
2193
2410
  (this.$config.fetch ?? fetch)(...args);
2194
2411
 
2195
- public updateStatus = async (
2412
+ public async updateStatus(
2196
2413
  input: UpdateStatusRequest,
2197
- ): Promise<UpdateStatus200Response> => {
2198
- const pathParameters = {};
2199
- const queryParameters = {};
2200
- const headerParameters = {};
2414
+ ): Promise<UpdateStatus200Response> {
2415
+ const pathParameters: { [key: string]: any } = {};
2416
+ const queryParameters: { [key: string]: any } = {};
2417
+ const headerParameters: { [key: string]: any } = {};
2418
+ if (!this.$config.options?.omitContentTypeHeader) {
2419
+ headerParameters['Content-Type'] = 'application/json';
2420
+ }
2201
2421
  const body = input;
2202
2422
 
2203
2423
  const response = await this.$fetch(
@@ -2215,7 +2435,7 @@ export class TestApi {
2215
2435
  throw new Error(
2216
2436
  \`Unknown response status \${response.status} returned by API\`,
2217
2437
  );
2218
- };
2438
+ }
2219
2439
  }
2220
2440
  "
2221
2441
  `;
@@ -2291,7 +2511,7 @@ exports[`openApiTsClientGenerator > should handle inline primitives and composit
2291
2511
  * Utility for serialisation and deserialisation of API types.
2292
2512
  */
2293
2513
  class $IO {
2294
- private static mapValues = (data: any, fn: (item: any) => any) =>
2514
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
2295
2515
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
2296
2516
 
2297
2517
  public static TestArrays200Response = {
@@ -2505,8 +2725,26 @@ class $IO {
2505
2725
  * Client configuration for TestApi
2506
2726
  */
2507
2727
  export interface TestApiConfig {
2728
+ /**
2729
+ * Base URL for the API
2730
+ */
2508
2731
  url: string;
2732
+ /**
2733
+ * Custom instance of fetch. By default the global 'fetch' is used.
2734
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
2735
+ */
2509
2736
  fetch?: typeof fetch;
2737
+ /**
2738
+ * Additional configuration
2739
+ */
2740
+ options?: {
2741
+ /**
2742
+ * By default, the client will add a Content-Type header, set to the media type defined for
2743
+ * the request in the OpenAPI specification.
2744
+ * Set this to false to omit this header.
2745
+ */
2746
+ omitContentTypeHeader?: boolean;
2747
+ };
2510
2748
  }
2511
2749
 
2512
2750
  /**
@@ -2517,6 +2755,14 @@ export class TestApi {
2517
2755
 
2518
2756
  constructor(config: TestApiConfig) {
2519
2757
  this.$config = config;
2758
+
2759
+ this.testArrays = this.testArrays.bind(this);
2760
+ this.testArraysWithOtherParameters =
2761
+ this.testArraysWithOtherParameters.bind(this);
2762
+ this.testComposites = this.testComposites.bind(this);
2763
+ this.testEnums = this.testEnums.bind(this);
2764
+ this.testPrimitiveBinary = this.testPrimitiveBinary.bind(this);
2765
+ this.testPrimitiveText = this.testPrimitiveText.bind(this);
2520
2766
  }
2521
2767
 
2522
2768
  private $url = (
@@ -2565,12 +2811,15 @@ export class TestApi {
2565
2811
  private $fetch: typeof fetch = (...args) =>
2566
2812
  (this.$config.fetch ?? fetch)(...args);
2567
2813
 
2568
- public testArrays = async (
2814
+ public async testArrays(
2569
2815
  input?: TestArraysRequest,
2570
- ): Promise<TestArrays200Response> => {
2571
- const pathParameters = {};
2572
- const queryParameters = {};
2573
- const headerParameters = {};
2816
+ ): Promise<TestArrays200Response> {
2817
+ const pathParameters: { [key: string]: any } = {};
2818
+ const queryParameters: { [key: string]: any } = {};
2819
+ const headerParameters: { [key: string]: any } = {};
2820
+ if (!this.$config.options?.omitContentTypeHeader) {
2821
+ headerParameters['Content-Type'] = 'application/json';
2822
+ }
2574
2823
  const body =
2575
2824
  input === undefined
2576
2825
  ? undefined
@@ -2593,15 +2842,18 @@ export class TestApi {
2593
2842
  throw new Error(
2594
2843
  \`Unknown response status \${response.status} returned by API\`,
2595
2844
  );
2596
- };
2845
+ }
2597
2846
 
2598
- public testArraysWithOtherParameters = async (
2847
+ public async testArraysWithOtherParameters(
2599
2848
  input: TestArraysWithOtherParametersRequest,
2600
- ): Promise<TestArraysWithOtherParameters200Response> => {
2601
- const pathParameters = {};
2602
- const queryParameters =
2849
+ ): Promise<TestArraysWithOtherParameters200Response> {
2850
+ const pathParameters: { [key: string]: any } = {};
2851
+ const queryParameters: { [key: string]: any } =
2603
2852
  $IO.TestArraysWithOtherParametersRequestQueryParameters.toJson(input);
2604
- const headerParameters = {};
2853
+ const headerParameters: { [key: string]: any } = {};
2854
+ if (!this.$config.options?.omitContentTypeHeader) {
2855
+ headerParameters['Content-Type'] = 'application/json';
2856
+ }
2605
2857
  const collectionFormats = {
2606
2858
  someParameter: 'multi',
2607
2859
  } as const;
@@ -2642,14 +2894,17 @@ export class TestApi {
2642
2894
  throw new Error(
2643
2895
  \`Unknown response status \${response.status} returned by API\`,
2644
2896
  );
2645
- };
2897
+ }
2646
2898
 
2647
- public testComposites = async (
2899
+ public async testComposites(
2648
2900
  input?: TestCompositesRequest,
2649
- ): Promise<TestComposites200Response> => {
2650
- const pathParameters = {};
2651
- const queryParameters = {};
2652
- const headerParameters = {};
2901
+ ): Promise<TestComposites200Response> {
2902
+ const pathParameters: { [key: string]: any } = {};
2903
+ const queryParameters: { [key: string]: any } = {};
2904
+ const headerParameters: { [key: string]: any } = {};
2905
+ if (!this.$config.options?.omitContentTypeHeader) {
2906
+ headerParameters['Content-Type'] = 'application/json';
2907
+ }
2653
2908
  const body =
2654
2909
  input === undefined
2655
2910
  ? undefined
@@ -2672,12 +2927,12 @@ export class TestApi {
2672
2927
  throw new Error(
2673
2928
  \`Unknown response status \${response.status} returned by API\`,
2674
2929
  );
2675
- };
2930
+ }
2676
2931
 
2677
- public testEnums = async (): Promise<TestEnums200Response> => {
2678
- const pathParameters = {};
2679
- const queryParameters = {};
2680
- const headerParameters = {};
2932
+ public async testEnums(): Promise<TestEnums200Response> {
2933
+ const pathParameters: { [key: string]: any } = {};
2934
+ const queryParameters: { [key: string]: any } = {};
2935
+ const headerParameters: { [key: string]: any } = {};
2681
2936
 
2682
2937
  const body = undefined;
2683
2938
 
@@ -2696,14 +2951,17 @@ export class TestApi {
2696
2951
  throw new Error(
2697
2952
  \`Unknown response status \${response.status} returned by API\`,
2698
2953
  );
2699
- };
2954
+ }
2700
2955
 
2701
- public testPrimitiveBinary = async (
2956
+ public async testPrimitiveBinary(
2702
2957
  input: TestPrimitiveBinaryRequest,
2703
- ): Promise<Blob> => {
2704
- const pathParameters = {};
2705
- const queryParameters = {};
2706
- const headerParameters = {};
2958
+ ): Promise<Blob> {
2959
+ const pathParameters: { [key: string]: any } = {};
2960
+ const queryParameters: { [key: string]: any } = {};
2961
+ const headerParameters: { [key: string]: any } = {};
2962
+ if (!this.$config.options?.omitContentTypeHeader) {
2963
+ headerParameters['Content-Type'] = 'application/octet-stream';
2964
+ }
2707
2965
  const body = input;
2708
2966
 
2709
2967
  const response = await this.$fetch(
@@ -2721,14 +2979,17 @@ export class TestApi {
2721
2979
  throw new Error(
2722
2980
  \`Unknown response status \${response.status} returned by API\`,
2723
2981
  );
2724
- };
2982
+ }
2725
2983
 
2726
- public testPrimitiveText = async (
2984
+ public async testPrimitiveText(
2727
2985
  input: TestPrimitiveTextRequest,
2728
- ): Promise<number> => {
2729
- const pathParameters = {};
2730
- const queryParameters = {};
2731
- const headerParameters = {};
2986
+ ): Promise<number> {
2987
+ const pathParameters: { [key: string]: any } = {};
2988
+ const queryParameters: { [key: string]: any } = {};
2989
+ const headerParameters: { [key: string]: any } = {};
2990
+ if (!this.$config.options?.omitContentTypeHeader) {
2991
+ headerParameters['Content-Type'] = 'application/json';
2992
+ }
2732
2993
  const body = String(input);
2733
2994
 
2734
2995
  const response = await this.$fetch(
@@ -2746,7 +3007,7 @@ export class TestApi {
2746
3007
  throw new Error(
2747
3008
  \`Unknown response status \${response.status} returned by API\`,
2748
3009
  );
2749
- };
3010
+ }
2750
3011
  }
2751
3012
  "
2752
3013
  `;
@@ -2893,7 +3154,7 @@ exports[`openApiTsClientGenerator > should handle multiple response status codes
2893
3154
  * Utility for serialisation and deserialisation of API types.
2894
3155
  */
2895
3156
  class $IO {
2896
- private static mapValues = (data: any, fn: (item: any) => any) =>
3157
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
2897
3158
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
2898
3159
 
2899
3160
  public static TestResponses2XXResponse = {
@@ -3019,8 +3280,26 @@ class $IO {
3019
3280
  * Client configuration for TestApi
3020
3281
  */
3021
3282
  export interface TestApiConfig {
3283
+ /**
3284
+ * Base URL for the API
3285
+ */
3022
3286
  url: string;
3287
+ /**
3288
+ * Custom instance of fetch. By default the global 'fetch' is used.
3289
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
3290
+ */
3023
3291
  fetch?: typeof fetch;
3292
+ /**
3293
+ * Additional configuration
3294
+ */
3295
+ options?: {
3296
+ /**
3297
+ * By default, the client will add a Content-Type header, set to the media type defined for
3298
+ * the request in the OpenAPI specification.
3299
+ * Set this to false to omit this header.
3300
+ */
3301
+ omitContentTypeHeader?: boolean;
3302
+ };
3024
3303
  }
3025
3304
 
3026
3305
  /**
@@ -3031,6 +3310,8 @@ export class TestApi {
3031
3310
 
3032
3311
  constructor(config: TestApiConfig) {
3033
3312
  this.$config = config;
3313
+
3314
+ this.testResponses = this.testResponses.bind(this);
3034
3315
  }
3035
3316
 
3036
3317
  private $url = (
@@ -3079,12 +3360,15 @@ export class TestApi {
3079
3360
  private $fetch: typeof fetch = (...args) =>
3080
3361
  (this.$config.fetch ?? fetch)(...args);
3081
3362
 
3082
- public testResponses = async (
3363
+ public async testResponses(
3083
3364
  input?: TestResponsesRequest,
3084
- ): Promise<TestResponses2XXResponse> => {
3085
- const pathParameters = {};
3086
- const queryParameters = {};
3087
- const headerParameters = {};
3365
+ ): Promise<TestResponses2XXResponse> {
3366
+ const pathParameters: { [key: string]: any } = {};
3367
+ const queryParameters: { [key: string]: any } = {};
3368
+ const headerParameters: { [key: string]: any } = {};
3369
+ if (!this.$config.options?.omitContentTypeHeader) {
3370
+ headerParameters['Content-Type'] = 'application/json';
3371
+ }
3088
3372
  const body =
3089
3373
  input === undefined
3090
3374
  ? undefined
@@ -3119,7 +3403,7 @@ export class TestApi {
3119
3403
  throw new Error(
3120
3404
  \`Unknown response status \${response.status} returned by API\`,
3121
3405
  );
3122
- };
3406
+ }
3123
3407
  }
3124
3408
  "
3125
3409
  `;
@@ -3153,7 +3437,7 @@ exports[`openApiTsClientGenerator > should handle not schema type 2`] = `
3153
3437
  * Utility for serialisation and deserialisation of API types.
3154
3438
  */
3155
3439
  class $IO {
3156
- private static mapValues = (data: any, fn: (item: any) => any) =>
3440
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
3157
3441
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
3158
3442
 
3159
3443
  public static TestNot200Response = {
@@ -3252,8 +3536,26 @@ class $IO {
3252
3536
  * Client configuration for TestApi
3253
3537
  */
3254
3538
  export interface TestApiConfig {
3539
+ /**
3540
+ * Base URL for the API
3541
+ */
3255
3542
  url: string;
3543
+ /**
3544
+ * Custom instance of fetch. By default the global 'fetch' is used.
3545
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
3546
+ */
3256
3547
  fetch?: typeof fetch;
3548
+ /**
3549
+ * Additional configuration
3550
+ */
3551
+ options?: {
3552
+ /**
3553
+ * By default, the client will add a Content-Type header, set to the media type defined for
3554
+ * the request in the OpenAPI specification.
3555
+ * Set this to false to omit this header.
3556
+ */
3557
+ omitContentTypeHeader?: boolean;
3558
+ };
3257
3559
  }
3258
3560
 
3259
3561
  /**
@@ -3264,6 +3566,8 @@ export class TestApi {
3264
3566
 
3265
3567
  constructor(config: TestApiConfig) {
3266
3568
  this.$config = config;
3569
+
3570
+ this.testNot = this.testNot.bind(this);
3267
3571
  }
3268
3572
 
3269
3573
  private $url = (
@@ -3312,12 +3616,13 @@ export class TestApi {
3312
3616
  private $fetch: typeof fetch = (...args) =>
3313
3617
  (this.$config.fetch ?? fetch)(...args);
3314
3618
 
3315
- public testNot = async (
3316
- input?: TestNotRequest,
3317
- ): Promise<TestNot200Response> => {
3318
- const pathParameters = {};
3319
- const queryParameters = {};
3320
- const headerParameters = {};
3619
+ public async testNot(input?: TestNotRequest): Promise<TestNot200Response> {
3620
+ const pathParameters: { [key: string]: any } = {};
3621
+ const queryParameters: { [key: string]: any } = {};
3622
+ const headerParameters: { [key: string]: any } = {};
3623
+ if (!this.$config.options?.omitContentTypeHeader) {
3624
+ headerParameters['Content-Type'] = 'application/json';
3625
+ }
3321
3626
  const body =
3322
3627
  input === undefined
3323
3628
  ? undefined
@@ -3340,7 +3645,7 @@ export class TestApi {
3340
3645
  throw new Error(
3341
3646
  \`Unknown response status \${response.status} returned by API\`,
3342
3647
  );
3343
- };
3648
+ }
3344
3649
  }
3345
3650
  "
3346
3651
  `;
@@ -3443,7 +3748,7 @@ exports[`openApiTsClientGenerator > should handle nullable schemas in various co
3443
3748
  * Utility for serialisation and deserialisation of API types.
3444
3749
  */
3445
3750
  class $IO {
3446
- private static mapValues = (data: any, fn: (item: any) => any) =>
3751
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
3447
3752
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
3448
3753
 
3449
3754
  public static PostSingleNullableObjectRequestContent = {
@@ -3966,8 +4271,26 @@ class $IO {
3966
4271
  * Client configuration for TestApi
3967
4272
  */
3968
4273
  export interface TestApiConfig {
4274
+ /**
4275
+ * Base URL for the API
4276
+ */
3969
4277
  url: string;
4278
+ /**
4279
+ * Custom instance of fetch. By default the global 'fetch' is used.
4280
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
4281
+ */
3970
4282
  fetch?: typeof fetch;
4283
+ /**
4284
+ * Additional configuration
4285
+ */
4286
+ options?: {
4287
+ /**
4288
+ * By default, the client will add a Content-Type header, set to the media type defined for
4289
+ * the request in the OpenAPI specification.
4290
+ * Set this to false to omit this header.
4291
+ */
4292
+ omitContentTypeHeader?: boolean;
4293
+ };
3971
4294
  }
3972
4295
 
3973
4296
  /**
@@ -3978,6 +4301,13 @@ export class TestApi {
3978
4301
 
3979
4302
  constructor(config: TestApiConfig) {
3980
4303
  this.$config = config;
4304
+
4305
+ this.postSingleNullableArray = this.postSingleNullableArray.bind(this);
4306
+ this.postSingleNullableBoolean = this.postSingleNullableBoolean.bind(this);
4307
+ this.postSingleNullableNumber = this.postSingleNullableNumber.bind(this);
4308
+ this.postSingleNullableObject = this.postSingleNullableObject.bind(this);
4309
+ this.postSingleNullableString = this.postSingleNullableString.bind(this);
4310
+ this.testNullable = this.testNullable.bind(this);
3981
4311
  }
3982
4312
 
3983
4313
  private $url = (
@@ -4026,12 +4356,15 @@ export class TestApi {
4026
4356
  private $fetch: typeof fetch = (...args) =>
4027
4357
  (this.$config.fetch ?? fetch)(...args);
4028
4358
 
4029
- public postSingleNullableArray = async (
4359
+ public async postSingleNullableArray(
4030
4360
  input?: PostSingleNullableArrayRequest,
4031
- ): Promise<string> => {
4032
- const pathParameters = {};
4033
- const queryParameters = {};
4034
- const headerParameters = {};
4361
+ ): Promise<string> {
4362
+ const pathParameters: { [key: string]: any } = {};
4363
+ const queryParameters: { [key: string]: any } = {};
4364
+ const headerParameters: { [key: string]: any } = {};
4365
+ if (!this.$config.options?.omitContentTypeHeader) {
4366
+ headerParameters['Content-Type'] = 'application/json';
4367
+ }
4035
4368
  const body =
4036
4369
  input === undefined
4037
4370
  ? undefined
@@ -4054,14 +4387,17 @@ export class TestApi {
4054
4387
  throw new Error(
4055
4388
  \`Unknown response status \${response.status} returned by API\`,
4056
4389
  );
4057
- };
4390
+ }
4058
4391
 
4059
- public postSingleNullableBoolean = async (
4392
+ public async postSingleNullableBoolean(
4060
4393
  input?: PostSingleNullableBooleanRequest,
4061
- ): Promise<string> => {
4062
- const pathParameters = {};
4063
- const queryParameters = {};
4064
- const headerParameters = {};
4394
+ ): Promise<string> {
4395
+ const pathParameters: { [key: string]: any } = {};
4396
+ const queryParameters: { [key: string]: any } = {};
4397
+ const headerParameters: { [key: string]: any } = {};
4398
+ if (!this.$config.options?.omitContentTypeHeader) {
4399
+ headerParameters['Content-Type'] = 'application/json';
4400
+ }
4065
4401
  const body = input === undefined ? undefined : String(input);
4066
4402
 
4067
4403
  const response = await this.$fetch(
@@ -4079,14 +4415,17 @@ export class TestApi {
4079
4415
  throw new Error(
4080
4416
  \`Unknown response status \${response.status} returned by API\`,
4081
4417
  );
4082
- };
4418
+ }
4083
4419
 
4084
- public postSingleNullableNumber = async (
4420
+ public async postSingleNullableNumber(
4085
4421
  input?: PostSingleNullableNumberRequest,
4086
- ): Promise<string> => {
4087
- const pathParameters = {};
4088
- const queryParameters = {};
4089
- const headerParameters = {};
4422
+ ): Promise<string> {
4423
+ const pathParameters: { [key: string]: any } = {};
4424
+ const queryParameters: { [key: string]: any } = {};
4425
+ const headerParameters: { [key: string]: any } = {};
4426
+ if (!this.$config.options?.omitContentTypeHeader) {
4427
+ headerParameters['Content-Type'] = 'application/json';
4428
+ }
4090
4429
  const body = input === undefined ? undefined : String(input);
4091
4430
 
4092
4431
  const response = await this.$fetch(
@@ -4104,14 +4443,17 @@ export class TestApi {
4104
4443
  throw new Error(
4105
4444
  \`Unknown response status \${response.status} returned by API\`,
4106
4445
  );
4107
- };
4446
+ }
4108
4447
 
4109
- public postSingleNullableObject = async (
4448
+ public async postSingleNullableObject(
4110
4449
  input?: PostSingleNullableObjectRequest,
4111
- ): Promise<string> => {
4112
- const pathParameters = {};
4113
- const queryParameters = {};
4114
- const headerParameters = {};
4450
+ ): Promise<string> {
4451
+ const pathParameters: { [key: string]: any } = {};
4452
+ const queryParameters: { [key: string]: any } = {};
4453
+ const headerParameters: { [key: string]: any } = {};
4454
+ if (!this.$config.options?.omitContentTypeHeader) {
4455
+ headerParameters['Content-Type'] = 'application/json';
4456
+ }
4115
4457
  const body =
4116
4458
  input === undefined
4117
4459
  ? undefined
@@ -4136,14 +4478,17 @@ export class TestApi {
4136
4478
  throw new Error(
4137
4479
  \`Unknown response status \${response.status} returned by API\`,
4138
4480
  );
4139
- };
4481
+ }
4140
4482
 
4141
- public postSingleNullableString = async (
4483
+ public async postSingleNullableString(
4142
4484
  input?: PostSingleNullableStringRequest,
4143
- ): Promise<string> => {
4144
- const pathParameters = {};
4145
- const queryParameters = {};
4146
- const headerParameters = {};
4485
+ ): Promise<string> {
4486
+ const pathParameters: { [key: string]: any } = {};
4487
+ const queryParameters: { [key: string]: any } = {};
4488
+ const headerParameters: { [key: string]: any } = {};
4489
+ if (!this.$config.options?.omitContentTypeHeader) {
4490
+ headerParameters['Content-Type'] = 'application/json';
4491
+ }
4147
4492
  const body = input === undefined ? undefined : String(input);
4148
4493
 
4149
4494
  const response = await this.$fetch(
@@ -4161,15 +4506,19 @@ export class TestApi {
4161
4506
  throw new Error(
4162
4507
  \`Unknown response status \${response.status} returned by API\`,
4163
4508
  );
4164
- };
4509
+ }
4165
4510
 
4166
- public testNullable = async (
4511
+ public async testNullable(
4167
4512
  input: TestNullableRequest,
4168
- ): Promise<TestNullable200Response> => {
4169
- const pathParameters = $IO.TestNullableRequestPathParameters.toJson(input);
4170
- const queryParameters =
4513
+ ): Promise<TestNullable200Response> {
4514
+ const pathParameters: { [key: string]: any } =
4515
+ $IO.TestNullableRequestPathParameters.toJson(input);
4516
+ const queryParameters: { [key: string]: any } =
4171
4517
  $IO.TestNullableRequestQueryParameters.toJson(input);
4172
- const headerParameters = {};
4518
+ const headerParameters: { [key: string]: any } = {};
4519
+ if (!this.$config.options?.omitContentTypeHeader) {
4520
+ headerParameters['Content-Type'] = 'application/json';
4521
+ }
4173
4522
  const collectionFormats = {
4174
4523
  queryString: 'multi',
4175
4524
  queryNumber: 'multi',
@@ -4205,7 +4554,7 @@ export class TestApi {
4205
4554
  throw new Error(
4206
4555
  \`Unknown response status \${response.status} returned by API\`,
4207
4556
  );
4208
- };
4557
+ }
4209
4558
  }
4210
4559
  "
4211
4560
  `;
@@ -4239,7 +4588,7 @@ exports[`openApiTsClientGenerator > should handle number and string constraints
4239
4588
  * Utility for serialisation and deserialisation of API types.
4240
4589
  */
4241
4590
  class $IO {
4242
- private static mapValues = (data: any, fn: (item: any) => any) =>
4591
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
4243
4592
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
4244
4593
 
4245
4594
  public static TestConstraints200Response = {
@@ -4343,8 +4692,26 @@ class $IO {
4343
4692
  * Client configuration for TestApi
4344
4693
  */
4345
4694
  export interface TestApiConfig {
4695
+ /**
4696
+ * Base URL for the API
4697
+ */
4346
4698
  url: string;
4699
+ /**
4700
+ * Custom instance of fetch. By default the global 'fetch' is used.
4701
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
4702
+ */
4347
4703
  fetch?: typeof fetch;
4704
+ /**
4705
+ * Additional configuration
4706
+ */
4707
+ options?: {
4708
+ /**
4709
+ * By default, the client will add a Content-Type header, set to the media type defined for
4710
+ * the request in the OpenAPI specification.
4711
+ * Set this to false to omit this header.
4712
+ */
4713
+ omitContentTypeHeader?: boolean;
4714
+ };
4348
4715
  }
4349
4716
 
4350
4717
  /**
@@ -4355,6 +4722,8 @@ export class TestApi {
4355
4722
 
4356
4723
  constructor(config: TestApiConfig) {
4357
4724
  this.$config = config;
4725
+
4726
+ this.testConstraints = this.testConstraints.bind(this);
4358
4727
  }
4359
4728
 
4360
4729
  private $url = (
@@ -4403,12 +4772,15 @@ export class TestApi {
4403
4772
  private $fetch: typeof fetch = (...args) =>
4404
4773
  (this.$config.fetch ?? fetch)(...args);
4405
4774
 
4406
- public testConstraints = async (
4775
+ public async testConstraints(
4407
4776
  input?: TestConstraintsRequest,
4408
- ): Promise<TestConstraints200Response> => {
4409
- const pathParameters = {};
4410
- const queryParameters = {};
4411
- const headerParameters = {};
4777
+ ): Promise<TestConstraints200Response> {
4778
+ const pathParameters: { [key: string]: any } = {};
4779
+ const queryParameters: { [key: string]: any } = {};
4780
+ const headerParameters: { [key: string]: any } = {};
4781
+ if (!this.$config.options?.omitContentTypeHeader) {
4782
+ headerParameters['Content-Type'] = 'application/json';
4783
+ }
4412
4784
  const body =
4413
4785
  input === undefined
4414
4786
  ? undefined
@@ -4431,7 +4803,7 @@ export class TestApi {
4431
4803
  throw new Error(
4432
4804
  \`Unknown response status \${response.status} returned by API\`,
4433
4805
  );
4434
- };
4806
+ }
4435
4807
  }
4436
4808
  "
4437
4809
  `;
@@ -4451,7 +4823,7 @@ exports[`openApiTsClientGenerator > should handle only default response 2`] = `
4451
4823
  * Utility for serialisation and deserialisation of API types.
4452
4824
  */
4453
4825
  class $IO {
4454
- private static mapValues = (data: any, fn: (item: any) => any) =>
4826
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
4455
4827
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
4456
4828
 
4457
4829
  public static GetTestdefaultResponse = {
@@ -4482,8 +4854,26 @@ class $IO {
4482
4854
  * Client configuration for TestApi
4483
4855
  */
4484
4856
  export interface TestApiConfig {
4857
+ /**
4858
+ * Base URL for the API
4859
+ */
4485
4860
  url: string;
4861
+ /**
4862
+ * Custom instance of fetch. By default the global 'fetch' is used.
4863
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
4864
+ */
4486
4865
  fetch?: typeof fetch;
4866
+ /**
4867
+ * Additional configuration
4868
+ */
4869
+ options?: {
4870
+ /**
4871
+ * By default, the client will add a Content-Type header, set to the media type defined for
4872
+ * the request in the OpenAPI specification.
4873
+ * Set this to false to omit this header.
4874
+ */
4875
+ omitContentTypeHeader?: boolean;
4876
+ };
4487
4877
  }
4488
4878
 
4489
4879
  /**
@@ -4494,6 +4884,8 @@ export class TestApi {
4494
4884
 
4495
4885
  constructor(config: TestApiConfig) {
4496
4886
  this.$config = config;
4887
+
4888
+ this.getTest = this.getTest.bind(this);
4497
4889
  }
4498
4890
 
4499
4891
  private $url = (
@@ -4542,10 +4934,10 @@ export class TestApi {
4542
4934
  private $fetch: typeof fetch = (...args) =>
4543
4935
  (this.$config.fetch ?? fetch)(...args);
4544
4936
 
4545
- public getTest = async (): Promise<GetTestdefaultResponse> => {
4546
- const pathParameters = {};
4547
- const queryParameters = {};
4548
- const headerParameters = {};
4937
+ public async getTest(): Promise<GetTestdefaultResponse> {
4938
+ const pathParameters: { [key: string]: any } = {};
4939
+ const queryParameters: { [key: string]: any } = {};
4940
+ const headerParameters: { [key: string]: any } = {};
4549
4941
 
4550
4942
  const body = undefined;
4551
4943
 
@@ -4559,7 +4951,7 @@ export class TestApi {
4559
4951
  );
4560
4952
 
4561
4953
  return $IO.GetTestdefaultResponse.fromJson(await response.json());
4562
- };
4954
+ }
4563
4955
  }
4564
4956
  "
4565
4957
  `;
@@ -4577,7 +4969,7 @@ exports[`openApiTsClientGenerator > should handle operation tags and multiple se
4577
4969
  * Utility for serialisation and deserialisation of API types.
4578
4970
  */
4579
4971
  class $IO {
4580
- private static mapValues = (data: any, fn: (item: any) => any) =>
4972
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
4581
4973
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
4582
4974
  }
4583
4975
 
@@ -4585,8 +4977,26 @@ class $IO {
4585
4977
  * Client configuration for TestApi
4586
4978
  */
4587
4979
  export interface TestApiConfig {
4980
+ /**
4981
+ * Base URL for the API
4982
+ */
4588
4983
  url: string;
4984
+ /**
4985
+ * Custom instance of fetch. By default the global 'fetch' is used.
4986
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
4987
+ */
4589
4988
  fetch?: typeof fetch;
4989
+ /**
4990
+ * Additional configuration
4991
+ */
4992
+ options?: {
4993
+ /**
4994
+ * By default, the client will add a Content-Type header, set to the media type defined for
4995
+ * the request in the OpenAPI specification.
4996
+ * Set this to false to omit this header.
4997
+ */
4998
+ omitContentTypeHeader?: boolean;
4999
+ };
4590
5000
  }
4591
5001
 
4592
5002
  /**
@@ -4597,6 +5007,11 @@ export class TestApi {
4597
5007
 
4598
5008
  constructor(config: TestApiConfig) {
4599
5009
  this.$config = config;
5010
+
5011
+ this._createUser = this._createUser.bind(this);
5012
+ this._getItems = this._getItems.bind(this);
5013
+ this.getStatus = this.getStatus.bind(this);
5014
+ this._getUsers = this._getUsers.bind(this);
4600
5015
  }
4601
5016
 
4602
5017
  private $url = (
@@ -4645,10 +5060,10 @@ export class TestApi {
4645
5060
  private $fetch: typeof fetch = (...args) =>
4646
5061
  (this.$config.fetch ?? fetch)(...args);
4647
5062
 
4648
- private _createUser = async (): Promise<string> => {
4649
- const pathParameters = {};
4650
- const queryParameters = {};
4651
- const headerParameters = {};
5063
+ private async _createUser(): Promise<string> {
5064
+ const pathParameters: { [key: string]: any } = {};
5065
+ const queryParameters: { [key: string]: any } = {};
5066
+ const headerParameters: { [key: string]: any } = {};
4652
5067
 
4653
5068
  const body = undefined;
4654
5069
 
@@ -4667,15 +5082,15 @@ export class TestApi {
4667
5082
  throw new Error(
4668
5083
  \`Unknown response status \${response.status} returned by API\`,
4669
5084
  );
4670
- };
5085
+ }
4671
5086
 
4672
5087
  /**
4673
5088
  * Returns a list of all the items
4674
5089
  */
4675
- private _getItems = async (): Promise<Array<string>> => {
4676
- const pathParameters = {};
4677
- const queryParameters = {};
4678
- const headerParameters = {};
5090
+ private async _getItems(): Promise<Array<string>> {
5091
+ const pathParameters: { [key: string]: any } = {};
5092
+ const queryParameters: { [key: string]: any } = {};
5093
+ const headerParameters: { [key: string]: any } = {};
4679
5094
 
4680
5095
  const body = undefined;
4681
5096
 
@@ -4689,17 +5104,17 @@ export class TestApi {
4689
5104
  );
4690
5105
 
4691
5106
  if (response.status === 200) {
4692
- return (await response.json()) as Array<string>;
5107
+ return await response.json();
4693
5108
  }
4694
5109
  throw new Error(
4695
5110
  \`Unknown response status \${response.status} returned by API\`,
4696
5111
  );
4697
- };
5112
+ }
4698
5113
 
4699
- public getStatus = async (): Promise<string> => {
4700
- const pathParameters = {};
4701
- const queryParameters = {};
4702
- const headerParameters = {};
5114
+ public async getStatus(): Promise<string> {
5115
+ const pathParameters: { [key: string]: any } = {};
5116
+ const queryParameters: { [key: string]: any } = {};
5117
+ const headerParameters: { [key: string]: any } = {};
4703
5118
 
4704
5119
  const body = undefined;
4705
5120
 
@@ -4718,12 +5133,12 @@ export class TestApi {
4718
5133
  throw new Error(
4719
5134
  \`Unknown response status \${response.status} returned by API\`,
4720
5135
  );
4721
- };
5136
+ }
4722
5137
 
4723
- private _getUsers = async (): Promise<Array<string>> => {
4724
- const pathParameters = {};
4725
- const queryParameters = {};
4726
- const headerParameters = {};
5138
+ private async _getUsers(): Promise<Array<string>> {
5139
+ const pathParameters: { [key: string]: any } = {};
5140
+ const queryParameters: { [key: string]: any } = {};
5141
+ const headerParameters: { [key: string]: any } = {};
4727
5142
 
4728
5143
  const body = undefined;
4729
5144
 
@@ -4737,19 +5152,19 @@ export class TestApi {
4737
5152
  );
4738
5153
 
4739
5154
  if (response.status === 200) {
4740
- return (await response.json()) as Array<string>;
5155
+ return await response.json();
4741
5156
  }
4742
5157
  throw new Error(
4743
5158
  \`Unknown response status \${response.status} returned by API\`,
4744
5159
  );
4745
- };
5160
+ }
4746
5161
 
4747
5162
  /**
4748
5163
  * users operations
4749
5164
  */
4750
5165
  public users = {
4751
- createUser: this._createUser,
4752
- getUsers: this._getUsers,
5166
+ createUser: this._createUser.bind(this),
5167
+ getUsers: this._getUsers.bind(this),
4753
5168
  };
4754
5169
 
4755
5170
  /**
@@ -4759,7 +5174,7 @@ export class TestApi {
4759
5174
  /**
4760
5175
  * Returns a list of all the items
4761
5176
  */
4762
- getItems: this._getItems,
5177
+ getItems: this._getItems.bind(this),
4763
5178
  };
4764
5179
  }
4765
5180
  "
@@ -4849,7 +5264,7 @@ exports[`openApiTsClientGenerator > should handle operations with complex map ty
4849
5264
  * Utility for serialisation and deserialisation of API types.
4850
5265
  */
4851
5266
  class $IO {
4852
- private static mapValues = (data: any, fn: (item: any) => any) =>
5267
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
4853
5268
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
4854
5269
 
4855
5270
  public static PostMapOfArraysOfObjectsRequestContent = {
@@ -4858,7 +5273,7 @@ class $IO {
4858
5273
  return model;
4859
5274
  }
4860
5275
  return {
4861
- ...$IO.mapValues(model, (item0) =>
5276
+ ...$IO.$mapValues(model, (item0) =>
4862
5277
  item0.map($IO.PostMapOfArraysOfObjectsRequestContentValueItem.toJson),
4863
5278
  ),
4864
5279
  };
@@ -4868,7 +5283,7 @@ class $IO {
4868
5283
  return json;
4869
5284
  }
4870
5285
  return {
4871
- ...$IO.mapValues(json, (item0) =>
5286
+ ...$IO.$mapValues(json, (item0) =>
4872
5287
  item0.map(
4873
5288
  $IO.PostMapOfArraysOfObjectsRequestContentValueItem.fromJson,
4874
5289
  ),
@@ -4969,7 +5384,10 @@ class $IO {
4969
5384
  return model;
4970
5385
  }
4971
5386
  return {
4972
- ...$IO.mapValues(model, $IO.PostMapOfObjectsRequestContentValue.toJson),
5387
+ ...$IO.$mapValues(
5388
+ model,
5389
+ $IO.PostMapOfObjectsRequestContentValue.toJson,
5390
+ ),
4973
5391
  };
4974
5392
  },
4975
5393
  fromJson: (json: any): PostMapOfObjectsRequestContent => {
@@ -4977,7 +5395,7 @@ class $IO {
4977
5395
  return json;
4978
5396
  }
4979
5397
  return {
4980
- ...$IO.mapValues(
5398
+ ...$IO.$mapValues(
4981
5399
  json,
4982
5400
  $IO.PostMapOfObjectsRequestContentValue.fromJson,
4983
5401
  ),
@@ -5019,8 +5437,26 @@ class $IO {
5019
5437
  * Client configuration for TestApi
5020
5438
  */
5021
5439
  export interface TestApiConfig {
5440
+ /**
5441
+ * Base URL for the API
5442
+ */
5022
5443
  url: string;
5444
+ /**
5445
+ * Custom instance of fetch. By default the global 'fetch' is used.
5446
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
5447
+ */
5023
5448
  fetch?: typeof fetch;
5449
+ /**
5450
+ * Additional configuration
5451
+ */
5452
+ options?: {
5453
+ /**
5454
+ * By default, the client will add a Content-Type header, set to the media type defined for
5455
+ * the request in the OpenAPI specification.
5456
+ * Set this to false to omit this header.
5457
+ */
5458
+ omitContentTypeHeader?: boolean;
5459
+ };
5024
5460
  }
5025
5461
 
5026
5462
  /**
@@ -5031,6 +5467,16 @@ export class TestApi {
5031
5467
 
5032
5468
  constructor(config: TestApiConfig) {
5033
5469
  this.$config = config;
5470
+
5471
+ this.postArrayOfMapsOfArraysOfNumbers =
5472
+ this.postArrayOfMapsOfArraysOfNumbers.bind(this);
5473
+ this.postArrayOfMapsOfNumbers = this.postArrayOfMapsOfNumbers.bind(this);
5474
+ this.postMapOfArraysOfObjects = this.postMapOfArraysOfObjects.bind(this);
5475
+ this.postMapOfMapsOfArraysOfNumbers =
5476
+ this.postMapOfMapsOfArraysOfNumbers.bind(this);
5477
+ this.postMapOfMapsOfNumbers = this.postMapOfMapsOfNumbers.bind(this);
5478
+ this.postMapOfNumbers = this.postMapOfNumbers.bind(this);
5479
+ this.postMapOfObjects = this.postMapOfObjects.bind(this);
5034
5480
  }
5035
5481
 
5036
5482
  private $url = (
@@ -5079,12 +5525,15 @@ export class TestApi {
5079
5525
  private $fetch: typeof fetch = (...args) =>
5080
5526
  (this.$config.fetch ?? fetch)(...args);
5081
5527
 
5082
- public postArrayOfMapsOfArraysOfNumbers = async (
5528
+ public async postArrayOfMapsOfArraysOfNumbers(
5083
5529
  input?: PostArrayOfMapsOfArraysOfNumbersRequest,
5084
- ): Promise<string> => {
5085
- const pathParameters = {};
5086
- const queryParameters = {};
5087
- const headerParameters = {};
5530
+ ): Promise<string> {
5531
+ const pathParameters: { [key: string]: any } = {};
5532
+ const queryParameters: { [key: string]: any } = {};
5533
+ const headerParameters: { [key: string]: any } = {};
5534
+ if (!this.$config.options?.omitContentTypeHeader) {
5535
+ headerParameters['Content-Type'] = 'application/json';
5536
+ }
5088
5537
  const body =
5089
5538
  input === undefined
5090
5539
  ? undefined
@@ -5111,14 +5560,17 @@ export class TestApi {
5111
5560
  throw new Error(
5112
5561
  \`Unknown response status \${response.status} returned by API\`,
5113
5562
  );
5114
- };
5563
+ }
5115
5564
 
5116
- public postArrayOfMapsOfNumbers = async (
5565
+ public async postArrayOfMapsOfNumbers(
5117
5566
  input?: PostArrayOfMapsOfNumbersRequest,
5118
- ): Promise<string> => {
5119
- const pathParameters = {};
5120
- const queryParameters = {};
5121
- const headerParameters = {};
5567
+ ): Promise<string> {
5568
+ const pathParameters: { [key: string]: any } = {};
5569
+ const queryParameters: { [key: string]: any } = {};
5570
+ const headerParameters: { [key: string]: any } = {};
5571
+ if (!this.$config.options?.omitContentTypeHeader) {
5572
+ headerParameters['Content-Type'] = 'application/json';
5573
+ }
5122
5574
  const body =
5123
5575
  input === undefined
5124
5576
  ? undefined
@@ -5141,14 +5593,17 @@ export class TestApi {
5141
5593
  throw new Error(
5142
5594
  \`Unknown response status \${response.status} returned by API\`,
5143
5595
  );
5144
- };
5596
+ }
5145
5597
 
5146
- public postMapOfArraysOfObjects = async (
5598
+ public async postMapOfArraysOfObjects(
5147
5599
  input?: PostMapOfArraysOfObjectsRequest,
5148
- ): Promise<string> => {
5149
- const pathParameters = {};
5150
- const queryParameters = {};
5151
- const headerParameters = {};
5600
+ ): Promise<string> {
5601
+ const pathParameters: { [key: string]: any } = {};
5602
+ const queryParameters: { [key: string]: any } = {};
5603
+ const headerParameters: { [key: string]: any } = {};
5604
+ if (!this.$config.options?.omitContentTypeHeader) {
5605
+ headerParameters['Content-Type'] = 'application/json';
5606
+ }
5152
5607
  const body =
5153
5608
  input === undefined
5154
5609
  ? undefined
@@ -5173,14 +5628,17 @@ export class TestApi {
5173
5628
  throw new Error(
5174
5629
  \`Unknown response status \${response.status} returned by API\`,
5175
5630
  );
5176
- };
5631
+ }
5177
5632
 
5178
- public postMapOfMapsOfArraysOfNumbers = async (
5633
+ public async postMapOfMapsOfArraysOfNumbers(
5179
5634
  input?: PostMapOfMapsOfArraysOfNumbersRequest,
5180
- ): Promise<string> => {
5181
- const pathParameters = {};
5182
- const queryParameters = {};
5183
- const headerParameters = {};
5635
+ ): Promise<string> {
5636
+ const pathParameters: { [key: string]: any } = {};
5637
+ const queryParameters: { [key: string]: any } = {};
5638
+ const headerParameters: { [key: string]: any } = {};
5639
+ if (!this.$config.options?.omitContentTypeHeader) {
5640
+ headerParameters['Content-Type'] = 'application/json';
5641
+ }
5184
5642
  const body =
5185
5643
  input === undefined
5186
5644
  ? undefined
@@ -5211,14 +5669,17 @@ export class TestApi {
5211
5669
  throw new Error(
5212
5670
  \`Unknown response status \${response.status} returned by API\`,
5213
5671
  );
5214
- };
5672
+ }
5215
5673
 
5216
- public postMapOfMapsOfNumbers = async (
5674
+ public async postMapOfMapsOfNumbers(
5217
5675
  input?: PostMapOfMapsOfNumbersRequest,
5218
- ): Promise<string> => {
5219
- const pathParameters = {};
5220
- const queryParameters = {};
5221
- const headerParameters = {};
5676
+ ): Promise<string> {
5677
+ const pathParameters: { [key: string]: any } = {};
5678
+ const queryParameters: { [key: string]: any } = {};
5679
+ const headerParameters: { [key: string]: any } = {};
5680
+ if (!this.$config.options?.omitContentTypeHeader) {
5681
+ headerParameters['Content-Type'] = 'application/json';
5682
+ }
5222
5683
  const body =
5223
5684
  input === undefined
5224
5685
  ? undefined
@@ -5243,14 +5704,17 @@ export class TestApi {
5243
5704
  throw new Error(
5244
5705
  \`Unknown response status \${response.status} returned by API\`,
5245
5706
  );
5246
- };
5707
+ }
5247
5708
 
5248
- public postMapOfNumbers = async (
5709
+ public async postMapOfNumbers(
5249
5710
  input?: PostMapOfNumbersRequest,
5250
- ): Promise<string> => {
5251
- const pathParameters = {};
5252
- const queryParameters = {};
5253
- const headerParameters = {};
5711
+ ): Promise<string> {
5712
+ const pathParameters: { [key: string]: any } = {};
5713
+ const queryParameters: { [key: string]: any } = {};
5714
+ const headerParameters: { [key: string]: any } = {};
5715
+ if (!this.$config.options?.omitContentTypeHeader) {
5716
+ headerParameters['Content-Type'] = 'application/json';
5717
+ }
5254
5718
  const body =
5255
5719
  input === undefined
5256
5720
  ? undefined
@@ -5273,14 +5737,17 @@ export class TestApi {
5273
5737
  throw new Error(
5274
5738
  \`Unknown response status \${response.status} returned by API\`,
5275
5739
  );
5276
- };
5740
+ }
5277
5741
 
5278
- public postMapOfObjects = async (
5742
+ public async postMapOfObjects(
5279
5743
  input?: PostMapOfObjectsRequest,
5280
- ): Promise<string> => {
5281
- const pathParameters = {};
5282
- const queryParameters = {};
5283
- const headerParameters = {};
5744
+ ): Promise<string> {
5745
+ const pathParameters: { [key: string]: any } = {};
5746
+ const queryParameters: { [key: string]: any } = {};
5747
+ const headerParameters: { [key: string]: any } = {};
5748
+ if (!this.$config.options?.omitContentTypeHeader) {
5749
+ headerParameters['Content-Type'] = 'application/json';
5750
+ }
5284
5751
  const body =
5285
5752
  input === undefined
5286
5753
  ? undefined
@@ -5303,7 +5770,7 @@ export class TestApi {
5303
5770
  throw new Error(
5304
5771
  \`Unknown response status \${response.status} returned by API\`,
5305
5772
  );
5306
- };
5773
+ }
5307
5774
  }
5308
5775
  "
5309
5776
  `;
@@ -5319,7 +5786,7 @@ exports[`openApiTsClientGenerator > should handle operations with multiple tags
5319
5786
  * Utility for serialisation and deserialisation of API types.
5320
5787
  */
5321
5788
  class $IO {
5322
- private static mapValues = (data: any, fn: (item: any) => any) =>
5789
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
5323
5790
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
5324
5791
  }
5325
5792
 
@@ -5327,8 +5794,26 @@ class $IO {
5327
5794
  * Client configuration for TestApi
5328
5795
  */
5329
5796
  export interface TestApiConfig {
5797
+ /**
5798
+ * Base URL for the API
5799
+ */
5330
5800
  url: string;
5801
+ /**
5802
+ * Custom instance of fetch. By default the global 'fetch' is used.
5803
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
5804
+ */
5331
5805
  fetch?: typeof fetch;
5806
+ /**
5807
+ * Additional configuration
5808
+ */
5809
+ options?: {
5810
+ /**
5811
+ * By default, the client will add a Content-Type header, set to the media type defined for
5812
+ * the request in the OpenAPI specification.
5813
+ * Set this to false to omit this header.
5814
+ */
5815
+ omitContentTypeHeader?: boolean;
5816
+ };
5332
5817
  }
5333
5818
 
5334
5819
  /**
@@ -5339,6 +5824,9 @@ export class TestApi {
5339
5824
 
5340
5825
  constructor(config: TestApiConfig) {
5341
5826
  this.$config = config;
5827
+
5828
+ this._getMultiTagged = this._getMultiTagged.bind(this);
5829
+ this._postMultiTagged = this._postMultiTagged.bind(this);
5342
5830
  }
5343
5831
 
5344
5832
  private $url = (
@@ -5387,10 +5875,10 @@ export class TestApi {
5387
5875
  private $fetch: typeof fetch = (...args) =>
5388
5876
  (this.$config.fetch ?? fetch)(...args);
5389
5877
 
5390
- private _getMultiTagged = async (): Promise<string> => {
5391
- const pathParameters = {};
5392
- const queryParameters = {};
5393
- const headerParameters = {};
5878
+ private async _getMultiTagged(): Promise<string> {
5879
+ const pathParameters: { [key: string]: any } = {};
5880
+ const queryParameters: { [key: string]: any } = {};
5881
+ const headerParameters: { [key: string]: any } = {};
5394
5882
 
5395
5883
  const body = undefined;
5396
5884
 
@@ -5409,12 +5897,12 @@ export class TestApi {
5409
5897
  throw new Error(
5410
5898
  \`Unknown response status \${response.status} returned by API\`,
5411
5899
  );
5412
- };
5900
+ }
5413
5901
 
5414
- private _postMultiTagged = async (): Promise<number> => {
5415
- const pathParameters = {};
5416
- const queryParameters = {};
5417
- const headerParameters = {};
5902
+ private async _postMultiTagged(): Promise<number> {
5903
+ const pathParameters: { [key: string]: any } = {};
5904
+ const queryParameters: { [key: string]: any } = {};
5905
+ const headerParameters: { [key: string]: any } = {};
5418
5906
 
5419
5907
  const body = undefined;
5420
5908
 
@@ -5433,29 +5921,29 @@ export class TestApi {
5433
5921
  throw new Error(
5434
5922
  \`Unknown response status \${response.status} returned by API\`,
5435
5923
  );
5436
- };
5924
+ }
5437
5925
 
5438
5926
  /**
5439
5927
  * tag1 operations
5440
5928
  */
5441
5929
  public tag1 = {
5442
- getMultiTagged: this._getMultiTagged,
5443
- postMultiTagged: this._postMultiTagged,
5930
+ getMultiTagged: this._getMultiTagged.bind(this),
5931
+ postMultiTagged: this._postMultiTagged.bind(this),
5444
5932
  };
5445
5933
 
5446
5934
  /**
5447
5935
  * tag2 operations
5448
5936
  */
5449
5937
  public tag2 = {
5450
- getMultiTagged: this._getMultiTagged,
5938
+ getMultiTagged: this._getMultiTagged.bind(this),
5451
5939
  };
5452
5940
 
5453
5941
  /**
5454
5942
  * tag3 operations
5455
5943
  */
5456
5944
  public tag3 = {
5457
- getMultiTagged: this._getMultiTagged,
5458
- postMultiTagged: this._postMultiTagged,
5945
+ getMultiTagged: this._getMultiTagged.bind(this),
5946
+ postMultiTagged: this._postMultiTagged.bind(this),
5459
5947
  };
5460
5948
  }
5461
5949
  "
@@ -5527,7 +6015,7 @@ exports[`openApiTsClientGenerator > should handle operations with simple request
5527
6015
  * Utility for serialisation and deserialisation of API types.
5528
6016
  */
5529
6017
  class $IO {
5530
- private static mapValues = (data: any, fn: (item: any) => any) =>
6018
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
5531
6019
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
5532
6020
 
5533
6021
  public static PostBooleanWithQueryRequestBodyParameters = {
@@ -5697,8 +6185,26 @@ class $IO {
5697
6185
  * Client configuration for TestApi
5698
6186
  */
5699
6187
  export interface TestApiConfig {
6188
+ /**
6189
+ * Base URL for the API
6190
+ */
5700
6191
  url: string;
6192
+ /**
6193
+ * Custom instance of fetch. By default the global 'fetch' is used.
6194
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
6195
+ */
5701
6196
  fetch?: typeof fetch;
6197
+ /**
6198
+ * Additional configuration
6199
+ */
6200
+ options?: {
6201
+ /**
6202
+ * By default, the client will add a Content-Type header, set to the media type defined for
6203
+ * the request in the OpenAPI specification.
6204
+ * Set this to false to omit this header.
6205
+ */
6206
+ omitContentTypeHeader?: boolean;
6207
+ };
5702
6208
  }
5703
6209
 
5704
6210
  /**
@@ -5709,6 +6215,13 @@ export class TestApi {
5709
6215
 
5710
6216
  constructor(config: TestApiConfig) {
5711
6217
  this.$config = config;
6218
+
6219
+ this.postBoolean = this.postBoolean.bind(this);
6220
+ this.postBooleanWithQuery = this.postBooleanWithQuery.bind(this);
6221
+ this.postNumber = this.postNumber.bind(this);
6222
+ this.postNumberWithQuery = this.postNumberWithQuery.bind(this);
6223
+ this.postString = this.postString.bind(this);
6224
+ this.postStringWithQuery = this.postStringWithQuery.bind(this);
5712
6225
  }
5713
6226
 
5714
6227
  private $url = (
@@ -5757,10 +6270,13 @@ export class TestApi {
5757
6270
  private $fetch: typeof fetch = (...args) =>
5758
6271
  (this.$config.fetch ?? fetch)(...args);
5759
6272
 
5760
- public postBoolean = async (input?: PostBooleanRequest): Promise<string> => {
5761
- const pathParameters = {};
5762
- const queryParameters = {};
5763
- const headerParameters = {};
6273
+ public async postBoolean(input?: PostBooleanRequest): Promise<string> {
6274
+ const pathParameters: { [key: string]: any } = {};
6275
+ const queryParameters: { [key: string]: any } = {};
6276
+ const headerParameters: { [key: string]: any } = {};
6277
+ if (!this.$config.options?.omitContentTypeHeader) {
6278
+ headerParameters['Content-Type'] = 'application/json';
6279
+ }
5764
6280
  const body = input === undefined ? undefined : String(input);
5765
6281
 
5766
6282
  const response = await this.$fetch(
@@ -5778,15 +6294,18 @@ export class TestApi {
5778
6294
  throw new Error(
5779
6295
  \`Unknown response status \${response.status} returned by API\`,
5780
6296
  );
5781
- };
6297
+ }
5782
6298
 
5783
- public postBooleanWithQuery = async (
6299
+ public async postBooleanWithQuery(
5784
6300
  input: PostBooleanWithQueryRequest,
5785
- ): Promise<string> => {
5786
- const pathParameters = {};
5787
- const queryParameters =
6301
+ ): Promise<string> {
6302
+ const pathParameters: { [key: string]: any } = {};
6303
+ const queryParameters: { [key: string]: any } =
5788
6304
  $IO.PostBooleanWithQueryRequestQueryParameters.toJson(input);
5789
- const headerParameters = {};
6305
+ const headerParameters: { [key: string]: any } = {};
6306
+ if (!this.$config.options?.omitContentTypeHeader) {
6307
+ headerParameters['Content-Type'] = 'application/json';
6308
+ }
5790
6309
  const collectionFormats = {
5791
6310
  filter: 'multi',
5792
6311
  } as const;
@@ -5812,12 +6331,15 @@ export class TestApi {
5812
6331
  throw new Error(
5813
6332
  \`Unknown response status \${response.status} returned by API\`,
5814
6333
  );
5815
- };
6334
+ }
5816
6335
 
5817
- public postNumber = async (input?: PostNumberRequest): Promise<string> => {
5818
- const pathParameters = {};
5819
- const queryParameters = {};
5820
- const headerParameters = {};
6336
+ public async postNumber(input?: PostNumberRequest): Promise<string> {
6337
+ const pathParameters: { [key: string]: any } = {};
6338
+ const queryParameters: { [key: string]: any } = {};
6339
+ const headerParameters: { [key: string]: any } = {};
6340
+ if (!this.$config.options?.omitContentTypeHeader) {
6341
+ headerParameters['Content-Type'] = 'application/json';
6342
+ }
5821
6343
  const body = input === undefined ? undefined : String(input);
5822
6344
 
5823
6345
  const response = await this.$fetch(
@@ -5835,15 +6357,18 @@ export class TestApi {
5835
6357
  throw new Error(
5836
6358
  \`Unknown response status \${response.status} returned by API\`,
5837
6359
  );
5838
- };
6360
+ }
5839
6361
 
5840
- public postNumberWithQuery = async (
6362
+ public async postNumberWithQuery(
5841
6363
  input: PostNumberWithQueryRequest,
5842
- ): Promise<string> => {
5843
- const pathParameters = {};
5844
- const queryParameters =
6364
+ ): Promise<string> {
6365
+ const pathParameters: { [key: string]: any } = {};
6366
+ const queryParameters: { [key: string]: any } =
5845
6367
  $IO.PostNumberWithQueryRequestQueryParameters.toJson(input);
5846
- const headerParameters = {};
6368
+ const headerParameters: { [key: string]: any } = {};
6369
+ if (!this.$config.options?.omitContentTypeHeader) {
6370
+ headerParameters['Content-Type'] = 'application/json';
6371
+ }
5847
6372
  const collectionFormats = {
5848
6373
  filter: 'multi',
5849
6374
  } as const;
@@ -5869,12 +6394,15 @@ export class TestApi {
5869
6394
  throw new Error(
5870
6395
  \`Unknown response status \${response.status} returned by API\`,
5871
6396
  );
5872
- };
6397
+ }
5873
6398
 
5874
- public postString = async (input?: PostStringRequest): Promise<string> => {
5875
- const pathParameters = {};
5876
- const queryParameters = {};
5877
- const headerParameters = {};
6399
+ public async postString(input?: PostStringRequest): Promise<string> {
6400
+ const pathParameters: { [key: string]: any } = {};
6401
+ const queryParameters: { [key: string]: any } = {};
6402
+ const headerParameters: { [key: string]: any } = {};
6403
+ if (!this.$config.options?.omitContentTypeHeader) {
6404
+ headerParameters['Content-Type'] = 'application/json';
6405
+ }
5878
6406
  const body = input === undefined ? undefined : String(input);
5879
6407
 
5880
6408
  const response = await this.$fetch(
@@ -5892,15 +6420,18 @@ export class TestApi {
5892
6420
  throw new Error(
5893
6421
  \`Unknown response status \${response.status} returned by API\`,
5894
6422
  );
5895
- };
6423
+ }
5896
6424
 
5897
- public postStringWithQuery = async (
6425
+ public async postStringWithQuery(
5898
6426
  input: PostStringWithQueryRequest,
5899
- ): Promise<string> => {
5900
- const pathParameters = {};
5901
- const queryParameters =
6427
+ ): Promise<string> {
6428
+ const pathParameters: { [key: string]: any } = {};
6429
+ const queryParameters: { [key: string]: any } =
5902
6430
  $IO.PostStringWithQueryRequestQueryParameters.toJson(input);
5903
- const headerParameters = {};
6431
+ const headerParameters: { [key: string]: any } = {};
6432
+ if (!this.$config.options?.omitContentTypeHeader) {
6433
+ headerParameters['Content-Type'] = 'application/json';
6434
+ }
5904
6435
  const collectionFormats = {
5905
6436
  filter: 'multi',
5906
6437
  } as const;
@@ -5926,7 +6457,7 @@ export class TestApi {
5926
6457
  throw new Error(
5927
6458
  \`Unknown response status \${response.status} returned by API\`,
5928
6459
  );
5929
- };
6460
+ }
5930
6461
  }
5931
6462
  "
5932
6463
  `;
@@ -5951,7 +6482,7 @@ exports[`openApiTsClientGenerator > should handle recursive schema references 2`
5951
6482
  * Utility for serialisation and deserialisation of API types.
5952
6483
  */
5953
6484
  class $IO {
5954
- private static mapValues = (data: any, fn: (item: any) => any) =>
6485
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
5955
6486
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
5956
6487
 
5957
6488
  public static TreeNode = {
@@ -6000,8 +6531,26 @@ class $IO {
6000
6531
  * Client configuration for TestApi
6001
6532
  */
6002
6533
  export interface TestApiConfig {
6534
+ /**
6535
+ * Base URL for the API
6536
+ */
6003
6537
  url: string;
6538
+ /**
6539
+ * Custom instance of fetch. By default the global 'fetch' is used.
6540
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
6541
+ */
6004
6542
  fetch?: typeof fetch;
6543
+ /**
6544
+ * Additional configuration
6545
+ */
6546
+ options?: {
6547
+ /**
6548
+ * By default, the client will add a Content-Type header, set to the media type defined for
6549
+ * the request in the OpenAPI specification.
6550
+ * Set this to false to omit this header.
6551
+ */
6552
+ omitContentTypeHeader?: boolean;
6553
+ };
6005
6554
  }
6006
6555
 
6007
6556
  /**
@@ -6012,6 +6561,9 @@ export class TestApi {
6012
6561
 
6013
6562
  constructor(config: TestApiConfig) {
6014
6563
  this.$config = config;
6564
+
6565
+ this.createTree = this.createTree.bind(this);
6566
+ this.getTree = this.getTree.bind(this);
6015
6567
  }
6016
6568
 
6017
6569
  private $url = (
@@ -6060,10 +6612,13 @@ export class TestApi {
6060
6612
  private $fetch: typeof fetch = (...args) =>
6061
6613
  (this.$config.fetch ?? fetch)(...args);
6062
6614
 
6063
- public createTree = async (input?: CreateTreeRequest): Promise<TreeNode> => {
6064
- const pathParameters = {};
6065
- const queryParameters = {};
6066
- const headerParameters = {};
6615
+ public async createTree(input?: CreateTreeRequest): Promise<TreeNode> {
6616
+ const pathParameters: { [key: string]: any } = {};
6617
+ const queryParameters: { [key: string]: any } = {};
6618
+ const headerParameters: { [key: string]: any } = {};
6619
+ if (!this.$config.options?.omitContentTypeHeader) {
6620
+ headerParameters['Content-Type'] = 'application/json';
6621
+ }
6067
6622
  const body =
6068
6623
  input === undefined
6069
6624
  ? undefined
@@ -6086,12 +6641,12 @@ export class TestApi {
6086
6641
  throw new Error(
6087
6642
  \`Unknown response status \${response.status} returned by API\`,
6088
6643
  );
6089
- };
6644
+ }
6090
6645
 
6091
- public getTree = async (): Promise<TreeNode> => {
6092
- const pathParameters = {};
6093
- const queryParameters = {};
6094
- const headerParameters = {};
6646
+ public async getTree(): Promise<TreeNode> {
6647
+ const pathParameters: { [key: string]: any } = {};
6648
+ const queryParameters: { [key: string]: any } = {};
6649
+ const headerParameters: { [key: string]: any } = {};
6095
6650
 
6096
6651
  const body = undefined;
6097
6652
 
@@ -6110,7 +6665,7 @@ export class TestApi {
6110
6665
  throw new Error(
6111
6666
  \`Unknown response status \${response.status} returned by API\`,
6112
6667
  );
6113
- };
6668
+ }
6114
6669
  }
6115
6670
  "
6116
6671
  `;
@@ -6155,7 +6710,7 @@ exports[`openApiTsClientGenerator > should handle refs and hoisting of inline sc
6155
6710
  * Utility for serialisation and deserialisation of API types.
6156
6711
  */
6157
6712
  class $IO {
6158
- private static mapValues = (data: any, fn: (item: any) => any) =>
6713
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
6159
6714
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
6160
6715
 
6161
6716
  public static Error = {
@@ -6307,8 +6862,26 @@ class $IO {
6307
6862
  * Client configuration for TestApi
6308
6863
  */
6309
6864
  export interface TestApiConfig {
6865
+ /**
6866
+ * Base URL for the API
6867
+ */
6310
6868
  url: string;
6869
+ /**
6870
+ * Custom instance of fetch. By default the global 'fetch' is used.
6871
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
6872
+ */
6311
6873
  fetch?: typeof fetch;
6874
+ /**
6875
+ * Additional configuration
6876
+ */
6877
+ options?: {
6878
+ /**
6879
+ * By default, the client will add a Content-Type header, set to the media type defined for
6880
+ * the request in the OpenAPI specification.
6881
+ * Set this to false to omit this header.
6882
+ */
6883
+ omitContentTypeHeader?: boolean;
6884
+ };
6312
6885
  }
6313
6886
 
6314
6887
  /**
@@ -6319,6 +6892,8 @@ export class TestApi {
6319
6892
 
6320
6893
  constructor(config: TestApiConfig) {
6321
6894
  this.$config = config;
6895
+
6896
+ this.postTest = this.postTest.bind(this);
6322
6897
  }
6323
6898
 
6324
6899
  private $url = (
@@ -6367,10 +6942,13 @@ export class TestApi {
6367
6942
  private $fetch: typeof fetch = (...args) =>
6368
6943
  (this.$config.fetch ?? fetch)(...args);
6369
6944
 
6370
- public postTest = async (input: PostTestRequest): Promise<void> => {
6371
- const pathParameters = {};
6372
- const queryParameters = {};
6373
- const headerParameters = {};
6945
+ public async postTest(input: PostTestRequest): Promise<void> {
6946
+ const pathParameters: { [key: string]: any } = {};
6947
+ const queryParameters: { [key: string]: any } = {};
6948
+ const headerParameters: { [key: string]: any } = {};
6949
+ if (!this.$config.options?.omitContentTypeHeader) {
6950
+ headerParameters['Content-Type'] = 'application/json';
6951
+ }
6374
6952
  const body =
6375
6953
  typeof input === 'object'
6376
6954
  ? JSON.stringify($IO.PostTestRequestContent.toJson(input))
@@ -6397,7 +6975,7 @@ export class TestApi {
6397
6975
  throw new Error(
6398
6976
  \`Unknown response status \${response.status} returned by API\`,
6399
6977
  );
6400
- };
6978
+ }
6401
6979
  }
6402
6980
  "
6403
6981
  `;
@@ -6440,7 +7018,7 @@ exports[`openApiTsClientGenerator > should handle request body property matching
6440
7018
  * Utility for serialisation and deserialisation of API types.
6441
7019
  */
6442
7020
  class $IO {
6443
- private static mapValues = (data: any, fn: (item: any) => any) =>
7021
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
6444
7022
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
6445
7023
 
6446
7024
  public static PostTest200Response = {
@@ -6585,8 +7163,26 @@ class $IO {
6585
7163
  * Client configuration for TestApi
6586
7164
  */
6587
7165
  export interface TestApiConfig {
7166
+ /**
7167
+ * Base URL for the API
7168
+ */
6588
7169
  url: string;
7170
+ /**
7171
+ * Custom instance of fetch. By default the global 'fetch' is used.
7172
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
7173
+ */
6589
7174
  fetch?: typeof fetch;
7175
+ /**
7176
+ * Additional configuration
7177
+ */
7178
+ options?: {
7179
+ /**
7180
+ * By default, the client will add a Content-Type header, set to the media type defined for
7181
+ * the request in the OpenAPI specification.
7182
+ * Set this to false to omit this header.
7183
+ */
7184
+ omitContentTypeHeader?: boolean;
7185
+ };
6590
7186
  }
6591
7187
 
6592
7188
  /**
@@ -6597,6 +7193,8 @@ export class TestApi {
6597
7193
 
6598
7194
  constructor(config: TestApiConfig) {
6599
7195
  this.$config = config;
7196
+
7197
+ this.postTest = this.postTest.bind(this);
6600
7198
  }
6601
7199
 
6602
7200
  private $url = (
@@ -6645,12 +7243,14 @@ export class TestApi {
6645
7243
  private $fetch: typeof fetch = (...args) =>
6646
7244
  (this.$config.fetch ?? fetch)(...args);
6647
7245
 
6648
- public postTest = async (
6649
- input: PostTestRequest,
6650
- ): Promise<PostTest200Response> => {
6651
- const pathParameters = {};
6652
- const queryParameters = $IO.PostTestRequestQueryParameters.toJson(input);
6653
- const headerParameters = {};
7246
+ public async postTest(input: PostTestRequest): Promise<PostTest200Response> {
7247
+ const pathParameters: { [key: string]: any } = {};
7248
+ const queryParameters: { [key: string]: any } =
7249
+ $IO.PostTestRequestQueryParameters.toJson(input);
7250
+ const headerParameters: { [key: string]: any } = {};
7251
+ if (!this.$config.options?.omitContentTypeHeader) {
7252
+ headerParameters['Content-Type'] = 'application/json';
7253
+ }
6654
7254
  const collectionFormats = {
6655
7255
  filter: 'multi',
6656
7256
  } as const;
@@ -6676,7 +7276,7 @@ export class TestApi {
6676
7276
  throw new Error(
6677
7277
  \`Unknown response status \${response.status} returned by API\`,
6678
7278
  );
6679
- };
7279
+ }
6680
7280
  }
6681
7281
  "
6682
7282
  `;
@@ -6718,7 +7318,7 @@ exports[`openApiTsClientGenerator > should handle special formats and vendor ext
6718
7318
  * Utility for serialisation and deserialisation of API types.
6719
7319
  */
6720
7320
  class $IO {
6721
- private static mapValues = (data: any, fn: (item: any) => any) =>
7321
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
6722
7322
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
6723
7323
 
6724
7324
  public static PostTest200Response = {
@@ -6887,8 +7487,26 @@ class $IO {
6887
7487
  * Client configuration for TestApi
6888
7488
  */
6889
7489
  export interface TestApiConfig {
7490
+ /**
7491
+ * Base URL for the API
7492
+ */
6890
7493
  url: string;
7494
+ /**
7495
+ * Custom instance of fetch. By default the global 'fetch' is used.
7496
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
7497
+ */
6891
7498
  fetch?: typeof fetch;
7499
+ /**
7500
+ * Additional configuration
7501
+ */
7502
+ options?: {
7503
+ /**
7504
+ * By default, the client will add a Content-Type header, set to the media type defined for
7505
+ * the request in the OpenAPI specification.
7506
+ * Set this to false to omit this header.
7507
+ */
7508
+ omitContentTypeHeader?: boolean;
7509
+ };
6892
7510
  }
6893
7511
 
6894
7512
  /**
@@ -6899,6 +7517,8 @@ export class TestApi {
6899
7517
 
6900
7518
  constructor(config: TestApiConfig) {
6901
7519
  this.$config = config;
7520
+
7521
+ this.postTest = this.postTest.bind(this);
6902
7522
  }
6903
7523
 
6904
7524
  private $url = (
@@ -6947,12 +7567,14 @@ export class TestApi {
6947
7567
  private $fetch: typeof fetch = (...args) =>
6948
7568
  (this.$config.fetch ?? fetch)(...args);
6949
7569
 
6950
- public postTest = async (
6951
- input: PostTestRequest,
6952
- ): Promise<PostTest200Response> => {
6953
- const pathParameters = {};
6954
- const queryParameters = $IO.PostTestRequestQueryParameters.toJson(input);
6955
- const headerParameters = {};
7570
+ public async postTest(input: PostTestRequest): Promise<PostTest200Response> {
7571
+ const pathParameters: { [key: string]: any } = {};
7572
+ const queryParameters: { [key: string]: any } =
7573
+ $IO.PostTestRequestQueryParameters.toJson(input);
7574
+ const headerParameters: { [key: string]: any } = {};
7575
+ if (!this.$config.options?.omitContentTypeHeader) {
7576
+ headerParameters['Content-Type'] = 'application/json';
7577
+ }
6956
7578
  const collectionFormats = {
6957
7579
  date: 'multi',
6958
7580
  timestamp: 'multi',
@@ -6979,7 +7601,7 @@ export class TestApi {
6979
7601
  throw new Error(
6980
7602
  \`Unknown response status \${response.status} returned by API\`,
6981
7603
  );
6982
- };
7604
+ }
6983
7605
  }
6984
7606
  "
6985
7607
  `;