typedapi-client-helpers 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.md +314 -167
  2. package/dist/api/generated/Import.d.ts +22 -0
  3. package/dist/api/generated/Import.d.ts.map +1 -0
  4. package/dist/api/generated/Import.js +48 -0
  5. package/dist/api/generated/Import.js.map +1 -0
  6. package/dist/api/generated/ImportRoute.d.ts +30 -0
  7. package/dist/api/generated/ImportRoute.d.ts.map +1 -0
  8. package/dist/api/generated/ImportRoute.js +13 -0
  9. package/dist/api/generated/ImportRoute.js.map +1 -0
  10. package/dist/api/generated/Order.d.ts +38 -0
  11. package/dist/api/generated/Order.d.ts.map +1 -0
  12. package/dist/api/generated/Order.js +75 -0
  13. package/dist/api/generated/Order.js.map +1 -0
  14. package/dist/api/generated/OrderRoute.d.ts +83 -0
  15. package/dist/api/generated/OrderRoute.d.ts.map +1 -0
  16. package/dist/api/generated/OrderRoute.js +13 -0
  17. package/dist/api/generated/OrderRoute.js.map +1 -0
  18. package/dist/api/generated/Product.d.ts +62 -0
  19. package/dist/api/generated/Product.d.ts.map +1 -0
  20. package/dist/api/generated/Product.js +114 -0
  21. package/dist/api/generated/Product.js.map +1 -0
  22. package/dist/api/generated/ProductRoute.d.ts +140 -0
  23. package/dist/api/generated/ProductRoute.d.ts.map +1 -0
  24. package/dist/api/generated/ProductRoute.js +13 -0
  25. package/dist/api/generated/ProductRoute.js.map +1 -0
  26. package/dist/api/generated/Report.d.ts +14 -0
  27. package/dist/api/generated/Report.d.ts.map +1 -0
  28. package/dist/api/generated/Report.js +32 -0
  29. package/dist/api/generated/Report.js.map +1 -0
  30. package/dist/api/generated/ReportRoute.d.ts +23 -0
  31. package/dist/api/generated/ReportRoute.d.ts.map +1 -0
  32. package/dist/api/generated/ReportRoute.js +13 -0
  33. package/dist/api/generated/ReportRoute.js.map +1 -0
  34. package/dist/api/generated/Supplier.d.ts +46 -0
  35. package/dist/api/generated/Supplier.d.ts.map +1 -0
  36. package/dist/api/generated/Supplier.js +87 -0
  37. package/dist/api/generated/Supplier.js.map +1 -0
  38. package/dist/api/generated/SupplierRoute.d.ts +101 -0
  39. package/dist/api/generated/SupplierRoute.d.ts.map +1 -0
  40. package/dist/api/generated/SupplierRoute.js +13 -0
  41. package/dist/api/generated/SupplierRoute.js.map +1 -0
  42. package/dist/api/generated/data-contracts.d.ts +277 -0
  43. package/dist/api/generated/data-contracts.d.ts.map +1 -0
  44. package/dist/api/generated/data-contracts.js +26 -0
  45. package/dist/api/generated/data-contracts.js.map +1 -0
  46. package/dist/api/generated/http-client.d.ts +61 -0
  47. package/dist/api/generated/http-client.d.ts.map +1 -0
  48. package/dist/api/generated/http-client.js +171 -0
  49. package/dist/api/generated/http-client.js.map +1 -0
  50. package/dist/api/index.d.ts +8 -0
  51. package/dist/api/index.d.ts.map +1 -0
  52. package/dist/api/index.js +8 -0
  53. package/dist/api/index.js.map +1 -0
  54. package/dist/api/methods/Import.api.d.ts +6 -0
  55. package/dist/api/methods/Import.api.d.ts.map +1 -0
  56. package/dist/api/methods/Import.api.js +27 -0
  57. package/dist/api/methods/Import.api.js.map +1 -0
  58. package/dist/api/methods/Order.api.d.ts +29 -0
  59. package/dist/api/methods/Order.api.d.ts.map +1 -0
  60. package/dist/api/methods/Order.api.js +52 -0
  61. package/dist/api/methods/Order.api.js.map +1 -0
  62. package/dist/api/methods/Product.api.d.ts +39 -0
  63. package/dist/api/methods/Product.api.d.ts.map +1 -0
  64. package/dist/api/methods/Product.api.js +69 -0
  65. package/dist/api/methods/Product.api.js.map +1 -0
  66. package/dist/api/methods/Report.api.d.ts +6 -0
  67. package/dist/api/methods/Report.api.d.ts.map +1 -0
  68. package/dist/api/methods/Report.api.js +19 -0
  69. package/dist/api/methods/Report.api.js.map +1 -0
  70. package/dist/api/methods/Supplier.api.d.ts +35 -0
  71. package/dist/api/methods/Supplier.api.d.ts.map +1 -0
  72. package/dist/api/methods/Supplier.api.js +63 -0
  73. package/dist/api/methods/Supplier.api.js.map +1 -0
  74. package/dist/index.cjs +47 -551
  75. package/dist/index.d.cts +108 -18
  76. package/dist/index.d.ts +108 -18
  77. package/dist/index.d.ts.map +1 -0
  78. package/dist/index.js +46 -551
  79. package/dist/index.js.map +1 -0
  80. package/dist/interfaces/ApiResult.d.ts +17 -0
  81. package/dist/interfaces/ApiResult.d.ts.map +1 -0
  82. package/dist/interfaces/ApiResult.js +2 -0
  83. package/dist/interfaces/ApiResult.js.map +1 -0
  84. package/dist/interfaces/Filter.d.ts +31 -0
  85. package/dist/interfaces/Filter.d.ts.map +1 -0
  86. package/dist/interfaces/Filter.js +2 -0
  87. package/dist/interfaces/Filter.js.map +1 -0
  88. package/dist/interfaces/SortType.d.ts +7 -0
  89. package/dist/interfaces/SortType.d.ts.map +1 -0
  90. package/dist/interfaces/SortType.js +2 -0
  91. package/dist/interfaces/SortType.js.map +1 -0
  92. package/dist/types/ApiCallOptions.d.ts +9 -0
  93. package/dist/types/ApiCallOptions.d.ts.map +1 -0
  94. package/dist/types/ApiCallOptions.js +2 -0
  95. package/dist/types/ApiCallOptions.js.map +1 -0
  96. package/dist/types/ApiMethodTypes.d.ts +24 -0
  97. package/dist/types/ApiMethodTypes.d.ts.map +1 -0
  98. package/dist/types/ApiMethodTypes.js +2 -0
  99. package/dist/types/ApiMethodTypes.js.map +1 -0
  100. package/dist/types/HttpResponse.d.ts +16 -0
  101. package/dist/types/HttpResponse.d.ts.map +1 -0
  102. package/dist/types/HttpResponse.js +2 -0
  103. package/dist/types/HttpResponse.js.map +1 -0
  104. package/dist/utils/SortTypeFromSortDirection.d.ts +22 -0
  105. package/dist/utils/SortTypeFromSortDirection.d.ts.map +1 -0
  106. package/dist/utils/SortTypeFromSortDirection.js +45 -0
  107. package/dist/utils/SortTypeFromSortDirection.js.map +1 -0
  108. package/dist/utils/buildQuery.d.ts +11 -0
  109. package/dist/utils/buildQuery.d.ts.map +1 -0
  110. package/dist/utils/buildQuery.js +94 -0
  111. package/dist/utils/buildQuery.js.map +1 -0
  112. package/dist/utils/extractArgsCallbacksAndParams.d.ts +22 -0
  113. package/dist/utils/extractArgsCallbacksAndParams.d.ts.map +1 -0
  114. package/dist/utils/extractArgsCallbacksAndParams.js +44 -0
  115. package/dist/utils/extractArgsCallbacksAndParams.js.map +1 -0
  116. package/dist/utils/extractArgsToastsAndParams.d.ts +18 -0
  117. package/dist/utils/extractArgsToastsAndParams.d.ts.map +1 -0
  118. package/dist/utils/extractArgsToastsAndParams.js +40 -0
  119. package/dist/utils/extractArgsToastsAndParams.js.map +1 -0
  120. package/dist/utils/handleApiResponse.d.ts +9 -0
  121. package/dist/utils/handleApiResponse.d.ts.map +1 -0
  122. package/dist/utils/handleApiResponse.js +49 -0
  123. package/dist/utils/handleApiResponse.js.map +1 -0
  124. package/dist/utils/toFormData.d.ts +8 -0
  125. package/dist/utils/toFormData.d.ts.map +1 -0
  126. package/dist/utils/toFormData.js +68 -0
  127. package/dist/utils/toFormData.js.map +1 -0
  128. package/package.json +5 -3
  129. package/scripts/generate-api-minimal.mjs +263 -25
package/dist/index.cjs CHANGED
@@ -22,6 +22,7 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  buildQuery: () => buildQuery,
24
24
  extractArgsCallbacksAndParams: () => extractArgsCallbacksAndParams,
25
+ extractArgsToastsAndParams: () => extractArgsToastsAndParams,
25
26
  getSortDirectionFromSortType: () => getSortDirectionFromSortType,
26
27
  getSortTypeFromSortDirection: () => getSortTypeFromSortDirection,
27
28
  handleApiResponse: () => handleApiResponse,
@@ -105,7 +106,7 @@ function isCallback(value) {
105
106
  function isRequestParams(value) {
106
107
  return typeof value === "object" && value !== null && !Array.isArray(value);
107
108
  }
108
- function extractArgsCallbacksAndParams(argsWithCallbacks) {
109
+ function extractArgsToastsAndParams(argsWithCallbacks) {
109
110
  const values = [...argsWithCallbacks];
110
111
  let onSuccess;
111
112
  let onError;
@@ -133,6 +134,41 @@ function extractArgsCallbacksAndParams(argsWithCallbacks) {
133
134
  };
134
135
  }
135
136
 
137
+ // src/utils/extractArgsCallbacksAndParams.ts
138
+ function isCallback2(value) {
139
+ return typeof value === "function";
140
+ }
141
+ function isRequestParams2(value) {
142
+ return typeof value === "object" && value !== null && !Array.isArray(value);
143
+ }
144
+ function extractArgsCallbacksAndParams(argsWithCallbacks) {
145
+ const values = [...argsWithCallbacks];
146
+ let onSuccess;
147
+ let onError;
148
+ let params;
149
+ let lastArgument = values[values.length - 1];
150
+ if (isRequestParams2(lastArgument)) {
151
+ params = lastArgument;
152
+ values.pop();
153
+ }
154
+ lastArgument = values[values.length - 1];
155
+ if (isCallback2(lastArgument)) {
156
+ onError = lastArgument;
157
+ values.pop();
158
+ }
159
+ lastArgument = values[values.length - 1];
160
+ if (isCallback2(lastArgument)) {
161
+ onSuccess = lastArgument;
162
+ values.pop();
163
+ }
164
+ return {
165
+ args: values,
166
+ onSuccess,
167
+ onError,
168
+ params
169
+ };
170
+ }
171
+
136
172
  // src/utils/handleApiResponse.ts
137
173
  async function readResponseBody(response) {
138
174
  if (response.status === 204) {
@@ -154,29 +190,32 @@ async function handleApiResponse(call, options) {
154
190
  response = await call();
155
191
  const data = await readResponseBody(response);
156
192
  if (response.ok) {
157
- await options?.onSuccess?.(data);
158
- return {
193
+ const result2 = {
159
194
  ok: true,
160
195
  status: response.status,
161
196
  response: data
162
197
  };
198
+ await options?.onSuccess?.(result2);
199
+ return result2;
163
200
  }
164
201
  const errorData = data;
165
- await options?.onError?.(errorData);
166
- return {
202
+ const result = {
167
203
  ok: false,
168
204
  status: response.status,
169
205
  response: data,
170
206
  error: errorData
171
207
  };
208
+ await options?.onError?.(result);
209
+ return result;
172
210
  } catch (error) {
173
- await options?.onError?.(error);
174
- return {
211
+ const result = {
175
212
  ok: false,
176
213
  status: error instanceof Response ? error.status : response?.status ?? 0,
177
214
  response: void 0,
178
215
  error
179
216
  };
217
+ await options?.onError?.(result);
218
+ return result;
180
219
  }
181
220
  }
182
221
 
@@ -211,514 +250,6 @@ function getSortDirectionFromSortType(sortType) {
211
250
  }
212
251
  }
213
252
 
214
- // src/api/generated/http-client.ts
215
- var HttpClient = class {
216
- constructor(apiConfig = {}) {
217
- this.baseUrl = "https://localhost:7000";
218
- this.securityData = null;
219
- this.abortControllers = /* @__PURE__ */ new Map();
220
- this.customFetch = (...fetchParams) => fetch(...fetchParams);
221
- this.baseApiParams = {
222
- credentials: "same-origin",
223
- headers: {},
224
- redirect: "follow",
225
- referrerPolicy: "no-referrer"
226
- };
227
- this.setSecurityData = (data) => {
228
- this.securityData = data;
229
- };
230
- this.contentFormatters = {
231
- ["application/json" /* Json */]: (input) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
232
- ["application/vnd.api+json" /* JsonApi */]: (input) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
233
- ["text/plain" /* Text */]: (input) => input !== null && typeof input !== "string" ? JSON.stringify(input) : input,
234
- ["multipart/form-data" /* FormData */]: (input) => {
235
- if (input instanceof FormData) {
236
- return input;
237
- }
238
- return Object.keys(input || {}).reduce((formData, key) => {
239
- const property = input[key];
240
- formData.append(
241
- key,
242
- property instanceof Blob ? property : typeof property === "object" && property !== null ? JSON.stringify(property) : `${property}`
243
- );
244
- return formData;
245
- }, new FormData());
246
- },
247
- ["application/x-www-form-urlencoded" /* UrlEncoded */]: (input) => this.toQueryString(input)
248
- };
249
- this.createAbortSignal = (cancelToken) => {
250
- if (this.abortControllers.has(cancelToken)) {
251
- const abortController2 = this.abortControllers.get(cancelToken);
252
- if (abortController2) {
253
- return abortController2.signal;
254
- }
255
- return void 0;
256
- }
257
- const abortController = new AbortController();
258
- this.abortControllers.set(cancelToken, abortController);
259
- return abortController.signal;
260
- };
261
- this.abortRequest = (cancelToken) => {
262
- const abortController = this.abortControllers.get(cancelToken);
263
- if (abortController) {
264
- abortController.abort();
265
- this.abortControllers.delete(cancelToken);
266
- }
267
- };
268
- this.request = async ({
269
- body,
270
- secure,
271
- path,
272
- type,
273
- query,
274
- format,
275
- baseUrl,
276
- cancelToken,
277
- ...params
278
- }) => {
279
- const secureParams = (typeof secure === "boolean" ? secure : this.baseApiParams.secure) && this.securityWorker && await this.securityWorker(this.securityData) || {};
280
- const requestParams = this.mergeRequestParams(params, secureParams);
281
- const queryString = query && this.toQueryString(query);
282
- const payloadFormatter = this.contentFormatters[type || "application/json" /* Json */];
283
- const responseFormat = format || requestParams.format;
284
- return this.customFetch(
285
- `${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`,
286
- {
287
- ...requestParams,
288
- headers: {
289
- ...requestParams.headers || {},
290
- ...type && type !== "multipart/form-data" /* FormData */ ? { "Content-Type": type } : {}
291
- },
292
- signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null,
293
- body: typeof body === "undefined" || body === null ? null : payloadFormatter(body)
294
- }
295
- ).then(async (response) => {
296
- const r = response;
297
- r.data = null;
298
- r.error = null;
299
- const responseToParse = responseFormat ? response.clone() : response;
300
- const data = !responseFormat ? r : await responseToParse[responseFormat]().then((data2) => {
301
- if (r.ok) {
302
- r.data = data2;
303
- } else {
304
- r.error = data2;
305
- }
306
- return r;
307
- }).catch((e) => {
308
- r.error = e;
309
- return r;
310
- });
311
- if (cancelToken) {
312
- this.abortControllers.delete(cancelToken);
313
- }
314
- if (!response.ok) throw data;
315
- return data;
316
- });
317
- };
318
- Object.assign(this, apiConfig);
319
- }
320
- encodeQueryParam(key, value) {
321
- const encodedKey = encodeURIComponent(key);
322
- return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`;
323
- }
324
- addQueryParam(query, key) {
325
- return this.encodeQueryParam(key, query[key]);
326
- }
327
- addArrayQueryParam(query, key) {
328
- const value = query[key];
329
- return value.map((v) => this.encodeQueryParam(key, v)).join("&");
330
- }
331
- toQueryString(rawQuery) {
332
- const query = rawQuery || {};
333
- const keys = Object.keys(query).filter(
334
- (key) => "undefined" !== typeof query[key]
335
- );
336
- return keys.map(
337
- (key) => Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)
338
- ).join("&");
339
- }
340
- addQueryParams(rawQuery) {
341
- const queryString = this.toQueryString(rawQuery);
342
- return queryString ? `?${queryString}` : "";
343
- }
344
- mergeRequestParams(params1, params2) {
345
- return {
346
- ...this.baseApiParams,
347
- ...params1,
348
- ...params2 || {},
349
- headers: {
350
- ...this.baseApiParams.headers || {},
351
- ...params1.headers || {},
352
- ...params2 && params2.headers || {}
353
- }
354
- };
355
- }
356
- };
357
-
358
- // src/api/generated/Import.ts
359
- var Import = class extends HttpClient {
360
- constructor() {
361
- super(...arguments);
362
- /**
363
- * No description
364
- *
365
- * @tags Import
366
- * @name UploadProductFile
367
- * @request POST:/api/import/products
368
- */
369
- this.uploadProductFile = (data, params = {}) => this.request({
370
- path: `/api/import/products`,
371
- method: "POST",
372
- body: data,
373
- type: "multipart/form-data" /* FormData */,
374
- format: "json",
375
- ...params
376
- });
377
- /**
378
- * No description
379
- *
380
- * @tags Import
381
- * @name UploadSupplierFile
382
- * @request POST:/api/import/suppliers
383
- */
384
- this.uploadSupplierFile = (data, params = {}) => this.request({
385
- path: `/api/import/suppliers`,
386
- method: "POST",
387
- body: data,
388
- type: "multipart/form-data" /* FormData */,
389
- format: "json",
390
- ...params
391
- });
392
- }
393
- };
394
-
395
- // src/api/methods/Import.api.ts
396
- var importApi = new Import();
397
-
398
- // src/api/generated/Order.ts
399
- var Order = class extends HttpClient {
400
- constructor() {
401
- super(...arguments);
402
- /**
403
- * No description
404
- *
405
- * @tags Order
406
- * @name GetOrders
407
- * @request GET:/api/orders
408
- */
409
- this.getOrders = (query = {}, params = {}) => this.request({
410
- path: `/api/orders`,
411
- method: "GET",
412
- query,
413
- format: "json",
414
- ...params
415
- });
416
- /**
417
- * No description
418
- *
419
- * @tags Order
420
- * @name CreateOrder
421
- * @request POST:/api/orders
422
- */
423
- this.createOrder = (data, params = {}) => this.request({
424
- path: `/api/orders`,
425
- method: "POST",
426
- body: data,
427
- type: "application/json" /* Json */,
428
- format: "json",
429
- ...params
430
- });
431
- /**
432
- * No description
433
- *
434
- * @tags Order
435
- * @name GetOrderById
436
- * @request GET:/api/orders/{id}
437
- */
438
- this.getOrderById = ({ id }, params = {}) => this.request({
439
- path: `/api/orders/${id}`,
440
- method: "GET",
441
- format: "json",
442
- ...params
443
- });
444
- /**
445
- * No description
446
- *
447
- * @tags Order
448
- * @name ApproveOrder
449
- * @request PUT:/api/orders/{id}/approve
450
- */
451
- this.approveOrder = ({ id }, data, params = {}) => this.request({
452
- path: `/api/orders/${id}/approve`,
453
- method: "PUT",
454
- body: data,
455
- type: "application/json" /* Json */,
456
- format: "json",
457
- ...params
458
- });
459
- }
460
- };
461
-
462
- // src/api/methods/Order.api.ts
463
- var orderApi = new Order();
464
- async function getOrders(query, onSuccess, onError, params) {
465
- return handleApiResponse(
466
- () => orderApi.getOrders(query, params ?? {}),
467
- { onSuccess, onError }
468
- );
469
- }
470
-
471
- // src/api/generated/Product.ts
472
- var Product = class extends HttpClient {
473
- constructor() {
474
- super(...arguments);
475
- /**
476
- * No description
477
- *
478
- * @tags Product
479
- * @name GetProducts
480
- * @request GET:/api/products
481
- */
482
- this.getProducts = (query = {}, params = {}) => this.request({
483
- path: `/api/products`,
484
- method: "GET",
485
- query,
486
- format: "json",
487
- ...params
488
- });
489
- /**
490
- * No description
491
- *
492
- * @tags Product
493
- * @name CreateProduct
494
- * @request POST:/api/products
495
- */
496
- this.createProduct = (data, params = {}) => this.request({
497
- path: `/api/products`,
498
- method: "POST",
499
- body: data,
500
- type: "application/json" /* Json */,
501
- format: "json",
502
- ...params
503
- });
504
- /**
505
- * No description
506
- *
507
- * @tags Product
508
- * @name GetProductById
509
- * @request GET:/api/products/{id}
510
- */
511
- this.getProductById = ({ id }, params = {}) => this.request({
512
- path: `/api/products/${id}`,
513
- method: "GET",
514
- format: "json",
515
- ...params
516
- });
517
- /**
518
- * No description
519
- *
520
- * @tags Product
521
- * @name UpdateProduct
522
- * @request PUT:/api/products/{id}
523
- */
524
- this.updateProduct = ({ id }, data, params = {}) => this.request({
525
- path: `/api/products/${id}`,
526
- method: "PUT",
527
- body: data,
528
- type: "application/json" /* Json */,
529
- format: "json",
530
- ...params
531
- });
532
- /**
533
- * No description
534
- *
535
- * @tags Product
536
- * @name DeleteProduct
537
- * @request DELETE:/api/products/{id}
538
- */
539
- this.deleteProduct = ({ id }, params = {}) => this.request({
540
- path: `/api/products/${id}`,
541
- method: "DELETE",
542
- ...params
543
- });
544
- /**
545
- * No description
546
- *
547
- * @tags Product
548
- * @name SearchProducts
549
- * @request GET:/api/products/search
550
- */
551
- this.searchProducts = (query = {}, params = {}) => this.request({
552
- path: `/api/products/search`,
553
- method: "GET",
554
- query,
555
- format: "json",
556
- ...params
557
- });
558
- /**
559
- * No description
560
- *
561
- * @tags Product
562
- * @name ExportProducts
563
- * @request GET:/api/products/export
564
- */
565
- this.exportProducts = (query = {}, params = {}) => this.request({
566
- path: `/api/products/export`,
567
- method: "GET",
568
- query,
569
- ...params
570
- });
571
- }
572
- };
573
-
574
- // src/api/methods/Product.api.ts
575
- var productApi = new Product();
576
-
577
- // src/api/generated/Report.ts
578
- var Report = class extends HttpClient {
579
- constructor() {
580
- super(...arguments);
581
- /**
582
- * No description
583
- *
584
- * @tags Report
585
- * @name GetInventorySummary
586
- * @request GET:/api/reports/summary
587
- */
588
- this.getInventorySummary = (query = {}, params = {}) => this.request({
589
- path: `/api/reports/summary`,
590
- method: "GET",
591
- query,
592
- format: "json",
593
- ...params
594
- });
595
- }
596
- };
597
-
598
- // src/api/methods/Report.api.ts
599
- var reportApi = new Report();
600
-
601
- // src/api/generated/Supplier.ts
602
- var Supplier = class extends HttpClient {
603
- constructor() {
604
- super(...arguments);
605
- /**
606
- * No description
607
- *
608
- * @tags Supplier
609
- * @name GetSuppliers
610
- * @request GET:/api/suppliers
611
- */
612
- this.getSuppliers = (query = {}, params = {}) => this.request({
613
- path: `/api/suppliers`,
614
- method: "GET",
615
- query,
616
- format: "json",
617
- ...params
618
- });
619
- /**
620
- * No description
621
- *
622
- * @tags Supplier
623
- * @name CreateSupplier
624
- * @request POST:/api/suppliers
625
- */
626
- this.createSupplier = (data, params = {}) => this.request({
627
- path: `/api/suppliers`,
628
- method: "POST",
629
- body: data,
630
- type: "application/json" /* Json */,
631
- format: "json",
632
- ...params
633
- });
634
- /**
635
- * No description
636
- *
637
- * @tags Supplier
638
- * @name GetSupplierById
639
- * @request GET:/api/suppliers/{id}
640
- */
641
- this.getSupplierById = ({ id }, params = {}) => this.request({
642
- path: `/api/suppliers/${id}`,
643
- method: "GET",
644
- format: "json",
645
- ...params
646
- });
647
- /**
648
- * No description
649
- *
650
- * @tags Supplier
651
- * @name UpdateSupplier
652
- * @request PUT:/api/suppliers/{id}
653
- */
654
- this.updateSupplier = ({ id }, data, params = {}) => this.request({
655
- path: `/api/suppliers/${id}`,
656
- method: "PUT",
657
- body: data,
658
- type: "application/json" /* Json */,
659
- format: "json",
660
- ...params
661
- });
662
- /**
663
- * No description
664
- *
665
- * @tags Supplier
666
- * @name DeleteSupplier
667
- * @request DELETE:/api/suppliers/{id}
668
- */
669
- this.deleteSupplier = ({ id }, params = {}) => this.request({
670
- path: `/api/suppliers/${id}`,
671
- method: "DELETE",
672
- ...params
673
- });
674
- }
675
- };
676
-
677
- // src/api/methods/Supplier.api.ts
678
- var supplierApi = new Supplier();
679
- async function createSupplier(...argsWithCallbacks) {
680
- const {
681
- args,
682
- onSuccess,
683
- onError,
684
- params
685
- } = extractArgsCallbacksAndParams(argsWithCallbacks);
686
- const requestArgs = [
687
- ...args,
688
- params ?? {}
689
- ];
690
- return handleApiResponse(
691
- () => supplierApi.createSupplier(
692
- ...requestArgs
693
- ),
694
- {
695
- onSuccess,
696
- onError
697
- }
698
- );
699
- }
700
- async function getSupplierById(...argsWithCallbacks) {
701
- const {
702
- args,
703
- onSuccess,
704
- onError,
705
- params
706
- } = extractArgsCallbacksAndParams(argsWithCallbacks);
707
- const requestArgs = [
708
- ...args,
709
- params ?? {}
710
- ];
711
- return handleApiResponse(
712
- () => supplierApi.getSupplierById(
713
- ...requestArgs
714
- ),
715
- {
716
- onSuccess,
717
- onError
718
- }
719
- );
720
- }
721
-
722
253
  // src/utils/toFormData.ts
723
254
  function toFormData(payload) {
724
255
  const formData = new FormData();
@@ -751,46 +282,11 @@ function appendFormDataValue(formData, key, value) {
751
282
  }
752
283
  formData.append(key, JSON.stringify(value));
753
284
  }
754
- var x = createSupplier(
755
- { id: "", name: "Test Supplier", active: true, countryCode: "US", email: "test.supplier@example.com", rating: 4.5 },
756
- () => {
757
- console.info("Created");
758
- },
759
- (error) => {
760
- console.error("Error", error);
761
- }
762
- );
763
- var y = getOrders(
764
- {},
765
- (response) => {
766
- console.info("Created", response);
767
- },
768
- (error) => {
769
- console.error("Error", error);
770
- }
771
- );
772
- var x2 = getSupplierById(
773
- { id: "1" },
774
- () => {
775
- console.info("Created");
776
- },
777
- (error) => {
778
- console.error("Error", error);
779
- }
780
- );
781
- var y2 = getSupplierById(
782
- { id: "1" },
783
- (response) => {
784
- console.info("Created", response);
785
- },
786
- (error) => {
787
- console.error("Error", error);
788
- }
789
- );
790
285
  // Annotate the CommonJS export names for ESM import in node:
791
286
  0 && (module.exports = {
792
287
  buildQuery,
793
288
  extractArgsCallbacksAndParams,
289
+ extractArgsToastsAndParams,
794
290
  getSortDirectionFromSortType,
795
291
  getSortTypeFromSortDirection,
796
292
  handleApiResponse,