@horpynka/api-sdk 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +305 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +116 -5
- package/dist/index.d.ts +116 -5
- package/dist/index.js +302 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -273,6 +273,161 @@ var AuthApi = class extends BaseAPI {
|
|
|
273
273
|
return AuthApiFp(this.configuration).signUp(signUpUserDTO, options).then((request) => request(this.axios, this.basePath));
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
|
+
var CategoriesApiAxiosParamCreator = function(configuration) {
|
|
277
|
+
return {
|
|
278
|
+
/**
|
|
279
|
+
*
|
|
280
|
+
* @param {*} [options] Override http request option.
|
|
281
|
+
* @throws {RequiredError}
|
|
282
|
+
*/
|
|
283
|
+
findAll: async (options = {}) => {
|
|
284
|
+
const localVarPath = `/categories`;
|
|
285
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
286
|
+
let baseOptions;
|
|
287
|
+
if (configuration) {
|
|
288
|
+
baseOptions = configuration.baseOptions;
|
|
289
|
+
}
|
|
290
|
+
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
291
|
+
const localVarHeaderParameter = {};
|
|
292
|
+
const localVarQueryParameter = {};
|
|
293
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
294
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
295
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
296
|
+
return {
|
|
297
|
+
url: toPathString(localVarUrlObj),
|
|
298
|
+
options: localVarRequestOptions
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
var CategoriesApiFp = function(configuration) {
|
|
304
|
+
const localVarAxiosParamCreator = CategoriesApiAxiosParamCreator(configuration);
|
|
305
|
+
return {
|
|
306
|
+
/**
|
|
307
|
+
*
|
|
308
|
+
* @param {*} [options] Override http request option.
|
|
309
|
+
* @throws {RequiredError}
|
|
310
|
+
*/
|
|
311
|
+
async findAll(options) {
|
|
312
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.findAll(options);
|
|
313
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
314
|
+
const localVarOperationServerBasePath = operationServerMap["CategoriesApi.findAll"]?.[localVarOperationServerIndex]?.url;
|
|
315
|
+
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2__default.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
var CategoriesApi = class extends BaseAPI {
|
|
320
|
+
/**
|
|
321
|
+
*
|
|
322
|
+
* @param {*} [options] Override http request option.
|
|
323
|
+
* @throws {RequiredError}
|
|
324
|
+
* @memberof CategoriesApi
|
|
325
|
+
*/
|
|
326
|
+
findAll(options) {
|
|
327
|
+
return CategoriesApiFp(this.configuration).findAll(options).then((request) => request(this.axios, this.basePath));
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
var DishesApiAxiosParamCreator = function(configuration) {
|
|
331
|
+
return {
|
|
332
|
+
/**
|
|
333
|
+
*
|
|
334
|
+
* @param {*} [options] Override http request option.
|
|
335
|
+
* @throws {RequiredError}
|
|
336
|
+
*/
|
|
337
|
+
findAll: async (options = {}) => {
|
|
338
|
+
const localVarPath = `/dishes`;
|
|
339
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
340
|
+
let baseOptions;
|
|
341
|
+
if (configuration) {
|
|
342
|
+
baseOptions = configuration.baseOptions;
|
|
343
|
+
}
|
|
344
|
+
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
345
|
+
const localVarHeaderParameter = {};
|
|
346
|
+
const localVarQueryParameter = {};
|
|
347
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
348
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
349
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
350
|
+
return {
|
|
351
|
+
url: toPathString(localVarUrlObj),
|
|
352
|
+
options: localVarRequestOptions
|
|
353
|
+
};
|
|
354
|
+
},
|
|
355
|
+
/**
|
|
356
|
+
*
|
|
357
|
+
* @param {number} id
|
|
358
|
+
* @param {*} [options] Override http request option.
|
|
359
|
+
* @throws {RequiredError}
|
|
360
|
+
*/
|
|
361
|
+
findOne: async (id, options = {}) => {
|
|
362
|
+
assertParamExists("findOne", "id", id);
|
|
363
|
+
const localVarPath = `/dishes/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
364
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
365
|
+
let baseOptions;
|
|
366
|
+
if (configuration) {
|
|
367
|
+
baseOptions = configuration.baseOptions;
|
|
368
|
+
}
|
|
369
|
+
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
370
|
+
const localVarHeaderParameter = {};
|
|
371
|
+
const localVarQueryParameter = {};
|
|
372
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
373
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
374
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
375
|
+
return {
|
|
376
|
+
url: toPathString(localVarUrlObj),
|
|
377
|
+
options: localVarRequestOptions
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
var DishesApiFp = function(configuration) {
|
|
383
|
+
const localVarAxiosParamCreator = DishesApiAxiosParamCreator(configuration);
|
|
384
|
+
return {
|
|
385
|
+
/**
|
|
386
|
+
*
|
|
387
|
+
* @param {*} [options] Override http request option.
|
|
388
|
+
* @throws {RequiredError}
|
|
389
|
+
*/
|
|
390
|
+
async findAll(options) {
|
|
391
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.findAll(options);
|
|
392
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
393
|
+
const localVarOperationServerBasePath = operationServerMap["DishesApi.findAll"]?.[localVarOperationServerIndex]?.url;
|
|
394
|
+
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2__default.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
395
|
+
},
|
|
396
|
+
/**
|
|
397
|
+
*
|
|
398
|
+
* @param {number} id
|
|
399
|
+
* @param {*} [options] Override http request option.
|
|
400
|
+
* @throws {RequiredError}
|
|
401
|
+
*/
|
|
402
|
+
async findOne(id, options) {
|
|
403
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.findOne(id, options);
|
|
404
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
405
|
+
const localVarOperationServerBasePath = operationServerMap["DishesApi.findOne"]?.[localVarOperationServerIndex]?.url;
|
|
406
|
+
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2__default.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
};
|
|
410
|
+
var DishesApi = class extends BaseAPI {
|
|
411
|
+
/**
|
|
412
|
+
*
|
|
413
|
+
* @param {*} [options] Override http request option.
|
|
414
|
+
* @throws {RequiredError}
|
|
415
|
+
* @memberof DishesApi
|
|
416
|
+
*/
|
|
417
|
+
findAll(options) {
|
|
418
|
+
return DishesApiFp(this.configuration).findAll(options).then((request) => request(this.axios, this.basePath));
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
*
|
|
422
|
+
* @param {number} id
|
|
423
|
+
* @param {*} [options] Override http request option.
|
|
424
|
+
* @throws {RequiredError}
|
|
425
|
+
* @memberof DishesApi
|
|
426
|
+
*/
|
|
427
|
+
findOne(id, options) {
|
|
428
|
+
return DishesApiFp(this.configuration).findOne(id, options).then((request) => request(this.axios, this.basePath));
|
|
429
|
+
}
|
|
430
|
+
};
|
|
276
431
|
var OrdersApiAxiosParamCreator = function(configuration) {
|
|
277
432
|
return {
|
|
278
433
|
/**
|
|
@@ -541,6 +696,60 @@ var OrdersApi = class extends BaseAPI {
|
|
|
541
696
|
return OrdersApiFp(this.configuration).update(id, updateOrderDto, options).then((request) => request(this.axios, this.basePath));
|
|
542
697
|
}
|
|
543
698
|
};
|
|
699
|
+
var ProductsApiAxiosParamCreator = function(configuration) {
|
|
700
|
+
return {
|
|
701
|
+
/**
|
|
702
|
+
*
|
|
703
|
+
* @param {*} [options] Override http request option.
|
|
704
|
+
* @throws {RequiredError}
|
|
705
|
+
*/
|
|
706
|
+
findAll: async (options = {}) => {
|
|
707
|
+
const localVarPath = `/products`;
|
|
708
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
709
|
+
let baseOptions;
|
|
710
|
+
if (configuration) {
|
|
711
|
+
baseOptions = configuration.baseOptions;
|
|
712
|
+
}
|
|
713
|
+
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
714
|
+
const localVarHeaderParameter = {};
|
|
715
|
+
const localVarQueryParameter = {};
|
|
716
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
717
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
718
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
719
|
+
return {
|
|
720
|
+
url: toPathString(localVarUrlObj),
|
|
721
|
+
options: localVarRequestOptions
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
};
|
|
726
|
+
var ProductsApiFp = function(configuration) {
|
|
727
|
+
const localVarAxiosParamCreator = ProductsApiAxiosParamCreator(configuration);
|
|
728
|
+
return {
|
|
729
|
+
/**
|
|
730
|
+
*
|
|
731
|
+
* @param {*} [options] Override http request option.
|
|
732
|
+
* @throws {RequiredError}
|
|
733
|
+
*/
|
|
734
|
+
async findAll(options) {
|
|
735
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.findAll(options);
|
|
736
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
737
|
+
const localVarOperationServerBasePath = operationServerMap["ProductsApi.findAll"]?.[localVarOperationServerIndex]?.url;
|
|
738
|
+
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2__default.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
739
|
+
}
|
|
740
|
+
};
|
|
741
|
+
};
|
|
742
|
+
var ProductsApi = class extends BaseAPI {
|
|
743
|
+
/**
|
|
744
|
+
*
|
|
745
|
+
* @param {*} [options] Override http request option.
|
|
746
|
+
* @throws {RequiredError}
|
|
747
|
+
* @memberof ProductsApi
|
|
748
|
+
*/
|
|
749
|
+
findAll(options) {
|
|
750
|
+
return ProductsApiFp(this.configuration).findAll(options).then((request) => request(this.axios, this.basePath));
|
|
751
|
+
}
|
|
752
|
+
};
|
|
544
753
|
|
|
545
754
|
// src/api/generated/configuration.ts
|
|
546
755
|
var Configuration = class {
|
|
@@ -631,8 +840,11 @@ var Configuration = class {
|
|
|
631
840
|
}
|
|
632
841
|
};
|
|
633
842
|
exports.tanstackClient = void 0;
|
|
634
|
-
exports.ordersApi = void 0;
|
|
635
843
|
exports.authApi = void 0;
|
|
844
|
+
exports.categoriesApi = void 0;
|
|
845
|
+
exports.dishesApi = void 0;
|
|
846
|
+
exports.ordersApi = void 0;
|
|
847
|
+
exports.productsApi = void 0;
|
|
636
848
|
function initApiClient(config) {
|
|
637
849
|
const apiClient = globalAxios2__default.default.create({
|
|
638
850
|
baseURL: config.baseURL,
|
|
@@ -642,16 +854,89 @@ function initApiClient(config) {
|
|
|
642
854
|
basePath: config.baseURL
|
|
643
855
|
});
|
|
644
856
|
exports.tanstackClient = new reactQuery.QueryClient();
|
|
645
|
-
exports.ordersApi = new OrdersApi(configuration, void 0, apiClient);
|
|
646
857
|
exports.authApi = new AuthApi(configuration, void 0, apiClient);
|
|
858
|
+
exports.categoriesApi = new CategoriesApi(configuration, void 0, apiClient);
|
|
859
|
+
exports.dishesApi = new DishesApi(configuration, void 0, apiClient);
|
|
860
|
+
exports.ordersApi = new OrdersApi(configuration, void 0, apiClient);
|
|
861
|
+
exports.productsApi = new ProductsApi(configuration, void 0, apiClient);
|
|
647
862
|
return apiClient;
|
|
648
863
|
}
|
|
864
|
+
var useAuthApi = () => {
|
|
865
|
+
const queryClient = reactQuery.useQueryClient();
|
|
866
|
+
const mutateRefresh = reactQuery.useMutation({
|
|
867
|
+
mutationFn: ({ onSettledCallback } = {}) => exports.authApi.refresh(),
|
|
868
|
+
onSettled: (_data, _error, variables) => {
|
|
869
|
+
queryClient.invalidateQueries({ queryKey: ["auth"] });
|
|
870
|
+
variables?.onSettledCallback && variables.onSettledCallback();
|
|
871
|
+
}
|
|
872
|
+
});
|
|
873
|
+
const mutateSignIn = reactQuery.useMutation({
|
|
874
|
+
mutationFn: ({ params: { signInUserDTO } }) => exports.authApi.signIn(signInUserDTO),
|
|
875
|
+
onSettled: (_data, _error, { onSettledCallback }) => {
|
|
876
|
+
queryClient.invalidateQueries({ queryKey: ["auth"] });
|
|
877
|
+
onSettledCallback && onSettledCallback();
|
|
878
|
+
}
|
|
879
|
+
});
|
|
880
|
+
const mutateSignUp = reactQuery.useMutation({
|
|
881
|
+
mutationFn: ({ params: { signUpUserDTO } }) => exports.authApi.signUp(signUpUserDTO),
|
|
882
|
+
onSettled: (_data, _error, { onSettledCallback }) => {
|
|
883
|
+
queryClient.invalidateQueries({ queryKey: ["auth"] });
|
|
884
|
+
onSettledCallback && onSettledCallback();
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
return {
|
|
888
|
+
mutateRefresh,
|
|
889
|
+
mutateSignIn,
|
|
890
|
+
mutateSignUp
|
|
891
|
+
};
|
|
892
|
+
};
|
|
893
|
+
var getCategoriesQuery = () => reactQuery.queryOptions({
|
|
894
|
+
queryKey: ["categories"],
|
|
895
|
+
queryFn: () => exports.categoriesApi.findAll().then((res) => res.data)
|
|
896
|
+
});
|
|
897
|
+
var useCategoriesApi = () => {
|
|
898
|
+
return {
|
|
899
|
+
getCategoriesQuery
|
|
900
|
+
};
|
|
901
|
+
};
|
|
902
|
+
var getDishesQuery = () => reactQuery.queryOptions({
|
|
903
|
+
queryKey: ["dishes"],
|
|
904
|
+
queryFn: () => exports.dishesApi.findAll().then((res) => res.data)
|
|
905
|
+
});
|
|
906
|
+
var getDishQuery = (id) => reactQuery.queryOptions({
|
|
907
|
+
queryKey: ["dishes", id],
|
|
908
|
+
queryFn: () => exports.dishesApi.findOne(id).then((res) => res.data)
|
|
909
|
+
});
|
|
910
|
+
var useDishesApi = () => {
|
|
911
|
+
return {
|
|
912
|
+
getDishesQuery,
|
|
913
|
+
getDishQuery
|
|
914
|
+
};
|
|
915
|
+
};
|
|
649
916
|
var getOrdersQuery = (params) => reactQuery.queryOptions({
|
|
650
917
|
queryKey: ["orders", params],
|
|
651
918
|
queryFn: () => exports.ordersApi.findAll(params?.page, params?.limit, params?.status).then((res) => res.data)
|
|
652
919
|
});
|
|
920
|
+
var getOrderQuery = (id) => reactQuery.queryOptions({
|
|
921
|
+
queryKey: ["orders", id],
|
|
922
|
+
queryFn: () => exports.ordersApi.findOne(id).then((res) => res.data)
|
|
923
|
+
});
|
|
653
924
|
var useOrdersApi = () => {
|
|
654
925
|
const queryClient = reactQuery.useQueryClient();
|
|
926
|
+
const mutateCreateOrder = reactQuery.useMutation({
|
|
927
|
+
mutationFn: ({ params: { createOrderDto } }) => exports.ordersApi.create(createOrderDto),
|
|
928
|
+
onSettled: (_data, _error, { onSettledCallback }) => {
|
|
929
|
+
queryClient.invalidateQueries({ queryKey: ["orders"] });
|
|
930
|
+
onSettledCallback && onSettledCallback();
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
const mutateUpdateOrder = reactQuery.useMutation({
|
|
934
|
+
mutationFn: ({ params: { id, updateOrderDto } }) => exports.ordersApi.update(id, updateOrderDto),
|
|
935
|
+
onSettled: (_data, _error, { onSettledCallback }) => {
|
|
936
|
+
queryClient.invalidateQueries({ queryKey: ["orders"] });
|
|
937
|
+
onSettledCallback && onSettledCallback();
|
|
938
|
+
}
|
|
939
|
+
});
|
|
655
940
|
const mutateDeleteReceipt = reactQuery.useMutation({
|
|
656
941
|
mutationFn: ({ params: { id } }) => exports.ordersApi.removeActiveReceipt(id),
|
|
657
942
|
onSettled: (_data, _error, { onSettledCallback }) => {
|
|
@@ -660,12 +945,28 @@ var useOrdersApi = () => {
|
|
|
660
945
|
}
|
|
661
946
|
});
|
|
662
947
|
return {
|
|
663
|
-
|
|
664
|
-
|
|
948
|
+
getOrdersQuery,
|
|
949
|
+
getOrderQuery,
|
|
950
|
+
mutateCreateOrder,
|
|
951
|
+
mutateUpdateOrder,
|
|
952
|
+
mutateDeleteReceipt
|
|
953
|
+
};
|
|
954
|
+
};
|
|
955
|
+
var getProductsQuery = () => reactQuery.queryOptions({
|
|
956
|
+
queryKey: ["products"],
|
|
957
|
+
queryFn: () => exports.productsApi.findAll().then((res) => res.data)
|
|
958
|
+
});
|
|
959
|
+
var useProductsApi = () => {
|
|
960
|
+
return {
|
|
961
|
+
getProductsQuery
|
|
665
962
|
};
|
|
666
963
|
};
|
|
667
964
|
|
|
668
965
|
exports.initApiClient = initApiClient;
|
|
966
|
+
exports.useAuthApi = useAuthApi;
|
|
967
|
+
exports.useCategoriesApi = useCategoriesApi;
|
|
968
|
+
exports.useDishesApi = useDishesApi;
|
|
669
969
|
exports.useOrdersApi = useOrdersApi;
|
|
970
|
+
exports.useProductsApi = useProductsApi;
|
|
670
971
|
//# sourceMappingURL=index.cjs.map
|
|
671
972
|
//# sourceMappingURL=index.cjs.map
|